Discord.py - 如何获取语音频道的 ID



>我正在尝试获取作者语音频道的ID。我正在尝试让它制作一个链接,您可以单击该链接以进入完整的语音频道(如果有意义的话(:

@client.command()
async def fullv(ctx):
 guild=ctx.message.guild
 author=ctx.message.author
 channel = 
 vc=f"https://discordapp.com/{guild.id}/{channel.id}"
 embed=discord.Embed(title="Join Full Voice", url=vc, description="Full voice is a DM voice chat in a Discord Server!", color=0x00ff40)
 await ctx.send(embed=embed)

如果没有{channel.id} vc=f"https://discordapp.com/{guild.id}/{channel.id}"它就可以正常工作,但是您无法查看语音通道

ctx.author.voice 是作者的VoiceState,它有一个表示该成员所在VoiceChannelchannel 属性:

if ctx.author.voice and ctx.author.voice.channel:
    channel = ctx.author.voice.channel
else:
    await ctx.send("You are not connected to a voice channel")
    return

最新更新