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: Philipp
GPG key ID: 9EBD8439AFBAB750

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