@@ -10,7 +10,7 @@ import {
10
10
} from './voiceOnDemand.helpers' ;
11
11
12
12
export const voiceOnDemand = createModule ( {
13
- slashCommands : ( ) => [
13
+ slashCommands : ( { logger } ) => [
14
14
{
15
15
schema : new SlashCommandBuilder ( )
16
16
. setName ( 'voice-on-demand' )
@@ -51,6 +51,7 @@ export const voiceOnDemand = createModule({
51
51
//NOTES: this is a potential race condition.
52
52
await cache . set ( 'lobbyIds' , [ ...lobbyIds , id ] ) ;
53
53
54
+ logger . info ( `Created voice on demand voice channel ${ id } ` ) ;
54
55
await interaction . reply ( {
55
56
content : 'Created voice on demand voice channel.' ,
56
57
ephemeral : true ,
@@ -59,7 +60,7 @@ export const voiceOnDemand = createModule({
59
60
} ,
60
61
} ,
61
62
] ,
62
- eventHandlers : ( ) => ( {
63
+ eventHandlers : ( { logger } ) => ( {
63
64
voiceStateUpdate : async ( oldState , newState ) => {
64
65
const lobbyIds = await cache . get ( 'lobbyIds' , [ ] ) ;
65
66
const onDemandChannels = await cache . get ( 'onDemandChannels' , [ ] ) ;
@@ -72,10 +73,18 @@ export const voiceOnDemand = createModule({
72
73
}
73
74
74
75
if ( isOnDemandChannel && isLeaveState ( oldState ) ) {
76
+ logger . debug (
77
+ { guild : newState . guild . id } ,
78
+ `User ${ oldState . member . displayName } left the on-demand channel` ,
79
+ ) ;
75
80
await handleLeaveOnDemand ( oldState ) ;
76
81
}
77
82
78
83
if ( isLobbyChannel && isJoinState ( newState ) ) {
84
+ logger . debug (
85
+ { guild : newState . guild . id } ,
86
+ `User ${ newState . member . displayName } joined the lobby` ,
87
+ ) ;
79
88
await handleJoinLobby ( newState ) ;
80
89
}
81
90
} ,
@@ -91,6 +100,11 @@ export const voiceOnDemand = createModule({
91
100
return ;
92
101
}
93
102
103
+ logger . info (
104
+ { guild : channel . guild . id } ,
105
+ `Voice on demand voice channel ${ channel . id } was deleted` ,
106
+ ) ;
107
+
94
108
await cache . set (
95
109
'lobbyIds' ,
96
110
lobbyIds . filter ( ( lobbyId ) => lobbyId !== channel . id ) ,
0 commit comments