generated from HoloTech/holotech-plugin-template
34 lines
763 B
Python
34 lines
763 B
Python
from typing import Optional
|
|
import asyncio
|
|
|
|
import twitchio
|
|
from twitchio.ext import commands as cmds
|
|
|
|
from meta import Bot
|
|
from meta.logger import log_wrap
|
|
from utils.lib import utc_now
|
|
|
|
from . import logger
|
|
|
|
from ..data import CampaignData
|
|
from ..campaign import CampaignRegistry
|
|
|
|
|
|
class CampaignComponent(cmds.Component):
|
|
def __init__(self, bot: Bot):
|
|
self.bot = bot
|
|
|
|
self.data = bot.dbconn.load_registry(CampaignData())
|
|
self.campaigns = CampaignRegistry(self.data)
|
|
|
|
# ----- API -----
|
|
async def component_load(self):
|
|
await self.data.init()
|
|
await self.bot.version_check(*self.data.VERSION)
|
|
await self.campaigns.init()
|
|
|
|
async def component_teardown(self):
|
|
pass
|
|
|
|
# ------ Commands -----
|