You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

GenericPermissionChecker.cs 576 B

12345678910111213141516171819202122
  1. using System;
  2. namespace Discord.Commands.Permissions
  3. {
  4. internal class GenericPermissionChecker : IPermissionChecker
  5. {
  6. private readonly Func<Command, User, Channel, bool> _checkFunc;
  7. private readonly string _error;
  8. public GenericPermissionChecker(Func<Command, User, Channel, bool> checkFunc, string error = null)
  9. {
  10. _checkFunc = checkFunc;
  11. _error = error;
  12. }
  13. public bool CanRun(Command command, User user, Channel channel, out string error)
  14. {
  15. error = _error;
  16. return _checkFunc(command, user, channel);
  17. }
  18. }
  19. }