|
1 | | -import { Client, TextChannel, REST, Routes, ActivityType } from 'discord.js'; |
| 1 | +import { Client, TextChannel, REST, Routes, ActivityType, EmbedBuilder } from 'discord.js'; |
2 | 2 | import commands from '../handlers/commandHandler'; |
3 | 3 | import Config from '../config'; |
4 | 4 | import logger from '../utils/logger'; |
5 | 5 |
|
6 | 6 | export const onReady = async (Bot: Client) => { |
7 | 7 | const rest = new REST({ version: '10' }).setToken(Config.DISCORD_TOKEN); |
8 | 8 | 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 | + |
10 | 12 | 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 | + |
12 | 26 | logger.info('Bot ready'); |
13 | | - // Set the bot's custom status |
| 27 | + |
14 | 28 | Bot.user?.setPresence({ |
15 | 29 | activities: [{ name: 'https://overextended.dev/', type: ActivityType.Custom }], |
16 | 30 | status: 'online', |
|
0 commit comments