我如何将函数中的参数提到 f 字符串中?

How would I mention a parameter from a function into a f string?

好的,所以我在命令中实现了一个 has_role() 函数。 代码:

@client.command()
@commands.has_role('Cleaner')
async def clear(ctx, amount=5):
    await ctx.channel.purge(limit=amount)

如果要触发 MissingRole 错误,我想发送一个 f 字符串,在 has_role() 函数中提及该角色。

@clear.error
async def mr4c(ctx, error):
    if isinstance(error, commands.MissingRole):
#just a special embed to display the error
        mr4cembed=discord.Embed(title='ERROR...', description=f"You do not have the required permission to execute this command!", color=discord.Colour.blue())
        #this is where I would like to mention it
        mr4cembed.set_footer(text=f'You need the {WHAT WOULD I WRITE HERE} role to proceed.')
        await ctx.send(embed=mr4cembed) 

使用missing_role attribute of exception:

@commands.command()
@commands.has_role("Dumb role")
async def test(ctx):
    ...

@test.error
async def handle(ctx, error):
    if isinstance(error, commands.MissingRole):
        await ctx.send(f"Role thats you need is: {error.missing_role}")