fix: annotations for events

This commit is contained in:
Marius Begby committed 2023-08-27 02:46:50 +02:00
1 parent 39e818283d
commit b118ebdfb0
26 files changed
+231 -173

No files matched your search

+10 -7
View File
@@ -1,23 +1,24 @@
import { v4 as uuidv4 } from 'uuid';
import config from 'config';
import { EmbedOptions } from '../../types/configTypes';
import { EmbedOptions, SystemOptions } from '../../types/configTypes';
const embedOptions: EmbedOptions = config.get('embedOptions');
const systemOptions = config.get('systemOptions');
import { EmbedBuilder } from 'discord.js';
const systemOptions: SystemOptions = config.get('systemOptions');
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import loggerModule from '../../services/logger';
import { ExtendedClient } from '../../types/clientTypes';
module.exports = {
name: 'reconnecting',
isDebug: false,
once: false,
execute: async (client) => {
execute: async (client: ExtendedClient) => {
const executionId = uuidv4();
const logger = loggerModule.child({
source: 'reconnecting.js',
module: 'event',
name: 'clientReconnecting',
executionId: executionId,
shardId: client.shard.ids[0]
shardId: client.shard?.ids[0]
});
logger.warn('Client is reconnecting to Discord APIs.');
@@ -25,13 +26,15 @@ module.exports = {
// send message to system message channel for event
if (systemOptions.systemMessageChannelId && systemOptions.systemUserId) {
if (systemOptions.systemMessageChannelId && systemOptions.systemUserId) {
const channel = await client.channels.cache.get(systemOptions.systemMessageChannelId);
const channel = (await client.channels.cache.get(
systemOptions.systemMessageChannelId
)) as BaseGuildTextChannel;
if (channel) {
await channel.send({
embeds: [
new EmbedBuilder()
.setDescription(
`${embedOptions.icons.warning} **${client.user.tag}** is **\`reconnecting\`**!` +
`${embedOptions.icons.warning} **${client.user?.tag}** is **\`reconnecting\`**!` +
`\n\n<@${systemOptions.systemUserId}>`
)
.setColor(embedOptions.colors.warning)