@@ -31,6 +31,7 @@ import { JellyfinStreamBuilderService } from '../jellyfin/jellyfin.stream.builde
3131import { JellyfinWebSocketService } from '../jellyfin/jellyfin.websocket.service' ;
3232
3333import { buildErrorMessage , buildMessage } from './discord.message.builder' ;
34+ import { EventNames } from '../../events/names' ;
3435
3536@Injectable ( )
3637export class DiscordVoiceService implements OnModuleDestroy {
@@ -59,7 +60,7 @@ export class DiscordVoiceService implements OnModuleDestroy {
5960 }
6061 }
6162
62- @OnEvent ( 'internal.audio.track.announce' )
63+ @OnEvent ( EventNames . Circuit . AnnounceTrack )
6364 handleOnNewTrack ( track : Track ) {
6465 const url = track . getStreamUrl ( this . jellyfinStreamBuilder ) ;
6566 const resource = createAudioResource ( url , {
@@ -215,26 +216,26 @@ export class DiscordVoiceService implements OnModuleDestroy {
215216 /**
216217 * Pauses the current audio player
217218 */
218- @OnEvent ( 'internal.voice.controls.pause' )
219+ @OnEvent ( EventNames . Controls . Pause )
219220 pause ( ) {
220221 this . createAndReturnOrGetAudioPlayer ( ) . pause ( ) ;
221222 const track = this . playbackService . getPlaylistOrDefault ( ) . getActiveTrack ( ) ;
222223 if ( track ) {
223224 track . playing = false ;
224225 }
225- this . eventEmitter . emit ( 'playback.state.pause' , true ) ;
226+ this . eventEmitter . emit ( EventNames . Circuit . Paused , true ) ;
226227 }
227228
228229 /**
229230 * Stops the audio player
230231 */
231- @OnEvent ( 'internal.voice.controls.stop' )
232+ @OnEvent ( EventNames . Controls . Stop )
232233 stop ( force : boolean ) : boolean {
233234 const hasStopped = this . createAndReturnOrGetAudioPlayer ( ) . stop ( force ) ;
234235 if ( hasStopped ) {
235236 const playlist = this . playbackService . getPlaylistOrDefault ( ) ;
236237 this . eventEmitter . emit (
237- 'internal.audio.track.finish' ,
238+ EventNames . Circuit . FinishedTrack ,
238239 playlist . getActiveTrack ( ) ,
239240 ) ;
240241 playlist . clear ( ) ;
@@ -251,7 +252,7 @@ export class DiscordVoiceService implements OnModuleDestroy {
251252 if ( track ) {
252253 track . playing = true ;
253254 }
254- this . eventEmitter . emit ( 'playback.state.pause' , false ) ;
255+ this . eventEmitter . emit ( EventNames . Circuit . Paused , false ) ;
255256 }
256257
257258 /**
@@ -269,7 +270,7 @@ export class DiscordVoiceService implements OnModuleDestroy {
269270 * Checks if the current state is paused or not and toggles the states to the opposite.
270271 * @returns The new paused state - true: paused, false: unpaused
271272 */
272- @OnEvent ( 'internal.voice.controls.togglePause' )
273+ @OnEvent ( EventNames . Controls . TogglePause )
273274 togglePaused ( ) : boolean {
274275 if ( this . isPaused ( ) ) {
275276 this . unpause ( ) ;
@@ -399,7 +400,7 @@ export class DiscordVoiceService implements OnModuleDestroy {
399400
400401 if ( finishedTrack ) {
401402 finishedTrack . playing = false ;
402- this . eventEmitter . emit ( 'internal.audio.track.finish' , finishedTrack ) ;
403+ this . eventEmitter . emit ( EventNames . Circuit . FinishedTrack , finishedTrack ) ;
403404 }
404405
405406 const hasNextTrack = playlist . hasNextTrackInPlaylist ( ) ;
0 commit comments