wow-token-app-bot/token_bot/core.py

33 lines
970 B
Python
Raw Normal View History

import logging
import aiohttp
from interactions import Extension, is_owner, check
from interactions import slash_command, listen
from interactions.api.events import Startup
from token_bot.token_database import database as pdb
from token_bot.token_database import database as tdb
VERSION = "0.9.0"
class Core(Extension):
def __init__(self, bot):
self._tdb: tdb.Database | None = None
self._pdb: pdb.Database | None = None
@listen(Startup)
async def on_start(self):
self.bot.logger.log(logging.INFO, "TokenBot Core ready")
self.bot.logger.log(logging.INFO, f"This is bot version {VERSION}")
self._tdb = tdb.Database(aiohttp.ClientSession())
@slash_command()
@check(is_owner())
async def version(self, ctx):
await ctx.send(f"This is bot version {VERSION}", ephemeral=True)
@slash_command()
async def help(self, ctx):
await ctx.send(f"This is bot help command", ephemeral=True)