1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
import { EmbedBuilder, Events, version } from 'discord.js';
import { readFileSync } from 'node:fs';
import { activities } from '../storage/activities.js';
import { abEmbedColour } from '../storage/consts.js';
import { QuoteOfTheDay } from '../plugins/qotd.js';
const { version: abVersion } = JSON.parse(readFileSync('./package.json', 'utf-8'));
function botActivity(client) {
const activity = activities[Math.floor(Math.random() * activities.length)];
client.user.setPresence({
activities: [{
name: activity.name,
type: activity.type
}],
status: 'online'
});
console.log(`[>] Updated bot presence to "${activity.name}"`);
}
export default {
name: Events.ClientReady,
once: true,
async execute(client) {
console.log('[>] AleeBot is now ready!');
console.log(`[i] Logged in as ${client.user.tag}`);
console.log(`[i] Bot ID: ${client.user.id}`);
console.log(`[i] Running version ${abVersion} | Serving in ${client.guilds.cache.size} guilds`);
await botActivity(client);
await QuoteOfTheDay(client);
if (process.env.NODE_ENV !== 'development') {
const readyEmbed = new EmbedBuilder()
.setAuthor({ name: 'AleeBot Status', iconURL: client.user.avatarURL() })
.setDescription('AleeBot has started')
.addFields(
{ name: 'Version', value: `${abVersion}`, inline: true },
{ name: 'Node.JS Version', value: `${process.versions.node}`, inline: true },
{ name: 'Discord.JS Version', value: `${version}`, inline: true }
)
.setColor(abEmbedColour);
let statusChannel = client.channels.cache.get(process.env.STATUS_CHANNEL_ID);
if (!statusChannel) return console.error('The status channel does not exist! Skipping.');
await statusChannel.send({ embeds: [readyEmbed] });
}
setInterval(function() {
botActivity(client);
}, 200000);
}
};
|