1
0
зеркало из https://github.com/glebtv/telegram-bot.git synced 2026-09-05 18:45:51 +03:00
Этот коммит содержится в:
Max Melentiev
2016-03-25 00:14:47 +03:00
родитель 1963533e33
Коммит d7a20a745c
4 изменённых файлов: 46 добавлений и 3 удалений

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

@@ -7,6 +7,25 @@ module Telegram
class Error < StandardError; end
class NotFound < Error; end
# Error class for events when chat is not available anymore for bot.
# While Telegram has same error codes for different messages and there is no
# official docs for this error codes it uses `description` to
# check response.
class StaleChat < Error
DESCRIPTIONS = [
'bot was kicked',
"can't write to",
'group chat is deactivated',
].freeze
class << self
def match_response?(response)
description = response['description'].to_s
DESCRIPTIONS.any? { |x| description[x] }
end
end
end
autoload :Client, 'telegram/bot/client'
autoload :ClientStub, 'telegram/bot/client_stub'
autoload :Middleware, 'telegram/bot/middleware'