Discord.py - 如何获取语音频道的 ID?
Discord.py - How would I get the ID of a Voice Channel?
我正在尝试获取作者语音频道的ID。我试图让它成为一个 link,你可以点击它进入一个完整的语音频道(如果这有意义的话):
@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)
在vc=f"https://discordapp.com/{guild.id}/{channel.id}"
中没有{channel.id}
它工作正常但是你无法查看语音频道
ctx.author.voice
是作者的 VoiceState
,它有一个 channel
属性代表成员所在的 VoiceChannel
:
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
我正在尝试获取作者语音频道的ID。我试图让它成为一个 link,你可以点击它进入一个完整的语音频道(如果这有意义的话):
@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)
在vc=f"https://discordapp.com/{guild.id}/{channel.id}"
中没有{channel.id}
它工作正常但是你无法查看语音频道
ctx.author.voice
是作者的 VoiceState
,它有一个 channel
属性代表成员所在的 VoiceChannel
:
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