'Ignoring Exception in_onmessage

I am new to making Discord Bots using Discord API and python, and apparently my code is acting a bit strange since i added Databases, i have used replit for the coding.

My code is:

import discord
import os
import requests
import json

client = discord.Client()

def get_quote():
    response = requests.get("http://zenquotes.io/api/random")
    json_data = json.loads(response.text)
    quote = json_data[0]['q'] + " -" + json_data[0]['a']
    return quote

@client.event
async def on_ready():
    print('{0.user}'.format(client) + ' has successfully logged in.')


@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content.startswith('.ltt help'):
        await message.channel.send('hello')
    
    if input.content.startswith('.ltt inspire'):
      quote = get_quote()
      await message.channel.send(quote)
client.run(os.getenv('TOKEN'))

And when i try to execute it, it gives me the following error after sucessfully executing: enter image description here

The error causes the bot to be unresponsive, even after mutliple triez of executing .ltt inspire and .ltt help, it seems their is a bug, or error. Even after rechecking the code the error persists.

Note: The following code is from a tutorial, if you want to refer to that here is the link: https://www.youtube.com/watch?v=SPTfmiYiuok
Note: I had not merged .ltt inspire and .ltt help before. When I did .ltt inspire was the only code that worked. .ltt help is not responding.



Solution 1:[1]

if message.content.startswith('.ltt inspire'):
      quote = get_quote()
      await message.channel.send(quote)

just make sure whenever you start a new line in on_message() you always stat that it is a message and not an input

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mortis