【发布时间】:2018-10-14 21:20:54
【问题描述】:
由于某种原因,它不允许我在某些具有特定角色“DJ”的用户访问命令时发出命令。我已经尝试了所有方法,但仍然无法正常工作。
@commands.command(pass_context=True, no_pm=True)
async def leave(self, ctx):
if ctx.message.author.roles == 'DJ':
try:
server = ctx.message.server
voice_client = self.client.voice_client_in(server)
await voice_client.disconnect()
except Exception as error:
await self.client.say('{}'.format(error))
else:
await self.client.say('You require the role `DJ` to use this command.')
【问题讨论】:
标签: python-3.x discord discord.py