зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-09-04 02:05:52 +03:00
Drop Initializer module
It was required for Botan support.
Этот коммит содержится в:
@@ -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
|
||||
Ссылка в новой задаче
Block a user