first version of prices command done

This commit is contained in:
2022-11-12 16:48:31 -03:00
parent 3d7666d7a0
commit 2661897767
4 changed files with 222 additions and 13 deletions

34
app.js
View File

@@ -7,7 +7,6 @@ const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.on('ready', () => {
console.log('working');
console.log(client.user);
});
client.login(process.env.BOT_TOKEN);
@@ -29,21 +28,36 @@ for (const file of commandFiles) {
}
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isChatInputCommand()) return;
console.log(interaction);
// if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
if (interaction.isChatInputCommand()) {
try {
await command.execute(interaction);
}
catch (error) {
console.error(error);
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
}
else if (interaction.isAutocomplete()) {
if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}
try {
await command.autocomplete(interaction);
}
catch (error) {
console.error(error);
}
}
if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}
try {
await command.execute(interaction);
}
catch (error) {
console.error(error);
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
});