Skip to content

Commit 6a16332

Browse files
Manuelpotb
authored andcommitted
chore: add logs
1 parent bbe0282 commit 6a16332

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/modules/voiceOnDemand/voiceOnDemand.module.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export const voiceOnDemand = createModule({
5252
//NOTES: this is a potential race condition.
5353
await cache.set('lobbyIds', [...lobbyIds, id]);
5454

55+
logger.info(`Created voice on demand voice channel ${id}`);
5556
await interaction.reply({
5657
content: 'Created voice on demand voice channel.',
5758
ephemeral: true,
@@ -60,7 +61,7 @@ export const voiceOnDemand = createModule({
6061
},
6162
},
6263
],
63-
eventHandlers: () => ({
64+
eventHandlers: ({ logger }) => ({
6465
voiceStateUpdate: async (oldState, newState) => {
6566
const lobbyIds = await cache.get('lobbyIds', []);
6667
const onDemandChannels = await cache.get('onDemandChannels', []);
@@ -73,10 +74,18 @@ export const voiceOnDemand = createModule({
7374
}
7475

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

7984
if (isLobbyChannel && isJoinState(newState)) {
85+
logger.debug(
86+
{ guild: newState.guild.id },
87+
`User ${newState.member.displayName} joined the lobby`,
88+
);
8089
await handleJoinLobby(newState);
8190
}
8291
},
@@ -92,6 +101,11 @@ export const voiceOnDemand = createModule({
92101
return;
93102
}
94103

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

0 commit comments

Comments
 (0)