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.
This commit is contained in:
Tarrgon
2025-09-29 18:43:44 -04:00
parent 85f6b63d4e
commit a540ce3c92
+4 -7
View File
@@ -117,28 +117,25 @@ export default {
if (fullBan) { if (fullBan) {
const alts = await comprehensiveAltLookupFromDiscord(idToUse, interaction.guild); 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'}.`); 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) { for (const data of altData) {
if (data.type == 'discord') { if (data.type == 'discord') {
try { try {
if (!data.banned) { if (!data.banned) {
await guild!.bans.create(data.thisId as string, { 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());
reason: (reason + ` ${fullBan ? 'Full banned' : 'Banned'} by ${moderator.username} (${moderator.id})${duration > 0 ? `. Expires at: ${time(expiresAt, TimestampStyles.ShortDateTime)}` : ''}`).trim(),
deleteMessageSeconds: deleteMessageDays
});
} }
} catch (e) { } catch (e) {
console.error(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);
} }
} }