style: run format:apply

This commit is contained in:
2026-01-10 09:27:41 -03:00
parent 710de16af1
commit f0e8f5e939
+22 -8
View File
@@ -12,9 +12,9 @@ import { Logger } from './utils/log';
import { config } from './utils/config'; import { config } from './utils/config';
type BotEventListeners = { type BotEventListeners = {
'messageCreate': (message: Message) => void; messageCreate: (message: Message) => void;
'interactionCreate': (interaction: Interaction) => void; interactionCreate: (interaction: Interaction) => void;
'voiceStateUpdate': (oldState: VoiceState, newState: VoiceState) => void; voiceStateUpdate: (oldState: VoiceState, newState: VoiceState) => void;
}; };
type BotEventListener<K extends keyof BotEventListeners> = BotEventListeners[K]; type BotEventListener<K extends keyof BotEventListeners> = BotEventListeners[K];
@@ -80,7 +80,10 @@ export class Bot {
try { try {
(listener as (...args: unknown[]) => void)(...args); (listener as (...args: unknown[]) => void)(...args);
} catch (error) { } catch (error) {
this.log.error(`Error in event listener for ${String(event)}:`, error); this.log.error(
`Error in event listener for ${String(event)}:`,
error
);
} }
} }
} }
@@ -116,9 +119,17 @@ export class Bot {
this.client.on('clientReady', () => this.onReady()); this.client.on('clientReady', () => this.onReady());
this.client.on('error', (err) => this.onError(err, false)); this.client.on('error', (err) => this.onError(err, false));
this.client.on('shardError', (err) => this.onError(err, true)); this.client.on('shardError', (err) => this.onError(err, true));
this.client.on('messageCreate', (message: Message<boolean>) => this.onMessage(message)); this.client.on('messageCreate', (message: Message<boolean>) =>
this.client.on('interactionCreate', (interaction: Interaction<CacheType>) => this.onInteraction(interaction)); this.onMessage(message)
this.client.on('voiceStateUpdate', (oldState: VoiceState, newState: VoiceState) => this.onVoiceStateUpdate(oldState, newState)); );
this.client.on('interactionCreate', (interaction: Interaction<CacheType>) =>
this.onInteraction(interaction)
);
this.client.on(
'voiceStateUpdate',
(oldState: VoiceState, newState: VoiceState) =>
this.onVoiceStateUpdate(oldState, newState)
);
this.log.info('Logging in...'); this.log.info('Logging in...');
await this.client.login(this.token); await this.client.login(this.token);
@@ -178,7 +189,10 @@ export class Bot {
this.emit('messageCreate', message); this.emit('messageCreate', message);
} }
private async onVoiceStateUpdate(oldState: VoiceState, newState: VoiceState): Promise<void> { private async onVoiceStateUpdate(
oldState: VoiceState,
newState: VoiceState
): Promise<void> {
this.emit('voiceStateUpdate', oldState, newState); this.emit('voiceStateUpdate', oldState, newState);
} }