Untitled

mail@pastecode.io avatar
unknown
python
2 months ago
921 B
0
Indexable
Never
import asyncio
import logging
from datetime import timedelta
from pprint import pprint
from pyrogram import Client, filters
from pyrogram.types import Message
from rocketry import Rocketry
from rocketry.conds import every, daily
from config import *


logging.basicConfig(
    format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", level=logging.INFO
)
schedule = Rocketry()


bot = Client("test", api_id=API_ID, api_hash=API_HASH, bot_token=TOKEN)


schedule = Rocketry()


@schedule.task(daily.at("12:15"), execution="async")
async def greeting():
    print("Schedule started...")
    await bot.send_message("me", "Hi")


@bot.on_message()
async def start_greeting(client, message: Message):
    await greeting()


@bot.on_message(filters.command("startsch", prefixes=["/", ""]))
async def start_schedule():
    schedule.run()


if __name__ == "__main__":
    bot.run()
Leave a Comment