python-3.x - 我可以撤销 on_command discord.py 中的命令吗?
问题描述
我有功能
async def dedupetwo(self, message):
我正在检查命令是否不是垃圾邮件,所以我通过调用获取消息历史记录是通道
async for m in message.channel.history(limit=2, before=message.message):
lastmsg = m
然后检查命令是否与该频道中的最后一条消息相同
if lastmsg.clean_content == ctx.message.clean_content:
我正试图在这个阶段撤销该命令的调用,但我找不到任何能够做到这一点的调用。是否有任何功能可以满足这一点,或者我应该如何做到这一点?
解决方案
如果语句满足,您可以使用return
来结束函数/命令if
if lastmsg.clean_content == ctx.message.clean_content:
return
推荐阅读
- ruby-on-rails - 如何在rails应用程序中的按钮上传递id?
- javascript - JavaScript:不断改变字符
- video - 在视频数据集上训练?
- php - move_uploaded_file 返回 true 但不执行 if 语句
- javascript - 如何将身份验证详细信息传递给 iframe 内的应用程序?
- vim - vim - 如何查询终端缓冲区的密码?
- python - 如何在 Visual Studio 代码的 Python 扩展中选择子文件夹作为包含测试的目录
- json - 如何在 Ionic 4 中显示 JSON 数据中的特定行
- reactjs - 无法访问 jest.mock 函数中的变量
- liquibase - HANA 数据库上的 HDI 容器的板载租户失败