Added Warn and Ban Commands, Added Logging, and Much More

This commit is contained in:
Ahmad 2025-02-23 21:39:49 -05:00
parent d89de72e08
commit 86adac3f08
No known key found for this signature in database
GPG key ID: 8FD8A93530D182BF
33 changed files with 2200 additions and 204 deletions

View file

@ -0,0 +1,48 @@
import {
CommandInteraction,
PermissionsBitField,
SlashCommandBuilder,
SlashCommandOptionsOnlyBuilder,
} from 'discord.js';
import { updateMember } from '../../db/db.js';
interface Command {
data: SlashCommandOptionsOnlyBuilder;
execute: (interaction: CommandInteraction) => Promise<void>;
}
const command: Command = {
data: new SlashCommandBuilder()
.setName('testleave')
.setDescription('Simulates a member leaving'),
execute: async (interaction) => {
const guild = interaction.guild;
if (
!interaction.memberPermissions!.has(
PermissionsBitField.Flags.Administrator,
)
) {
await interaction.reply({
content: 'You do not have permission to use this command.',
flags: ['Ephemeral'],
});
}
const fakeMember = await guild!.members.fetch(interaction.user.id);
guild!.client.emit('guildMemberRemove', fakeMember);
await interaction.reply({
content: 'Triggered the leave event!',
flags: ['Ephemeral'],
});
await updateMember({
discordId: interaction.user.id,
currentlyInServer: true,
});
},
};
export default command;