Ask coding questions

← Back to all posts
My Bot isn't working and not printing hi

I am learning how to create a telegram bot but it's not working.
It also shows no error and neither does it print Hi.
When I made changes in that 75(replace > to >=) line, it shows "ValueError: max() arg is an empty sequence".

Please help me.

Tutorial I am following:

Answered by CosmicBear [earned 5 cycles]
View Answer

It isn't running the code to print hi. How python works, is that it runs the code from top to bottom. However, the "main" function has an infinite loop which means that it will never print hi. To get around this, use a coroutine.
This is some code that uses the threading module, but you can use other modules as well for example asyncio.


@CosmicBear Thanks but my bot isn't working. It's print hi, but it was just to check whether the script is running or not. I think there is some problem with the code, can you please help me with that?


@A036Nikhil what exactly is the problem right now?


@CosmicBear so now problem is it is sending hi infinite time.