mirror of
https://github.com/ahmadk953/poixpixel-discord-bot.git
synced 2025-05-10 10:43:06 +00:00
Added Warn and Ban Commands, Added Logging, and Much More
This commit is contained in:
parent
d89de72e08
commit
86adac3f08
33 changed files with 2200 additions and 204 deletions
48
src/commands/testing/testLeave.ts
Normal file
48
src/commands/testing/testLeave.ts
Normal 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;
|
Loading…
Add table
Add a link
Reference in a new issue