From 7ffb8ed8c47aa35950a011420a30a600b16b03f5 Mon Sep 17 00:00:00 2001 From: FiniteReality Date: Tue, 21 Feb 2017 21:58:05 +0000 Subject: [PATCH] Add type constraints for Add/RemoveModuleAsync --- src/Discord.Net.Commands/CommandService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Discord.Net.Commands/CommandService.cs b/src/Discord.Net.Commands/CommandService.cs index 2c7955028..cc60f7c18 100644 --- a/src/Discord.Net.Commands/CommandService.cs +++ b/src/Discord.Net.Commands/CommandService.cs @@ -73,7 +73,7 @@ namespace Discord.Commands _moduleLock.Release(); } } - public async Task AddModuleAsync() + public async Task AddModuleAsync() where T : ModuleBase { await _moduleLock.WaitAsync().ConfigureAwait(false); try @@ -86,7 +86,7 @@ namespace Discord.Commands var module = ModuleClassBuilder.Build(this, typeInfo).FirstOrDefault(); if (module.Value == default(ModuleInfo)) - throw new InvalidOperationException($"Could not build the module {typeof(T).FullName}, did you pass an invalid type?"); + throw new InvalidOperationException($"Could not build the module {typeof(T).FullName}"); _typedModuleDefs[module.Key] = module.Value; @@ -143,7 +143,7 @@ namespace Discord.Commands _moduleLock.Release(); } } - public async Task RemoveModuleAsync() + public async Task RemoveModuleAsync() where T : ModuleBase { await _moduleLock.WaitAsync().ConfigureAwait(false); try