feat: add log on Discord when bot has started
Some checks are pending
CodeQL / Analyze (javascript) (push) Waiting to run
ESLint / Run eslint scanning (push) Waiting to run
Prettier / Run prettier scanning (push) Waiting to run

This commit is contained in:
Anthony Berg 2025-01-15 17:42:54 +01:00
parent d72b66f988
commit 32776a2311
3 changed files with 22 additions and 1 deletions

View File

@ -22,6 +22,7 @@
import { Listener } from '@sapphire/framework'; import { Listener } from '@sapphire/framework';
import type { Client } from 'discord.js'; import type { Client } from 'discord.js';
import IDs from '#utils/ids';
export class ReadyListener extends Listener { export class ReadyListener extends Listener {
public constructor( public constructor(
@ -35,8 +36,24 @@ export class ReadyListener extends Listener {
}); });
} }
public run(client: Client) { public async run(client: Client) {
const { username, id } = client.user!; const { username, id } = client.user!;
this.container.logger.info(`Successfully logged in as ${username} (${id})`); this.container.logger.info(`Successfully logged in as ${username} (${id})`);
const botLogChannel = await client.channels.fetch(IDs.channels.logs.bot);
if (botLogChannel === null) {
this.container.logger.error(
'ReadyListener: Could not find the channel for bot logs.',
);
return;
} else if (!botLogChannel.isSendable()) {
this.container.logger.info(
'ReadyListener: No permission to send in bots logs channel.',
);
return;
}
botLogChannel.send('The bot has started up!');
} }
} }

View File

@ -18,6 +18,7 @@
*/ */
const devIDs = { const devIDs = {
guild: '999431674972618792',
roles: { roles: {
trusted: '999431675081666599', trusted: '999431675081666599',
booster: '', booster: '',
@ -126,6 +127,7 @@ const devIDs = {
}, },
logs: { logs: {
restricted: '999431681217937513', restricted: '999431681217937513',
bot: '999431681217937516',
economy: '999431681599623198', economy: '999431681599623198',
sus: '999431681599623199', sus: '999431681599623199',
}, },

View File

@ -20,6 +20,7 @@
import devIDs from '#utils/devIDs'; import devIDs from '#utils/devIDs';
let IDs = { let IDs = {
guild: '730907954345279591',
roles: { roles: {
trusted: '1329089675977035879', trusted: '1329089675977035879',
booster: '731213264540795012', booster: '731213264540795012',
@ -128,6 +129,7 @@ let IDs = {
}, },
logs: { logs: {
restricted: '920993034462715925', restricted: '920993034462715925',
bot: '872126272015314966',
economy: '932050015034159174', economy: '932050015034159174',
sus: '872884989950324826', sus: '872884989950324826',
}, },