Update 2.0 | Replaced with SlashCommands | Subscribe, Unscubscribe, List, Info

This commit is contained in:
DeSqBlocki
2024-12-20 23:56:37 +01:00
parent 8c9eea25c0
commit 1b5d1834a6
9 changed files with 873 additions and 373 deletions
+17
View File
@@ -0,0 +1,17 @@
const { Events, ActivityType } = require('discord.js');
module.exports = {
name: Events.ClientReady,
once: true,
async execute(client) {
console.log(`Ready! Logged in as ${client.user.tag}`)
client.user.setPresence({
activities: [{
name: 'Notyfing',
type: ActivityType.Streaming,
url: 'https://twitch.tv/desq_blocki'
}],
status: 'online'
})
}
}
+27
View File
@@ -0,0 +1,27 @@
const { Events } = require('discord.js')
module.exports = {
name: Events.InteractionCreate,
once: false,
async execute(interaction) {
if (interaction.isChatInputCommand()) { commandHandler(interaction) };
}
}
async function commandHandler(interaction) {
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!', ephemeral: true });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
}
}