diff --git a/token_bot/tracker.py b/token_bot/tracker.py index 224111c..04fb770 100644 --- a/token_bot/tracker.py +++ b/token_bot/tracker.py @@ -76,7 +76,7 @@ class Tracker(Extension): )] alerts_by_flavor = await gather_alerts_by_flavor(users_alerts[user]) 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) @@ -197,7 +197,8 @@ class Tracker(Extension): "Please register with /register before adding alerts", ephemeral=True) 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: await ctx.send("You do not have any alerts registered", ephemeral=True) return @@ -209,7 +210,7 @@ class Tracker(Extension): )] alerts_by_flavor = await gather_alerts_by_flavor(alerts) 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) ################################### @@ -360,7 +361,7 @@ class Tracker(Extension): ephemeral=True) 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 flavor = alerts[0].flavor fields: List[EmbedField] = [] @@ -370,7 +371,7 @@ class Tracker(Extension): if trigger.last_trigger is not None: 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") - 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" f"```history.last_price_datum:\n" f"\t{history.last_price_datum[0].strftime('%Y-%m-%d %H:%M:%S UTC')}\n"