This repo contains my attempt to learn haskell by creating simple echo bot.
stack build
stack test
stack exec bot-exe -- --config .confThe bot can be configured via these three sources in order of decreasing priority:
Option name is prefixed by --
bot --config .conf --tg.token 123456:AaseDG55yIn the option name . is replaced by _, and the whole name is prefixed with BOT_
BOT_tg_token=123456:AaseDG55y botUse --config parameter to specify config file. It consists of key value pairs, separated by =. Supports comments, starting with # and multiline strings. Quotes " are optional for values.
# Config file for the bot
# tg.proxy = 127.0.0.1:9080
tg.token = 1258788986:AAErwZlr
logLevel = Debug
helpText = "
Hi,
what did you wanted?
"
Per API options can be used with tg. or vk. prefix. If used as is the option applied to both API's
| Option | Type | Value | Default | Description |
|---|---|---|---|---|
helpText |
Global | String | Some text | /help command answer |
logLevel |
Per API | Debug | Info | Warning | Error |
Warning |
Log level |
proxy |
Per API | localhost:5000 |
-- | Http proxy host and port |
repeatTimes |
Global | Integer | 5 | Initial number of repetitions |
tg.token |
For Tg API | String | -- | Telegram bot token |
vk.groupId |
For Vk API | Integer | -- | Vkontakte group id |
vk.token |
For Vk API | String | -- | Vkontakte group token |
| Module | Description |
|---|---|
| Bot.API | Interface of a bot API |
| Bot.IO | Interface of a bot logic |
| Bot | Bot engine |
| Deserialization | Common JSON deserialization options |
| EchoBot.Options | Echo bot options |
| EchoBot.State | Echo bot state |
| EchoBot | Implementation of the echo bot logic |
| Logger | Logger definition and implementation |
| Misc | Miscellaneous functions |
| Options | Reading options from CLI arguments, environment variables and config file |
| Telegram.Chat | Telegram chat object |
| Telegram.Message | Telegram message object |
| Telegram.Update | Telegram update object |
| Telegram.User | Telegram user object |
| Telegram | Telegram bot API definition |
| UserData | Storing clients data in RAM |
| Vk.Message | Vkontakte message object |
| Vk.Poll | Long poll Vkontakte related stuff |
| Vk.Update | Vkontakte update object |
| Vk | Vkontakte bot API definition |