UNPKG

makecord-create

Version:

Create advanced Discord Bots with Makecord - Now with TypeScript support

24 lines (19 loc) 720 B
const { Events } = require('discord.js'); const { config } = require('../config.js'); module.exports = { name: Events.MessageCreate, execute(message) { if (message.author.bot) return; if (!message.content.startsWith(config.prefix)) return; const args = message.content.slice(config.prefix.length).trim().split(/ +/); const commandName = args.shift().toLowerCase(); const command = message.client.commands.get(commandName); if (!command) return; try { command.execute(message, args); } catch (error) { console.error(error); message.reply('An error occurred while executing the command!'); } }, };