From a540ce3c925ae5a84961cbf80439c8507634fb4f Mon Sep 17 00:00:00 2001 From: Tarrgon <61888458+Tarrgon@users.noreply.github.com> Date: Mon, 29 Sep 2025 18:43:44 -0400 Subject: [PATCH] Only kick alts The joiner will prevent them from joining, and if they are banned, only the banned account has its ban lifted. This prevents future headaches of unbanning. --- src/commands/ban.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/commands/ban.ts b/src/commands/ban.ts index b81ed34..cf1e3f5 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.ts @@ -117,28 +117,25 @@ export default { if (fullBan) { const alts = await comprehensiveAltLookupFromDiscord(idToUse, interaction.guild); - await banAllAlts([alts], interaction.guild, interaction.user, fullBan, reason, deleteMessageDays, duration, expiresAt); + await removeAllAlts([alts], interaction.guild, interaction.user, fullBan, reason, deleteMessageDays, duration, expiresAt); } await interaction.editReply(`<@${idToUse}> (${idToUse}) has been ${fullBan ? 'full banned' : 'banned'}.`); } }; -async function banAllAlts(altData: AltData[], guild: Guild, moderator: User, fullBan: boolean, reason: string, deleteMessageDays: number, duration: number, expiresAt: Date) { +async function removeAllAlts(altData: AltData[], guild: Guild, moderator: User, fullBan: boolean, reason: string, deleteMessageDays: number, duration: number, expiresAt: Date) { for (const data of altData) { if (data.type == 'discord') { try { if (!data.banned) { - await guild!.bans.create(data.thisId as string, { - reason: (reason + ` ${fullBan ? 'Full banned' : 'Banned'} by ${moderator.username} (${moderator.id})${duration > 0 ? `. Expires at: ${time(expiresAt, TimestampStyles.ShortDateTime)}` : ''}`).trim(), - deleteMessageSeconds: deleteMessageDays - }); + await guild.members.kick(data.thisId as string, (reason + ` ${fullBan ? 'Full banned' : 'Banned'} by ${moderator.username} (${moderator.id})${duration > 0 ? `. Expires at: ${time(expiresAt, TimestampStyles.ShortDateTime)}` : ''}`).trim()); } } catch (e) { console.error(e); } } - await banAllAlts(data.alts, guild, moderator, fullBan, reason, deleteMessageDays, duration, expiresAt); + await removeAllAlts(data.alts, guild, moderator, fullBan, reason, deleteMessageDays, duration, expiresAt); } } \ No newline at end of file