@Bot.command()
async def join(ctx):
if (ctx.author.voice):
channel = ctx.author.voice.channel
await channel.connect()
await ctx.send('Bot joined')
else:
await ctx.send("You must be in a voice channel first so I can join it.")
@Bot.command()
async def leave(
ctx):
if (ctx.voice_client):
await ctx.guild.voice_client.disconnect()
await ctx.send('Bot left')
else:
await ctx.send("I'm not in a voice channel, use the join command to make me join")
我正在为我的机器人使用此代码。机器人可以加入但不能离开,它会在发送命令时忽略要离开的命令
这应该起作用:
相关问题 更多 >
编程相关推荐