style: run format:apply
This commit is contained in:
+22
-8
@@ -12,9 +12,9 @@ import { Logger } from './utils/log';
|
||||
import { config } from './utils/config';
|
||||
|
||||
type BotEventListeners = {
|
||||
'messageCreate': (message: Message) => void;
|
||||
'interactionCreate': (interaction: Interaction) => void;
|
||||
'voiceStateUpdate': (oldState: VoiceState, newState: VoiceState) => void;
|
||||
messageCreate: (message: Message) => void;
|
||||
interactionCreate: (interaction: Interaction) => void;
|
||||
voiceStateUpdate: (oldState: VoiceState, newState: VoiceState) => void;
|
||||
};
|
||||
type BotEventListener<K extends keyof BotEventListeners> = BotEventListeners[K];
|
||||
|
||||
@@ -80,7 +80,10 @@ export class Bot {
|
||||
try {
|
||||
(listener as (...args: unknown[]) => void)(...args);
|
||||
} 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('error', (err) => this.onError(err, false));
|
||||
this.client.on('shardError', (err) => this.onError(err, true));
|
||||
this.client.on('messageCreate', (message: Message<boolean>) => this.onMessage(message));
|
||||
this.client.on('interactionCreate', (interaction: Interaction<CacheType>) => this.onInteraction(interaction));
|
||||
this.client.on('voiceStateUpdate', (oldState: VoiceState, newState: VoiceState) => this.onVoiceStateUpdate(oldState, newState));
|
||||
this.client.on('messageCreate', (message: Message<boolean>) =>
|
||||
this.onMessage(message)
|
||||
);
|
||||
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...');
|
||||
await this.client.login(this.token);
|
||||
@@ -178,7 +189,10 @@ export class Bot {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user