让bot等待discord.py中的角色删除

时间:2020-08-24 20:23:00

标签: python discord discord.py discord.py-rewrite

我正在尝试让机器人等待某个特定角色被删除才能执行操作,而我所达到的最远的目标是在更改机器人角色时使其执行一个操作(无论它是添加还是删除) ,但这不是我想要的。 我假设它与支票有关,这是我不确定的设置方法,这是我尝试过的方法:

def check(member, role):
    return role not in member.roles
disable = await bot.wait_for("member_update", check=check)
if disable:
    await ctx.send("Disabled.")

任何帮助,请先感谢。

1 个答案:

答案 0 :(得分:2)

您的检查不正确,这是一个应该起作用的示例:

def check(member, role):
    return role.name == "name of your specific role here"

仅当角色名称与提供的特定角色相同时,才将disable设置为true。如果愿意,您也可以使用role.id

相关问题