Skip to content

Bot Notifications #288

@fubuloubu

Description

@fubuloubu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions