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

View File

@@ -9,6 +9,7 @@ from discord.ext.commands import Bot, Cog, HybridCommand, HybridCommandError
from discord.ext.commands.errors import CommandInvokeError, CheckFailure
from discord.app_commands.errors import CommandInvokeError as appCommandInvokeError, TransformerError
from aiohttp import ClientSession
from twitchAPI.twitch import Twitch
from data import Database
from utils.lib import tabulate
@@ -23,6 +24,8 @@ from .monitor import SystemMonitor, ComponentMonitor, StatusLevel, ComponentStat
if TYPE_CHECKING:
from core.cog import CoreCog
from twitch.cog import TwitchAuthCog
from modules.profiles.cog import ProfileCog
logger = logging.getLogger(__name__)
@@ -31,7 +34,9 @@ class LionBot(Bot):
def __init__(
self, *args, appname: str, shardname: str, db: Database, config: Conf,
initial_extensions: List[str], web_client: ClientSession,
testing_guilds: List[int] = [], **kwargs
twitch: Twitch,
testing_guilds: List[int] = [],
**kwargs
):
kwargs.setdefault('tree_cls', LionTree)
super().__init__(*args, **kwargs)
@@ -43,6 +48,7 @@ class LionBot(Bot):
self.shardname = shardname
# self.appdata = appdata
self.config = config
self.twitch = twitch
self.system_monitor = SystemMonitor()
self.monitor = ComponentMonitor('LionBot', self._monitor_status)
@@ -101,6 +107,14 @@ class LionBot(Bot):
def get_cog(self, name: Literal['CoreCog']) -> 'CoreCog':
...
@overload
def get_cog(self, name: Literal['ProfileCog']) -> 'ProfileCog':
...
@overload
def get_cog(self, name: Literal['TwitchAuthCog']) -> 'TwitchAuthCog':
...
@overload
def get_cog(self, name: str) -> Optional[Cog]:
...