Python Discord.py默认值(如果未给出)

Python Discord.py默认值(如果未给出),python,discord,bots,discord.py,Python,Discord,Bots,Discord.py,如果频道未设置,则设置为687744572042117243有什么想法吗?有两种方法: 将其设置为“无”,然后签入命令。 直接在参数中设置通道 第一条路: @机器人命令 异步def movectx,成员:discord.member,通道:discord.VoiceChannel=None: 信道=信道如果信道else bot.get_信道687744572042117243 等待成员。editvoice\u频道=频道 第二种方式: @机器人命令 异步def movectx,成员:discord

如果频道未设置,则设置为687744572042117243有什么想法吗?

有两种方法:

将其设置为“无”,然后签入命令。 直接在参数中设置通道 第一条路:

@机器人命令 异步def movectx,成员:discord.member,通道:discord.VoiceChannel=None: 信道=信道如果信道else bot.get_信道687744572042117243 等待成员。editvoice\u频道=频道 第二种方式:

@机器人命令 异步def movectx,成员:discord.member,通道:discord.VoiceChannel=bot.get_通道687744572042117243: 等待成员。editvoice\u频道=频道
@bot.command(pass_context=True)
async def move(ctx, member: discord.Member, channel: discord.VoiceChannel):
    await member.edit(voice_channel=channel)