A Telegram bot that trains a markov chain on your group chat.
- Clone the repository and configure the bot in
config/config.exs. - Run
mix deps.getto install the dependencies mix runto run normally ORiex -S mixfor a REPL
The MarkovBot.Utilities module contains a helper function that trains the bot on a JSON Telegram export.
From a REPL, run:
# NOTE: in case you wish to return to the previous state of the chain,
# you can use a named backup, since they will not get purged
MarkovBot.Scheduler.Tasks.backup("backup_name")
MarkovBot.Utilities.train_from_telegram("path/to/file.json") # relative paths can be used
MarkovBot.Scheduler.Tasks.autosave # force an auto-save to write the updated chain to diskYou can update the config at runtime with built-in Elixir utilities from the Application module,
but be aware it will not write your changes into config/config.exs,
in order to make your changes persistent you will have to edit it manually.
Application.put_env(:markov_bot, :admins, [ 12345 ]) # overwrite the list of adminsBy default the built-in cron service will auto-save the chain to disk every 15 minutes, create a backup every day, and purge old backups every week (which are kept for 7 days by default)