Python 如何制作一个简单的机器人,自动对频道中的每条消息做出反应

Python 如何制作一个简单的机器人,自动对频道中的每条消息做出反应,python,discord,discord.py,bots,Python,Discord,Discord.py,Bots,我有这个代码,在cog中,它没有任何作用,我没有任何错误, 不和谐。 我想让机器人自动对特定频道中的每条消息做出反应 from discord.ext import commands from discord.ext.commands import Bot import asyncio client = commands.Bot(command_prefix = '*') class Autoreact(commands.Cog): def __init__(self, cli

我有这个代码,在cog中,它没有任何作用,我没有任何错误, 不和谐。 我想让机器人自动对特定频道中的每条消息做出反应

from discord.ext import commands
from discord.ext.commands   import Bot
import asyncio

client = commands.Bot(command_prefix = '*')

class Autoreact(commands.Cog):

    def __init__(self, client):

        self.client = client
        
    @commands.Cog.listener()
    async def on_message(self, message):
        if (message.channel.id == "817770701603340289"):
            
            await message.add_reaction(":daek:817793235988643861")



def setup(client):

    client.add_cog(Autoreact(client))```

ID是整数,不是字符串

@commands.Cog.listener()
_消息上的异步定义(self,message):
如果message.channel.id==817770701603340289:
等待消息。添加反应(“:daek:817793235988643861”)