Class: MTProto::TL::ExportBotToken
- Inherits:
-
Object
- Object
- MTProto::TL::ExportBotToken
- Includes:
- Binary
- Defined in:
- lib/mtproto/tl/objects/export_bot_token.rb
Constant Summary collapse
- CONSTRUCTOR =
0xbd0d99eb- INPUT_USER =
0xf21158c6- INPUT_USER_SELF =
0xf7c1b13f- BOOL_TRUE =
0x997275b5- BOOL_FALSE =
0xbc799737
Instance Method Summary collapse
-
#initialize(bot:, revoke: false) ⇒ ExportBotToken
constructor
bot: { id:, access_hash: } or { type: :self }.
- #serialize ⇒ Object
Methods included from Binary
#b_u32, #b_u64, #u32_b, #u64_b
Constructor Details
#initialize(bot:, revoke: false) ⇒ ExportBotToken
bot: { id:, access_hash: } or { type: :self }
15 16 17 18 |
# File 'lib/mtproto/tl/objects/export_bot_token.rb', line 15 def initialize(bot:, revoke: false) @bot = bot @revoke = revoke end |
Instance Method Details
#serialize ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/mtproto/tl/objects/export_bot_token.rb', line 20 def serialize result = u32_b(CONSTRUCTOR) result += if @bot[:type] == :self u32_b(INPUT_USER_SELF) else u32_b(INPUT_USER) + u64_b(@bot[:id]) + u64_b(@bot[:access_hash] || 0) end result += u32_b(@revoke ? BOOL_TRUE : BOOL_FALSE) result end |