README.md in telegram-bot-0.8.0 vs README.md in telegram-bot-0.9.0.alpha1
- old
+ new
@@ -3,21 +3,23 @@
[![Gem Version](https://badge.fury.io/rb/telegram-bot.svg)](http://badge.fury.io/rb/telegram-bot)
[![Code Climate](https://codeclimate.com/github/telegram-bot-rb/telegram-bot/badges/gpa.svg)](https://codeclimate.com/github/telegram-bot-rb/telegram-bot)
[![Build Status](https://travis-ci.org/telegram-bot-rb/telegram-bot.svg)](https://travis-ci.org/telegram-bot-rb/telegram-bot)
Tools for developing bot for Telegram. Best used with Rails, but can be be used in
-standalone app. Supposed to be used in webhook-mode in production, and poller-mode
+[standalone app](https://github.com/telegram-bot-rb/telegram-bot/wiki/Non-rails-application).
+Supposed to be used in webhook-mode in production, and poller-mode
in development, but you can use poller in production if you want.
Package contains:
- Ligthweight client for bot API (with fast and thread-safe
[httpclient](https://github.com/nahi/httpclient) under the hood).
- Controller with message parser. Allows to write separate methods for each command.
- Middleware and routes helpers for production env.
- Poller with automatic source-reloader for development env.
- Rake tasks to update webhook urls.
+- Async requests for Telegram and/or Botan API. Let the queue adapter handle errors!
Here is sample [telegram_bot_app](https://github.com/telegram-bot-rb/telegram_bot_app)
with session, keyboards and inline queries.
Run it on your local machine in 1 minute!
@@ -350,15 +352,15 @@
```
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`:
+There are some helpers for controllers in `Telegram::Bot::Botan::ControllerHelpers`:
```ruby
class Telegram::WebhookController < Telegram::Bot::UpdatesController
- include Telegram::Bot::UpdatesController::Botan
+ include Telegram::Bot::Botan::ControllerHelpers
# This will track with event: action_name & data: payload
before_action :botan_track_action
def smth(*)
@@ -370,9 +372,23 @@
end
end
```
There is no stubbing for botan clients, so don't set botan token in tests.
+
+### Async mode
+
+There is built in support for async requests using ActiveJob. Without Rails
+you can implement your own worker class to handle such requests. This allows:
+
+- Process updates very fast, without waiting for telegram and botan responses.
+- Handle and retry network and other errors with queue adapter.
+- ???
+
+To enable this mode add `async: true` to bot's and botan's config.
+For more information and custom configuration check out
+[docs](http://www.rubydoc.info/github/telegram-bot-rb/telegram-bot/master/Telegram/Bot/Async) or
+[source](https://github.com/telegram-bot-rb/telegram-bot/blob/master/lib/telegram/bot/async.rb).
## Development
After checking out the repo, run `bin/setup` to install dependencies.
Then, run `rake spec` to run the tests.