Reputation: 75
I had a necessity to connect to a voice channel using its id. After some research, I came across something like this:-
channel: discord.channel.VoiceChannel = ctx.message.author.voice.channel
But I am unable to find a way of getting the channel using its id.
Thanks
Upvotes: 0
Views: 366
Reputation: 2455
You can use the guild.get_channel
method to get a voice channel by id.
voicechannel = guild.get_channel(123456789012345678)
If you don't already have the guild, you can get it from the message.
voicechannel = message.guild.get_channel(123456789012345678)
Upvotes: 2