Added support for custom errors from permission checkers

This commit is contained in:
RogueException
2015-11-10 15:37:32 -04:00
parent d9759abf4c
commit f06a1d7278
8 changed files with 52 additions and 27 deletions

View File

@@ -14,9 +14,18 @@ namespace Discord.Modules
_filterType = manager.FilterType;
}
public bool CanRun(Command command, User user, Channel channel)
public bool CanRun(Command command, User user, Channel channel, out string error)
{
return _filterType == FilterType.Unrestricted || _filterType == FilterType.AllowPrivate || _manager.HasChannel(channel);
if (_filterType == FilterType.Unrestricted || _filterType == FilterType.AllowPrivate || _manager.HasChannel(channel))
{
error = null;
return true;
}
else
{
error = "This module is currently disabled.";
return false;
}
}
}
}