Error if ModuleService is used before it is added to DiscordClient

This commit is contained in:
RogueException
2015-11-06 00:27:42 -04:00
parent f1443def75
commit 48ad4a53ba

View File

@@ -24,7 +24,8 @@ namespace Discord.Modules
public void Install(IModule module, FilterType type)
{
if (_modules.ContainsKey(module)) throw new InvalidOperationException("This module has already been added.");
if (_client == null) throw new InvalidOperationException("Service needs to be added to a DiscordClient before modules can be installed.");
if (_modules.ContainsKey(module)) throw new InvalidOperationException("This module has already been added.");
var manager = new ModuleManager(_client, type);
_modules.Add(module, manager);