Info: I was working on my bot recently, and was able to make the bot react on message if you have a command in the channel's topic (Description). I've looked up and tried everything I could, but none worked. The bot's console gets spammed with errors, though the reactions work. I did noticed though that since I implemented this, my bot only works in some servers and completely stopped (Besides the on_message reactions) in other servers. I have no clue why it works in some over others and haven't been able to figure that out either.
Error:
File "FILENAME", line NUMBER, in on_message
if "S|Wave" in message.channel.topic:
TypeError: argument of type 'NoneType' is not iterable
Code:
@client.event
async def on_message(message):
if "S|Wave" in message.channel.topic:
await message.add_reaction("👋")
If it helps, I have multiple of these under on_message, including ping reactions and other on_message events.
Since you're using on_message
and since it does have a topic this suggests that the channel can only be a TextChannel
.
This doesn't really matter but the channel that you're sending a message in doesn't have a set topic and so it will return None
. You could solve this by adding a quick if statement eg.
@client.event
async def on_message(message):
if "S|Wave" in message.channel.topic if message.channel.topic else "":
await message.add_reaction("👋")