Browse Source

Complete DisableServer crash workaround

tags/docs-0.9
RogueException 9 years ago
parent
commit
53cf815d1a
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      src/Discord.Net.Modules/ModuleManager.cs

+ 5
- 4
src/Discord.Net.Modules/ModuleManager.cs View File

@@ -152,7 +152,7 @@ namespace Discord.Modules
public bool DisableServer(Server server) public bool DisableServer(Server server)
{ {
if (server == null) throw new ArgumentNullException(nameof(server)); if (server == null) throw new ArgumentNullException(nameof(server));
//if (!_useServerWhitelist) throw new InvalidOperationException("This module is not configured to use a server whitelist.");
if (!_useServerWhitelist) return false;


lock (this) lock (this)
{ {
@@ -168,8 +168,9 @@ namespace Discord.Modules
public void DisableAllServers() public void DisableAllServers()
{ {
if (!_useServerWhitelist) throw new InvalidOperationException("This module is not configured to use a server whitelist."); if (!_useServerWhitelist) throw new InvalidOperationException("This module is not configured to use a server whitelist.");
if (!_useServerWhitelist) return;


lock (this)
lock (this)
{ {
if (ServerDisabled != null) if (ServerDisabled != null)
{ {
@@ -223,7 +224,7 @@ namespace Discord.Modules
public bool DisableChannel(Channel channel) public bool DisableChannel(Channel channel)
{ {
if (channel == null) throw new ArgumentNullException(nameof(channel)); if (channel == null) throw new ArgumentNullException(nameof(channel));
if (!_useChannelWhitelist) throw new InvalidOperationException("This module is not configured to use a channel whitelist.");
if (!_useChannelWhitelist) return false;


lock (this) lock (this)
{ {
@@ -250,7 +251,7 @@ namespace Discord.Modules
} }
public void DisableAllChannels() public void DisableAllChannels()
{ {
if (!_useChannelWhitelist) throw new InvalidOperationException("This module is not configured to use a channel whitelist.");
if (!_useChannelWhitelist) return;


lock (this) lock (this)
{ {


Loading…
Cancel
Save