Skip to main content

A telegram bot to organize PoGo raid that it can be self hosted

Project description

Codacy Badge

Important

The bot is now in beta version

Description

A telegram bot to organize PoGo raid that it can be self hosted.

If you publish a raid screenshot in a group where this bot is present, it identifies the raid an provides you a poll to organize the raid.

Requirements

Python

The bot needs Python version 3.7 or newer, and the modules that are present in the requirements.txt file.

To install the modules use pip:

$ pip install -r requirements.txt

Tesseract

The bot needs an installation of Tesseract OCR and a pre-trained neural network for english. Both can be found from the official Arch and Ubuntu repositories.

Refer to this link.

Redis

The bot requires a dedicated instance of Redis database.

Refer to this link.

Run

The bot needs to know, the bot api token, that you can obtain from @BotFather and the address of redis instance.

To understand how to provide these informations to the bot:

$ python ./main.py -h
usage: main.py [-h] [-t TOKEN] [-r HOST] [-p PORT] [-a SUPERADMIN]
               [-b BOSSES_FILE] [-g GYMS_FILE] [-d DEBUG_FOLDER] [-v] [--info]
               [--debug]

optional arguments:
  -h, --help            show this help message and exit
  -t TOKEN, --token TOKEN
                        telegram bot token
  -r HOST, --host HOST  redis host
  -p PORT, --port PORT  redis port
  -a SUPERADMIN, --superadmin SUPERADMIN
                        superadmin's id
  -b BOSSES_FILE, --bosses-file BOSSES_FILE
                        JSON file contains possible pokémons in the raids. It
                        can be also provided over http(s)
  -g GYMS_FILE, --gyms-file GYMS_FILE
                        JSON file contains gyms and their coordinates. It can
                        be also provided over http(s)
  -d DEBUG_FOLDER, --debug-folder DEBUG_FOLDER
                        debug folder
  -v                    number of -v specifics level of verbosity
  --info                equal to -vv
  --debug               equal to -vvv

An example:

$ python3 ./main.py -t [BOT_TOKEN] -r 127.0.0.1 -p 6379

Dockerized version [recommended]

Requirements

The dockerized version of the bot requires docker and docker-compose to work.

Refer to this link.

Installation

You can choose two kinds of setup:

Use the image on Docker Hub

  1. Download .env and docker-compose.yaml files and put them in a folder.

  2. Edit them to adapt the setup to your requirements(see below).

  3. Run the containers.

    docker-compose up
    

Compile your own Docker image

  1. Clone the whole repo and init the submodule.

    git clone https://github.com/RobertoBochet/pogoraidbot-dockerized.git ./pogoraidbot
    cd pogoraidbot
    git submodule update --init
    
  2. Edit the .env and docker-compose.yaml to adapt the setup to your requirements(see below).

  3. Build and start the containers.

    docker-compose build
    docker-compose up
    

Configuration

Required

In .env replace:

  • [BOT_TOKEN] with your bot's token
  • [SUPERADMIN_ID] with the Telegram id of the main admin
  • [TIME_ZONE] with your time zone (refer to this table on column TZ database name)

Optional

  • Add support to gym identification

    In .env set the env PGRB_BOT_GYMS_FILE with the position of your gyms file.

  • Add support to boss identification

    In .env set the env PGRB_BOT_BOSSES_FILE with the position of your bosses file.

  • Make redis data persistent

    Uncomment the line command: ["redis-server", "--appendonly", "yes"] in docker-compose.yaml.

    If you want make the redis data persistent also to container destruction uncomment also the volumes section of the redis service and set the env PGRB_REDIS_PATH.

  • Assign static IP for the virtual network

    Uncomment all the three networks sections in docker-compose.yaml and set the three env PGRB_NETWORK_* with IP and subnet in .env.

Credits

In this project are used the following Python libraries:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pogoraidbot-0.4.6.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

pogoraidbot-0.4.6-py3-none-any.whl (42.8 kB view details)

Uploaded Python 3

File details

Details for the file pogoraidbot-0.4.6.tar.gz.

File metadata

  • Download URL: pogoraidbot-0.4.6.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for pogoraidbot-0.4.6.tar.gz
Algorithm Hash digest
SHA256 6b3b36380ee8774440b3481982292c761b8e75274b8d053624155bb0ffa6c824
MD5 61643ef3e251003ad8b7ce705c6be3cf
BLAKE2b-256 3b8411a294ed914d453d873c43616b403aac0d14ded915c8e3368eaab5e86abc

See more details on using hashes here.

File details

Details for the file pogoraidbot-0.4.6-py3-none-any.whl.

File metadata

  • Download URL: pogoraidbot-0.4.6-py3-none-any.whl
  • Upload date:
  • Size: 42.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for pogoraidbot-0.4.6-py3-none-any.whl
Algorithm Hash digest
SHA256 445ac88a7b08ef392d5f0dffb0a772cb424b76eb44978aaabd4881a928814d6c
MD5 2f85f097cdc7f43e89ebadc2617eb139
BLAKE2b-256 d512fae5501a247a7d29747e4d8b537a0070f196a17e35b2558977d6d07a12d9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page