This repository has been archived on 2024-10-15. You can view files and clone it, but cannot push or open issues or pull requests.
PyrogramBotBase/main.py

36 lines
590 B
Python
Raw Normal View History

2023-04-01 15:25:41 +03:00
import logging
from os import getpid
from modules.app import PyroClient
logging.basicConfig(
level=logging.INFO,
format="%(name)s.%(funcName)s | %(levelname)s | %(message)s",
datefmt="[%X]",
)
logger = logging.getLogger(__name__)
try:
import uvloop
uvloop.install()
except ImportError:
pass
2023-05-14 22:27:07 +03:00
def main():
2023-04-01 15:25:41 +03:00
client = PyroClient()
try:
2023-05-14 22:27:07 +03:00
client.run()
2023-04-01 15:25:41 +03:00
except KeyboardInterrupt:
logger.warning(f"Forcefully shutting down with PID {getpid()}...")
finally:
2023-05-14 22:27:07 +03:00
client.__exit__()
exit()
2023-04-01 15:25:41 +03:00
if __name__ == "__main__":
2023-05-14 22:29:23 +03:00
main()