44 lines
955 B
Python
44 lines
955 B
Python
import contextlib
|
|
import logging
|
|
from os import getpid
|
|
|
|
from classes.pyroclient import PyroClient
|
|
from modules.scheduler import scheduler
|
|
|
|
# Uncomment this and the line below client declaration
|
|
# in order to use context manager in your commands.
|
|
# Don't forget to disable PyroClient workers if you want
|
|
# to use convopyro, because workers create more event loops.
|
|
# from convopyro import Conversation
|
|
|
|
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="%(name)s.%(funcName)s | %(levelname)s | %(message)s",
|
|
datefmt="[%X]",
|
|
)
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
with contextlib.suppress(ImportError):
|
|
import uvloop
|
|
|
|
uvloop.install()
|
|
|
|
|
|
def main():
|
|
client = PyroClient()
|
|
# Conversation(client)
|
|
|
|
try:
|
|
client.run()
|
|
except KeyboardInterrupt:
|
|
logger.warning("Forcefully shutting down with PID %s...", getpid())
|
|
finally:
|
|
scheduler.shutdown()
|
|
exit()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|