Add Discord.js stuff

This commit is contained in:
2025-07-30 17:18:48 +02:00
parent 1d7c16eea3
commit f67ddacb88
9 changed files with 1659 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
const { Events, MessageFlags } = require('discord.js');
module.exports = {
name: Events.InteractionCreate,
async execute(interaction) {
if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}
try {
await command.execute(interaction);
}
catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({ content: 'There was an error while executing this command!', flags: MessageFlags.Ephemeral });
}
else {
await interaction.reply({ content: 'There was an error while executing this command!', flags: MessageFlags.Ephemeral });
}
}
},
};

17
events/ready.js Normal file
View File

@@ -0,0 +1,17 @@
const { Events, ActivityType } = require('discord.js');
module.exports = {
name: Events.ClientReady,
once: true,
execute(client) {
console.log(`Ready! Logged in as ${client.user.tag}`);
client.user.setPresence({
activities: [{
name: 'with bnuuys',
state: 'bnuy bnuy bnuy bnuy bnuy',
type: ActivityType.Playing,
}],
status: 'online',
});
},
};