Browse Source

Merge pull request #522 from RogueException/feature/idiot-repellent

Throw an InvalidOp if a user tries to set the DefaultRunMode to Default
tags/1.0-rc
RogueException GitHub 8 years ago
parent
commit
941e8383b1
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      src/Discord.Net.Commands/CommandService.cs

+ 2
- 0
src/Discord.Net.Commands/CommandService.cs View File

@@ -35,6 +35,8 @@ namespace Discord.Commands
_caseSensitive = config.CaseSensitiveCommands; _caseSensitive = config.CaseSensitiveCommands;
_separatorChar = config.SeparatorChar; _separatorChar = config.SeparatorChar;
_defaultRunMode = config.DefaultRunMode; _defaultRunMode = config.DefaultRunMode;
if (_defaultRunMode == RunMode.Default)
throw new InvalidOperationException("The default run mode cannot be set to Default, it must be one of Sync, Mixed, or Async");


_moduleLock = new SemaphoreSlim(1, 1); _moduleLock = new SemaphoreSlim(1, 1);
_typedModuleDefs = new ConcurrentDictionary<Type, ModuleInfo>(); _typedModuleDefs = new ConcurrentDictionary<Type, ModuleInfo>();


Loading…
Cancel
Save