【发布时间】:2018-02-28 11:21:24
【问题描述】:
我正在制作一个不和谐的机器人,我想知道如何让某人需要一个必需的角色才能使用命令。
@bot.command(pass_context = True)
@commands.cooldown(1, 30, commands.BucketType.user)
async def test(ctx):
if commands.has_role("| Premium |"):
msg = ["test", "test2"]
await bot.send_message(ctx.message.author,
random.choice(msg))
请告诉我执行此操作的正确方法,因为 if commands.has_role("| Premium |"): 不正确
【问题讨论】:
-
呃...这个确切的问题不是因为今天早上太宽泛而被标记了吗?在问题关闭时删除并重新发布您的问题只会使您的帐户被标记为垃圾邮件发送者并被阻止提问。
-
@squaswin 我标记了我自己的帖子 lmao
-
@squaswin 我改变了它并添加了示例程序......所以它没有那么广泛
标签: python discord discord.py