Moved event handlers to seperate files

This commit is contained in:
2023-11-18 18:42:32 +01:00
parent 4621abe01c
commit 1befe97f90
11 changed files with 316 additions and 213 deletions

View File

@@ -0,0 +1,10 @@
module.exports = {
name: 'conolelog',
description: "console log",
type: 'ready',
/** @param { import('discord.js').Client } client */
execute(client) {
console.log("Logged in as " + client.user.tag + "!");
}
}

View File

@@ -0,0 +1,27 @@
const { Events } = require('discord.js');
const { botLogChannel, color } = require('../../config/options.json');
module.exports = {
name: 'sendonlinemessage',
description: "send an online message",
type: 'ready',
execute(client) {
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;
}
channel.send({
embeds: [{
description: `Bot is online!`,
color: embedColor
}]
});
}
}
}

36
events/ready/status.js Normal file
View File

@@ -0,0 +1,36 @@
const { Events, ActivityType } = require('discord.js');
module.exports = {
name: 'status',
description: 'Sets the status of the bot',
type: 'ready',
/** @param { import('discord.js').Client } client */
execute(client) {
client.user.setActivity(
{ name: "over the Illegitimate Server", type: ActivityType.Watching }
);
const activities = [
{ name: "for Martina's return", type: ActivityType.Watching },
{ name: "w vri's feelings", type: ActivityType.Playing },
{ name: "urCryhard steal finals again", type: ActivityType.Watching },
{ name: "with Perlcence the AI", type: ActivityType.Playing },
{ name: "with ur mom in my bed", type: ActivityType.Playing },
{ name: "with Jone the idiot", type: ActivityType.Playing },
{ name: "over the Illegitimate Server", type: ActivityType.Watching }
];
let i = 0;
setInterval(() =>
client.user.setActivity(
activities[i++ % activities.length]
),
1000 * 60 * 30
)
client.on(Events.ClientReady, () => {
client.user.setStatus('dnd');
});
}
}