diff options
Diffstat (limited to 'src/listeners/message')
-rw-r--r-- | src/listeners/message/autoPublisher.ts | 13 | ||||
-rw-r--r-- | src/listeners/message/automodCreate.ts | 2 | ||||
-rw-r--r-- | src/listeners/message/blacklistedFile.ts | 4 | ||||
-rw-r--r-- | src/listeners/message/boosterMessage.ts | 2 | ||||
-rw-r--r-- | src/listeners/message/level.ts | 7 | ||||
-rw-r--r-- | src/listeners/message/verbose.ts | 14 |
6 files changed, 23 insertions, 19 deletions
diff --git a/src/listeners/message/autoPublisher.ts b/src/listeners/message/autoPublisher.ts index 1be58a3..3a7bbb7 100644 --- a/src/listeners/message/autoPublisher.ts +++ b/src/listeners/message/autoPublisher.ts @@ -15,10 +15,15 @@ export default class autoPublisherListener extends BushListener { const autoPublishChannels = await message.guild.getSetting('autoPublishChannels'); if (autoPublishChannels) { if (message.channel.type === 'GUILD_NEWS' && autoPublishChannels.some((x) => message.channel.id.includes(x))) { - const success = await message.crosspost().catch(() => false); - if (!success) - void client.console.warn('AutoPublisher', `Failed to publish <<${message.id}>> in <<${message.guild.name}>>.`); - void client.logger.log('AutoPublisher', `Published message <<${message.id}>> in <<${message.guild.name}>>.`); + await message + .crosspost() + .then( + () => void client.logger.log('autoPublisher', `Published message <<${message.id}>> in <<${message.guild!.name}>>.`) + ) + .catch( + () => + void client.console.warn('autoPublisher', `Failed to publish <<${message.id}>> in <<${message.guild!.name}>>.`) + ); } } } diff --git a/src/listeners/message/automodCreate.ts b/src/listeners/message/automodCreate.ts index 4165043..ac05bf9 100644 --- a/src/listeners/message/automodCreate.ts +++ b/src/listeners/message/automodCreate.ts @@ -85,7 +85,7 @@ export default class AutomodMessageCreateListener extends BushListener { } void client.console.info( - 'AutoMod', + 'autoMod', `Severity <<${highestOffence}>> action performed on <<${message.author.tag}>> (<<${message.author.id}>>) in <<#${message.channel.name}>> in <<${message.guild.name}>>` ); diff --git a/src/listeners/message/blacklistedFile.ts b/src/listeners/message/blacklistedFile.ts index 5aa5477..733ab73 100644 --- a/src/listeners/message/blacklistedFile.ts +++ b/src/listeners/message/blacklistedFile.ts @@ -133,7 +133,7 @@ export default class BlacklistedFileListener extends BushListener { ); if (message.channel.type === 'DM') return; void this.client.console.info( - 'BlacklistedFile', + 'blacklistedFile', `Deleted <<${foundFiles.map((f) => f.description).join(' and ')}>> sent by <<${message.author.tag}>> in ${ message.channel.name }.` @@ -143,7 +143,7 @@ export default class BlacklistedFileListener extends BushListener { `<@!${message.author.id}>, please do not send ${foundFiles.map((f) => f.description).join(' or ')}.` ); void this.client.console.warn( - 'BlacklistedFile', + 'blacklistedFile', `Failed to delete <<${foundFiles.map((f) => f.description).join(' and ')}>> sent by <<${message.author.tag}>> in <<${ message.channel.type === 'DM' ? `${message.channel.recipient.tag}'s DMs` : message.channel.name }>>.` diff --git a/src/listeners/message/boosterMessage.ts b/src/listeners/message/boosterMessage.ts index 5d49661..122fa39 100644 --- a/src/listeners/message/boosterMessage.ts +++ b/src/listeners/message/boosterMessage.ts @@ -14,7 +14,7 @@ export default class BoosterMessageListener extends BushListener { if (!message.guild || !(await message.guild?.hasFeature('boosterMessageReact'))) return; if (message.type === 'USER_PREMIUM_GUILD_SUBSCRIPTION') { return await message.react('<:nitroboost:785160348885975062>').catch(() => { - void this.client.console.warn('BoosterMessage', `Failed to react to <<${message.id}>>.`); + void this.client.console.warn('boosterMessage', `Failed to react to <<${message.id}>>.`); }); } } diff --git a/src/listeners/message/level.ts b/src/listeners/message/level.ts index 83d9e3b..7722db7 100644 --- a/src/listeners/message/level.ts +++ b/src/listeners/message/level.ts @@ -30,14 +30,11 @@ export default class LevelListener extends BushListener { }); const xpToGive = Level.genRandomizedXp(); const success = await user.increment('xp', { by: xpToGive }).catch((e) => { - void client.logger.error('levelMessageListener', e?.stack || e); + void client.logger.error('level', e?.stack || e); return false; }); if (success) - void client.logger.verbose( - `levelMessage`, - `Gave <<${xpToGive}>> XP to <<${message.author.tag}>> in <<${message.guild}>>.` - ); + void client.logger.verbose(`level`, `Gave <<${xpToGive}>> XP to <<${message.author.tag}>> in <<${message.guild}>>.`); this.#levelCooldowns.add(`${message.guild.id}-${message.author.id}`); setTimeout(() => this.#levelCooldowns.delete(`${message.guild!.id}-${message.author.id}`), 60_000); } diff --git a/src/listeners/message/verbose.ts b/src/listeners/message/verbose.ts index 9404412..8177529 100644 --- a/src/listeners/message/verbose.ts +++ b/src/listeners/message/verbose.ts @@ -10,11 +10,13 @@ export default class MessageVerboseListener extends BushListener { }); } - public override exec(...[message]: BushClientEvents['messageCreate']): Promise<void> | undefined { - if (message.channel?.type === 'DM') return; - void this.client.console.verbose( - 'messageVerbose', - `A message was sent by <<${message.author.tag}>> in <<${message.channel.name}>> in <<${message.guild!.name}>>.` - ); + public override exec(...[message]: BushClientEvents['messageCreate']): void { + if (client.isReady()) { + if (message.channel?.type === 'DM') return; + void this.client.console.verbose( + 'messageVerbose', + `A message was sent by <<${message.author.tag}>> in <<${message.channel.name}>> in <<${message.guild!.name}>>.` + ); + } } } |