From ae690b02a6b2e14774796917f8f0414bcb154a28 Mon Sep 17 00:00:00 2001 From: Taken Date: Wed, 18 Oct 2023 00:49:45 +0200 Subject: [PATCH] Added message events --- events/messages/clown.js | 11 +++++++++++ index.js | 42 ++++++++++++++++++++++++++++------------ 2 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 events/messages/clown.js diff --git a/events/messages/clown.js b/events/messages/clown.js new file mode 100644 index 0000000..c2a90e0 --- /dev/null +++ b/events/messages/clown.js @@ -0,0 +1,11 @@ +module.exports = { + name: 'ur mom', + description: 'ur moms someone', + type: 'message', + + async execute(message) { + if (message.content.toLowerCase().includes('ur mom') && message.author.username === "taken.lua") { + message.react("Woot:734345936347725885"); + } + } +} diff --git a/index.js b/index.js index 4d13240..b15952f 100644 --- a/index.js +++ b/index.js @@ -198,22 +198,40 @@ client.on(Events.InteractionCreate, async interaction => { }); client.on(Events.ClientReady, () => { - console.log("Logged in as " + client.user.tag + "!"); - const channel = client.channels.cache.get(botLogChannel); - const embedColor = Number(color.replace('#', '0x')) + if (process.env.NODE_ENV !== 'dev') { + console.log("Logged in as " + client.user.tag + "!"); + const channel = client.channels.cache.get(botLogChannel); + const embedColor = Number(color.replace('#', '0x')) - if (!channel) { - return; + if (!channel) { + return; + } + + channel.send({ + embeds: [{ + description: `Bot is online!`, + color: embedColor + }] + }); } - - channel.send({ - embeds: [{ - description: `Bot is online!`, - color: embedColor - }] - }); }); +// message files +const messagePath = path.join(__dirname, 'events', 'messages'); +const messageFiles = fs.readdirSync(messagePath).filter(file => file.endsWith('.js')); + +for (const file of messageFiles) { + + const filePath = path.join(messagePath, file); + const message = require(filePath); + + if (message.type === 'message') { + client.on(Events.MessageCreate, message.execute); + } else { + console.log(`[WARNING] The message at ${filePath} is missing a required "type" property.`); + } +} + client.on(Events.ClientReady, () => { client.user.setActivity( { name: "over the Illegitimate Server", type: ActivityType.Watching }