Class: Telegrambot::Types::Message

Inherits:
Base
  • Object
show all
Defined in:
lib/telegrambot/types/message.rb

Instance Method Summary collapse

Methods inherited from Base

#to_compact_hash

Instance Method Details

#argumentsString

Returns:

  • (String)


47
48
49
50
51
# File 'lib/telegrambot/types/message.rb', line 47

def arguments
  if command?
    text.gsub(command, '').strip
  end
end

#commandString

Returns:

  • (String)


40
41
42
43
44
# File 'lib/telegrambot/types/message.rb', line 40

def command
  if command?
    text.slice(entities.first.offset, entities.first.length)
  end
end

#command?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/telegrambot/types/message.rb', line 35

def command?
    entities.first.type == "bot_command"
end