-1

Image of my code

Im trying to check if my bot is in a voice channel. Although for some reason voice_client always returns as None. Even when its in a vc. Why?

Derpy
  • 13
  • 2

1 Answers1

0

A bit iffy on this answer because I haven't seen the context of the code you provided, but if I am not mistaken, you should use the following for the definition of voice_client:discord.utils.get(ctx.bot.voice_clients, guild=ctx.guild) Additionally, you can use the is_connected() function of voice_client to find if the bot is connected as a Boolean value.

Flame
  • 1
  • Hm this doesnt seem to work. I think it may be because the way im connecting the bot to a vc is by: async def connect_to(self, guild_id: int, channel_id: str): ws = self.bot._connection._get_websocket(guild_id) await ws.voice_state(str(guild_id), channel_id) – Derpy Jul 25 '21 at 02:56