【发布时间】:2022-01-01 06:32:21
【问题描述】:
我目前正在使用这些命令让我的机器人离开/加入 vc。加入工作正常,但离开将不起作用。
import discord
from discord.ext import commands
import youtube_dl
class music(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def join(self,ctx):
if ctx.author.voice is None:
await ctx.send("You're not in a voice channel!")
voice_channel = ctx.author.voice.channel
if ctx.voice_client is None:
await voice_channel.connect()
else:
await ctx.voice_channel.move_to(voice_channel)
@commands.command()
async def disconnect(self,ctx):
await ctx.voice_client.disconnect()
任何帮助理解为什么会非常感激!
【问题讨论】: