Sha256: 495849e512b5098dba752947b030672e43e5a907288c9c84d15d819f14668ad1

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

module Moceansdk
  module Modules
    module Command
      module McObject

        class TgRequestContact < AbstractMc
          def action
            'send-telegram'
          end

          def required_key
            ['from', 'to', 'content', 'tg_keyboard']
          end

          def from(from, contact_type = 'bot_username')
            @params[:'from'] = {}
            @params[:'from'][:'id'] = from
            @params[:'from'][:'type'] = contact_type
            return self
          end

          def to(to, contact_type = "chat_id")
            @params[:'to'] = {}
            @params[:'to'][:'id'] = to
            @params[:'to'][:'type'] = contact_type
            return self
          end

          def content(text)
            @params[:'content'] = {}
            @params[:'content'][:'text'] = text
            @params[:'content'][:'type'] = 'text'
            return self
          end

          def button(text)
            @params[:'tg_keyboard'] = {
              :'button_text' => text,
              :'button_request' => 'contact'
            }
            return self
          end

        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moceansdk-1.1.1 lib/moceansdk/modules/command/mc_object/tg_request_contact.rb