1
0
зеркало из https://github.com/glebtv/telegram-bot.git synced 2026-08-28 15:26:18 +03:00
Files
telegram-bot/lib/telegram/bot/initializers.rb
Max Melentiev 9e396cabc4 New methods from bot api v3.5
Collect all api helper-methods in Client::ApiHelper module.
Add bin/fetch-telegram-methods to update methods list from website.
2017-11-24 11:08:12 +03:00

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