예제 #1
0
        public async Task Anonymize(params string[] args)
        {
            if (Context.Guild == null)
            {
                await ReplyAsync(Base.Sentences.CommandDontPm(Context.Guild));

                return;
            }
            await p.DoAction(Context.User, Program.Module.Settings);

            if (!CanModify(Context.User, Context.Guild))
            {
                await ReplyAsync(Base.Sentences.OnlyOwnerStr(Context.Guild, Context.Guild.OwnerId));
            }
            if (args.Length == 0)
            {
                if (Program.p.db.IsAnonymized(Context.Guild.Id))
                {
                    await ReplyAsync(Sentences.AnonymizeCurrentTrue(Context.Guild));
                }
                else
                {
                    await ReplyAsync(Sentences.AnonymizeCurrentFalse(Context.Guild));
                }
            }
            else
            {
                if (bool.TryParse(string.Join(" ", args), out bool value))
                {
                    await Games.GameModule.Anonymize(Context.Guild.Id, value);
                    await ReplyAsync(Base.Sentences.DoneStr(Context.Guild));
                }
                else
                {
                    await ReplyAsync(Sentences.AnonymizeHelp(Context.Guild));
                }
            }
        }