Skip to content
IvanMontillaPublic

About

Telegram bot that stores messages.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

YapKeep

Telegram bot that forwards messages to a separate chat (channel, group or account).

Intended to keep evidence when scammers edit or delete messages. Anti-gaslighting tool.

How to build and deploy on DigitalOcean

DigitalOcean builds it for us in their App Platform.

  1. Create a new DigitalOcean App:
    1. Ensure "Git repository" tab is selected.
    2. Select a "Git provider" and "Repository" where this source code is hosted.
    3. Select the "Branch" this application runs from. Usually, the default is fine.
    4. Leave "Source directories (Optional)" empty.
    5. Enable automatic deployments if you don't have a separate application for tests.
    6. Proceed to next step.
  2. Set up resource settings:
    1. It's optional to change resource's name (Defaults to yapkeep).
    2. Change app's "Instance size" to minimal (512 MB RAM | 1 Shared vCPU | 50 GB bandwidth at $5.00/mo).
    3. At Deployment settings set the Run command to the one specified at the end of this section.
    4. Leave Network settings at their defaults (Public HTTP port at 8080, no internal ports defined, and HTTP request routes with 1 route set at /).
    5. Add environment variables on the resource, by clicking on the "Add from .env" button.
      1. Copy the template from .env-sample and fill in the values. Click on "Save" button once done.
      2. Recommended: Set all environment variables to Run time in the "Scope" setting for each one.
      3. Recommended: Enable encryption for every variable that ends with _KEY.
  3. Skip creating "App-level environment variables", as these are not necessary for this project.
  4. Select a "Region" for your app to be deployed.
    1. The closer to Telegram servers, the better. A reference: What are the IP addresses of Telegram Data Centers?.
  5. Finalize step:
    1. Choose a unique app name. The default setting is fine.
    2. Select a project. It defaults to the one you're currently at.
      1. Can be left as is if this is your first time using DigitalOcean.
    3. Click on the "Create app" button on the right sidebar.

Run command: gunicorn --worker-tmp-dir /dev/shm --pythonpath 'bot' --workers=3 --capture-output --enable-stdio-inheritance "app:app"

Environment variables required to run

  • BOT_WEBHOOK_KEY: Part of the URL that Telegram hits when sending us notifications. Used as an anti-spam measure, security-through-obscurity (Currently, Telegram doesn't support a better way).
    • Just generate any random alphanumeric string, with at least 16 characters.
    • How it ends up looking: https://<app_fdqn>/webhook/<bot_webhook_key>
  • OPT_PRETTYPRINT: Pretty-print output JSONs on HTTP requests.
  • TG_API_KEY: Telegram's main bot API key. Obtained through BotFather.
  • TG_OUTPUT_CHAT_ID: Output chat of the message logging activity. It could be a channel, group or individual account.

Refer to .env-sample file for an updated environment variables template.

Telegram bot configuration

This page has been intentionally left blank.

Open a new GitHub Issue on this repo, and I'll provide an email for professional services.

I charge a one-time setup fee on your server.

About

Telegram bot that stores messages.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages