зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-08-28 15:26:18 +03:00
Collect all api helper-methods in Client::ApiHelper module. Add bin/fetch-telegram-methods to update methods list from website.
22 строки
533 B
Ruby
22 строки
533 B
Ruby
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
|