"""Shared reply helpers for command handlers.""" from __future__ import annotations import discord import strings as S async def reply_db_error(interaction: discord.Interaction) -> None: """Tell the user the database is unavailable. Economy core functions return {"ok": False, "reason": "db_error"} on a PocketBase outage. Without this, handlers either fall through silently (a deferred interaction hangs on "thinking...") or show a misleading "you're broke" message. Works whether or not the interaction was already deferred. """ msg = S.ERR["db_error"] try: if interaction.response.is_done(): await interaction.followup.send(msg, ephemeral=True) else: await interaction.response.send_message(msg, ephemeral=True) except discord.HTTPException: pass