是否有机器人在键入命令时为用户赋予特定角色?

Is there a bot that gives a specific role to a user when a command is typed?

我想做一个小测验。如果一个人输入像 !answer 这样的命令,机器人会给出一个角色,比如 2 级。下一次这个人回答正确时,他们会获得下一个角色,比如 3 级。

使用discord.Member.add_roles()。所以添加角色代码可能是这样的:

@client.command(name='give_me_role')
async def give_me_role(ctx):
    role = discord.utils.get(ctx.guild.roles, name='Level 2')
    try:
        await ctx.message.author.add_roles(role)
    except discord.errors.Forbidden:
        await ctx.send('I do not have the permissions, please try again')
    except AttributeError: # ctx.message.author is a `discord.User` object, they are not in the guild
        pass