Error if ModuleService is used before it is added to DiscordClient
This commit is contained in:
@@ -24,7 +24,8 @@ namespace Discord.Modules
|
|||||||
|
|
||||||
public void Install(IModule module, FilterType type)
|
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);
|
var manager = new ModuleManager(_client, type);
|
||||||
_modules.Add(module, manager);
|
_modules.Add(module, manager);
|
||||||
|
|||||||
Reference in New Issue
Block a user