Merge branch 'dev' into 'main'

Added message events

See merge request illegitimate/illegitimate-bot!37
This commit is contained in:
2023-10-17 22:51:46 +00:00
2 changed files with 41 additions and 12 deletions

11
events/messages/clown.js Normal file
View File

@@ -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");
}
}
}

View File

@@ -198,22 +198,40 @@ client.on(Events.InteractionCreate, async interaction => {
}); });
client.on(Events.ClientReady, () => { client.on(Events.ClientReady, () => {
console.log("Logged in as " + client.user.tag + "!"); if (process.env.NODE_ENV !== 'dev') {
const channel = client.channels.cache.get(botLogChannel); console.log("Logged in as " + client.user.tag + "!");
const embedColor = Number(color.replace('#', '0x')) const channel = client.channels.cache.get(botLogChannel);
const embedColor = Number(color.replace('#', '0x'))
if (!channel) { if (!channel) {
return; 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.on(Events.ClientReady, () => {
client.user.setActivity( client.user.setActivity(
{ name: "over the Illegitimate Server", type: ActivityType.Watching } { name: "over the Illegitimate Server", type: ActivityType.Watching }