I’m trying to work through the beginner discord bot in Python video/instructional and I’m having a weird error. It seems that the messages from discord are triggering the code, but there is nothing in message.content. So replies based on content in a message doesn’t work.
I think everything else is set up because I can get message.id, and I can have the bot reply as long as it’s not a conditional format based off of the message content.
here’s the portion of the code in question:
@client.event
async def on_message(message):
msg = message.content
print(msg) #a blank line is printed here
print(message.id)
if message.author == client.user:
return
if message.content.startswith(‘j’): # this conditional will run if there is nothing
print(message.id) #between the apostrophes
quote = get_quote()
await message.channel.send(quote)
if any(word in msg for word in sad_words):
print(msg)
print(message.id)
await message.channel.send(random.choice(starter_encouragements))
if you have any ideas why the messages are coming through empty, I’d really appreciate it!