From 7b63d34c8814bfb8588844278d9615dee95abb47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=B9=E3=82=BF=E3=83=BC=E3=82=AF=E3=82=AE=E3=83=A3?= =?UTF-8?q?=E3=83=B3=E3=82=B0?= Date: Wed, 3 Feb 2021 22:31:58 +0530 Subject: [PATCH] Add some telethon examples --- Scheduling-Functions.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Scheduling-Functions.md b/Scheduling-Functions.md index 8f5f668..62529a5 100644 --- a/Scheduling-Functions.md +++ b/Scheduling-Functions.md @@ -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) \ No newline at end of file