Home

Awesome

Group Butler

Build Status Coverage Status Localization Status

Short introduction

Group Butler helps people administrate their groups, and includes many other useful tools.

Group Butler was born as an otouto v3.1 (@mokubot), but it has since been turned into an administration bot.

Group Butler on Telegram:


Setup

First of all, take a look at your bot settings

Create a plain text file named .env with the following:

Your .env file should now look somewhat like this:

TG_TOKEN=123456789:ABCDefGhw3gUmZOq36-D_46_AMwGBsfefbcQ
SUPERADMINS=[12345678]
LOG_CHAT=12345678
LOG_ADMIN=12345678

Setup (using Docker)

Requirements:

Running (dev mode)

Run make dev_polling. Docker will pull and build the required images, so the first time you run this command should take a little while. After that, the bot should be up and running.

Code is mounted on the bot container, so you can make changes and restart the bot as you normally would.

Redis default port is mounted to host, just in case you want to debug something using tools available at the host.

The redis container is set to not persist data while in dev mode.

Running (production mode)

There’s a number of ways you can use docker for deploying into production.

Files named docker-compose.*.yml are gitignored, just in case you feel the need to override docker-compose.yml or write something else entirely.

The bot also supports reading Docker Secrets (may work with other vaults too). Check lua/config.lua to see which variables can be read from secrets.

Compose Example

You can deploy Group Butler by running:

make easy_deploy

Swarm Example

Assuming you have deployed redis into, for instance staging (docker stack deploy … or docker service create …) and exported the required environment variables (like $TG_TOKEN…), you could deploy Group Butler by running:

docker stack deploy staging -c docker-compose.yml

Setup (without using Docker)

List of required packages:

You will need some other Lua modules too, which can be (and should be) installed through the Lua package manager LuaRocks.

Installation

You can easily install Group Butler by running the following commands:

# Tested on Ubuntu 16.04

$ wget https://raw.githubusercontent.com/group-butler/GroupButler/master/install.sh
$ bash install.sh

or

# Tested on Ubuntu 14.04, 15.04 and 16.04, Debian 7, Linux Mint 17.2

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install libreadline-dev libssl-dev lua5.1 liblua5.1-dev git make unzip redis-server curl libcurl4-gnutls-dev

# We are going now to install LuaRocks and the required Lua modules

$ wget http://luarocks.org/releases/luarocks-2.2.2.tar.gz
$ tar zxpf luarocks-2.2.2.tar.gz
$ cd luarocks-2.2.2
$ ./configure; sudo make bootstrap
$ sudo luarocks install luasec
$ sudo luarocks install luasocket
$ sudo luarocks install redis-lua
$ sudo luarocks install lua-term
$ sudo luarocks install serpent
$ sudo luarocks install lua-cjson
$ sudo luarocks install Lua-cURL
$ cd ..

# Clone the repository and give the launch script permissions to be executed
# If you want to clone the beta branch, use git clone with the [-b beta] option

$ git clone https://github.com/group-butler/GroupButler.git
$ cd GroupButler
$ sudo chmod +x launch.sh

Before you start the bot, you have to start the Redis process.

# Start Redis

$ sudo service redis-server start

Starting the process

To start the bot, run ./launch.sh. To stop the bot, press Control <kbd>CTRL</kbd>+<kbd>C</kbd> twice.

You may also start the bot with ./polling.lua, however it will not restart automatically. You will also need to find another way to export the required environment variables.


Something that you should known before run the bot

Some notes about the database

Everything is stored on Redis, and the fastest way to edit your database is via the Redis CLI.

You can find a backup of your Redis database in /etc/redis/dump.rdb. The name of this file and the frequency of saves are dependent on your redis configuration file.


Translators

If you want to help translate the bot, follow the instructions below. Parts of Group Butler use tools from gettext. However we don't use binary format *.mo for the sake of simplicity. The bot parses the *.po files in the locales directory at runtime.

We recommend contributing translations to our Crowdin project.

Note for developers: update the POT file whenever you change a string, and don't forget to use the i18n() function so it's translatable. In order to update the POT file you will need to install gettext and then run:

make pot

Credits

Topkecleon, for the original otouto

Iman Daneshi and Tiago Danin, for Jack-telegram-bot

Cosmonawt, for his Lua library for the Bot API

Yago Pérez for his telegram-bot

The Werewolf guys, for aiding the spread of the bot

Lucas Montuano, for helping me a lot in the debugging of the bot

All the Admins of our discussion groups about Group Butler

All the people who reported bugs and suggested new stuff

Le Laide