python - Discord.py 中的频道 ID 比较
问题描述
我试图让机器人回复已编辑的消息,但仅限于特定频道。似乎只是忽略了我对 SelectedChannel 和后消息通道 ID 的比较。我获取频道 ID 的方式是否有错误?
selectedChannel = (channel id here)
@bot.event
async def on_message_edit(before, after):
if (before.content != after.content) and (selectedChannel == after.channel.id):
await after.reply("Edit")
解决方案
推荐阅读
- c# - Netcore 3.0 与 5.0 的区别,NullReferenceException 与 WriteValueWithResultAsync (BLE Lib)
- git - 是否可以忽略 IntelliJ IDEA 中的远程存储库之一
- sql - 根据 x 和 y 坐标列表从 Oracle 查询几何对象列表
- asp.net - 每次触发事件处理程序时如何更新视图
- qt5 - 设置过滤器后为什么不能使用 QDir 列出目录中的条目?
- flutter - 如何在颤动中将液体滑动动画添加到主页中?
- c# - 使用 Swashbuckle 显示自定义类型的模型属性的描述
- c# - 如何在 Code First 中使用表值作为枚举?
- html - 带有下拉路由的 Angular Bootstrap 导航栏
- laravel - Laravel 错误 429(请求过多):如何检查和记录请求计数?