Sha256: b2ed1362b7870b94c62262ee7a0edce5f07d3135b62b5cd4ad003c4b25e42f75

Contents?: true

Size: 451 Bytes

Versions: 1

Compression:

Stored size: 451 Bytes

Contents

module Commands
  class Base
    def self.invoke(*args)
      new(*args).invoke
    end

    def initialize(message, user)
      @message = message
      @user = user
    end

    def invoke
      raise NotImplementedError
    end

    private

    def say(text)
      send_message(@user.telegram_id, text)
    end

    def send_message(chat_id, text)
      BOT.api.send_message(chat_id: chat_id, text: text, parse_mode: 'Markdown')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
telegrator-0.2.0.rc1 lib/telegrator/generators/bot/templates/app/commands/base.rb.tt