-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessageCreate.js
More file actions
22 lines (19 loc) · 942 Bytes
/
Copy pathmessageCreate.js
File metadata and controls
22 lines (19 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const { OWNERS } = require('../src/Constants.js');
module.exports = {
name: 'messageCreate',
execute(message, client) {
if (message.author.bot || !message.guild) return;
if (message.channel.id === '1172434696915914813' && !(message.content.toLowerCase().startsWith('c') || message.content.toLowerCase().startsWith('#credit'))) return message.delete().catch(() => {});
if (!message.content.startsWith(client.prefix)) return;
const args = message.content.slice(client.prefix.length).trim().replaceAll('\n', ' ').split(/ +/);
const commandName = args.shift().toLowerCase();
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
if (!command) return;
if (command.owners && !OWNERS.includes(message.author.id)) return;
try {
command.execute(message, args, client);
} catch (e) {
console.error(e);
}
},
};