Browse Source

Error if ModuleService is used before it is added to DiscordClient

tags/docs-0.9
RogueException 9 years ago
parent
commit
48ad4a53ba
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      src/Discord.Net.Modules/ModuleService.cs

+ 2
- 1
src/Discord.Net.Modules/ModuleService.cs 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);


Loading…
Cancel
Save