2024-11-30 11:27:32 +00:00
|
|
|
import aiohttp
|
2024-12-02 12:58:16 +00:00
|
|
|
from interactions import Extension
|
|
|
|
from interactions import slash_command, listen
|
|
|
|
from interactions.api.events import Startup
|
2024-11-30 11:27:32 +00:00
|
|
|
|
|
|
|
from token_bot.token_database import database as pdb
|
2024-12-02 12:58:16 +00:00
|
|
|
from token_bot.token_database import database as tdb
|
2024-11-30 11:27:32 +00:00
|
|
|
|
|
|
|
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)
|