Class: CallbackQuery
- Inherits:
-
Object
- Object
- CallbackQuery
- Defined in:
- lib/objects/callback_query.rb
Overview
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.
Instance Method Summary collapse
-
#chat_instance ⇒ Object
Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent.
-
#data ⇒ Object
Optional.
Data associated with the callback button. -
#from ⇒ Object
Sender.
-
#game_short_name ⇒ Object
Optional.
Short name of a Game to be returned, serves as the unique identifier for the game. -
#id ⇒ Object
Unique identifier for this query.
-
#initialize(query) ⇒ CallbackQuery
constructor
:nodoc:.
-
#inline_message_id ⇒ Object
Optional.
Identifier of the message sent via the bot in inline mode, that originated the query. -
#message ⇒ Object
Optional
.
Constructor Details
#initialize(query) ⇒ CallbackQuery
:nodoc:
16 17 18 |
# File 'lib/objects/callback_query.rb', line 16 def initialize(query) # :nodoc: @query = query end |
Instance Method Details
#chat_instance ⇒ Object
Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games.
49 50 51 |
# File 'lib/objects/callback_query.rb', line 49 def chat_instance @query.chat_instance end |
#data ⇒ Object
Optional.
Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field.
55 56 57 |
# File 'lib/objects/callback_query.rb', line 55 def data @query.data end |
#from ⇒ Object
Sender. Returns User object
26 27 28 |
# File 'lib/objects/callback_query.rb', line 26 def from User.new(@query.from) end |
#game_short_name ⇒ Object
Optional.
Short name of a Game to be returned, serves as the unique identifier for the game
61 62 63 |
# File 'lib/objects/callback_query.rb', line 61 def game_short_name @query.game_short_name end |
#id ⇒ Object
Unique identifier for this query.
21 22 23 |
# File 'lib/objects/callback_query.rb', line 21 def id @query.id end |
#inline_message_id ⇒ Object
Optional.
Identifier of the message sent via the bot in inline mode, that originated the query.
42 43 44 |
# File 'lib/objects/callback_query.rb', line 42 def @query. end |
#message ⇒ Object
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.
33 34 35 36 37 38 |
# File 'lib/objects/callback_query.rb', line 33 def data = @query. return Message.new(data) if data false end |