1
0
зеркало из https://github.com/glebtv/telegram-bot.git synced 2026-09-03 17:55:52 +03:00

Updated readme, prepare to 0.7.0

Этот коммит содержится в:
Max Melentiev
2016-05-12 14:35:36 +03:00
родитель 23fb9a28d1
Коммит a52e7ff31b
4 изменённых файлов: 18 добавлений и 5 удалений

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

@@ -5,6 +5,8 @@
- Changed action methods signature
- `#inline_query(payload) -> #inline_query(query, offset)`
- `#chosen_inline_result(payload)` -> `#chosen_inline_result(result_id, query)`
- MessageContext doesn't use second #process call to run contextual action.
- Botan.io metrics.
# 0.6.0

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

@@ -17,7 +17,8 @@ Package contains:
- Poller with automatic source-reloader for development env.
- Rake tasks to update webhook urls.
Here is sample [telegram_bot_app](https://github.com/telegram-bot-rb/telegram_bot_app).
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!
## Installation
@@ -151,6 +152,8 @@ class Telegram::WebhookController < Telegram::Bot::UpdatesController
end
```
#### Optional typecasting
You can enable typecasting of `update` with `telegram-bot-types` by including
`Telegram::Bot::UpdatesPoller::TypedUpdate`:
@@ -164,6 +167,8 @@ class Telegram::WebhookController < Telegram::Bot::UpdatesController
end
```
#### Session
There is support for sessions using `ActiveSupport::Cache` stores.
```ruby
@@ -197,6 +202,8 @@ class Telegram::WebhookController < Telegram::Bot::UpdatesController
end
```
#### Message context
It's usual to support chain of messages like BotFather: after receiving command
it asks you for additional argument. There is `MessageContext` for this:
@@ -242,6 +249,8 @@ data. If data has a prefix with colon like this `my_ctx:smth...` it'll call
`my_ctx_callback_query('smth...')` when there is such action method. Otherwise
it'll call `callback_query('my_ctx:smth...')` as usual.
#### Processesing updates
To process update run:
```ruby
@@ -283,7 +292,8 @@ telegram_webhooks bot => TelegramChatController,
# You can override this options or specify others:
telegram_webhooks TelegramController, as: :my_webhook
telegram_webhooks bot => [TelegramChatController, as: :chat_webhook],
other_bot => [TelegramAuctionController,
other_bot => TelegramAuctionController,
admin_chat: TelegramAdminChatController
```
For Rack applications you can also use `Telegram::Bot::Middleware` or just
@@ -328,7 +338,7 @@ Certificate can be specified with `CERT=path/to/cert`.
### Botan.io metrics
Initialize with `bot = Bot.new(token, botan: 'botan token')`
Initialize with `bot = Telegram::Bot::Client.new(token, botan: 'botan token')`
or just add `botan` key in `secrets.yml`:
```yml

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

@@ -15,7 +15,8 @@ module Telegram
end
class << self
# Makes all
# Any call to Client.new will return ClientStub instance when `enabled` is true.
# Can be used with a block.
def stub_all!(enabled = true)
Client.extend(StubbedConstructor) unless Client < StubbedConstructor
return @_stub_all = enabled unless block_given?

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

@@ -1,6 +1,6 @@
module Telegram
module Bot
VERSION = '0.6.0'.freeze
VERSION = '0.7.0'.freeze
def self.gem_version
Gem::Version.new VERSION