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

Python 使bot等待discord.py中的角色删除,python,discord,discord.py,discord.py-rewrite,Python,Discord,Discord.py,Discord.py Rewrite,我试图让bot等待一个特定的角色被删除,以便它执行一个操作,我所做的最远的事情就是让它在bot角色发生更改时执行一个操作(无论是否添加或删除),但是这不是我想要的。 我假设它与支票有关,我不确定如何设置,以下是我尝试的: def check(member, role): return role not in member.roles disable = await bot.wait_for("member_update", check=check) if disabl

我试图让bot等待一个特定的角色被删除,以便它执行一个操作,我所做的最远的事情就是让它在bot角色发生更改时执行一个操作(无论是否添加或删除),但是这不是我想要的。 我假设它与支票有关,我不确定如何设置,以下是我尝试的:

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.")

如果您有任何帮助,我们将不胜感激。

您的支票不正确,下面是一个可行的示例:

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

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

您的检查不正确,下面是一个应该有效的示例:

def check(member, role):
    return role.name == "name of your specific role here"
仅当角色名称与提供的特定角色相同时,才会将
disable
设置为
true
。如果愿意,也可以使用
role.id