I have telegram bot which is made by python. The file must run at 06:00 P.M everyday.
My PC is Windows 10.
How can I achieve this , please guide me.
Question posted in Telegram API
A comprehensive official documentation can be found here.
A comprehensive official documentation can be found here.
3
Answers
If you are using
python-telegram-bot
you should take a look at JobQueue.It has a
run_daily
which does what you want:Here is an example with it:
This example executes the function
daily_function
everyday at 18:00.You can use Windows scheduled tasks:
Save your python file. For example: my_python.py
Create a bat file that runs my_python.py. Assuming Python is installed in the path below:
"C:UsersMyUserAppDataLocalProgramsPythonPython37-32python.exe"
And my_python is saved in:
Create new text file and save it as run_my_python.bat with the following content:
Go to Windows Task Scheduler, set your trigger, and choose "Start a program" action. Select run_my_python and save the scheduled task.