The is_owner check doesn't work in the context I used it in, so change it to check against my userID

This commit is contained in:
Emily Doherty 2024-12-07 14:51:21 -08:00
parent 5372ec1d94
commit 5d084dbae5

View File

@ -76,7 +76,7 @@ class Tracker(Extension):
)] )]
alerts_by_flavor = await gather_alerts_by_flavor(users_alerts[user]) alerts_by_flavor = await gather_alerts_by_flavor(users_alerts[user])
for flavor in alerts_by_flavor: for flavor in alerts_by_flavor:
embeds.append(await self.render_alert_flavor(alerts_by_flavor[flavor])) embeds.append(await self.render_alert_flavor(alerts_by_flavor[flavor], user=user))
await discord_user.send(embeds=embeds) await discord_user.send(embeds=embeds)
@ -197,7 +197,8 @@ class Tracker(Extension):
"Please register with /register before adding alerts", "Please register with /register before adding alerts",
ephemeral=True) ephemeral=True)
return return
alerts = await self._users.list_alerts(ctx.user.id) user = await self._users.get(ctx.user.id)
alerts = await self._users.list_alerts(user)
if len(alerts) == 0: if len(alerts) == 0:
await ctx.send("You do not have any alerts registered", ephemeral=True) await ctx.send("You do not have any alerts registered", ephemeral=True)
return return
@ -209,7 +210,7 @@ class Tracker(Extension):
)] )]
alerts_by_flavor = await gather_alerts_by_flavor(alerts) alerts_by_flavor = await gather_alerts_by_flavor(alerts)
for flavor in alerts_by_flavor: for flavor in alerts_by_flavor:
embeds.append(await self.render_alert_flavor(alerts_by_flavor[flavor])) embeds.append(await self.render_alert_flavor(alerts_by_flavor[flavor], user=user))
await ctx.send(embeds=embeds, ephemeral=True) await ctx.send(embeds=embeds, ephemeral=True)
################################### ###################################
@ -360,7 +361,7 @@ class Tracker(Extension):
ephemeral=True) ephemeral=True)
return await self._alert_select_menu_handler(ctx, low_menu, low_message) return await self._alert_select_menu_handler(ctx, low_menu, low_message)
async def render_alert_flavor(self, alerts: List[Alert]) -> Embed: async def render_alert_flavor(self, alerts: List[Alert], user: User | None = None) -> Embed:
region = alerts[0].region region = alerts[0].region
flavor = alerts[0].flavor flavor = alerts[0].flavor
fields: List[EmbedField] = [] fields: List[EmbedField] = []
@ -370,7 +371,7 @@ class Tracker(Extension):
if trigger.last_trigger is not None: if trigger.last_trigger is not None:
alert_str = (f"Last Alerting Price Value: {format(trigger.last_alerting[1], ",")}\n" alert_str = (f"Last Alerting Price Value: {format(trigger.last_alerting[1], ",")}\n"
f"Last Alerting Time: {trigger.last_alerting[0].strftime('%Y-%m-%d %H:%M:%S UTC')}\n") f"Last Alerting Time: {trigger.last_alerting[0].strftime('%Y-%m-%d %H:%M:%S UTC')}\n")
if is_owner(): if user is not None and user.user_id == 265678699435655169:
alert_str += (f"\nShowing you some internals since you are the bot owner:\n" alert_str += (f"\nShowing you some internals since you are the bot owner:\n"
f"```history.last_price_datum:\n" f"```history.last_price_datum:\n"
f"\t{history.last_price_datum[0].strftime('%Y-%m-%d %H:%M:%S UTC')}\n" f"\t{history.last_price_datum[0].strftime('%Y-%m-%d %H:%M:%S UTC')}\n"