Skip to content

Commit

Permalink
Merge branch 'feature-multi-client'
Browse files Browse the repository at this point in the history
  • Loading branch information
vkopitsa committed Jul 29, 2019
2 parents 14d1bfb + a6ce870 commit d1c9248
Show file tree
Hide file tree
Showing 10 changed files with 692 additions and 256 deletions.
2 changes: 1 addition & 1 deletion .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

APP_PORT=127.0.0.1:8090
TELEGRAM_TOKEN=
MONO_TOKEN=
MONO_TOKENS=
TELEGRAM_ADMINS=
TELEGRAM_CHATS=

Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ Run `mono_personal_tgbot` execution file in your terminal with following env var
`TELEGRAM_TOKEN` | [How to get telegram bot token](https://core.telegram.org/bots#3-how-do-i-create-a-bot)
`TELEGRAM_ADMINS` | ids of the trusted user, example: `1234567,1234567`
`TELEGRAM_CHATS` | ids of the trusted chats, example: `-1234567,-1234567`
`MONO_TOKEN` | [How to get monobank token](https://api.monobank.ua/)
`SET_WEBHOOK` | url to receive new statement, example: `https://you_domain/web_hook`
`MONO_TOKENS` | list of the tokens and it is `number`. [How to get monobank token](https://api.monobank.ua/)

### Telegram commands

Command | Description
------------------------ | -----------------------------------------------------------
`/balance` | Get `UAH` balance of your account
`/report` | Get a report for the period
`/balance[_n]` | Get `UAH` balance of the default client or first one or by number. example: `/balance`, `/balance_1`
`/report` | Get a report for the period of the default client or first one or by number. example: `/report`, `/report_1`
`/get_webhook[_n]` | Get a status about setup webhook of the default client or first one or by number. example: `/get_webhook`, `/get_webhook_1`
`/set_webhook[_n]` | Set webhook url to monobank api of the default client or first one or by number. example: `/set_webhook`, `/set_webhook_1`


## Usage with docker-compose

Expand Down
10 changes: 5 additions & 5 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ func main() {
os.Getenv("TELEGRAM_TOKEN"),
os.Getenv("TELEGRAM_ADMINS"),
os.Getenv("TELEGRAM_CHATS"),
os.Getenv("MONO_TOKEN"),
os.Getenv("MONO_TOKENS"),
)

webHook := os.Getenv("SET_WEBHOOK")
if webHook != "" {
bot.SetWebHook(webHook)
return
// init clients
err := bot.InitMonoClients()
if err != nil {
panic(err)
}

go bot.TelegramStart()
Expand Down
Loading

0 comments on commit d1c9248

Please sign in to comment.