python - 我正在尝试为特殊角色创建命令,但它不起作用
问题描述
此命令适用于具有特定角色的用户。它不会沙化消息,但也不会沙化有关错误的消息。请帮助我的代码:
@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")
解决方案
推荐阅读
- python-3.x - 使用 tex 为以下代码在 matplotlib 图中下划线不起作用
- angular - 使用异步管道解决 Angular 模板中的自定义 rxjs 主题
- scala - 在 partitionBy 函数之后获取一列的最后一个视图
- java - 什么是 JAVA8 的铸造?
- angular - 在迁移的 Angular 应用上找不到入口模块
- javascript - 在无限滚动中跟随用户滚动的横幅
- python - wxPython - 将小部件直接添加到 sizer 有什么缺点吗?
- amazon-web-services - 端点未使用 pod 的新 IP 地址更新
- node.js - 如何使用 nginx 作为 s3 aws 的代理?
- vis.js-network - 如何获取节点,连接到边缘被删除?