wow-token-app-bot/token_bot/core.py
Emily Doherty c78ced85ca Very Initial MVP
There is so much more to do, but I think it is time to commit this to VCS
2024-11-30 03:27:32 -08:00

51 lines
1.7 KiB
Python

import json
import os
import aiohttp
from interactions import Extension, Permissions, SlashContext, OptionType, slash_option
from interactions import check, is_owner, slash_command, slash_default_member_permission, listen
from interactions.api.events import Startup, MessageCreate
from interactions import Task, IntervalTrigger
from token_bot.token_database import database as tdb
from token_bot.token_database import database as pdb
VERSION = "0.1.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):
print("TokenBot Core ready")
print(f"This is bot version {VERSION}")
self._tdb = tdb.Database(aiohttp.ClientSession())
@slash_command()
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)
@slash_command(
description="The current retail token cost"
)
async def current(self, ctx):
current = await self._tdb.current(tdb.Flavor.RETAIL)
await ctx.send(f"us: {current['us']}\neu: {current['eu']}\ntw: {current['tw']}\nkr: {current['kr']}",
ephemeral=True)
@slash_command(
description="The current classic token cost"
)
async def current_classic(self, ctx):
current = await self._tdb.current(tdb.Flavor.CLASSIC)
await ctx.send(f"us: {current['us']}\neu: {current['eu']}\ntw: {current['tw']}\nkr: {current['kr']}",
ephemeral=True)