|
machinatrix
A very silly Matrix bot written in C
|
A very silly Matrix bot written in C.
To use it, create an account, start the machinatrix_matrix program, join a room, and send commands prefixed with an IRC-style mention of the user name. Current supported commands:
ping: pongword: random worddamn: random curseabbr: random de-abbreviationbard: random Shakespearean insultdlpo <term>: lookup etymology (DLPO)wikt <term>: lookup etymology (Wiktionary)parl: use unparliamentary languagetr: translate word (Wiktionary)stats: print statisticsA C compiler and a UNIX programming environment are required, along with the following libraries (tested versions in parentheses):
The main program, machinatrix, is responsible for executing the commands and can be tested without involving the Matrix server. Commands are accepted as arguments. If none is provided, they are read from stdin.
$ ./machinatrix ping pong $ ./machinatrix ping pong ping pong
A second binary, machinatrix_matrix, connects to the server, listens for new messages, and replies. It executes the machinatrix program to handle the commands.
$ ./machinatrix_matrix \
--server matrix.example.com \
--user @machinatrix:matrix.example.com \
--token /path/to/token_file
Arguments after --, if present, are forwarded to machinatrix.
numeraria is an optional statistics database service. It uses an SQLite database to record commands.
$ ./numeraria --db-path numeraria.sqlite --bind-unix numeraria.sock & $ ./machinatrix --numeraria-unix numeraria.sock ping pong ping pong stats numeraria 2 "ping" ""
To use with machinatrix_matrix, use the extra machinatrix arguments:
$ ./machinatrix_matrix \
# regular arguments \
-- --numeraria-unix numeraria.sock