#Idk But after some time by bot leave the vc

1 messages · Page 1 of 1 (latest)

dense walrus
#

In bot's console i got this logs

Unhandled error: Command raised an exception: ChannelTimeoutException: Unable to connect to trexz as it exceeded the timeout of 30.0 seconds.
Unhandled error: Command raised an exception: ChannelTimeoutException: Unable to connect to trexz as it exceeded the timeout of 30.0 seconds.
Unhandled error: Command raised an exception: ChannelTimeoutException: Unable to connect to trexz as it exceeded the timeout of 30.0 seconds.

and in lavalink host console i got this logs

2025-05-25T17:26:03.252Z  INFO 28 --- [Lavalink] [  XNIO-1 task-3] l.server.io.RequestLoggingFilter         : PATCH /v4/sessions/2k0eyofwezfnhqq1/players/1261283892938149969?noReplace=True, client=5.219.265.820, payload={"voice": {"sessionId": "5bc1b3f1418b5b6c269bef6f1d1c664", "token": "a8f8b9700434a3b4", "endpoint": "us-south311.discord.media:443"}}
2025-05-25T17:26:03.264Z  INFO 28 --- [Lavalink] [  XNIO-1 task-3] l.server.io.RequestLoggingFilter         : DELETE /v4/sessions/2k0eyofwezfnhqq1/players/1261283892938149969
#

whenever this happens if i try to connect the bot in vc itimmediately leave the vc

#

like from last 5-6 month its working fine

#

but im getting this problem from last 1-2 week

#

i did't even updated the code

#

sometimes bo works smoothly but after a long time it get auto disconnected

shrewd knoll
#

Your client send de voice Payload and delete the player

dense walrus
#

let me check the full code

shrewd knoll
#

Yeah

#

You just have to read logs from your bot

dense walrus
#

But like there was no problem with it from last 5-6 months

#

I am using same music module

#

It happening from last 1-2 weeks

#

Idk why

#

Well how we connect player can effect this ?

sage glacier
dense walrus
#

Why the session get deleted? Like what's the core problem in this

#

From lavalink or Client

#

@sage glacier

sage glacier
dense walrus
sage glacier
#

Discord sending a wrong voice close code but wavelink can't handle that because the DiscordVoiceCloseCode enum init. raises a value error due to that the while loop got break in the node websocket keep alive task

dense walrus
#

Logged in as Trexz#1994
✅ Persistent ticket views registered successfully!
✅ Successfully connected 1 nodes.
✅ Node Trexz On Fire is ready!
❌ Failed to connect to Wavelink nodes: Unable to connect to babumoshai as it exceeded the timeout of 30.0 seconds.

well this are logs when i tryied to connect bot

basically after Restart and connected 1 node The bot will join all the vc where 24/7 Mode is enabled

dense walrus
#

well i found something in my code

        self.auto_pause_tasks = {}

    async def check_voice_activity(self, guild_id: int, channel_id: int):
        """Check for voice channel activity and auto-pause if inactive."""
        while True:
            await asyncio.sleep(60)
            if channel := self.bot.get_channel(channel_id):
                members = [m for m in channel.members if not m.bot]
                if not members and (player := self.bot.wavelink.get_player(guild_id)):
                    if player.playing:
                        await player.pause
                        self.logger.info(f"Auto-paused music in {guild_id} due to inactivity")
                elif player and player.paused and members:
                    await player.resume
                    self.logger.info(f"Auto-resumed music in {guild_id}")

    @commands.Cog.listener() 
    async def on_voice_state_update(self, member: discord.Member, before: discord.VoiceState, after: discord.VoiceState):
        """Listener to handle bot disconnection and member activity in voice channels."""
        if member.bot and before.channel and not after.channel:
            if vc_data := self.db.find_one({"guild_id": member.guild.id}):
                await asyncio.sleep(5)
                
                if not any(vc.connected and vc.playing for vc in self.bot.voice_clients):
                    if channel := self.bot.get_channel(vc_data["voice_channel_id"]):
                        try:
                            player = await channel.connect(cls=wavelink.Player, self_deaf=True)
                            if vc_data.get("last_track"):
                                track = await wavelink.YouTubeTrack.search(vc_data["last_track"])
                                await player.play(track)
                        except Exception as e:
                            self.logger.error(f"Error reconnecting to channel {channel.id} in guild {member.guild.id}: {str(e)}")

#

This is what making problem and players get disconnected

sage glacier
dense walrus
sage glacier
#

Looks like generated by chatgpt

dense walrus
sage glacier
#

Wavelink has no class YouTubeTrack

dense walrus
#

Ya I know

#

But idk how this is in my code 💀

#

Well I removed this and bot is working well from last 12 hrs