UNPKG

@tgsnake/core

Version:

Pure Telegram MTProto library for nodejs

42 lines (41 loc) 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Bool = exports.BoolTrue = exports.BoolFalse = void 0; const TLObject_js_1 = require("../TLObject.js"); const platform_node_js_1 = require("../../../platform.node.js"); class BoolFalse extends TLObject_js_1.TLObject { static ID = 0xbc799737; static value = false; static write() { const buff = platform_node_js_1.Buffer.alloc(4); buff.writeUInt32LE(BoolFalse.ID); return buff; } static async read(_data, ..._arg) { return BoolFalse.value; } } exports.BoolFalse = BoolFalse; class BoolTrue extends BoolFalse { static ID = 0x997275b5; static value = true; static write() { const buff = platform_node_js_1.Buffer.alloc(4); buff.writeUInt32LE(BoolTrue.ID); return buff; } static async read(_data, ..._arg) { return BoolTrue.value; } } exports.BoolTrue = BoolTrue; class Bool extends TLObject_js_1.TLObject { className = 'Bool'; static write(value) { return value ? BoolTrue.write() : BoolFalse.write(); } static async read(data, ..._arg) { return data.readUInt32LE(4) === BoolTrue.ID; } } exports.Bool = Bool;