Check if user exists and if alerts exist before attempting to list them
This commit is contained in:
parent
ad504aba42
commit
ec1bf6f1d1
@ -191,7 +191,15 @@ class Tracker(Extension):
|
||||
description="List all alerts you have signed up for"
|
||||
)
|
||||
async def list_alerts(self, ctx: SlashContext):
|
||||
if not await self._users.exists(ctx.user.id):
|
||||
await ctx.send("You are not registered with any region\n"
|
||||
"Please register with /register before adding alerts",
|
||||
ephemeral=True)
|
||||
return
|
||||
alerts = await self._users.list_alerts(ctx.user.id)
|
||||
if len(alerts) == 0:
|
||||
await ctx.send("You do not have any alerts registered", ephemeral=True)
|
||||
return
|
||||
alerts_str = f"You have {len(alerts)} out of 25 maximum alerts registered"
|
||||
embeds = [Embed(
|
||||
title="List of TokenBot Tracker Alerts",
|
||||
|
Loading…
Reference in New Issue
Block a user