Add twitch auth module.

This commit is contained in:
2025-06-06 00:05:24 +10:00
parent 9625dec1e4
commit 2cf81c38e8
10 changed files with 450 additions and 4 deletions
+7 -3
View File
@@ -4,6 +4,7 @@ import logging
import aiohttp
import discord
from discord.ext import commands
from twitchAPI.twitch import Twitch
from meta import LionBot, conf, sharding, appname
from meta.app import shardname
@@ -49,13 +50,15 @@ async def _data_monitor() -> ComponentStatus:
async def main():
log_action_stack.set(("Initialising",))
logger.info("Initialising StudyLion")
logger.info("Initialising LionBot")
intents = discord.Intents.all()
intents.members = True
intents.message_content = True
intents.presences = False
twitch = await Twitch(conf.twitch['app_id'], conf.twitch['app_secret'])
async with db.open():
version = await db.version()
if version.version != DATA_VERSION:
@@ -82,6 +85,7 @@ async def main():
help_command=None,
proxy=conf.bot.get('proxy', None),
chunk_guilds_at_startup=False,
twitch=twitch
) as lionbot:
ctx_bot.set(lionbot)
lionbot.system_monitor.add_component(
@@ -89,11 +93,11 @@ async def main():
)
try:
log_context.set(f"APP: {appname}")
logger.info("StudyLion initialised, starting!", extra={'action': 'Starting'})
logger.info("LionBot initialised, starting!", extra={'action': 'Starting'})
await lionbot.start(conf.bot['TOKEN'])
except asyncio.CancelledError:
log_context.set(f"APP: {appname}")
logger.info("StudyLion closed, shutting down.", extra={'action': "Shutting Down"}, exc_info=True)
logger.info("LionBot closed, shutting down.", extra={'action': "Shutting Down"}, exc_info=True)
def _main():