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

Remove Bot::StaleChat in favor of Bot::Forbidden

Этот коммит содержится в:
Max Melentiev
2017-02-10 09:31:11 +03:00
родитель 99fbe41b16
Коммит 817af95369
7 изменённых файлов: 63 добавлений и 50 удалений

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

@@ -6,26 +6,7 @@ module Telegram
module Bot
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 blocked',
'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
class Forbidden < Error; end
autoload :Async, 'telegram/bot/async'
autoload :Botan, 'telegram/bot/botan'