Ejemplo n.º 1
0
        public async Task Clean(CommandContext ctx,
                                [Description("Number of message to remove from the current channel")] int limit = 2)
        {
            var messages = await ctx.Channel.GetMessagesAsync(BotServices.LimitToRange(limit)).ConfigureAwait(false);

            await ctx.Channel.DeleteMessagesAsync(messages).ConfigureAwait(false);

            await BotServices.SendEmbedAsync(ctx, Formatter.Bold(messages.Count.ToString()) + " message(s) removed from #" + ctx.Channel.Name, EmbedType.Good).ConfigureAwait(false);
        }
Ejemplo n.º 2
0
        public async Task Purge(CommandContext ctx,
                                [Description("Server user whose messages will be purged")] DiscordMember member,
                                [Description("Number of messages to purge")][RemainingText] int limit = 0)
        {
            var messages = await ctx.Channel.GetMessagesAsync(BotServices.LimitToRange(limit)).ConfigureAwait(false);

            await ctx.Channel.DeleteMessagesAsync(messages.Where(m => m.Author.Id == member.Id)).ConfigureAwait(false);

            await BotServices.SendEmbedAsync(ctx, $"Purged **{limit}** messages by {member.Username}#{member.Discriminator} (ID:{member.Id})", EmbedType.Good).ConfigureAwait(false);
        }