【发布时间】:2020-08-30 05:55:24
【问题描述】:
我正在使用 discord.py 创建音乐机器人,但在将机器人连接到语音频道时遇到问题。我使用 Cog 将音乐功能与其他功能区分开来。
@commands.command()
async def join_voice(self, ctx):
channel = ctx.author.voice.channel
print(channel.id)
await self.client.VoiceChannel.connect()
但我得到了错误:
AttributeError: 'NoneType' object has no attribute 'channel'
我已经查看了此处的所有文档和所有类似问题,但仍然没有解决方案!
有人可以帮忙吗?
【问题讨论】:
标签: python python-3.x discord.py discord.py-rewrite