Ask coding questions

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

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:
https://www.codementor.io/@garethdwyer/building-a-telegram-bot-using-python-part-1-goi5fncay

Answered by CosmicBear [earned 5 cycles]
View Answer
Voters
A036Nikhil
Comments
hotnewtop
CosmicBear

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.

A036Nikhil

@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?

CosmicBear

@A036Nikhil what exactly is the problem right now?

A036Nikhil

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