Skip to content
Branch: master
Go to file

Latest commit


Failed to load latest commit information.
Latest commit message
Commit time


Bot-reminder for Telegram

It uses

And contains examples of usage:


This bot should accept your messages, parse hashtags and let you navigate across messages and hashtags


To use this bot locally you need:

  • Install java 8
  • Optional Set up IntelliJ Idea (tip: you can use EAP for free for home projects)
  • Clone this project
  • Install scala and sbt
  • Optional Tip: use IntelliJ Idea Grep Console to view color logs
  • Install and set up Postgres (read more below)
  • Create bot and specify token with -Dbot.token=TOKEN VM-option

Docker publishing

This application uses sbt native plugin to package jar and docker images

You can publish your application to docker hub using:

sbt docker:publish

You should have docker installed and make docker login before to push to docker hub (by default it's public).


I use logging to check the status of my application. In most cases logging is the only way to find out that users are facing issues in the application

Logging is used for debugging sakes only, so text logging is enough for me. I'm not tracking the activity of users at the current stage

For text logging i use default scala stack:

Logging usage

This technology list might overwhelm at first, but it's easy, once you have set up everything.

To set up logging you should specify its' settings using logback.xml file. You can create it in resources and logback will find it automatically. My development settings are in src/main/resources/logback.xml. My production settings are in production-conf/logback.xml.

To use logging you should implement StrictLogging trait and then i can use logger variable from it. String interpolation will be calculated lazily.

logger.debug(s"Message [$message] snoozed for [$duration]")

Color logs

I print my logs in console and use ANSI colors to separate different levels (ERROR from INFO). If you use console, ANSI colors are working by default. If you use IntelliJ Idea, use Grep Console to enable it.

Production settings

In production i separate debug and error logs in different files. Use rollback policies to zip my logs and move it to archive directory.

You can see it in production-conf/logback.xml.

To run and update my application in production i use docker. Docker images are stateless, i should expose volume from my hard drive to write logs there. I'm using -v argument for it, like this:

-v ~/lise-bot/logs:/logs
-v ~/lise-bot/production-conf:/config 


You can run bot from docker repository using:

sudo docker run \
   --name=lise-bot --net=host \
   -v /path/to/lise-bot/logs:/logs \
   -v /path/to/lise-bot/journal:/journal \
   -v /path/to/ \
   eliseealex/lise-bot:1.0-SNAPSHOT \
   -Dbot.token=TOKEN \
   -Ddb.default.user=LISE_DB_USER \
   -Ddb.default.password=LISE_DB_PASS \
   -Ddb.default.url=LISE_DB_URL \
   -Dakka.persistence.journal.leveldb.dir=/journal \
   -Dakka.persistence.snapshot-store.leveldb.dir=/journal/snapshot \
   -Dlogback.configurationFile=/config/logback.xml >> lise-bot/bot.log &

Use --net=host access Postgres through localhost. Hint: use explicit tag.

Postgres set up

You will need new database lise, new user lise_root that have privileges to this database:

# create database lise;

# create user lise_root with password 'root';

# GRANT ALL privileges ON DATABASE lise TO lise_root;

To provide access from localhost with password change pb_hba.conf to match:

# "local" is for Unix domain socket connections only
local   all             all                                     md5


We are using flyway for migration.

To initialize or migrate database use:

sbt flywayMigrate

To get info about migration:

sbt flywayInfo

To your migrations:

sbt flywayClean

Be careful you should clean with the same scripts that you initialized.

Don't commit production settings, instead use:

sbt flywayMigrate -Dflyway.user=prodUser -Dflyway.password=prodPassword -Dflyway.url=prodUrl

Console utility

Or you can use console flyway utility with:

./flyway -user=prodUser -password=prodPass -url=jdbc:postgresql://localhost:5432/prodDatabase -locations=filesystem:/home/user/path/to/scripts/ migrate

To install it on linux:

  1. download;
  2. unarchive with tar -xvf flyway-commandline-4.0.3-linux-x64.tar.gz;
  3. change directory to anarchived.

Read more about flyway.


No description, website, or topics provided.



No releases published


You can’t perform that action at this time.