Class: MTProto::TL::SetBotCommands
- Inherits:
-
Object
- Object
- MTProto::TL::SetBotCommands
- Includes:
- Binary
- Defined in:
- lib/mtproto/tl/objects/set_bot_commands.rb
Constant Summary collapse
- CONSTRUCTOR =
0x0517165a- BOT_COMMAND_SCOPE_DEFAULT =
0x2f6cb2ab- BOT_COMMAND =
0xc27ac8c7
Instance Method Summary collapse
-
#initialize(commands:, lang_code: '') ⇒ SetBotCommands
constructor
commands: array of { command:, description: }.
- #serialize ⇒ Object
Methods included from Binary
#b_u32, #b_u64, #u32_b, #u64_b
Constructor Details
#initialize(commands:, lang_code: '') ⇒ SetBotCommands
commands: array of { command:, description: }
13 14 15 16 |
# File 'lib/mtproto/tl/objects/set_bot_commands.rb', line 13 def initialize(commands:, lang_code: '') @commands = commands @lang_code = lang_code end |
Instance Method Details
#serialize ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mtproto/tl/objects/set_bot_commands.rb', line 18 def serialize result = u32_b(CONSTRUCTOR) result += u32_b(BOT_COMMAND_SCOPE_DEFAULT) result += serialize_tl_string(@lang_code) result += u32_b(Constructors::VECTOR) result += u32_b(@commands.size) @commands.each do |cmd| result += u32_b(BOT_COMMAND) result += serialize_tl_string(cmd[:command]) result += serialize_tl_string(cmd[:description]) end result end |