【发布时间】:2022-10-16 06:32:44
【问题描述】:
我正在尝试检查用户是否具有特定角色,如果他们具有该角色,他们可以使用该命令,但无论我是否具有该角色,我都会触发 else 。
代码
@bot.slash_command(name="test", description = "testing cmd")
async def test(ctx, member: discord.Member):
role = "1023451893575450665"
if get(member.roles, id=role):
await ctx.send("your application has been accepted")
else:
await ctx.send("your application has been denied")
【问题讨论】:
-
role是角色名称还是角色 ID?
标签: discord discord.py bots roles pycord