Closed Yudha2204 closed 2 years ago
I made a music bot for the first month it played very well, but after about 3 months it becomes laggy even though i run it locally
async execute() { if (!this.message.member?.voice?.channel) { this.message.channel.send('You Need To Join Voice Channel :microphone:') return; } else { const adapter = this.message?.guild?.voiceAdapterCreator as unknown; this.server.channel = joinVoiceChannel({ channelId : this.message.member.voice.channelId ?? '', guildId : this.message.guildId ?? '', adapterCreator : adapter as DiscordGatewayAdapterCreator }); } let filterQueue: Song[] = this.server.queue.filter((x: Song) => x.status === MusicStatus.Unplayed); if (filterQueue.length > 0) { this.server.status = 'active'; this.server.player = createAudioPlayer(); const song = await playDl.stream(filterQueue[0].url); const audioResource = createAudioResource(song.stream, { inputType : song.type }) this.server.player.play(audioResource); this.server.channel.subscribe(this.server.player); filterQueue[0].status = MusicStatus.Playing; // filterQueue[1].status = MusicStatus.Next; this.server.player.on(AudioPlayerStatus.Idle, async () => { filterQueue[0].status = MusicStatus.Done; await this.execute(); return; }) this.message.channel.send(`Now Playing ${filterQueue[0].name} :musical_note:`); } else { this.message.channel.send(`Queue Is Empty, I Will Leave Voice Channel If Theres No Activity, :hand_splayed:`); this.server.status = 'inactive'; } this.server.timeStamp = new Date(); }
0.6.0
16.11.1
Windows
Low (slightly annoying)
Issue description
I made a music bot for the first month it played very well, but after about 3 months it becomes laggy even though i run it locally
Code sample
@discordjs/voice version
0.6.0
Node.js version
16.11.1
Operating system
Windows
Priority this issue should have
Low (slightly annoying)