Initial Template
This commit is contained in:
42
src/bot.py
Normal file
42
src/bot.py
Normal 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())
|
||||
Reference in New Issue
Block a user