Initial commit
This commit is contained in:
27
main.py
Normal file
27
main.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import asyncio
|
||||
import os
|
||||
import traceback
|
||||
import signal
|
||||
from typing import Callable
|
||||
|
||||
import bot
|
||||
import config
|
||||
import ai
|
||||
from ai import Message, Role
|
||||
|
||||
async def main() -> None:
|
||||
"""Application entry point"""
|
||||
stop_event = asyncio.Event()
|
||||
loop = asyncio.get_running_loop()
|
||||
def shutdown_handler():
|
||||
stop_event.set()
|
||||
|
||||
for sig in (signal.SIGINT, signal.SIGTERM):
|
||||
loop.add_signal_handler(sig, shutdown_handler)
|
||||
# get available tools
|
||||
await bot.start()
|
||||
await stop_event.wait()
|
||||
await bot.stop()
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user