Esempio n. 1
0
        protected override async Task ExecuteGuild(IGuildCommandContext context, object argObj)
        {
            ArgumentContainer args = argObj as ArgumentContainer;

            GuildModerationLog  guildModerationLog = GuildModerationLog.GetOrCreateGuildModerationLog(context.Guild.Id);
            UserModerationLog   userModerationLog  = guildModerationLog.GetOrCreateUserModerationLog(args.UserId);
            UserModerationEntry moderationEntry    = new UserModerationEntry(context.Guild.Id, ModerationType.Note, null, context.GuildUser, args.Note);
            await userModerationLog.AddModerationEntry(moderationEntry);

            await context.Channel.SendEmbedAsync($"Added Note `{args.Note}` to modlogs for {(args.TargetUser == null ? Markdown.InlineCodeBlock(args.UserId.ToString()) : args.TargetUser.Mention)}");
        }
Esempio n. 2
0
        protected override async Task ExecuteGuild(IGuildCommandContext context, object argObj)
        {
            ArgumentContainer args      = argObj as ArgumentContainer;
            IDMChannel        dmchannel = await args.TargetUser.GetOrCreateDMChannelAsync();

            await dmchannel.SendMessageAsync($"You have been warned on {context.Guild} for `{args.Warning}`!");

            GuildModerationLog  guildModerationLog = GuildModerationLog.GetOrCreateGuildModerationLog(context.Guild.Id);
            UserModerationLog   userModerationLog  = guildModerationLog.GetOrCreateUserModerationLog(args.TargetUser.Id);
            UserModerationEntry moderationEntry    = new UserModerationEntry(context.Guild.Id, ModerationType.Warning, null, context.GuildUser, args.Warning);
            await userModerationLog.AddModerationEntry(moderationEntry);

            await context.Channel.SendEmbedAsync($"Warned {args.TargetUser.Mention} with `{args.Warning}`");
        }
Esempio n. 3
0
        protected override async Task ExecuteGuild(IGuildCommandContext context, object argObj)
        {
            ArgumentContainer args = argObj as ArgumentContainer;

            try
            {
                await args.ToBeKicked.KickAsync(args.Reason);

                GuildModerationLog  guildModerationLog = GuildModerationLog.GetOrCreateGuildModerationLog(context.Guild.Id);
                UserModerationLog   userModerationLog  = guildModerationLog.GetOrCreateUserModerationLog(args.ToBeKicked.Id);
                UserModerationEntry moderationEntry    = new UserModerationEntry(context.Guild.Id, ModerationType.Kicked, null, context.GuildUser, args.Reason);
                await userModerationLog.AddModerationEntry(moderationEntry);

                await context.Channel.SendEmbedAsync($"Kicked {args.ToBeKicked} for reason: `{args.Reason}`");
            }
            catch (HttpException e)
            {
                await context.Channel.SendEmbedAsync($"Failed to kick due to \"{e.Reason}\"!", true);
            }
        }