lib/telegram/bot/config_methods.rb
# Returns config for .bots method. By default uses `telegram['bots']` section
# from `secrets.yml` merging `telegram['bot']` at `:default` key.
#
# Can be overwritten with .bots_config=
Returns config for .bots method.

Can be overwritten with .bots_config
Returns config for . bots method . Can be overwritten with . bots_config
def bots_config
        @bots_config ||=
          if defined?(Rails.application)
            app = Rails.application
            store = app.credentials[:telegram] if app.respond_to?(:credentials)
            store ||= app.secrets[:telegram] if app.respond_to?(:secrets)
            store ||= {}
            store = store.with_indifferent_access
            store.fetch(:bots, {}).symbolize_keys.tap do |config|
              default = store[:bot]
              config[:default] = default if default
            end
          else
            {}
          end
      end
def bots_config @bots_config ||= if defined? ( Rails . application ) app = Rails . application store = app . credentials [ :telegram ] if app . respond_to? ( :credentials ) store ||= app . secrets [ :telegram ] if app . respond_to? ( :secrets ) store ||= { } store = store . with_indifferent_access store . fetch ( :bots , { } ) . symbolize_keys . tap do | config | default = store [ :bot ] config [ :default ] = default if default end else { } end end
Returns config for .bots method.
Returns config for . bots method .