Pucxobot is a Telegram robot and website to play the following games:
- Love Letter
- 6 Takes!
- Fox in the Forest
- Zombie Dice
To try the website, go here.
To build the server, you first need to install libcurl, json-c, openssl and meson. On Fedora you can install them with the following command:
sudo dnf install json-c-devel libcurl-devel openssl-devel meson ninja-build
On Debian you can install them with the following command:
sudo apt install libjson-c-dev libcurl4-openssl-dev libssl-dev \ pkg-config meson ninja-build
Next, to build the project type the following:
mkdir build && cd build meson .. ninja
Before running it, you need to create a configuration file in
~/.pucxobot/conf.txt. You can either run the server as the Telegram
bot, the website or both at the same time.
To run the program as a Telegram bot you need to get an API key by
talking to @BotFather on Telegram. You can
enter it into the
conf.txt with something like this:
[bot] apikey = 123456789:AAABBEUAEUIEAIUE_auieauieauie botname = cardgamebot language = en
The language can be
eo. You can
create several bots with one configuration file by repeating the
[bot] section. This is useful if you want to have multiple bots in
To play a game, you can add the bot to a group and type
will present you with a choice of the available games to play.
You can also type
/help to get a summary of the rules of the game.
To run the program as a website add something like this to the
[server] address = 3648
You can change the port number or the listen address or leave the
address line out entirely to use the default port.
The server is just to run the WebSocket back-end and you will still
files for the site are in the
web directory. They are first filtered
through a script to generate the different translations. If you run
ninja install you can find all the web files ready in
<prefix>/share/web. The server can handle multiple languages
simultaneously so there’s no need to configure the language.
If the webserver that serves the web pages is using HTTPS then
Pucxobot also needs to use TLS to handle the WebSockets or the browser
will refuse to connect to a mix of secure and insecure resources and
the site will not work. You can tell Pucxobot to use TLS by specifying
files for the certificate and private keys with the
private_key options in the
[server] section. The default port for
the server with TLS is different from the one without. Therefore you
can make Pucxobot accept both secure and insecure connections with a
configuration like this:
[server] [server] certificate = /path/to/cert.pem private_key = /path/to/key.pem
The first server section specifies the default unencrypted server on port 3648 and the second one makes it additionally listen for encrypted websockets on port 3649.
If you pass
-d to the program it will detach from the terminal and
run as a daemon. By default, Pucxobot prints log messages to the
terminal. However if it is run as a daemon it will instead log to
~/.pucxobot/log.txt. You can override this data file directory and
the log file by adding an extra section to the config like this:
[general] data_dir = /var/run/puxcobot-data log_file = /var/log/my-super-log-file
The program needs write access to the data directory in order to store its state.