Class: MTProto::TL::BotCallbackAnswer
- Inherits:
-
Object
- Object
- MTProto::TL::BotCallbackAnswer
- Defined in:
- lib/mtproto/tl/objects/bot_callback_answer.rb
Overview
messages.botCallbackAnswer — the reply to messages.getBotCallbackAnswer: the
answer the pressed bot produced via setBotCallbackAnswer (or the server's
empty default when the bot never answered). message is the toast/alert
text, alert selects a modal over a toast, url (paired with has_url) is a
game/redirect link, native_ui marks a Telegram-native prompt, and
cache_time is how long the client may cache this answer.
Constant Summary collapse
- CONSTRUCTOR =
0x36585ea4
Instance Attribute Summary collapse
-
#alert ⇒ Object
readonly
Returns the value of attribute alert.
-
#cache_time ⇒ Object
readonly
Returns the value of attribute cache_time.
-
#has_url ⇒ Object
readonly
Returns the value of attribute has_url.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#native_ui ⇒ Object
readonly
Returns the value of attribute native_ui.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
-
.deserialize(data) ⇒ Object
messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int.
Instance Method Summary collapse
-
#initialize(alert: false, has_url: false, native_ui: false, message: nil, url: nil, cache_time: 0) ⇒ BotCallbackAnswer
constructor
A new instance of BotCallbackAnswer.
Constructor Details
#initialize(alert: false, has_url: false, native_ui: false, message: nil, url: nil, cache_time: 0) ⇒ BotCallbackAnswer
Returns a new instance of BotCallbackAnswer.
16 17 18 19 20 21 22 23 |
# File 'lib/mtproto/tl/objects/bot_callback_answer.rb', line 16 def initialize(alert: false, has_url: false, native_ui: false, message: nil, url: nil, cache_time: 0) @alert = alert @has_url = has_url @native_ui = native_ui @message = @url = url @cache_time = cache_time end |
Instance Attribute Details
#alert ⇒ Object (readonly)
Returns the value of attribute alert.
14 15 16 |
# File 'lib/mtproto/tl/objects/bot_callback_answer.rb', line 14 def alert @alert end |
#cache_time ⇒ Object (readonly)
Returns the value of attribute cache_time.
14 15 16 |
# File 'lib/mtproto/tl/objects/bot_callback_answer.rb', line 14 def cache_time @cache_time end |
#has_url ⇒ Object (readonly)
Returns the value of attribute has_url.
14 15 16 |
# File 'lib/mtproto/tl/objects/bot_callback_answer.rb', line 14 def has_url @has_url end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
14 15 16 |
# File 'lib/mtproto/tl/objects/bot_callback_answer.rb', line 14 def @message end |
#native_ui ⇒ Object (readonly)
Returns the value of attribute native_ui.
14 15 16 |
# File 'lib/mtproto/tl/objects/bot_callback_answer.rb', line 14 def native_ui @native_ui end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
14 15 16 |
# File 'lib/mtproto/tl/objects/bot_callback_answer.rb', line 14 def url @url end |
Class Method Details
.deserialize(data) ⇒ Object
messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/mtproto/tl/objects/bot_callback_answer.rb', line 28 def self.deserialize(data) constructor = data[0, 4].unpack1('L<') unless constructor == CONSTRUCTOR raise "Expected botCallbackAnswer constructor, got 0x#{constructor.to_s(16)}" end flags = data[4, 4].unpack1('L<') offset = 8 = nil , offset = read_tl_string(data, offset) if flags.anybits?(1 << 0) url = nil url, offset = read_tl_string(data, offset) if flags.anybits?(1 << 2) cache_time = data[offset, 4].unpack1('l<') new( alert: flags.anybits?(1 << 1), has_url: flags.anybits?(1 << 3), native_ui: flags.anybits?(1 << 4), message: , url: url, cache_time: cache_time ) end |