首页 > 解决方案 > 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")

标签: pythondiscorddiscord.py

解决方案


推荐阅读