mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-19 19:46:41 +00:00
Updated Scheduling Functions (markdown)
parent
af14b68658
commit
e8d70769f1
@ -60,22 +60,22 @@ If you don't mind using other libraries, [`aiocron`](https://github.com/gawel/ai
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
You Can Also Use [`apscheduler`](https://github.com/agronholm/apscheduler), Which is Much Simpler And Much Efficient.
|
You can also use [`apscheduler`](https://github.com/agronholm/apscheduler), which is much simpler and much efficient.
|
||||||
|
|
||||||
Here is A Example For Running A Job (Function) Everyday at 6am.
|
Here is a example for running a job (Function) everyday at 6am.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||||
|
|
||||||
async def greet_me():
|
async def greet_me():
|
||||||
print("Good Morning Midhun")
|
print("Good morning Midhun")
|
||||||
|
|
||||||
scheduler = AsyncIOScheduler()
|
scheduler = AsyncIOScheduler()
|
||||||
scheduler.add_job(greet_me, trigger="cron", hour=06)
|
scheduler.add_job(greet_me, trigger="cron", hour=06)
|
||||||
scheduler.start()
|
scheduler.start()
|
||||||
```
|
```
|
||||||
|
|
||||||
You Can Also Run A Job At Specific intervals, Here is A Example For it.
|
You can also run a job at specific intervals, here is a example for it.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||||
@ -87,8 +87,8 @@ scheduler = AsyncIOScheduler()
|
|||||||
scheduler.add_job(this_will_run_at_every_one_hour, 'interval', minutes=60)
|
scheduler.add_job(this_will_run_at_every_one_hour, 'interval', minutes=60)
|
||||||
scheduler.start()
|
scheduler.start()
|
||||||
```
|
```
|
||||||
You Can Also Set Custom TimeZones And Also Use DataBases For Running These Functions.
|
You can also set custom Time zone and also use database for running these functions.
|
||||||
|
|
||||||
I Like This Because it's More Advance And Better.
|
This is more advance And works smoothly with telethon.
|
||||||
|
|
||||||
Read More About This From [`Here`](https://apscheduler.readthedocs.io/en/stable)
|
Read more about this from [`Here`](https://apscheduler.readthedocs.io/en/stable)
|
Loading…
Reference in New Issue
Block a user