Having Trouble with the Python Discord Bot Tutorial

Hello! Does anyone know how to solve this? Can you please help me?

The first attempt had succeeded, but when I retried it, it keeps showing this:

We have logged in as ****#0000

Ignoring exception in on_message
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 53, in on_message
    option = option + db["encouragements"]
TypeError: can only concatenate list (not "ObservedList") to list

This is what my program looks like:

async def on_ready():
  print('We have logged in as {0.user}'.format(client))

async def on_message(message):

  msg = message.content
  chl = message.channel
  aut = message.author

  if aut == client.user:

  if msg.startswith('!quote'):
    quote = get_quote()
    await chl.send(quote)
  option = starter_encouragements
  if "encouragements" in db.keys():
    option = option + db["encouragements"]
  if any(word in msg for word in sad_words):
    await chl.send(random.choice(starter_encouragements))

Although I thoroughly followed the code in the tutorial, it keeps happening. Please help me :< I’m still a beginner with the code stuff, so I’m not good with technical terms.

Thank you in advance!

here instead of + try using append or something similar

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.