'Discord Selfbot unable to call on_message()

I made a Selfbot on Discord (please do not tell me its against the ToS, I have already been told hundreds of times) to send the string "Hello!" everytime someone sends "!hello", and it can also grind other bots such as Dank Memer, all via an on_message() function. But for some reason, when I run the bot, it can login into the account, but the on_message() doesn't seem to work. There is a print() function called in it which is also not displayed, which means that the bot cannot react to the on_message function. It is currently hosted and run on https://replit.com. Please help, I cannot continue developing it after this.

Full Code here:

import discord
import time
from random import randint

TOKEN = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 


client = discord.Client()

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

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

    elif message.content.startswith('$hello'):
        while True:
            await message.channel.send('pls beg')
            time.sleep(randint(17,22))
            await message.channel.send('pls fish')
            time.sleep(randint(3,5))
            await message.channel.send("pls sell fish all")
            time.sleep(randint(1,2))
            await message.channel.send("pls sell rarefish all")
            time.sleep(randint(1,2))
            await message.channel.send("pls sell jellyfish all")
            time.sleep(randint(1,2))
            await message.channel.send("pls sell jellyfish all")
            time.sleep(randint(2,4))
            await message.channel.send("pls sell seaweed all")
            time.sleep(randint(1,2))
            await message.channel.send("pls sell junk all")
            time.sleep(randint(1,2))
            await message.channel.send("pls sell trash all")
            time.sleep(randint(1,2))
            await message.channel.send("pls sell garbage all")
            time.sleep(randint(1,2))
            await message.channel.send("pls hunt")
            time.sleep(randint(3,5))
            await message.channel.send("pls sell skunk all")
            time.sleep(randint(1,2))
            await message.channel.send("pls sell rabbit all")
            time.sleep(randint(1,2))
            await message.channel.send("pls sell duck all")
            time.sleep(randint(1,2))
            await message.channel.send("pls sell deer all")
            time.sleep(randint(1,2))
            await message.channel.send("pls sell boar all")
            time.sleep(randint(3,5))
            await message.channel.send("pls dig")
            time.sleep(randint(3,5))
            await message.channel.send("pls sell junk all")
            time.sleep(randint(1,2))
            await message.channel.send("pls sell worm all")
            time.sleep(randint(1,2))
            await message.channel.send("pls sell ant all")
            time.sleep(randint(1,2))
            await message.channel.send("pls sell ladybug all")
            time.sleep(randint(3,5))
            await message.channel.send("pls sell stickbug all")
            time.sleep(randint(3,5))
            await message.channel.send("pls daily")
            time.sleep(randint(3,5))

    elif message.content.startswith('Catch'):
        await message.channel.send('pls buy fishingpole')
    elif message.content.startswith('Dodge'):
        await message.channel.send('pls buy huntingrifle')
        await message.channel.send('pls buy life')
    elif message.content.startswith('Look'):
        await message.channel.send('pls buy shovel')
    elif message.content.startswith('Dunk'):
        await message.channel.send('pls buy shovel')
    elif message.content.startswith('Hit'):
        await message.channel.send('pls buy shovel')

client.run(TOKEN, bot=False)


Sources

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

Source: Stack Overflow

Solution Source