Git Product home page Git Product logo

the-tag-bot's Introduction

The Tag Bot

@TheTagBot is a Telegram bot that lets you save and retrieve media using your own tags.

Setup

If you want to host your own copy of this bot, here's how:

  1. Get Nix running on your system (preferably use NixOS)

  2. Install Elasticsearch

  3. Copy secrets-example.py to secrets.py and edit the HTTP_PASS variable to a secure password (for example hunter2), this is the password for the Elasticsearch user that the bot will use

  4. Setup security in Elasticsearch by putting the following into $ES_PATH_CONF/elasticsearch.yml:

    xpack.security.enabled: true
    discovery.type: single-node

    Then run (as the same user that Elasticsearch runs as):

    elasticsearch-setup-passwords auto

    Put the generated password for the elastic user in secrets.py:

    HTTP_PASS = '<super secret password that you generated earlier>'
    ADMIN_HTTP_PASS = 'elastic user password here'
  5. Now you can run the bot using nix-shell in the repo root:

    nix-shell shell.nix --run 'python bot.py'
    

    The bot will take care of setting up the Elasticsearch indicies that it needs.

  6. Telethon will prompt for your bot token when you first run the bot, when you move it to a server simply copy the bot.session file to the server.

Config

You can change the limits in constants.py to suit your needs.

Development

When you want to make changes to the index mapping, you have to delete and re-create it with the new settings. The scripts directory has two scripts that can help with this:

  • backup.py makes the index read-only and copies all the documents into a backup index
  • recreate.py deletes and re-creates the index with the settings in settings.json, then copies the documents from the backup (you can run this multiple times after having run backup.py once)

the-tag-bot's People

Contributors

udf avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.