mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 10:53:44 +03:00
Add some telethon examples
parent
e8d70769f1
commit
7b63d34c88
|
@ -68,7 +68,8 @@ Here is a example for running a job (Function) everyday at 6am.
|
|||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
|
||||
async def greet_me():
|
||||
print("Good morning Midhun")
|
||||
print("Good morning Midhun.")
|
||||
await client.send_message('me', 'Good Morning To Myself !')
|
||||
|
||||
scheduler = AsyncIOScheduler()
|
||||
scheduler.add_job(greet_me, trigger="cron", hour=06)
|
||||
|
@ -81,7 +82,7 @@ You can also run a job at specific intervals, here is a example for it.
|
|||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
|
||||
async def this_will_run_at_every_one_hour():
|
||||
print("One hour has passed")
|
||||
await client.send_message('me', 'One hour has passed.')
|
||||
|
||||
scheduler = AsyncIOScheduler()
|
||||
scheduler.add_job(this_will_run_at_every_one_hour, 'interval', minutes=60)
|
||||
|
@ -89,6 +90,6 @@ scheduler.start()
|
|||
```
|
||||
You can also set custom Time zone and also use database for running these functions.
|
||||
|
||||
This is more advance And works smoothly with telethon.
|
||||
This is more advance And works smoothly with Telethon.
|
||||
|
||||
Read more about this from [`Here`](https://apscheduler.readthedocs.io/en/stable)
|
Loading…
Reference in New Issue
Block a user