コード例 #1
0
        public override Task <PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services)
        {
            if (context.Guild.Id != Program.TheGrandCodingGuild.Id)
            {
                return(Task.FromResult(PreconditionResult.FromError($"User is not within the {Program.TheGrandCodingGuild.Name} guild")));
            }
            var self = FourAcesCasino.GetTGCUser(context.User as SocketGuildUser);

            if (self.Blocked_Toggle_By != 0)
            {
                return(Task.FromResult(PreconditionResult.FromError($"You are prevented from changing your own roles\r\nYou may wish to contact any Admin. (ref code {self.Blocked_Toggle_By})")));
            }
            return(Task.FromResult(PreconditionResult.FromSuccess()));
        }
コード例 #2
0
ファイル: AdminModule.cs プロジェクト: CheAle14/casino-bot
        public async Task PreventNicknameChange(SocketGuildUser target)
        {
            TGCUser user = FourAcesCasino.GetTGCUser(target);

            if (user.Blocked_Nickname_By != 0)
            {
                user.Blocked_Nickname_By = 0;
                await ReplyAsync("Removed the mark preventing that user from changing their nickname");
            }
            else
            {
                user.Blocked_Nickname_By = Context.User.Id;
                await ReplyAsync("User has been marked as unable to change their nickname\nNote that if they have the Discord permission (or have admin perms) they can set it anyway");
            }
        }
コード例 #3
0
ファイル: AdminModule.cs プロジェクト: CheAle14/casino-bot
        public async Task PreventToggleRoles(SocketGuildUser target)
        {
            var user = FourAcesCasino.GetTGCUser(target);

            if (user.Blocked_Toggle_By != 0)
            {
                user.Blocked_Toggle_By = 0;
                await ReplyAsync("Removed mark that prevented them toggling the role.");
            }
            else
            {
                user.Blocked_Toggle_By = Context.User.Id;
                await ReplyAsync("Added a mark preventing them from changing their roles.\r\nIf they have the Discord permission (or admin perms) they can bypass this");
            }
        }
コード例 #4
0
ファイル: AdminModule.cs プロジェクト: CheAle14/casino-bot
        protected override void BeforeExecute(CommandInfo command)
        {
            var usr     = TheGrandCodingGuild.GetUser(Context.User.Id);
            var tgcUser = FourAcesCasino.GetTGCUser(usr);

            Self = tgcUser;
            if (Self.User.Guild.Id != TheGrandCodingGuild.Id)
            {
                LogMsg("Invalid guild for Self TGC user " + Self.User.Guild.Name);
                Self.User = TheGrandCodingGuild.GetUser(Self.User.Id);
            }
            if (command.Name.StartsWith("toggle "))
            {
                if (Self.Blocked_Toggle_By != 0)
                {
                }
            }
            base.BeforeExecute(command);
        }