Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

Commit 6f3aa4e

Browse files
committed
feat(onReady): enhance bot startup logging with command registration details
1 parent 85b17c0 commit 6f3aa4e

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/events/onReady.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
1-
import { Client, TextChannel, REST, Routes, ActivityType } from 'discord.js';
1+
import { Client, TextChannel, REST, Routes, ActivityType, EmbedBuilder } from 'discord.js';
22
import commands from '../handlers/commandHandler';
33
import Config from '../config';
44
import logger from '../utils/logger';
55

66
export const onReady = async (Bot: Client) => {
77
const rest = new REST({ version: '10' }).setToken(Config.DISCORD_TOKEN);
88
const commandData = Array.from(commands.values()).map((command) => command.data.toJSON());
9-
await rest.put(Routes.applicationCommands(Config.CLIENT_ID), { body: commandData }); // Register Commands Globally
9+
10+
await rest.put(Routes.applicationCommands(Config.CLIENT_ID), { body: commandData });
11+
1012
const logChannel = Bot.channels.cache.get(Config.LOG_CHANNEL) as TextChannel;
11-
logChannel && (await logChannel.send('Bot started.'));
13+
14+
const commandCount = commandData.length;
15+
const embed = new EmbedBuilder()
16+
.setTitle('Bot Started')
17+
.setDescription(`Successfully started and registered **${commandCount}** commands.`)
18+
.setColor(0x00ff00)
19+
.setTimestamp()
20+
.setFooter({ text: 'Bot Initialization', iconURL: Bot.user?.avatarURL() || '' });
21+
22+
if (logChannel) {
23+
await logChannel.send({ embeds: [embed] });
24+
}
25+
1226
logger.info('Bot ready');
13-
// Set the bot's custom status
27+
1428
Bot.user?.setPresence({
1529
activities: [{ name: 'https://overextended.dev/', type: ActivityType.Custom }],
1630
status: 'online',

0 commit comments

Comments
 (0)