Overview
A notifications API would simplify the integration of providing notifications to the user, depending on the environment setup
Specification
@bot.on_metric(f"{token}/{bot.signer.address}", lt=MIN_BALANCE)
async def notify_low_balance(balance: Decimal):
if not bot.state.already_notified:
await bot.notify("Bot needs a refill!")
@bot.on_metric(f"{token}/{bot.signer.address}", gt=MIN_BALANCE)
def reset_low_balance(_):
bot.state.already_notified = False
class Notification(BaseModel):
message: str
... # other fields (with defaults), sourced from `**kwargs` on `.notify`
And some way to configure notification handlers (e.g. Telegram, Email, Silverback Platform, etc.)
Dependencies
n/a