[英]role specific command
角色特定命令是的,它的工作終於得到了它。
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))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.