Esempio n. 1
0
 public bool CanRun(AdaCommand command, IGuildUser user, IMessage message, IMessageChannel channel, IGuild guild, out string error)
 {
     error = "This is a debug command. It can be only ran by Emzi0767.";
     if (user.Id == 181875147148361728u && user.Username == "Emzi0767" && user.Discriminator == "1837")
     {
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
        public bool CanRun(AdaCommand cmd, IGuildUser user, IMessage message, IMessageChannel channel, IGuild guild, out string error)
        {
            var srv = guild.Id;
            var can = AdvancedCommandsPlugin.Instance.IsEnabled(cmd.Name, srv);

            error = "";
            if (can)
            {
                return(true);
            }
            error = "This command was disabled on this server";
            return(false);
        }
Esempio n. 3
0
        public bool CanRun(AdaCommand command, IGuildUser user, IMessage message, IMessageChannel channel, IGuild guild, out string error)
        {
            error = "";
            var prm = command.RequiredPermission;
            var chn = channel as IGuildChannel;

            if (chn == null)
            {
                return(false);
            }
            var chp = user.GetPermissions(chn);

            if (prm == AdaPermission.None && user.GuildPermissions.Administrator)
            {
                return(true);
            }
            if ((chp.RawValue & (ulong)prm) == (ulong)prm || (user.GuildPermissions.RawValue & (ulong)prm) == (ulong)prm)
            {
                return(true);
            }
            error = "Insufficient Permissions";
            return(false);
        }