added basic functions
This commit is contained in:
22
discordbot/events/interactionCreate.js
Normal file
22
discordbot/events/interactionCreate.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const { Events } = 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 executing ${interaction.commandName}`);
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
};
|
12
discordbot/events/ready.js
Normal file
12
discordbot/events/ready.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const { Events } = require('discord.js');
|
||||
const deployCommands = require('../functions/deployCommands');
|
||||
|
||||
module.exports = {
|
||||
name: Events.ClientReady,
|
||||
once: true,
|
||||
execute(client) {
|
||||
console.log(`Ready! Logged in as ${client.user.tag}`);
|
||||
|
||||
deployCommands();
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user