1
0
зеркало из https://github.com/glebtv/telegram-bot.git synced 2026-09-04 02:05:52 +03:00
It was required for Botan support.
Этот коммит содержится в:
Max Melentiev
2020-11-27 09:37:55 +00:00
родитель e178f808b6
Коммит f654071c4c
5 изменённых файлов: 75 добавлений и 89 удалений

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

@@ -25,7 +25,6 @@ module Telegram
autoload :Client, 'telegram/bot/client'
autoload :ClientStub, 'telegram/bot/client_stub'
autoload :DebugClient, 'telegram/bot/debug_client'
autoload :Initializers, 'telegram/bot/initializers'
autoload :Middleware, 'telegram/bot/middleware'
autoload :RSpec, 'telegram/bot/rspec'
autoload :Tasks, 'telegram/bot/tasks'

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

@@ -1,3 +1,4 @@
require 'active_support/core_ext/hash/keys'
require 'json'
require 'httpclient'
@@ -7,7 +8,6 @@ module Telegram
URL_TEMPLATE = 'https://api.telegram.org/bot%<token>s/'.freeze
autoload :TypedResponse, 'telegram/bot/client/typed_response'
extend Initializers
prepend Async
include DebugClient
@@ -15,6 +15,16 @@ module Telegram
include ApiHelper
class << self
# Accepts different options to initialize bot.
def wrap(input, **options)
case input
when Symbol then by_id(input) or raise "#{name} #{input.inspect} not configured"
when self then input
when Hash then new(**input.symbolize_keys, **options)
else new(input, **options)
end
end
def by_id(id)
Telegram.bots[id]
end

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

@@ -1,21 +0,0 @@
require 'active_support/core_ext/hash/keys'
module Telegram
module Bot
module Initializers
# Accepts different options to initialize bot.
def wrap(input, **options)
case input
when Symbol then by_id(input) or raise "#{name} #{input.inspect} not configured"
when self then input
when Hash then new(**input.symbolize_keys, **options)
else new(input, **options)
end
end
def by_id(_id)
raise 'Not implemented'
end
end
end
end