让机器人等待 discord.py 中的角色移除

Make the bot wait for role removal in discord.py

我正在尝试让机器人等待特定角色被删除以执行操作,我已经达到的最远是在机器人角色更改时让它执行操作(无论它是添加还是删除),但这不是我想要的。 我假设它与检查有关,我不确定如何设置,这是我尝试过的:

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