From 32776a23117d9e20c5839b22238286b844f38fd7 Mon Sep 17 00:00:00 2001 From: Anthony Berg Date: Wed, 15 Jan 2025 17:42:54 +0100 Subject: [PATCH] feat: add log on Discord when bot has started --- src/listeners/ready.ts | 19 ++++++++++++++++++- src/utils/devIDs.ts | 2 ++ src/utils/ids.ts | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/listeners/ready.ts b/src/listeners/ready.ts index c6721be..027cb75 100644 --- a/src/listeners/ready.ts +++ b/src/listeners/ready.ts @@ -22,6 +22,7 @@ import { Listener } from '@sapphire/framework'; import type { Client } from 'discord.js'; +import IDs from '#utils/ids'; export class ReadyListener extends Listener { 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!; 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!'); } } diff --git a/src/utils/devIDs.ts b/src/utils/devIDs.ts index 53051b1..e650c42 100644 --- a/src/utils/devIDs.ts +++ b/src/utils/devIDs.ts @@ -18,6 +18,7 @@ */ const devIDs = { + guild: '999431674972618792', roles: { trusted: '999431675081666599', booster: '', @@ -126,6 +127,7 @@ const devIDs = { }, logs: { restricted: '999431681217937513', + bot: '999431681217937516', economy: '999431681599623198', sus: '999431681599623199', }, diff --git a/src/utils/ids.ts b/src/utils/ids.ts index 333893e..4aeb2f3 100644 --- a/src/utils/ids.ts +++ b/src/utils/ids.ts @@ -20,6 +20,7 @@ import devIDs from '#utils/devIDs'; let IDs = { + guild: '730907954345279591', roles: { trusted: '1329089675977035879', booster: '731213264540795012', @@ -128,6 +129,7 @@ let IDs = { }, logs: { restricted: '920993034462715925', + bot: '872126272015314966', economy: '932050015034159174', sus: '872884989950324826', },