Skip to content

Commit 4c1929c

Browse files
author
Manuel
committed
chore: add logs
1 parent b58f723 commit 4c1929c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/modules/voiceOnDemand/voiceOnDemand.module.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from './voiceOnDemand.helpers';
1111

1212
export const voiceOnDemand = createModule({
13-
slashCommands: () => [
13+
slashCommands: ({ logger }) => [
1414
{
1515
schema: new SlashCommandBuilder()
1616
.setName('voice-on-demand')
@@ -51,6 +51,7 @@ export const voiceOnDemand = createModule({
5151
//NOTES: this is a potential race condition.
5252
await cache.set('lobbyIds', [...lobbyIds, id]);
5353

54+
logger.info(`Created voice on demand voice channel ${id}`);
5455
await interaction.reply({
5556
content: 'Created voice on demand voice channel.',
5657
ephemeral: true,
@@ -59,7 +60,7 @@ export const voiceOnDemand = createModule({
5960
},
6061
},
6162
],
62-
eventHandlers: () => ({
63+
eventHandlers: ({ logger }) => ({
6364
voiceStateUpdate: async (oldState, newState) => {
6465
const lobbyIds = await cache.get('lobbyIds', []);
6566
const onDemandChannels = await cache.get('onDemandChannels', []);
@@ -72,10 +73,18 @@ export const voiceOnDemand = createModule({
7273
}
7374

7475
if (isOnDemandChannel && isLeaveState(oldState)) {
76+
logger.debug(
77+
{ guild: newState.guild.id },
78+
`User ${oldState.member.displayName} left the on-demand channel`,
79+
);
7580
await handleLeaveOnDemand(oldState);
7681
}
7782

7883
if (isLobbyChannel && isJoinState(newState)) {
84+
logger.debug(
85+
{ guild: newState.guild.id },
86+
`User ${newState.member.displayName} joined the lobby`,
87+
);
7988
await handleJoinLobby(newState);
8089
}
8190
},
@@ -91,6 +100,11 @@ export const voiceOnDemand = createModule({
91100
return;
92101
}
93102

103+
logger.info(
104+
{ guild: channel.guild.id },
105+
`Voice on demand voice channel ${channel.id} was deleted`,
106+
);
107+
94108
await cache.set(
95109
'lobbyIds',
96110
lobbyIds.filter((lobbyId) => lobbyId !== channel.id),

0 commit comments

Comments
 (0)