Initial Template

This commit is contained in:
2025-08-01 00:05:48 +10:00
commit 7457ae6ac1
19 changed files with 1293 additions and 0 deletions

42
src/bot.py Normal file
View File

@@ -0,0 +1,42 @@
import asyncio
import logging
import websockets
from twitchio.web import AiohttpAdapter
from meta import CrocBot, conf, setup_main_logger, args
from data import Database
from modules import twitch_setup
logger = logging.getLogger(__name__)
async def main():
db = Database(conf.data['args'])
async with db.open():
adapter = AiohttpAdapter(
host=conf.bot.get('wshost', None),
port=conf.bot.getint('wsport', None),
domain=conf.bot.get('wsdomain', None),
eventsub_secret=conf.bot.get('eventsub_secret', None)
)
bot = CrocBot(
config=conf,
dbconn=db,
adapter=adapter,
setup=twitch_setup,
)
try:
await bot.start()
finally:
await bot.close()
def _main():
setup_main_logger()
asyncio.run(main())