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

Fixed MessageContext for messages without text

Этот коммит содержится в:
Max Melentiev
2016-05-11 22:13:45 +03:00
родитель 62475965e9
Коммит 9b3fb562a3
3 изменённых файлов: 20 добавлений и 3 удалений

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

@@ -24,7 +24,7 @@ module Telegram
#
# # To run other action with all the callbacks:
# context_handler :rename do |message|
# process(:rename, *m['text'].split)
# process(:rename, *m['text'].try!(:split)) # Message can be without text
# end
#
# # Or just
@@ -32,7 +32,7 @@ module Telegram
# context_handler :rename # to call :rename
#
# # For messages without context use this instead of `message` method:
# context_handle do |message|
# context_handler do |message|
# end
#
def context_handler(context = nil, action = nil, &block)
@@ -56,7 +56,7 @@ module Telegram
if handler.respond_to?(:call)
instance_exec(message, &handler)
else
process(handler, *message['text'].split)
process(handler, *message['text'].try!(:split))
end
end