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

Basic actions are called with most useful params instead of payload

Этот коммит содержится в:
Max Melentiev
2016-05-17 10:49:47 +03:00
родитель 4593a10dec
Коммит 8994328654
4 изменённых файлов: 48 добавлений и 15 удалений

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

@@ -17,7 +17,7 @@ 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).
Run it on your local machine in 1 minute!
## Installation
@@ -102,7 +102,8 @@ class Telegram::WebhookController < Telegram::Bot::UpdatesController
# use callbacks like in any other controllers
around_action :with_locale
# Every update can have one of: message, inline_query & chosen_inline_result.
# Every update can have one of: message, inline_query, chosen_inline_result,
# callback_query.
# Define method with same name to respond to this updates.
def message(message)
# message can be also accessed via instance method
@@ -110,6 +111,13 @@ class Telegram::WebhookController < Telegram::Bot::UpdatesController
# store_message(message['text'])
end
# This basic methods receives commonly used params:
#
# message(payload)
# inline_query(query, offset)
# chosen_inline_result(result_id, query)
# callback_query(data)
# Define public methods to respond to commands.
# Command arguments will be parsed and passed to the method.
# Be sure to use splat args and default values to not get errors when