added ephemeral, check if it's the correct channel

This commit is contained in:
Philipp 2022-09-24 22:20:42 +02:00
parent f7d59f1b1a
commit 4153aeef8f
Signed by: Spaenny
GPG Key ID: 9EBD8439AFBAB750
1 changed files with 18 additions and 11 deletions

View File

@ -35,17 +35,24 @@ def main():
async def reserve_slot(ctx: interactions.CommandContext, steamid: str): async def reserve_slot(ctx: interactions.CommandContext, steamid: str):
steam_id = SteamID(steamid) steam_id = SteamID(steamid)
user = ctx.user user = ctx.user
if steam_id.isValid() == True: channel = ctx.channel.id
try:
database.create_reserved_slot(mysql, user, steam_id.steam2(1)) if channel != "433738529898627073":
await ctx.send(f"You just claimed a reserved slot for: `{steam_id.steam2(1)}`!") await ctx.send(f"This command only works in the Channel <#433738529898627073>!", ephemeral=True)
except Exception as err: return
if str(err) == "Duplicate entrys":
await ctx.send(f"You have already claimed a reserved slot!") if steam_id.isValid() == False:
else: await ctx.send(f"You failed to give a valid SteamID as it seems, please head to <https://steamid.xyz/ and check.", ephemeral=True)
await ctx.send(f"Something failed with the database, please try again later.") return
else:
await ctx.send(f"You failed to give a valid SteamID as it seems, please head to <https://steamid.xyz/ and check.") 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"Something failed with the database, please try again later.", ephemeral=True)
return
await ctx.send(f"You have already claimed a reserved slot!", ephemeral=True)
bot.start() bot.start()