This commit is contained in:
Louis Mazin 2025-07-01 15:58:36 +02:00
parent bc5a651fe6
commit 33ae51bab6

View File

@ -47,32 +47,6 @@ client.on('ready', () => {
deploy(token); deploy(token);
}); });
client.on(Events.InteractionCreate, async 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 {
if (interaction.commandName === 'server-stats') {
await command.execute(interaction, palworldToken);
}else{
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 });
}
}
});
client.on(Events.MessageReactionAdd, async (reaction, user) => { client.on(Events.MessageReactionAdd, async (reaction, user) => {
console.log('=== ÉVÉNEMENT REÇU ==='); console.log('=== ÉVÉNEMENT REÇU ===');
console.log('Emoji:', reaction.emoji.name); console.log('Emoji:', reaction.emoji.name);
@ -119,6 +93,32 @@ client.on(Events.MessageReactionAdd, async (reaction, user) => {
} }
}); });
client.on(Events.InteractionCreate, async 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 {
if (interaction.commandName === 'server-stats') {
await command.execute(interaction, palworldToken);
}else{
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 });
}
}
});
client.login(token); client.login(token);
setInterval(()=>{update(headers,numbers,client,palworldToken)}, 300000); setInterval(()=>{update(headers,numbers,client,palworldToken)}, 300000);