first commit
This commit is contained in:
26
discord-bot/events/interactionCreate.js
Normal file
26
discord-bot/events/interactionCreate.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const { Events } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: Events.InteractionCreate,
|
||||
async execute({ log, createEmbed, client }, interaction) {
|
||||
|
||||
if (interaction.isChatInputCommand()) {
|
||||
const command = interaction.client.commands.get(interaction.commandName);
|
||||
|
||||
if (!command) {
|
||||
return log.Error(`No command matching ${interaction.commandName} was found`);
|
||||
} else {
|
||||
log.Info(`${interaction.user.username} executed command ${interaction.commandName}`);
|
||||
}
|
||||
|
||||
try {
|
||||
await command.execute({ interaction, log, createEmbed, client });
|
||||
} catch (error) {
|
||||
log.Error(error);
|
||||
|
||||
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
};
|
11
discord-bot/events/ready.js
Normal file
11
discord-bot/events/ready.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const { Events } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: Events.ClientReady,
|
||||
once: true,
|
||||
execute({ client, log }) {
|
||||
log.Info(`Ready! Logged in as ${client.user.tag}`);
|
||||
|
||||
require('../functions/registerCommands.js').registerCommands(log);
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user