我正在製作一個不和諧的機器人,我想知道如何讓某人需要使用命令所需的角色。如何讓某人需要角色來使用命令?
@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))
請告訴我正確的方法,因爲如果這樣做commands.has_role(「|高級|」):是不正確的
呃......這個確切的問題沒有被標記爲今天早上過於寬泛?在關閉時刪除並重新發布您的問題只會將您的帳戶標記爲垃圾郵件發送者並阻止提問。 – squaswin
@squaswin我標記了我自己的帖子lmao –
@squaswin,我改變了它,並添加了示例程序...所以它沒有那麼廣泛 –