INNER CODE UNIT · Python
notify_upgrade
PleasePrompto/ductor · ductor_bot/messenger/telegram/app.py:355
async def notify_upgrade(self, text: str, opts: SendRichOpts | None = None) -> None:
"""Route upgrade-available notifications (#64).
Fallback policy (mirrors ``notify_startup``):
* ``upgrade_targets`` empty (default) -> ``broadcast``.
* ``upgrade_targets`` non-empty but every entry disabled -> explicit
silence (no fallback).
``opts`` (reply_markup, etc.) is preserved on each per-target send.
"""
configured = self._config.notifications.upgrade_targets
if not configured:
await self.broadcast(text, opts)
return
targets = [t for t in configured if t.enabled and t.chat_id is not None]
for target in targets:
try:
assert target.chat_id is not None
target_opts = SendRichOpts(