Skip to content

Short installation and usage guide

theyellow edited this page Jan 23, 2021 · 9 revisions

Prerequesits:

  • Java 8 or higher
  • at least 600 MB RAM available - e.g. Raspi running here for small community here ;)
  • (optional) Docker / docker-compose
  • (optional) Database (MySQL/MariaDB or PostgreSQL)

Preparation:

Best solution for the database with pogorobot is to use the provided docker-compose script to have a database on docker without doing anything.

If you want your own hosted database (for whatever reason) you should prefer postgres instead of MySQL/MariaDB, it's easier and more secure in transaction-handling.

So the following for self hosted MySQL/MariaDB only: Set storage engine to innoDB because transaction are used. Non-transactional engines like MyISAM are not tested... The easiest way is editing mysql config file (my.cnf or my.ini depending on your operation system) and set the default storageEngine: Your just have to add the line default-storage-engine = InnoDB under the [mysqld] section

If you're on your self-hosted database, you build your own, empty database:

CREATE DATABASE telegram;

Getting your executable jar

There are 2 ways:

  • If you have a compiled jar you can just begin. (Precompiled by Travis CI -> pogorobot-1.1.0-exec.jar )

  • Preferred way: Compile yourself, use mvn in the root direcory of this project and use according to your database:


For mysql:
mvn clean verify -P mysql
or for postgres (standard)
mvn clean verify

In ./target/ you'll find the compiled jar, the right one should end with -exec.jar . Copy it to the folder where you want to run your bot.


Configuration

In your runtime-folder you should have a directory-structure with files like below (name of directory doesn't matter), you can download directly from GitHub example-files

~/telegrambot/telegrambot-x.y.z-exec.jar
~/telegrambot/config/botconfig.properties
~/telegrambot/config/groupraidmonsters.txt
~/telegrambot/config/geofences.txt
~/telegrambot/config/groupchatid.txt
~/telegrambot/config/groupgeofences.txt
~/telegrambot/config/groupiv.txt
~/telegrambot/config/groupmonsters.txt
~/telegrambot/config/dts.json

The main configuration file is config/botconfig.properties, there you should adjust main settings like bot-token and database connection.

The other files are for configuring all your groups and channels. You can also define the areas there that your users should be able to choose in your bot. This configuration is a little bit complex, another Wiki-page coming soon will help you creating your own set of config-files. The dts.json is the file with message-templates for your generated messages.

When you're done with configuration you can run your bot with java.

Run your bot

If you using docker:

(Inside of the pogorobot-directory)
Build and start 2 docker-images (database and pogorobot)
sudo docker-compose up --build -d

If you're using your own hosted database, you are able to start from this directory with something similar like

java -Dext.properties.dir=file:$PWD/config -jar telegrambot-x.y.z-exec.jar

Start/stop and destroy pogorobot / database with docker:

sudo docker-compose stop
sudo docker-compose start

Destroy pogorobot and docker-postgres:

sudo docker-compose down