import os import interactions import database from dotenv import load_dotenv from steamid import SteamID def main(): load_dotenv() token = os.getenv('DISCORD_TOKEN') host = os.getenv('MYSQL_HOST') user = os.getenv('MYSQL_USER') password = os.getenv('MYSQL_PASSWORD') db = os.getenv('MYSQL_DATABASE') bot = interactions.Client(token=token) mysql = database.create_connection(host, user, password, db) database.init_test_database(mysql) @bot.command( name="reserve_slot", description="Claim your reserved slot on the DM Server", scope=433600034983116810, options=[ interactions.Option( name="steamid", description="Please provide your SteamID, from https://steamid.xyz/", type=interactions.OptionType.STRING, required=True, ), ], ) async def reserve_slot(ctx: interactions.CommandContext, steamid: str): steam_id = SteamID(steamid) user = ctx.user if steam_id.isValid() == True: try: database.create_reserved_slot(mysql, user, steam_id.steam2(1)) await ctx.send(f"You just claimed a reserved slot for: `{steam_id.steam2(1)}`!") except Exception as err: if str(err) == "Duplicate entrys": await ctx.send(f"You have already claimed a reserved slot!") else: await ctx.send(f"Something failed with the database, please try again later.") else: await ctx.send(f"You failed to give a valid SteamID as it seems, please head to