From 39520149600e230d670d5990099140b841a436ff Mon Sep 17 00:00:00 2001 From: Nix Krystik Date: Tue, 11 Aug 2026 19:02:28 +0800 Subject: [PATCH] (rewrite): Organise :3 --- src/commands/moderation/ban.ts | 85 ++-------------------------------- 1 file changed, 4 insertions(+), 81 deletions(-) diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index 677d513..0fa6919 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -1,87 +1,10 @@ -import { ChatInputCommandInteraction, Client, Guild, GuildMember, time, TimestampStyles, User } from 'discord.js'; -import { Database } from '../../shared/Database'; -import { AltData, comprehensiveAltLookupFromDiscord, CreateDefaultEmbed, deferInteraction, getIdFromInput, SetSeverity } from '../../utils'; - -// export default { -// handler: async function (client: Client, interaction: ChatInputCommandInteraction) { -// await deferInteraction(interaction); - -// const input = interaction.options.getString('user', true); - -// const idToUse = getIdFromInput(input); -// const reason = interaction.options.getString('reason') ?? ''; - -// const hours = (interaction.options.getNumber('hours') ?? 0) * 3.6e+6; -// const minutes = (interaction.options.getNumber('minutes') ?? 0) * 60000; -// const seconds = (interaction.options.getNumber('seconds') ?? 0) * 1000; - -// const duration = hours + minutes + seconds; - -// const deleteMessageDays = (interaction.options.getNumber('delete-message-days') ?? 0) * 86400; - -// const fullBan = interaction.options.getBoolean('full-ban') ?? false; - -// let banMember: GuildMember | null = null; - -// try { -// banMember = await interaction.guild.members.fetch(idToUse); -// } catch (e) { -// // Member not in server. -// } - -// const member = await interaction.guild.members.fetch(interaction.user.id); - -// if (banMember && member.roles.highest.comparePositionTo(banMember.roles.highest) <= 0) { -// return await interaction.editReply('You do not have permission to ban this user.'); -// } - -// if (banMember && !banMember.bannable) { -// return await interaction.editReply('I do not have permission to ban this user.'); -// } - -// const expiresAt = new Date(Date.now() + duration); - -// await Database.putBan(idToUse, duration > 0 ? expiresAt : null, fullBan); - -// try { -// await interaction.guild.bans.create(idToUse, { -// reason: (reason + ` ${fullBan ? 'Full banned' : 'Banned'} by ${interaction.user.username} (${interaction.user.id})${duration > 0 ? `. Expires at: ${time(expiresAt, TimestampStyles.ShortDateTime)}` : ''}`).trim(), -// deleteMessageSeconds: deleteMessageDays -// }); -// } catch (e) { -// console.error(e); -// return await interaction.editReply("Error banning user (couldn't ban)."); -// } - -// if (fullBan) { -// const alts = await comprehensiveAltLookupFromDiscord(idToUse, interaction.guild); - -// 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 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.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 removeAllAlts(data.alts, guild, moderator, fullBan, reason, deleteMessageDays, duration, expiresAt); -// } -// } - // External Imports import { Command, CommandBuilder, CommandClient, CommandInteraction, Constants, SlashCommand } from 'athena-prime'; +// Internal Imports +import { Database } from '../../shared/Database'; +import { CreateDefaultEmbed, SetSeverity } from '../../utils'; + // --------------- @SlashCommand(