0
votes

For my Discord bot, I am trying to have it only respond to messages in one channel. I have the following code:

@client.event
async def send(message):
  if message.channel.id == 897042290487492638:
    await message.channel.send('Hi!')

The idea is it takes the channel id of a sent message, and if it matches the designated channel, it will respond with 'Hi!'. My problem is when I send a message from the designated channel, the bot will not do anything. I checked the permissions of the bot, and it had all permissions necessary for something like this. To double-check, I added a command earlier in my code to ensure the bot was working, and I could execute said command just fine. Does anyone know what I am missing here?

I do know that I can change the bot's permissions to only read the designated channel, but I want it to be able to read other channels for certain commands. I only want to read this channel for this particular instance, and I figured this would be the best way to do it. Any help is greatly appreciated!