-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Im forced to use pyrogram + aioclock together i need feature that give use ability to add a task into group of tasks on run time
my loop have strategy like this
import asyncio
import sys
import pyrogram
from helpers.logger import CustomFormatter
from helpers.task import clock
from clients import app,api,calls,db
import logging
# Configure the root logger
logging.basicConfig(level=logging.INFO)
# Get the root logger
root_logger = logging.getLogger()
# Create and set the custom formatter to the root logger's handlers
formatter = CustomFormatter(datefmt='%H:%M:%S')
for handler in root_logger.handlers:
handler.setFormatter(formatter)
async def main():
await db.connect()
await app.start()
await api.start()
await calls.start()
try:
await clock.serve()
await pyrogram.idle()
except asyncio.CancelledError:
pass
except KeyboardInterrupt:
print('KeyboardInterrupt received, shutting down ...')
except ImportError:
print('could not load the plugins module, does the directory exist '
'in the correct location?', file=sys.stderr)
except Exception as e:
print(f"error: {e}")
finally:
await app.stop()
await api.stop()
await db.disconnect()
if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(main())and i need to add schedule task on run time without to be forced restarting my bot!
ManiMozaffar
Metadata
Metadata
Assignees
Labels
No labels