python-角色特定命令
作者:互联网
角色特定命令是的,它的工作终于得到了它.
from discord.ext import commands
bot = commands.Bot('?')
@bot.command(pass_context=True)
@commands.has_any_role("Admin", "Moderator")
async def hello(ctx):
await bot.say("Hello {}".format(ctx.message.author.mention))
解决方法:
您可以使用discord.ext.commands扩展名,它提供了has_any_role
装饰器.
from discord.ext import commands
bot = commands.Bot('?')
@bot.command(pass_context=True)
@commands.has_any_role("Admin", "Moderator")
async def hello(ctx):
await bot.say("Hello {}".format(ctx.message.author.mention))
标签:discord,python,python-3-x,discord-py 来源: https://codeday.me/bug/20191012/1902443.html