首页 > 解决方案 > 我正在尝试为特殊角色创建命令,但它不起作用

问题描述

此命令适用于具有特定角色的用户。它不会沙化消息,但也不会沙化有关错误的消息。请帮助我的代码:

@client.command(pass_context = True)
async def m(ctx, *,message,amount = 1):
  if "Test" in [role.name for role in message.author.roles]:
    embed = discord.Embed(description=message, color = 0x1abc9c)
    await ctx.channel.purge(limit = amount)
    msg = await ctx.send(embed=embed)
  else:
    print("error")

标签: pythondiscord.py

解决方案


推荐阅读