Skip to content

Feature Request: Telegram Bot for Points/Drop Updates #233

Description

@ColinShark

I don't know how easy it would be to implement, but can we have a Telegram Bot Feature? :D

I thought maybe a Class for a Telegram Bot, so we can receive updates on Points, Drops and/or Bets from our own Bot in Telegram. Perhaps a Class to handle everything.

Users could be told in the Readme to create a bot with BotFather and add the Token and their own User ID to the run.py. All api request would need to go to https://api.telegram.org/bot<token>/METHOD_NAME, where Method_Name could just be sendMessage with appropriate information filled in.

As an additional bonus, maybe even commands to restart the points miner? 👀

I know, I've kinda skipped the issue template 🙈


Edit: I've made a (rough) proof-of-concept in WebSocketsPool.on_message:

 message.type == "points-earned":
    earned = message.data["point_gain"]["total_points"]
    reason_code = message.data["point_gain"]["reason_code"]

    token = "123456789:bottokenhere123abc456def789ghi"
    api = f"https://api.telegram.org/bot{token}/sendMessage"
    r = requests.post(
        api,
        data={
            "chat_id": 289579584,
            "text": f"+{earned}{ws.streamers[streamer_index]} - Reason: {reason_code}."
        }
    )
    if r.raise_for_status():
        # https://docs.python-requests.org/en/master/user/quickstart/#response-status-codes
        pass

    logger.info(
        f"+{earned}{ws.streamers[streamer_index]} - Reason: {reason_code}.",
        extra={...}
    )

What it could look like:

Proof of Concept

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions