public async Task Clear(CommandContext ctx, [Description("The amount of message to delete, will cap at 200.")] int amount = 100) { try { await ctx.Channel.DeleteMessagesAsync(await ctx.Channel.GetMessagesAsync(Math.Max(amount, 200))); } catch (BadRequestException) { await ctx.Channel.SendMessageAsync(MessageUtils.BuildError($"Couldn't delete all messages, some are older than 14 days (Discord limit when purging).")); return; } await ctx.Channel.SendMessageAsync(MessageUtils.BuildSuccess($"Successfully deleted `{amount}` messages !")); }
public async Task Prefix(CommandContext ctx, [Description("The new prefix.")] string prefix) { if (prefix.Length > 3) { await ctx.Channel.SendMessageAsync(MessageUtils.BuildError("Prefix length caps to 3 ! This prefix is too long !")); return; } var guild = await Db.FetchDbGuildAsync(ctx.Guild); guild.Prefix = prefix; await Db.UpdateDbGuild(guild); await ctx.Channel.SendMessageAsync(MessageUtils.BuildSuccess($"Prefix was successfully changed to `{prefix}` !")); }