diff --git a/Commands/InteractionCommands/BanInteractions.cs b/Commands/InteractionCommands/BanInteractions.cs index 64bcfbf8..59250400 100644 --- a/Commands/InteractionCommands/BanInteractions.cs +++ b/Commands/InteractionCommands/BanInteractions.cs @@ -11,7 +11,8 @@ public async Task BanSlashCommand(InteractionContext ctx, [Option("reason", "The reason the user is being banned")] string reason, [Option("keep_messages", "Whether to keep the users messages when banning")] bool keepMessages = false, [Option("time", "The length of time the user is banned for")] string time = null, - [Option("appeal_link", "Whether to show the user an appeal URL in the DM")] bool appealable = false + [Option("appeal_link", "Whether to show the user an appeal URL in the DM")] bool appealable = false, + [Option("compromised_account", "Whether to include special instructions for compromised accounts")] bool compromisedAccount = false ) { // Initial response to avoid the 3 second timeout, will edit later. @@ -78,7 +79,7 @@ public async Task BanSlashCommand(InteractionContext ctx, if (member is null) { - await BanHelpers.BanFromServerAsync(user.Id, reason, ctx.User.Id, ctx.Guild, messageDeleteDays, ctx.Channel, banDuration, appealable); + await BanFromServerAsync(user.Id, reason, ctx.User.Id, ctx.Guild, messageDeleteDays, ctx.Channel, banDuration, appealable, compromisedAccount); } else { @@ -86,7 +87,7 @@ public async Task BanSlashCommand(InteractionContext ctx, { if (DiscordHelpers.AllowedToMod(await ctx.Guild.GetMemberAsync(ctx.Client.CurrentUser.Id), member)) { - await BanHelpers.BanFromServerAsync(user.Id, reason, ctx.User.Id, ctx.Guild, messageDeleteDays, ctx.Channel, banDuration, appealable); + await BanFromServerAsync(user.Id, reason, ctx.User.Id, ctx.Guild, messageDeleteDays, ctx.Channel, banDuration, appealable, compromisedAccount); } else { diff --git a/Helpers/BanHelpers.cs b/Helpers/BanHelpers.cs index 4be5f96a..1745ef6d 100644 --- a/Helpers/BanHelpers.cs +++ b/Helpers/BanHelpers.cs @@ -2,13 +2,16 @@ { public class BanHelpers { - public static async Task BanFromServerAsync(ulong targetUserId, string reason, ulong moderatorId, DiscordGuild guild, int deleteDays = 7, DiscordChannel channel = null, TimeSpan banDuration = default, bool appealable = false) + public static async Task BanFromServerAsync(ulong targetUserId, string reason, ulong moderatorId, DiscordGuild guild, int deleteDays = 7, DiscordChannel channel = null, TimeSpan banDuration = default, bool appealable = false, bool compromisedAccount = false) { bool permaBan = false; DateTime? actionTime = DateTime.Now; DateTime? expireTime = actionTime + banDuration; DiscordMember moderator = await guild.GetMemberAsync(moderatorId); + if (reason.ToLower().Contains("compromised")) + compromisedAccount = true; + if (banDuration == default) { permaBan = true; @@ -34,7 +37,10 @@ public static async Task BanFromServerAsync(ulong targetUserId, string rea { if (appealable) { - await targetMember.SendMessageAsync($"{Program.cfgjson.Emoji.Banned} You have been banned from **{guild.Name}**!\nReason: **{reason}**\nYou can appeal the ban here: <{Program.cfgjson.AppealLink}>"); + if (compromisedAccount) + await targetMember.SendMessageAsync($"{Program.cfgjson.Emoji.Banned} You have been banned from **{guild.Name}**!\nReason: **{reason}**\nYou can appeal the ban here: <{Program.cfgjson.AppealLink}>\nBefore appealing, please follow these steps to protect your account:\n1. Reset your Discord account password. Even if you use MFA, this will reset all session tokens.\n2. Review active sessions and authorised app connections.\n3. Ensure your PC is free of malware.\n4. [Enable MFA](https://support.discord.com/hc/en-us/articles/219576828-Setting-up-Multi-Factor-Authentication) if not already."); + else + await targetMember.SendMessageAsync($"{Program.cfgjson.Emoji.Banned} You have been banned from **{guild.Name}**!\nReason: **{reason}**\nYou can appeal the ban here: <{Program.cfgjson.AppealLink}>"); } else {