wow-token-app-bot

An interactions.py Discord bot for getting and alerting on the WoW Token Price
git clone https://git.emily.sh/wowtoken-app/wow-token-app-bot.git
Log | Files | Refs | README | LICENSE

commit e5caf728299ba31c85d963e7293c1e9c147edaf7
parent 3303f9a939d22b7b1974bb3d0fb27551d9e72997
Author: Emily Doherty <git@emily.sh>
Date:   Wed,  4 Dec 2024 20:31:54 -0800

Add some debugging information for myself to debug triggers not firing when expected

Diffstat:
Mtoken_bot/history_manager/update_trigger.py | 8++++++--
Mtoken_bot/tracker.py | 16++++++++++++++--
2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/token_bot/history_manager/update_trigger.py b/token_bot/history_manager/update_trigger.py @@ -21,9 +21,14 @@ class UpdateTrigger: def last_trigger(self) -> Tuple[datetime.datetime, int] | None: return self._last_trigger + @property def last_alerting(self) -> Tuple[datetime.datetime, int] | None: return self._last_alerting + @property + def squelched(self): + return self._squelched + def _find_next_trigger(self, comparison_operator: operator, starting_point: datetime.datetime, history: List[Tuple[datetime.datetime, int]]): candidate_datum : Tuple[datetime.datetime, int] | None = None for datum in history: @@ -99,4 +104,4 @@ class UpdateTrigger: return not was_squelched elif self._squelched: self._squelched = False - return False -\ No newline at end of file + return False diff --git a/token_bot/tracker.py b/token_bot/tracker.py @@ -368,8 +368,20 @@ class Tracker(Extension): history = await self._history_manager.get_history(alert.flavor, alert.region) trigger = await history.find_update_trigger_from_alert(alert) 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") + 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(): + 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" + f"\t{history.last_price_datum[1]}\n" + f"trigger.last_alerting:\n" + f"\t{trigger.last_alerting[0].strftime('%Y-%m-%d %H:%M:%S UTC')}\n" + f"\t{trigger.last_alerting[1]}\n" + f"trigger.last_trigger:\n" + f"\t{trigger.last_trigger[0].strftime('%Y-%m-%d %H:%M:%S UTC')}\n" + f"\t{trigger.last_trigger[1]}\n" + f"trigger.squelched:\n\t{trigger.squelched}```") else: alert_str = "You should only be seeing this if the bot has not finished importing history at startup." fields.append(