class CallbackQuery

Monday, August 24 2020

This object represents an incoming callback query from a callback button in an inline keyboard.

If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.

Public Instance Methods

chat_instance() click to toggle source

Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games.

# File lib/objects/callback_query.rb, line 49
def chat_instance
  @query.chat_instance
end
data() click to toggle source

Optional. Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field.

# File lib/objects/callback_query.rb, line 55
def data
  @query.data
end
from() click to toggle source

Sender. Returns User object

# File lib/objects/callback_query.rb, line 26
def from
  User.new(@query.from)
end
game_short_name() click to toggle source

Optional. Short name of a Game to be returned, serves as the unique identifier for the game

# File lib/objects/callback_query.rb, line 61
def game_short_name
  @query.game_short_name
end
id() click to toggle source

Unique identifier for this query.

# File lib/objects/callback_query.rb, line 21
def id
  @query.id
end
inline_message_id() click to toggle source

Optional. Identifier of the message sent via the bot in inline mode, that originated the query.

# File lib/objects/callback_query.rb, line 42
def inline_message_id
  @query.inline_message_id
end
message() click to toggle source

Optional. Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old.

# File lib/objects/callback_query.rb, line 33
def message
  data = @query.message
  return Message.new(data) if data

  false
end