1
0
зеркало из https://github.com/glebtv/telegram-bot.git synced 2026-09-06 02:55:50 +03:00
Этот коммит содержится в:
Max Melentiev
2016-05-12 14:20:51 +03:00
родитель 1f139a2b36
Коммит 9b9e55a449
9 изменённых файлов: 220 добавлений и 27 удалений

Просмотреть файл

@@ -309,6 +309,42 @@ Check out `telegram/bot/updates_controller/rspec_helpers` and
Use `rake telegram:bot:set_webhook` to update webhook url for all configured bots.
Certificate can be specified with `CERT=path/to/cert`.
### Botan.io metrics
Initialize with `bot = Bot.new(token, botan: 'botan token')`
or just add `botan` key in `secrets.yml`:
```yml
telegram:
bot:
token: bot_token
botan: botan_token
```
Access to Botan client with `bot.botan`.
Use `bot.botan.track(event, uid, payload)` to track events.
There are some helpers for controllers in `Telegram::Bot::UpdatesController::Botan`:
```ruby
class Telegram::WebhookController < Telegram::Bot::UpdatesController
include Telegram::Bot::UpdatesController::Botan
# This will track with event: action_name & data: payload
before_action :botan_track_action
def smth(*)
# This will track event for current user only when botan is configured.
botan_track :my_event, custom_data
# or get access directly to botan client:
botan.track(...)
end
end
```
There is no stubbing for botan clients, so don't set botan token in tests.
## Development
After checking out the repo, run `bin/setup` to install dependencies.