123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import asyncio
- import datetime
- from pyexpat.errors import messages
- from random import randint
- from typing import Iterable
- from aiogram.types import Message
- import queu
- from async_db import Database
- from handlers import users_message
- from loader import scheduler, logger
- from utils import ScheduledMessage
- db = Database()
- def chat_id_in_list(chat_id):
- return
- async def main():
- scheduler.start()
- for i in range(0, 50):
- await db.jobs_add(2, -814326413, f'Добрый день, message-{i}')
- await db.jobs_add(2, -1001517227500, f'Добрый день, message-{i}')
- # db.jobs_add(0, randint(1111,9999), 'message to send')
- # db.jobs_add(2, randint(1111,9999), 'message to delete')
- # db.jobs_add(1234, randint(1111,9999), 'message delete')
- # list_jobs = await db.get_jobs()
- # scheduler.add_job(queu.create_tasks, trigger='interval', seconds=60, next_run_time=datetime.datetime.now())
- """`
- каждые 5 секунд до 20 сообщений по 10 в один чат
- in: [(10 messages in chat1), (5 messages in chat1)], [(10 messages in chat2),], [(10 messages in chat3),]
- out: [
- [10 messages in chat1 and 10 messages in chat2],
- [5 messages in chat1 and 10 messages in chat2 and 5 messages in chat3], ...]
- """
- await asyncio.sleep(2000)
- if __name__ == '__main__':
- asyncio.run(main())
|