@mtcute/core 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -3
- package/cjs/highlevel/base.d.ts +3 -1
- package/cjs/highlevel/base.js +18 -0
- package/cjs/highlevel/base.js.map +1 -1
- package/cjs/highlevel/client.d.ts +23 -10
- package/cjs/highlevel/client.js +26 -19
- package/cjs/highlevel/client.js.map +1 -1
- package/cjs/highlevel/client.types.d.ts +14 -0
- package/cjs/highlevel/client.types.js.map +1 -1
- package/cjs/highlevel/index.d.ts +0 -2
- package/cjs/highlevel/index.js +0 -2
- package/cjs/highlevel/index.js.map +1 -1
- package/cjs/highlevel/methods/_imports.js.map +1 -1
- package/cjs/highlevel/methods/_init.js +4 -29
- package/cjs/highlevel/methods/_init.js.map +1 -1
- package/cjs/highlevel/methods/bots/get-callback-answer.js +2 -2
- package/cjs/highlevel/methods/bots/get-callback-answer.js.map +1 -1
- package/cjs/highlevel/methods/dialogs/create-folder.js +1 -1
- package/cjs/highlevel/methods/dialogs/create-folder.js.map +1 -1
- package/cjs/highlevel/methods/dialogs/edit-folder.js +1 -1
- package/cjs/highlevel/methods/dialogs/edit-folder.js.map +1 -1
- package/cjs/highlevel/methods/dialogs/find-folder.js +1 -1
- package/cjs/highlevel/methods/dialogs/find-folder.js.map +1 -1
- package/cjs/highlevel/methods/dialogs/get-folders.d.ts +1 -1
- package/cjs/highlevel/methods/dialogs/get-folders.js +1 -1
- package/cjs/highlevel/methods/dialogs/get-folders.js.map +1 -1
- package/cjs/highlevel/methods/files/download-file.d.ts +1 -10
- package/cjs/highlevel/methods/files/download-file.js +1 -32
- package/cjs/highlevel/methods/files/download-file.js.map +1 -1
- package/cjs/highlevel/methods/files/download-iterable.js +2 -1
- package/cjs/highlevel/methods/files/download-iterable.js.map +1 -1
- package/cjs/highlevel/methods/files/download-node-stream.js +4 -0
- package/cjs/highlevel/methods/files/download-node-stream.js.map +1 -0
- package/cjs/highlevel/methods/files/normalize-input-media.d.ts +1 -1
- package/cjs/highlevel/methods/files/normalize-input-media.js +2 -1
- package/cjs/highlevel/methods/files/normalize-input-media.js.map +1 -1
- package/cjs/highlevel/methods/files/upload-file.d.ts +0 -3
- package/cjs/highlevel/methods/files/upload-file.js +17 -13
- package/cjs/highlevel/methods/files/upload-file.js.map +1 -1
- package/cjs/highlevel/methods/messages/find-in-update.js +23 -8
- package/cjs/highlevel/methods/messages/find-in-update.js.map +1 -1
- package/cjs/highlevel/methods/messages/send-media-group.d.ts +1 -1
- package/cjs/highlevel/methods/messages/send-media-group.js.map +1 -1
- package/cjs/highlevel/methods/messages/send-media.d.ts +2 -2
- package/cjs/highlevel/methods/messages/send-media.js +5 -4
- package/cjs/highlevel/methods/messages/send-media.js.map +1 -1
- package/cjs/highlevel/methods/messages/send-text.d.ts +1 -1
- package/cjs/highlevel/methods/messages/send-text.js +7 -6
- package/cjs/highlevel/methods/messages/send-text.js.map +1 -1
- package/cjs/highlevel/methods/misc/with-params.d.ts +10 -0
- package/cjs/highlevel/methods/misc/with-params.js +32 -0
- package/cjs/highlevel/methods/misc/with-params.js.map +1 -0
- package/cjs/highlevel/methods.d.ts +13 -1
- package/cjs/highlevel/methods.js +4 -6
- package/cjs/highlevel/methods.js.map +1 -1
- package/cjs/highlevel/types/bots/command-scope/index.d.ts +10 -0
- package/cjs/highlevel/types/bots/command-scope/index.js +29 -0
- package/cjs/highlevel/types/bots/command-scope/index.js.map +1 -0
- package/cjs/highlevel/types/bots/command-scope/inner.d.ts +54 -0
- package/cjs/highlevel/types/bots/command-scope/inner.js +76 -0
- package/cjs/highlevel/types/bots/command-scope/inner.js.map +1 -0
- package/cjs/highlevel/types/bots/index.d.ts +4 -4
- package/cjs/highlevel/types/bots/index.js +4 -4
- package/cjs/highlevel/types/bots/index.js.map +1 -1
- package/cjs/highlevel/types/bots/inline-message/factories.d.ts +43 -0
- package/cjs/highlevel/types/bots/inline-message/factories.js +175 -0
- package/cjs/highlevel/types/bots/inline-message/factories.js.map +1 -0
- package/cjs/highlevel/types/bots/inline-message/index.d.ts +3 -0
- package/cjs/highlevel/types/bots/inline-message/index.js +33 -0
- package/cjs/highlevel/types/bots/inline-message/index.js.map +1 -0
- package/{esm/highlevel/types/bots/input/input-inline-message.d.ts → cjs/highlevel/types/bots/inline-message/types.d.ts} +2 -45
- package/cjs/highlevel/types/bots/inline-message/types.js +3 -0
- package/cjs/highlevel/types/bots/inline-message/types.js.map +1 -0
- package/cjs/highlevel/types/bots/inline-result/factories.d.ts +94 -0
- package/cjs/highlevel/types/bots/inline-result/factories.js +486 -0
- package/cjs/highlevel/types/bots/inline-result/factories.js.map +1 -0
- package/cjs/highlevel/types/bots/inline-result/index.d.ts +3 -0
- package/cjs/highlevel/types/bots/inline-result/index.js +33 -0
- package/cjs/highlevel/types/bots/inline-result/index.js.map +1 -0
- package/{esm/highlevel/types/bots/input/input-inline-result.d.ts → cjs/highlevel/types/bots/inline-result/types.d.ts} +1 -95
- package/cjs/highlevel/types/bots/inline-result/types.js +3 -0
- package/cjs/highlevel/types/bots/inline-result/types.js.map +1 -0
- package/cjs/highlevel/types/bots/{keyboard-builder.d.ts → keyboards/builder.d.ts} +1 -1
- package/cjs/highlevel/types/bots/{keyboard-builder.js → keyboards/builder.js} +1 -1
- package/cjs/highlevel/types/bots/keyboards/builder.js.map +1 -0
- package/cjs/highlevel/types/bots/keyboards/factories.d.ts +195 -0
- package/cjs/highlevel/types/bots/keyboards/factories.js +366 -0
- package/cjs/highlevel/types/bots/keyboards/factories.js.map +1 -0
- package/cjs/highlevel/types/bots/keyboards/index.d.ts +14 -0
- package/cjs/highlevel/types/bots/keyboards/index.js +33 -0
- package/cjs/highlevel/types/bots/keyboards/index.js.map +1 -0
- package/cjs/highlevel/types/bots/keyboards/types.d.ts +34 -0
- package/cjs/highlevel/types/bots/keyboards/types.js +3 -0
- package/cjs/highlevel/types/bots/keyboards/types.js.map +1 -0
- package/cjs/highlevel/types/media/document.js +3 -2
- package/cjs/highlevel/types/media/document.js.map +1 -1
- package/cjs/highlevel/types/media/index.d.ts +1 -1
- package/cjs/highlevel/types/media/index.js +1 -1
- package/cjs/highlevel/types/media/index.js.map +1 -1
- package/cjs/highlevel/types/media/input-media/factories.d.ts +141 -0
- package/cjs/highlevel/types/media/input-media/factories.js +250 -0
- package/cjs/highlevel/types/media/input-media/factories.js.map +1 -0
- package/cjs/highlevel/types/media/input-media/index.d.ts +3 -0
- package/cjs/highlevel/types/media/input-media/index.js +33 -0
- package/cjs/highlevel/types/media/input-media/index.js.map +1 -0
- package/cjs/highlevel/types/media/{input-media.d.ts → input-media/types.d.ts} +5 -145
- package/cjs/highlevel/types/media/input-media/types.js +3 -0
- package/cjs/highlevel/types/media/input-media/types.js.map +1 -0
- package/cjs/highlevel/types/media/thumbnail.js +5 -4
- package/cjs/highlevel/types/media/thumbnail.js.map +1 -1
- package/cjs/highlevel/types/messages/message.d.ts +1 -1
- package/cjs/highlevel/types/messages/message.js +3 -3
- package/cjs/highlevel/types/messages/message.js.map +1 -1
- package/cjs/highlevel/types/misc/index.d.ts +1 -1
- package/cjs/highlevel/types/misc/index.js +1 -1
- package/cjs/highlevel/types/misc/index.js.map +1 -1
- package/cjs/highlevel/types/misc/input-privacy-rule/allow.d.ts +22 -0
- package/cjs/highlevel/types/misc/input-privacy-rule/allow.js +36 -0
- package/cjs/highlevel/types/misc/input-privacy-rule/allow.js.map +1 -0
- package/cjs/highlevel/types/misc/input-privacy-rule/bundle.d.ts +3 -0
- package/cjs/highlevel/types/misc/input-privacy-rule/bundle.js +31 -0
- package/cjs/highlevel/types/misc/input-privacy-rule/bundle.js.map +1 -0
- package/cjs/highlevel/types/misc/input-privacy-rule/disallow.d.ts +20 -0
- package/cjs/highlevel/types/misc/input-privacy-rule/disallow.js +32 -0
- package/cjs/highlevel/types/misc/input-privacy-rule/disallow.js.map +1 -0
- package/cjs/highlevel/types/misc/input-privacy-rule/index.d.ts +3 -0
- package/cjs/highlevel/types/misc/input-privacy-rule/index.js +33 -0
- package/cjs/highlevel/types/misc/input-privacy-rule/index.js.map +1 -0
- package/cjs/highlevel/types/misc/input-privacy-rule/types.d.ts +11 -0
- package/cjs/highlevel/types/misc/input-privacy-rule/types.js +3 -0
- package/cjs/highlevel/types/misc/input-privacy-rule/types.js.map +1 -0
- package/cjs/highlevel/types/peers/chat-photo.js +3 -2
- package/cjs/highlevel/types/peers/chat-photo.js.map +1 -1
- package/cjs/highlevel/types/updates/callback-query.js +2 -2
- package/cjs/highlevel/types/updates/callback-query.js.map +1 -1
- package/cjs/highlevel/types/updates/user-status-update.js +1 -1
- package/cjs/highlevel/types/updates/user-status-update.js.map +1 -1
- package/cjs/highlevel/updates/manager.d.ts +5 -3
- package/cjs/highlevel/updates/manager.js +81 -67
- package/cjs/highlevel/updates/manager.js.map +1 -1
- package/cjs/highlevel/utils/convert-file-id.js +7 -6
- package/cjs/highlevel/utils/convert-file-id.js.map +1 -1
- package/cjs/highlevel/utils/file-utils.js +8 -4
- package/cjs/highlevel/utils/file-utils.js.map +1 -1
- package/cjs/highlevel/utils/inline-utils.js +3 -2
- package/cjs/highlevel/utils/inline-utils.js.map +1 -1
- package/cjs/highlevel/utils/inspectable.d.ts +1 -1
- package/cjs/highlevel/utils/inspectable.js +3 -2
- package/cjs/highlevel/utils/inspectable.js.map +1 -1
- package/cjs/highlevel/utils/memoize.d.ts +1 -1
- package/cjs/highlevel/utils/memoize.js +1 -0
- package/cjs/highlevel/utils/memoize.js.map +1 -1
- package/cjs/highlevel/utils/stream-utils.d.ts +0 -2
- package/cjs/highlevel/utils/stream-utils.js +1 -28
- package/cjs/highlevel/utils/stream-utils.js.map +1 -1
- package/cjs/highlevel/utils/string-session.js +3 -2
- package/cjs/highlevel/utils/string-session.js.map +1 -1
- package/cjs/highlevel/worker/index.d.ts +3 -0
- package/cjs/highlevel/{types/bots/input → worker}/index.js +3 -2
- package/cjs/highlevel/worker/index.js.map +1 -0
- package/cjs/highlevel/worker/port.d.ts +6 -3
- package/cjs/highlevel/worker/port.js +8 -2
- package/cjs/highlevel/worker/port.js.map +1 -1
- package/cjs/highlevel/worker/protocol.d.ts +5 -1
- package/cjs/highlevel/worker/protocol.js.map +1 -1
- package/cjs/highlevel/worker/worker.d.ts +11 -4
- package/cjs/highlevel/worker/worker.js +53 -49
- package/cjs/highlevel/worker/worker.js.map +1 -1
- package/cjs/network/authorization.js +1 -0
- package/cjs/network/authorization.js.map +1 -1
- package/cjs/network/client.d.ts +4 -4
- package/cjs/network/client.js +3 -1
- package/cjs/network/client.js.map +1 -1
- package/cjs/network/mtproto-session.d.ts +1 -0
- package/cjs/network/mtproto-session.js +7 -1
- package/cjs/network/mtproto-session.js.map +1 -1
- package/cjs/network/multi-session-connection.d.ts +1 -0
- package/cjs/network/multi-session-connection.js +6 -0
- package/cjs/network/multi-session-connection.js.map +1 -1
- package/cjs/network/network-manager.d.ts +5 -1
- package/cjs/network/network-manager.js +24 -15
- package/cjs/network/network-manager.js.map +1 -1
- package/cjs/network/persistent-connection.d.ts +3 -0
- package/cjs/network/persistent-connection.js +23 -1
- package/cjs/network/persistent-connection.js.map +1 -1
- package/cjs/network/session-connection.d.ts +2 -0
- package/cjs/network/session-connection.js +21 -7
- package/cjs/network/session-connection.js.map +1 -1
- package/cjs/network/transports/index.d.ts +0 -3
- package/cjs/network/transports/index.js +0 -4
- package/cjs/network/transports/index.js.map +1 -1
- package/cjs/platform.d.ts +18 -0
- package/cjs/platform.js +36 -0
- package/cjs/platform.js.map +1 -0
- package/cjs/storage/index.d.ts +1 -2
- package/cjs/storage/index.js +1 -2
- package/cjs/storage/index.js.map +1 -1
- package/{esm/storage/providers → cjs/storage}/memory/driver.d.ts +1 -1
- package/cjs/storage/memory/driver.js.map +1 -0
- package/{esm/storage/providers → cjs/storage}/memory/index.d.ts +2 -2
- package/cjs/storage/memory/index.js.map +1 -0
- package/cjs/storage/{providers/memory → memory}/repository/auth-keys.d.ts +1 -1
- package/cjs/storage/memory/repository/auth-keys.js.map +1 -0
- package/{esm/storage/providers → cjs/storage}/memory/repository/kv.d.ts +1 -1
- package/cjs/storage/memory/repository/kv.js.map +1 -0
- package/{esm/storage/providers → cjs/storage}/memory/repository/peers.d.ts +1 -1
- package/cjs/storage/memory/repository/peers.js.map +1 -0
- package/{esm/storage/providers → cjs/storage}/memory/repository/ref-messages.d.ts +1 -1
- package/cjs/storage/memory/repository/ref-messages.js.map +1 -0
- package/cjs/storage/storage.js +2 -1
- package/cjs/storage/storage.js.map +1 -1
- package/cjs/utils/binary/asn1-parser.js +3 -3
- package/cjs/utils/binary/asn1-parser.js.map +1 -1
- package/cjs/utils/crypto/abstract.d.ts +0 -1
- package/cjs/utils/crypto/abstract.js.map +1 -1
- package/cjs/utils/crypto/index.d.ts +0 -2
- package/cjs/utils/crypto/index.js +0 -3
- package/cjs/utils/crypto/index.js.map +1 -1
- package/cjs/utils/crypto/keys.js +5 -3
- package/cjs/utils/crypto/keys.js.map +1 -1
- package/cjs/utils/crypto/password.js +3 -3
- package/cjs/utils/crypto/password.js.map +1 -1
- package/cjs/utils/dcs.d.ts +4 -0
- package/cjs/utils/dcs.js +0 -4
- package/cjs/utils/dcs.js.map +1 -1
- package/cjs/utils/{platform/error-reporting.d.ts → error-reporting.d.ts} +1 -1
- package/cjs/utils/error-reporting.js.map +1 -0
- package/cjs/utils/index.d.ts +4 -1
- package/cjs/utils/index.js +6 -1
- package/cjs/utils/index.js.map +1 -1
- package/cjs/utils/links/common.js +1 -1
- package/cjs/utils/links/common.js.map +1 -1
- package/cjs/utils/logger.d.ts +1 -0
- package/cjs/utils/logger.js +9 -22
- package/cjs/utils/logger.js.map +1 -1
- package/esm/highlevel/base.d.ts +3 -1
- package/esm/highlevel/base.js +18 -0
- package/esm/highlevel/base.js.map +1 -1
- package/esm/highlevel/client.d.ts +23 -10
- package/esm/highlevel/client.js +12 -19
- package/esm/highlevel/client.js.map +1 -1
- package/esm/highlevel/client.types.d.ts +14 -0
- package/esm/highlevel/client.types.js.map +1 -1
- package/esm/highlevel/index.d.ts +0 -2
- package/esm/highlevel/index.js +0 -2
- package/esm/highlevel/index.js.map +1 -1
- package/esm/highlevel/methods/_imports.js.map +1 -1
- package/esm/highlevel/methods/_init.js +4 -29
- package/esm/highlevel/methods/_init.js.map +1 -1
- package/esm/highlevel/methods/bots/get-callback-answer.js +2 -2
- package/esm/highlevel/methods/bots/get-callback-answer.js.map +1 -1
- package/esm/highlevel/methods/dialogs/create-folder.js +1 -1
- package/esm/highlevel/methods/dialogs/create-folder.js.map +1 -1
- package/esm/highlevel/methods/dialogs/edit-folder.js +1 -1
- package/esm/highlevel/methods/dialogs/edit-folder.js.map +1 -1
- package/esm/highlevel/methods/dialogs/find-folder.js +1 -1
- package/esm/highlevel/methods/dialogs/find-folder.js.map +1 -1
- package/esm/highlevel/methods/dialogs/get-folders.d.ts +1 -1
- package/esm/highlevel/methods/dialogs/get-folders.js +1 -1
- package/esm/highlevel/methods/dialogs/get-folders.js.map +1 -1
- package/esm/highlevel/methods/files/download-file.d.ts +1 -10
- package/esm/highlevel/methods/files/download-file.js +2 -30
- package/esm/highlevel/methods/files/download-file.js.map +1 -1
- package/esm/highlevel/methods/files/download-iterable.js +2 -1
- package/esm/highlevel/methods/files/download-iterable.js.map +1 -1
- package/esm/highlevel/methods/files/download-node-stream.js +3 -0
- package/esm/highlevel/methods/files/download-node-stream.js.map +1 -0
- package/esm/highlevel/methods/files/normalize-input-media.d.ts +1 -1
- package/esm/highlevel/methods/files/normalize-input-media.js +2 -1
- package/esm/highlevel/methods/files/normalize-input-media.js.map +1 -1
- package/esm/highlevel/methods/files/upload-file.d.ts +0 -3
- package/esm/highlevel/methods/files/upload-file.js +17 -13
- package/esm/highlevel/methods/files/upload-file.js.map +1 -1
- package/esm/highlevel/methods/messages/find-in-update.js +23 -8
- package/esm/highlevel/methods/messages/find-in-update.js.map +1 -1
- package/esm/highlevel/methods/messages/send-media-group.d.ts +1 -1
- package/esm/highlevel/methods/messages/send-media-group.js.map +1 -1
- package/esm/highlevel/methods/messages/send-media.d.ts +2 -2
- package/esm/highlevel/methods/messages/send-media.js +4 -3
- package/esm/highlevel/methods/messages/send-media.js.map +1 -1
- package/esm/highlevel/methods/messages/send-text.d.ts +1 -1
- package/esm/highlevel/methods/messages/send-text.js +4 -3
- package/esm/highlevel/methods/messages/send-text.js.map +1 -1
- package/esm/highlevel/methods/misc/with-params.d.ts +10 -0
- package/esm/highlevel/methods/misc/with-params.js +28 -0
- package/esm/highlevel/methods/misc/with-params.js.map +1 -0
- package/esm/highlevel/methods.d.ts +13 -1
- package/esm/highlevel/methods.js +0 -1
- package/esm/highlevel/methods.js.map +1 -1
- package/esm/highlevel/types/auth/sent-code.js +4 -3
- package/esm/highlevel/types/bots/command-scope/index.d.ts +10 -0
- package/esm/highlevel/types/bots/command-scope/index.js +11 -0
- package/esm/highlevel/types/bots/command-scope/index.js.map +1 -0
- package/esm/highlevel/types/bots/command-scope/inner.d.ts +54 -0
- package/esm/highlevel/types/bots/command-scope/inner.js +69 -0
- package/esm/highlevel/types/bots/command-scope/inner.js.map +1 -0
- package/esm/highlevel/types/bots/game-high-score.js +5 -4
- package/esm/highlevel/types/bots/index.d.ts +4 -4
- package/esm/highlevel/types/bots/index.js +4 -4
- package/esm/highlevel/types/bots/index.js.map +1 -1
- package/esm/highlevel/types/bots/inline-message/factories.d.ts +43 -0
- package/esm/highlevel/types/bots/inline-message/factories.js +163 -0
- package/esm/highlevel/types/bots/inline-message/factories.js.map +1 -0
- package/esm/highlevel/types/bots/inline-message/index.d.ts +3 -0
- package/esm/highlevel/types/bots/inline-message/index.js +4 -0
- package/esm/highlevel/types/bots/inline-message/index.js.map +1 -0
- package/{cjs/highlevel/types/bots/input/input-inline-message.d.ts → esm/highlevel/types/bots/inline-message/types.d.ts} +2 -45
- package/esm/highlevel/types/bots/inline-message/types.js +2 -0
- package/esm/highlevel/types/bots/inline-message/types.js.map +1 -0
- package/esm/highlevel/types/bots/inline-result/factories.d.ts +94 -0
- package/esm/highlevel/types/bots/inline-result/factories.js +470 -0
- package/esm/highlevel/types/bots/inline-result/factories.js.map +1 -0
- package/esm/highlevel/types/bots/inline-result/index.d.ts +3 -0
- package/esm/highlevel/types/bots/inline-result/index.js +4 -0
- package/esm/highlevel/types/bots/inline-result/index.js.map +1 -0
- package/{cjs/highlevel/types/bots/input/input-inline-result.d.ts → esm/highlevel/types/bots/inline-result/types.d.ts} +1 -95
- package/esm/highlevel/types/bots/inline-result/types.js +2 -0
- package/esm/highlevel/types/bots/inline-result/types.js.map +1 -0
- package/esm/highlevel/types/bots/{keyboard-builder.d.ts → keyboards/builder.d.ts} +1 -1
- package/esm/highlevel/types/bots/{keyboard-builder.js → keyboards/builder.js} +1 -1
- package/esm/highlevel/types/bots/keyboards/builder.js.map +1 -0
- package/esm/highlevel/types/bots/keyboards/factories.d.ts +195 -0
- package/esm/highlevel/types/bots/keyboards/factories.js +341 -0
- package/esm/highlevel/types/bots/keyboards/factories.js.map +1 -0
- package/esm/highlevel/types/bots/keyboards/index.d.ts +14 -0
- package/esm/highlevel/types/bots/keyboards/index.js +15 -0
- package/esm/highlevel/types/bots/keyboards/index.js.map +1 -0
- package/esm/highlevel/types/bots/keyboards/types.d.ts +34 -0
- package/esm/highlevel/types/bots/keyboards/types.js +2 -0
- package/esm/highlevel/types/bots/keyboards/types.js.map +1 -0
- package/esm/highlevel/types/files/file-location.js +4 -3
- package/esm/highlevel/types/files/web-document.js +4 -3
- package/esm/highlevel/types/media/audio.js +5 -4
- package/esm/highlevel/types/media/contact.js +4 -3
- package/esm/highlevel/types/media/dice.js +4 -3
- package/esm/highlevel/types/media/document.js +8 -6
- package/esm/highlevel/types/media/document.js.map +1 -1
- package/esm/highlevel/types/media/game.js +5 -4
- package/esm/highlevel/types/media/index.d.ts +1 -1
- package/esm/highlevel/types/media/index.js +1 -1
- package/esm/highlevel/types/media/index.js.map +1 -1
- package/esm/highlevel/types/media/input-media/factories.d.ts +141 -0
- package/esm/highlevel/types/media/input-media/factories.js +228 -0
- package/esm/highlevel/types/media/input-media/factories.js.map +1 -0
- package/esm/highlevel/types/media/input-media/index.d.ts +3 -0
- package/esm/highlevel/types/media/input-media/index.js +4 -0
- package/esm/highlevel/types/media/input-media/index.js.map +1 -0
- package/esm/highlevel/types/media/{input-media.d.ts → input-media/types.d.ts} +5 -145
- package/esm/highlevel/types/media/input-media/types.js +2 -0
- package/esm/highlevel/types/media/input-media/types.js.map +1 -0
- package/esm/highlevel/types/media/invoice.js +9 -7
- package/esm/highlevel/types/media/location.js +7 -5
- package/esm/highlevel/types/media/photo.js +5 -4
- package/esm/highlevel/types/media/poll.js +5 -4
- package/esm/highlevel/types/media/sticker.js +5 -4
- package/esm/highlevel/types/media/story.js +4 -3
- package/esm/highlevel/types/media/thumbnail.js +10 -8
- package/esm/highlevel/types/media/thumbnail.js.map +1 -1
- package/esm/highlevel/types/media/venue.js +5 -4
- package/esm/highlevel/types/media/video.js +5 -4
- package/esm/highlevel/types/media/voice.js +5 -4
- package/esm/highlevel/types/media/web-page.js +5 -4
- package/esm/highlevel/types/messages/dialog.js +5 -4
- package/esm/highlevel/types/messages/draft-message.js +5 -4
- package/esm/highlevel/types/messages/message-entity.js +5 -4
- package/esm/highlevel/types/messages/message-forward.js +5 -4
- package/esm/highlevel/types/messages/message-reactions.js +5 -4
- package/esm/highlevel/types/messages/message-replies.js +5 -4
- package/esm/highlevel/types/messages/message.d.ts +1 -1
- package/esm/highlevel/types/messages/message.js +6 -5
- package/esm/highlevel/types/messages/message.js.map +1 -1
- package/esm/highlevel/types/messages/replied-message.js +5 -4
- package/esm/highlevel/types/misc/index.d.ts +1 -1
- package/esm/highlevel/types/misc/index.js +1 -1
- package/esm/highlevel/types/misc/index.js.map +1 -1
- package/esm/highlevel/types/misc/input-privacy-rule/allow.d.ts +22 -0
- package/esm/highlevel/types/misc/input-privacy-rule/allow.js +31 -0
- package/esm/highlevel/types/misc/input-privacy-rule/allow.js.map +1 -0
- package/esm/highlevel/types/misc/input-privacy-rule/bundle.d.ts +3 -0
- package/esm/highlevel/types/misc/input-privacy-rule/bundle.js +4 -0
- package/esm/highlevel/types/misc/input-privacy-rule/bundle.js.map +1 -0
- package/esm/highlevel/types/misc/input-privacy-rule/disallow.d.ts +20 -0
- package/esm/highlevel/types/misc/input-privacy-rule/disallow.js +27 -0
- package/esm/highlevel/types/misc/input-privacy-rule/disallow.js.map +1 -0
- package/esm/highlevel/types/misc/input-privacy-rule/index.d.ts +3 -0
- package/esm/highlevel/types/misc/input-privacy-rule/index.js +4 -0
- package/esm/highlevel/types/misc/input-privacy-rule/index.js.map +1 -0
- package/esm/highlevel/types/misc/input-privacy-rule/types.d.ts +11 -0
- package/esm/highlevel/types/misc/input-privacy-rule/types.js +2 -0
- package/esm/highlevel/types/misc/input-privacy-rule/types.js.map +1 -0
- package/esm/highlevel/types/misc/sticker-set.js +5 -4
- package/esm/highlevel/types/misc/takeout-session.js +4 -3
- package/esm/highlevel/types/peers/chat-colors.js +4 -3
- package/esm/highlevel/types/peers/chat-event/index.js +5 -4
- package/esm/highlevel/types/peers/chat-invite-link-member.js +5 -4
- package/esm/highlevel/types/peers/chat-invite-link.js +5 -4
- package/esm/highlevel/types/peers/chat-location.js +5 -4
- package/esm/highlevel/types/peers/chat-member.js +5 -4
- package/esm/highlevel/types/peers/chat-permissions.js +4 -3
- package/esm/highlevel/types/peers/chat-photo.js +12 -9
- package/esm/highlevel/types/peers/chat-photo.js.map +1 -1
- package/esm/highlevel/types/peers/chat-preview.js +5 -4
- package/esm/highlevel/types/peers/chat.js +5 -4
- package/esm/highlevel/types/peers/forum-topic.js +5 -4
- package/esm/highlevel/types/peers/user.js +5 -4
- package/esm/highlevel/types/premium/boost-slot.js +5 -4
- package/esm/highlevel/types/premium/boost-stats.js +4 -3
- package/esm/highlevel/types/premium/boost.js +5 -4
- package/esm/highlevel/types/reactions/emoji-status.js +4 -3
- package/esm/highlevel/types/reactions/peer-reaction.js +5 -4
- package/esm/highlevel/types/reactions/reaction-count.js +4 -3
- package/esm/highlevel/types/stories/all-stories.js +5 -4
- package/esm/highlevel/types/stories/interactive/channel-post.js +5 -4
- package/esm/highlevel/types/stories/interactive/location.js +5 -4
- package/esm/highlevel/types/stories/interactive/reaction.js +4 -3
- package/esm/highlevel/types/stories/interactive/venue.js +5 -4
- package/esm/highlevel/types/stories/peer-stories.js +5 -4
- package/esm/highlevel/types/stories/stealth-mode.js +4 -3
- package/esm/highlevel/types/stories/story-interactions.js +5 -4
- package/esm/highlevel/types/stories/story-viewer.js +9 -7
- package/esm/highlevel/types/stories/story.js +5 -4
- package/esm/highlevel/types/updates/bot-chat-join-request.js +5 -4
- package/esm/highlevel/types/updates/bot-reaction.js +9 -7
- package/esm/highlevel/types/updates/bot-stopped.js +5 -4
- package/esm/highlevel/types/updates/callback-query.js +11 -9
- package/esm/highlevel/types/updates/callback-query.js.map +1 -1
- package/esm/highlevel/types/updates/chat-join-request.js +5 -4
- package/esm/highlevel/types/updates/chat-member-update.js +5 -4
- package/esm/highlevel/types/updates/chosen-inline-result.js +5 -4
- package/esm/highlevel/types/updates/delete-message-update.js +4 -3
- package/esm/highlevel/types/updates/delete-story-update.js +5 -4
- package/esm/highlevel/types/updates/history-read-update.js +4 -3
- package/esm/highlevel/types/updates/inline-query.js +5 -4
- package/esm/highlevel/types/updates/poll-update.js +5 -4
- package/esm/highlevel/types/updates/poll-vote.js +5 -4
- package/esm/highlevel/types/updates/pre-checkout-query.js +5 -4
- package/esm/highlevel/types/updates/story-update.js +5 -4
- package/esm/highlevel/types/updates/user-status-update.js +5 -4
- package/esm/highlevel/types/updates/user-status-update.js.map +1 -1
- package/esm/highlevel/types/updates/user-typing-update.js +4 -3
- package/esm/highlevel/updates/manager.d.ts +5 -3
- package/esm/highlevel/updates/manager.js +81 -67
- package/esm/highlevel/updates/manager.js.map +1 -1
- package/esm/highlevel/utils/convert-file-id.js +7 -6
- package/esm/highlevel/utils/convert-file-id.js.map +1 -1
- package/esm/highlevel/utils/file-utils.js +8 -4
- package/esm/highlevel/utils/file-utils.js.map +1 -1
- package/esm/highlevel/utils/inline-utils.js +4 -3
- package/esm/highlevel/utils/inline-utils.js.map +1 -1
- package/esm/highlevel/utils/inspectable.d.ts +1 -1
- package/esm/highlevel/utils/inspectable.js +3 -2
- package/esm/highlevel/utils/inspectable.js.map +1 -1
- package/esm/highlevel/utils/memoize.d.ts +1 -1
- package/esm/highlevel/utils/memoize.js +1 -0
- package/esm/highlevel/utils/memoize.js.map +1 -1
- package/esm/highlevel/utils/stream-utils.d.ts +0 -2
- package/esm/highlevel/utils/stream-utils.js +0 -26
- package/esm/highlevel/utils/stream-utils.js.map +1 -1
- package/esm/highlevel/utils/string-session.js +4 -3
- package/esm/highlevel/utils/string-session.js.map +1 -1
- package/esm/highlevel/worker/index.d.ts +3 -0
- package/esm/highlevel/worker/index.js +4 -0
- package/esm/highlevel/worker/index.js.map +1 -0
- package/esm/highlevel/worker/port.d.ts +6 -3
- package/esm/highlevel/worker/port.js +8 -2
- package/esm/highlevel/worker/port.js.map +1 -1
- package/esm/highlevel/worker/protocol.d.ts +5 -1
- package/esm/highlevel/worker/protocol.js.map +1 -1
- package/esm/highlevel/worker/worker.d.ts +11 -4
- package/esm/highlevel/worker/worker.js +51 -47
- package/esm/highlevel/worker/worker.js.map +1 -1
- package/esm/network/authorization.js +1 -0
- package/esm/network/authorization.js.map +1 -1
- package/esm/network/client.d.ts +4 -4
- package/esm/network/client.js +4 -2
- package/esm/network/client.js.map +1 -1
- package/esm/network/mtproto-session.d.ts +1 -0
- package/esm/network/mtproto-session.js +7 -1
- package/esm/network/mtproto-session.js.map +1 -1
- package/esm/network/multi-session-connection.d.ts +1 -0
- package/esm/network/multi-session-connection.js +6 -0
- package/esm/network/multi-session-connection.js.map +1 -1
- package/esm/network/network-manager.d.ts +5 -1
- package/esm/network/network-manager.js +24 -15
- package/esm/network/network-manager.js.map +1 -1
- package/esm/network/persistent-connection.d.ts +3 -0
- package/esm/network/persistent-connection.js +23 -1
- package/esm/network/persistent-connection.js.map +1 -1
- package/esm/network/session-connection.d.ts +2 -0
- package/esm/network/session-connection.js +21 -7
- package/esm/network/session-connection.js.map +1 -1
- package/esm/network/transports/index.d.ts +0 -3
- package/esm/network/transports/index.js +0 -3
- package/esm/network/transports/index.js.map +1 -1
- package/esm/platform.d.ts +18 -0
- package/esm/platform.js +31 -0
- package/esm/platform.js.map +1 -0
- package/esm/storage/index.d.ts +1 -2
- package/esm/storage/index.js +1 -2
- package/esm/storage/index.js.map +1 -1
- package/{cjs/storage/providers → esm/storage}/memory/driver.d.ts +1 -1
- package/esm/storage/memory/driver.js.map +1 -0
- package/{cjs/storage/providers → esm/storage}/memory/index.d.ts +2 -2
- package/esm/storage/memory/index.js.map +1 -0
- package/esm/storage/{providers/memory → memory}/repository/auth-keys.d.ts +1 -1
- package/esm/storage/memory/repository/auth-keys.js.map +1 -0
- package/{cjs/storage/providers → esm/storage}/memory/repository/kv.d.ts +1 -1
- package/esm/storage/memory/repository/kv.js.map +1 -0
- package/{cjs/storage/providers → esm/storage}/memory/repository/peers.d.ts +1 -1
- package/esm/storage/memory/repository/peers.js.map +1 -0
- package/{cjs/storage/providers → esm/storage}/memory/repository/ref-messages.d.ts +1 -1
- package/esm/storage/memory/repository/ref-messages.js.map +1 -0
- package/esm/storage/storage.js +3 -2
- package/esm/storage/storage.js.map +1 -1
- package/esm/utils/binary/asn1-parser.js +3 -3
- package/esm/utils/binary/asn1-parser.js.map +1 -1
- package/esm/utils/crypto/abstract.d.ts +0 -1
- package/esm/utils/crypto/abstract.js.map +1 -1
- package/esm/utils/crypto/index.d.ts +0 -2
- package/esm/utils/crypto/index.js +0 -2
- package/esm/utils/crypto/index.js.map +1 -1
- package/esm/utils/crypto/keys.js +6 -4
- package/esm/utils/crypto/keys.js.map +1 -1
- package/esm/utils/crypto/password.js +3 -3
- package/esm/utils/crypto/password.js.map +1 -1
- package/esm/utils/dcs.d.ts +4 -0
- package/esm/utils/dcs.js +0 -4
- package/esm/utils/dcs.js.map +1 -1
- package/esm/utils/{platform/error-reporting.d.ts → error-reporting.d.ts} +1 -1
- package/esm/utils/error-reporting.js.map +1 -0
- package/esm/utils/index.d.ts +4 -1
- package/esm/utils/index.js +6 -1
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/links/common.js +1 -1
- package/esm/utils/links/common.js.map +1 -1
- package/esm/utils/logger.d.ts +1 -0
- package/esm/utils/logger.js +9 -22
- package/esm/utils/logger.js.map +1 -1
- package/package.json +24 -52
- package/cjs/highlevel/base.test.js +0 -14
- package/cjs/highlevel/base.test.js.map +0 -1
- package/cjs/highlevel/methods/files/_platform.js +0 -33
- package/cjs/highlevel/methods/files/_platform.js.map +0 -1
- package/cjs/highlevel/methods/files/_platform.web.d.ts +0 -1
- package/cjs/highlevel/methods/files/_platform.web.js +0 -26
- package/cjs/highlevel/methods/files/_platform.web.js.map +0 -1
- package/cjs/highlevel/methods/files/download-file.web.d.ts +0 -1
- package/cjs/highlevel/methods/files/download-file.web.js +0 -9
- package/cjs/highlevel/methods/files/download-file.web.js.map +0 -1
- package/cjs/highlevel/methods/messages/send-text.test.d.ts +0 -1
- package/cjs/highlevel/methods/messages/send-text.test.js +0 -140
- package/cjs/highlevel/methods/messages/send-text.test.js.map +0 -1
- package/cjs/highlevel/methods/users/get-users.test.d.ts +0 -1
- package/cjs/highlevel/methods/users/get-users.test.js +0 -33
- package/cjs/highlevel/methods/users/get-users.test.js.map +0 -1
- package/cjs/highlevel/methods/users/resolve-peer.test.d.ts +0 -1
- package/cjs/highlevel/methods/users/resolve-peer.test.js +0 -307
- package/cjs/highlevel/methods/users/resolve-peer.test.js.map +0 -1
- package/cjs/highlevel/types/bots/command-scope.d.ts +0 -63
- package/cjs/highlevel/types/bots/command-scope.js +0 -87
- package/cjs/highlevel/types/bots/command-scope.js.map +0 -1
- package/cjs/highlevel/types/bots/input/index.d.ts +0 -2
- package/cjs/highlevel/types/bots/input/index.js.map +0 -1
- package/cjs/highlevel/types/bots/input/input-inline-message.js +0 -179
- package/cjs/highlevel/types/bots/input/input-inline-message.js.map +0 -1
- package/cjs/highlevel/types/bots/input/input-inline-result.js +0 -490
- package/cjs/highlevel/types/bots/input/input-inline-result.js.map +0 -1
- package/cjs/highlevel/types/bots/keyboard-builder.js.map +0 -1
- package/cjs/highlevel/types/bots/keyboard-builder.test.d.ts +0 -1
- package/cjs/highlevel/types/bots/keyboard-builder.test.js +0 -162
- package/cjs/highlevel/types/bots/keyboard-builder.test.js.map +0 -1
- package/cjs/highlevel/types/bots/keyboards.d.ts +0 -239
- package/cjs/highlevel/types/bots/keyboards.js +0 -380
- package/cjs/highlevel/types/bots/keyboards.js.map +0 -1
- package/cjs/highlevel/types/bots/keyboards.test.d.ts +0 -1
- package/cjs/highlevel/types/bots/keyboards.test.js +0 -146
- package/cjs/highlevel/types/bots/keyboards.test.js.map +0 -1
- package/cjs/highlevel/types/media/input-media.js +0 -254
- package/cjs/highlevel/types/media/input-media.js.map +0 -1
- package/cjs/highlevel/types/misc/input-privacy-rule.d.ts +0 -63
- package/cjs/highlevel/types/misc/input-privacy-rule.js +0 -85
- package/cjs/highlevel/types/misc/input-privacy-rule.js.map +0 -1
- package/cjs/highlevel/types/peers/peers-index.test.d.ts +0 -1
- package/cjs/highlevel/types/peers/peers-index.test.js +0 -71
- package/cjs/highlevel/types/peers/peers-index.test.js.map +0 -1
- package/cjs/highlevel/types/peers/user.test.d.ts +0 -1
- package/cjs/highlevel/types/peers/user.test.js +0 -176
- package/cjs/highlevel/types/peers/user.test.js.map +0 -1
- package/cjs/highlevel/utils/file-type.test.d.ts +0 -1
- package/cjs/highlevel/utils/file-type.test.js +0 -64
- package/cjs/highlevel/utils/file-type.test.js.map +0 -1
- package/cjs/highlevel/utils/file-utils.test.d.ts +0 -1
- package/cjs/highlevel/utils/file-utils.test.js +0 -126
- package/cjs/highlevel/utils/file-utils.test.js.map +0 -1
- package/cjs/highlevel/utils/inline-utils.test.d.ts +0 -1
- package/cjs/highlevel/utils/inline-utils.test.js +0 -47
- package/cjs/highlevel/utils/inline-utils.test.js.map +0 -1
- package/cjs/highlevel/utils/inspectable.test.d.ts +0 -1
- package/cjs/highlevel/utils/inspectable.test.js +0 -97
- package/cjs/highlevel/utils/inspectable.test.js.map +0 -1
- package/cjs/highlevel/utils/memoize.test.d.ts +0 -1
- package/cjs/highlevel/utils/memoize.test.js +0 -60
- package/cjs/highlevel/utils/memoize.test.js.map +0 -1
- package/cjs/highlevel/utils/peer-utils.test.d.ts +0 -1
- package/cjs/highlevel/utils/peer-utils.test.js +0 -109
- package/cjs/highlevel/utils/peer-utils.test.js.map +0 -1
- package/cjs/highlevel/utils/platform/storage.d.ts +0 -1
- package/cjs/highlevel/utils/platform/storage.js +0 -10
- package/cjs/highlevel/utils/platform/storage.js.map +0 -1
- package/cjs/highlevel/utils/platform/storage.web.d.ts +0 -1
- package/cjs/highlevel/utils/platform/storage.web.js +0 -14
- package/cjs/highlevel/utils/platform/storage.web.js.map +0 -1
- package/cjs/highlevel/utils/query-batcher.test.d.ts +0 -1
- package/cjs/highlevel/utils/query-batcher.test.js +0 -502
- package/cjs/highlevel/utils/query-batcher.test.js.map +0 -1
- package/cjs/highlevel/utils/stream-utils.test.d.ts +0 -1
- package/cjs/highlevel/utils/stream-utils.test.js +0 -98
- package/cjs/highlevel/utils/stream-utils.test.js.map +0 -1
- package/cjs/highlevel/utils/string-session.test.d.ts +0 -1
- package/cjs/highlevel/utils/string-session.test.js +0 -198
- package/cjs/highlevel/utils/string-session.test.js.map +0 -1
- package/cjs/highlevel/utils/voice-utils.test.d.ts +0 -1
- package/cjs/highlevel/utils/voice-utils.test.js +0 -28
- package/cjs/highlevel/utils/voice-utils.test.js.map +0 -1
- package/cjs/highlevel/worker/platform/connect.d.ts +0 -2
- package/cjs/highlevel/worker/platform/connect.js +0 -19
- package/cjs/highlevel/worker/platform/connect.js.map +0 -1
- package/cjs/highlevel/worker/platform/connect.web.d.ts +0 -2
- package/cjs/highlevel/worker/platform/connect.web.js +0 -51
- package/cjs/highlevel/worker/platform/connect.web.js.map +0 -1
- package/cjs/highlevel/worker/platform/register.d.ts +0 -2
- package/cjs/highlevel/worker/platform/register.js +0 -20
- package/cjs/highlevel/worker/platform/register.js.map +0 -1
- package/cjs/highlevel/worker/platform/register.web.d.ts +0 -2
- package/cjs/highlevel/worker/platform/register.web.js +0 -64
- package/cjs/highlevel/worker/platform/register.web.js.map +0 -1
- package/cjs/network/auth-key.test.d.ts +0 -1
- package/cjs/network/auth-key.test.js +0 -111
- package/cjs/network/auth-key.test.js.map +0 -1
- package/cjs/network/config-manager.test.d.ts +0 -1
- package/cjs/network/config-manager.test.js +0 -174
- package/cjs/network/config-manager.test.js.map +0 -1
- package/cjs/network/persistent-connection.test.d.ts +0 -1
- package/cjs/network/persistent-connection.test.js +0 -157
- package/cjs/network/persistent-connection.test.js.map +0 -1
- package/cjs/network/transports/intermediate.test.d.ts +0 -1
- package/cjs/network/transports/intermediate.test.js +0 -84
- package/cjs/network/transports/intermediate.test.js.map +0 -1
- package/cjs/network/transports/obfuscated.test.d.ts +0 -1
- package/cjs/network/transports/obfuscated.test.js +0 -131
- package/cjs/network/transports/obfuscated.test.js.map +0 -1
- package/cjs/network/transports/tcp.d.ts +0 -32
- package/cjs/network/transports/tcp.js +0 -130
- package/cjs/network/transports/tcp.js.map +0 -1
- package/cjs/network/transports/tcp.test.d.ts +0 -1
- package/cjs/network/transports/tcp.test.js +0 -103
- package/cjs/network/transports/tcp.test.js.map +0 -1
- package/cjs/network/transports/websocket.d.ts +0 -46
- package/cjs/network/transports/websocket.js +0 -124
- package/cjs/network/transports/websocket.js.map +0 -1
- package/cjs/network/transports/websocket.test.d.ts +0 -1
- package/cjs/network/transports/websocket.test.js +0 -91
- package/cjs/network/transports/websocket.test.js.map +0 -1
- package/cjs/storage/providers/idb/driver.d.ts +0 -18
- package/cjs/storage/providers/idb/driver.js +0 -138
- package/cjs/storage/providers/idb/driver.js.map +0 -1
- package/cjs/storage/providers/idb/idb.test.d.ts +0 -1
- package/cjs/storage/providers/idb/idb.test.js +0 -29
- package/cjs/storage/providers/idb/idb.test.js.map +0 -1
- package/cjs/storage/providers/idb/index.d.ts +0 -22
- package/cjs/storage/providers/idb/index.js +0 -28
- package/cjs/storage/providers/idb/index.js.map +0 -1
- package/cjs/storage/providers/idb/repository/auth-keys.d.ts +0 -14
- package/cjs/storage/providers/idb/repository/auth-keys.js +0 -70
- package/cjs/storage/providers/idb/repository/auth-keys.js.map +0 -1
- package/cjs/storage/providers/idb/repository/kv.d.ts +0 -11
- package/cjs/storage/providers/idb/repository/kv.js +0 -34
- package/cjs/storage/providers/idb/repository/kv.js.map +0 -1
- package/cjs/storage/providers/idb/repository/peers.d.ts +0 -12
- package/cjs/storage/providers/idb/repository/peers.js +0 -38
- package/cjs/storage/providers/idb/repository/peers.js.map +0 -1
- package/cjs/storage/providers/idb/repository/ref-messages.d.ts +0 -12
- package/cjs/storage/providers/idb/repository/ref-messages.js +0 -57
- package/cjs/storage/providers/idb/repository/ref-messages.js.map +0 -1
- package/cjs/storage/providers/idb/utils.d.ts +0 -3
- package/cjs/storage/providers/idb/utils.js +0 -27
- package/cjs/storage/providers/idb/utils.js.map +0 -1
- package/cjs/storage/providers/memory/driver.js.map +0 -1
- package/cjs/storage/providers/memory/index.js.map +0 -1
- package/cjs/storage/providers/memory/memory.test.d.ts +0 -1
- package/cjs/storage/providers/memory/memory.test.js +0 -13
- package/cjs/storage/providers/memory/memory.test.js.map +0 -1
- package/cjs/storage/providers/memory/repository/auth-keys.js.map +0 -1
- package/cjs/storage/providers/memory/repository/kv.js.map +0 -1
- package/cjs/storage/providers/memory/repository/peers.js.map +0 -1
- package/cjs/storage/providers/memory/repository/ref-messages.js.map +0 -1
- package/cjs/storage/service/auth-keys.test.d.ts +0 -1
- package/cjs/storage/service/auth-keys.test.js +0 -22
- package/cjs/storage/service/auth-keys.test.js.map +0 -1
- package/cjs/storage/service/updates.test.d.ts +0 -1
- package/cjs/storage/service/updates.test.js +0 -60
- package/cjs/storage/service/updates.test.js.map +0 -1
- package/cjs/storage/service/utils.test-utils.d.ts +0 -2
- package/cjs/storage/service/utils.test-utils.js +0 -19
- package/cjs/storage/service/utils.test-utils.js.map +0 -1
- package/cjs/utils/async-lock.test.d.ts +0 -1
- package/cjs/utils/async-lock.test.js +0 -25
- package/cjs/utils/async-lock.test.js.map +0 -1
- package/cjs/utils/bigint-utils.test.d.ts +0 -1
- package/cjs/utils/bigint-utils.test.js +0 -150
- package/cjs/utils/bigint-utils.test.js.map +0 -1
- package/cjs/utils/buffer-utils.test.d.ts +0 -1
- package/cjs/utils/buffer-utils.test.js +0 -69
- package/cjs/utils/buffer-utils.test.js.map +0 -1
- package/cjs/utils/condition-variable.test.d.ts +0 -1
- package/cjs/utils/condition-variable.test.js +0 -27
- package/cjs/utils/condition-variable.test.js.map +0 -1
- package/cjs/utils/controllable-promise.test.d.ts +0 -1
- package/cjs/utils/controllable-promise.test.js +0 -17
- package/cjs/utils/controllable-promise.test.js.map +0 -1
- package/cjs/utils/crypto/factorization.test.d.ts +0 -1
- package/cjs/utils/crypto/factorization.test.js +0 -19
- package/cjs/utils/crypto/factorization.test.js.map +0 -1
- package/cjs/utils/crypto/keys.test.d.ts +0 -1
- package/cjs/utils/crypto/keys.test.js +0 -40
- package/cjs/utils/crypto/keys.test.js.map +0 -1
- package/cjs/utils/crypto/miller-rabin.test.d.ts +0 -1
- package/cjs/utils/crypto/miller-rabin.test.js +0 -60
- package/cjs/utils/crypto/miller-rabin.test.js.map +0 -1
- package/cjs/utils/crypto/mtproto.test.d.ts +0 -1
- package/cjs/utils/crypto/mtproto.test.js +0 -50
- package/cjs/utils/crypto/mtproto.test.js.map +0 -1
- package/cjs/utils/crypto/node.d.ts +0 -21
- package/cjs/utils/crypto/node.js +0 -74
- package/cjs/utils/crypto/node.js.map +0 -1
- package/cjs/utils/crypto/node.test.d.ts +0 -1
- package/cjs/utils/crypto/node.test.js +0 -14
- package/cjs/utils/crypto/node.test.js.map +0 -1
- package/cjs/utils/crypto/password.test.d.ts +0 -1
- package/cjs/utils/crypto/password.test.js +0 -95
- package/cjs/utils/crypto/password.test.js.map +0 -1
- package/cjs/utils/crypto/utils.test.d.ts +0 -1
- package/cjs/utils/crypto/utils.test.js +0 -49
- package/cjs/utils/crypto/utils.test.js.map +0 -1
- package/cjs/utils/crypto/wasm.d.ts +0 -22
- package/cjs/utils/crypto/wasm.js +0 -41
- package/cjs/utils/crypto/wasm.js.map +0 -1
- package/cjs/utils/crypto/web.d.ts +0 -11
- package/cjs/utils/crypto/web.js +0 -40
- package/cjs/utils/crypto/web.js.map +0 -1
- package/cjs/utils/crypto/web.test.d.ts +0 -1
- package/cjs/utils/crypto/web.test.js +0 -17
- package/cjs/utils/crypto/web.test.js.map +0 -1
- package/cjs/utils/deque.test.d.ts +0 -1
- package/cjs/utils/deque.test.js +0 -128
- package/cjs/utils/deque.test.js.map +0 -1
- package/cjs/utils/function-utils.test.d.ts +0 -1
- package/cjs/utils/function-utils.test.js +0 -23
- package/cjs/utils/function-utils.test.js.map +0 -1
- package/cjs/utils/linked-list.test.d.ts +0 -1
- package/cjs/utils/linked-list.test.js +0 -36
- package/cjs/utils/linked-list.test.js.map +0 -1
- package/cjs/utils/links/bots.test.d.ts +0 -1
- package/cjs/utils/links/bots.test.js +0 -152
- package/cjs/utils/links/bots.test.js.map +0 -1
- package/cjs/utils/links/chat.test.d.ts +0 -1
- package/cjs/utils/links/chat.test.js +0 -84
- package/cjs/utils/links/chat.test.js.map +0 -1
- package/cjs/utils/links/misc.test.d.ts +0 -1
- package/cjs/utils/links/misc.test.js +0 -153
- package/cjs/utils/links/misc.test.js.map +0 -1
- package/cjs/utils/links/proxy.test.d.ts +0 -1
- package/cjs/utils/links/proxy.test.js +0 -74
- package/cjs/utils/links/proxy.test.js.map +0 -1
- package/cjs/utils/links/user.test.d.ts +0 -1
- package/cjs/utils/links/user.test.js +0 -63
- package/cjs/utils/links/user.test.js.map +0 -1
- package/cjs/utils/logger.test.d.ts +0 -1
- package/cjs/utils/logger.test.js +0 -139
- package/cjs/utils/logger.test.js.map +0 -1
- package/cjs/utils/long-utils.test.d.ts +0 -1
- package/cjs/utils/long-utils.test.js +0 -158
- package/cjs/utils/long-utils.test.js.map +0 -1
- package/cjs/utils/lru-map.test.d.ts +0 -1
- package/cjs/utils/lru-map.test.js +0 -96
- package/cjs/utils/lru-map.test.js.map +0 -1
- package/cjs/utils/lru-set.test.d.ts +0 -1
- package/cjs/utils/lru-set.test.js +0 -77
- package/cjs/utils/lru-set.test.js.map +0 -1
- package/cjs/utils/peer-utils.test.d.ts +0 -1
- package/cjs/utils/peer-utils.test.js +0 -110
- package/cjs/utils/peer-utils.test.js.map +0 -1
- package/cjs/utils/platform/crypto.d.ts +0 -1
- package/cjs/utils/platform/crypto.js +0 -8
- package/cjs/utils/platform/crypto.js.map +0 -1
- package/cjs/utils/platform/crypto.web.d.ts +0 -1
- package/cjs/utils/platform/crypto.web.js +0 -14
- package/cjs/utils/platform/crypto.web.js.map +0 -1
- package/cjs/utils/platform/error-reporting.js.map +0 -1
- package/cjs/utils/platform/exit-hook.d.ts +0 -1
- package/cjs/utils/platform/exit-hook.js +0 -45
- package/cjs/utils/platform/exit-hook.js.map +0 -1
- package/cjs/utils/platform/exit-hook.web.d.ts +0 -1
- package/cjs/utils/platform/exit-hook.web.js +0 -21
- package/cjs/utils/platform/exit-hook.web.js.map +0 -1
- package/cjs/utils/platform/logging.d.ts +0 -1
- package/cjs/utils/platform/logging.js +0 -34
- package/cjs/utils/platform/logging.js.map +0 -1
- package/cjs/utils/platform/logging.web.d.ts +0 -1
- package/cjs/utils/platform/logging.web.js +0 -35
- package/cjs/utils/platform/logging.web.js.map +0 -1
- package/cjs/utils/platform/transport.d.ts +0 -1
- package/cjs/utils/platform/transport.js +0 -8
- package/cjs/utils/platform/transport.js.map +0 -1
- package/cjs/utils/platform/transport.web.d.ts +0 -1
- package/cjs/utils/platform/transport.web.js +0 -15
- package/cjs/utils/platform/transport.web.js.map +0 -1
- package/cjs/utils/sorted-array.test.d.ts +0 -1
- package/cjs/utils/sorted-array.test.js +0 -66
- package/cjs/utils/sorted-array.test.js.map +0 -1
- package/cjs/utils/tl-json.test.d.ts +0 -1
- package/cjs/utils/tl-json.test.js +0 -83
- package/cjs/utils/tl-json.test.js.map +0 -1
- package/cjs/utils/type-assertions.test.d.ts +0 -1
- package/cjs/utils/type-assertions.test.js +0 -67
- package/cjs/utils/type-assertions.test.js.map +0 -1
- package/esm/highlevel/base.test.d.ts +0 -1
- package/esm/highlevel/base.test.js +0 -12
- package/esm/highlevel/base.test.js.map +0 -1
- package/esm/highlevel/methods/files/_platform.d.ts +0 -1
- package/esm/highlevel/methods/files/_platform.js +0 -26
- package/esm/highlevel/methods/files/_platform.js.map +0 -1
- package/esm/highlevel/methods/files/_platform.web.d.ts +0 -1
- package/esm/highlevel/methods/files/_platform.web.js +0 -19
- package/esm/highlevel/methods/files/_platform.web.js.map +0 -1
- package/esm/highlevel/methods/files/download-file.web.d.ts +0 -1
- package/esm/highlevel/methods/files/download-file.web.js +0 -5
- package/esm/highlevel/methods/files/download-file.web.js.map +0 -1
- package/esm/highlevel/methods/messages/send-text.test.d.ts +0 -1
- package/esm/highlevel/methods/messages/send-text.test.js +0 -135
- package/esm/highlevel/methods/messages/send-text.test.js.map +0 -1
- package/esm/highlevel/methods/users/get-users.test.d.ts +0 -1
- package/esm/highlevel/methods/users/get-users.test.js +0 -28
- package/esm/highlevel/methods/users/get-users.test.js.map +0 -1
- package/esm/highlevel/methods/users/resolve-peer.test.d.ts +0 -1
- package/esm/highlevel/methods/users/resolve-peer.test.js +0 -302
- package/esm/highlevel/methods/users/resolve-peer.test.js.map +0 -1
- package/esm/highlevel/types/bots/command-scope.d.ts +0 -63
- package/esm/highlevel/types/bots/command-scope.js +0 -84
- package/esm/highlevel/types/bots/command-scope.js.map +0 -1
- package/esm/highlevel/types/bots/input/index.d.ts +0 -2
- package/esm/highlevel/types/bots/input/index.js +0 -3
- package/esm/highlevel/types/bots/input/index.js.map +0 -1
- package/esm/highlevel/types/bots/input/input-inline-message.js +0 -176
- package/esm/highlevel/types/bots/input/input-inline-message.js.map +0 -1
- package/esm/highlevel/types/bots/input/input-inline-result.js +0 -487
- package/esm/highlevel/types/bots/input/input-inline-result.js.map +0 -1
- package/esm/highlevel/types/bots/keyboard-builder.js.map +0 -1
- package/esm/highlevel/types/bots/keyboard-builder.test.d.ts +0 -1
- package/esm/highlevel/types/bots/keyboard-builder.test.js +0 -160
- package/esm/highlevel/types/bots/keyboard-builder.test.js.map +0 -1
- package/esm/highlevel/types/bots/keyboards.d.ts +0 -239
- package/esm/highlevel/types/bots/keyboards.js +0 -377
- package/esm/highlevel/types/bots/keyboards.js.map +0 -1
- package/esm/highlevel/types/bots/keyboards.test.d.ts +0 -1
- package/esm/highlevel/types/bots/keyboards.test.js +0 -144
- package/esm/highlevel/types/bots/keyboards.test.js.map +0 -1
- package/esm/highlevel/types/media/input-media.js +0 -251
- package/esm/highlevel/types/media/input-media.js.map +0 -1
- package/esm/highlevel/types/misc/input-privacy-rule.d.ts +0 -63
- package/esm/highlevel/types/misc/input-privacy-rule.js +0 -82
- package/esm/highlevel/types/misc/input-privacy-rule.js.map +0 -1
- package/esm/highlevel/types/peers/peers-index.test.d.ts +0 -1
- package/esm/highlevel/types/peers/peers-index.test.js +0 -69
- package/esm/highlevel/types/peers/peers-index.test.js.map +0 -1
- package/esm/highlevel/types/peers/user.test.d.ts +0 -1
- package/esm/highlevel/types/peers/user.test.js +0 -171
- package/esm/highlevel/types/peers/user.test.js.map +0 -1
- package/esm/highlevel/utils/file-type.test.d.ts +0 -1
- package/esm/highlevel/utils/file-type.test.js +0 -62
- package/esm/highlevel/utils/file-type.test.js.map +0 -1
- package/esm/highlevel/utils/file-utils.test.d.ts +0 -1
- package/esm/highlevel/utils/file-utils.test.js +0 -124
- package/esm/highlevel/utils/file-utils.test.js.map +0 -1
- package/esm/highlevel/utils/inline-utils.test.d.ts +0 -1
- package/esm/highlevel/utils/inline-utils.test.js +0 -42
- package/esm/highlevel/utils/inline-utils.test.js.map +0 -1
- package/esm/highlevel/utils/inspectable.test.d.ts +0 -1
- package/esm/highlevel/utils/inspectable.test.js +0 -95
- package/esm/highlevel/utils/inspectable.test.js.map +0 -1
- package/esm/highlevel/utils/memoize.test.d.ts +0 -1
- package/esm/highlevel/utils/memoize.test.js +0 -58
- package/esm/highlevel/utils/memoize.test.js.map +0 -1
- package/esm/highlevel/utils/peer-utils.test.d.ts +0 -1
- package/esm/highlevel/utils/peer-utils.test.js +0 -107
- package/esm/highlevel/utils/peer-utils.test.js.map +0 -1
- package/esm/highlevel/utils/platform/storage.d.ts +0 -1
- package/esm/highlevel/utils/platform/storage.js +0 -6
- package/esm/highlevel/utils/platform/storage.js.map +0 -1
- package/esm/highlevel/utils/platform/storage.web.d.ts +0 -1
- package/esm/highlevel/utils/platform/storage.web.js +0 -10
- package/esm/highlevel/utils/platform/storage.web.js.map +0 -1
- package/esm/highlevel/utils/query-batcher.test.d.ts +0 -1
- package/esm/highlevel/utils/query-batcher.test.js +0 -500
- package/esm/highlevel/utils/query-batcher.test.js.map +0 -1
- package/esm/highlevel/utils/stream-utils.test.d.ts +0 -1
- package/esm/highlevel/utils/stream-utils.test.js +0 -96
- package/esm/highlevel/utils/stream-utils.test.js.map +0 -1
- package/esm/highlevel/utils/string-session.test.d.ts +0 -1
- package/esm/highlevel/utils/string-session.test.js +0 -196
- package/esm/highlevel/utils/string-session.test.js.map +0 -1
- package/esm/highlevel/utils/voice-utils.test.d.ts +0 -1
- package/esm/highlevel/utils/voice-utils.test.js +0 -26
- package/esm/highlevel/utils/voice-utils.test.js.map +0 -1
- package/esm/highlevel/worker/platform/connect.d.ts +0 -2
- package/esm/highlevel/worker/platform/connect.js +0 -15
- package/esm/highlevel/worker/platform/connect.js.map +0 -1
- package/esm/highlevel/worker/platform/connect.web.d.ts +0 -2
- package/esm/highlevel/worker/platform/connect.web.js +0 -47
- package/esm/highlevel/worker/platform/connect.web.js.map +0 -1
- package/esm/highlevel/worker/platform/register.d.ts +0 -2
- package/esm/highlevel/worker/platform/register.js +0 -16
- package/esm/highlevel/worker/platform/register.js.map +0 -1
- package/esm/highlevel/worker/platform/register.web.d.ts +0 -2
- package/esm/highlevel/worker/platform/register.web.js +0 -60
- package/esm/highlevel/worker/platform/register.web.js.map +0 -1
- package/esm/network/auth-key.test.d.ts +0 -1
- package/esm/network/auth-key.test.js +0 -106
- package/esm/network/auth-key.test.js.map +0 -1
- package/esm/network/config-manager.test.d.ts +0 -1
- package/esm/network/config-manager.test.js +0 -172
- package/esm/network/config-manager.test.js.map +0 -1
- package/esm/network/persistent-connection.test.d.ts +0 -1
- package/esm/network/persistent-connection.test.js +0 -155
- package/esm/network/persistent-connection.test.js.map +0 -1
- package/esm/network/transports/intermediate.test.d.ts +0 -1
- package/esm/network/transports/intermediate.test.js +0 -82
- package/esm/network/transports/intermediate.test.js.map +0 -1
- package/esm/network/transports/obfuscated.test.d.ts +0 -1
- package/esm/network/transports/obfuscated.test.js +0 -129
- package/esm/network/transports/obfuscated.test.js.map +0 -1
- package/esm/network/transports/tcp.d.ts +0 -32
- package/esm/network/transports/tcp.js +0 -122
- package/esm/network/transports/tcp.js.map +0 -1
- package/esm/network/transports/tcp.test.d.ts +0 -1
- package/esm/network/transports/tcp.test.js +0 -101
- package/esm/network/transports/tcp.test.js.map +0 -1
- package/esm/network/transports/websocket.d.ts +0 -46
- package/esm/network/transports/websocket.js +0 -116
- package/esm/network/transports/websocket.js.map +0 -1
- package/esm/network/transports/websocket.test.d.ts +0 -1
- package/esm/network/transports/websocket.test.js +0 -89
- package/esm/network/transports/websocket.test.js.map +0 -1
- package/esm/storage/providers/idb/driver.d.ts +0 -18
- package/esm/storage/providers/idb/driver.js +0 -134
- package/esm/storage/providers/idb/driver.js.map +0 -1
- package/esm/storage/providers/idb/idb.test.d.ts +0 -1
- package/esm/storage/providers/idb/idb.test.js +0 -27
- package/esm/storage/providers/idb/idb.test.js.map +0 -1
- package/esm/storage/providers/idb/index.d.ts +0 -22
- package/esm/storage/providers/idb/index.js +0 -23
- package/esm/storage/providers/idb/index.js.map +0 -1
- package/esm/storage/providers/idb/repository/auth-keys.d.ts +0 -14
- package/esm/storage/providers/idb/repository/auth-keys.js +0 -66
- package/esm/storage/providers/idb/repository/auth-keys.js.map +0 -1
- package/esm/storage/providers/idb/repository/kv.d.ts +0 -11
- package/esm/storage/providers/idb/repository/kv.js +0 -30
- package/esm/storage/providers/idb/repository/kv.js.map +0 -1
- package/esm/storage/providers/idb/repository/peers.d.ts +0 -12
- package/esm/storage/providers/idb/repository/peers.js +0 -34
- package/esm/storage/providers/idb/repository/peers.js.map +0 -1
- package/esm/storage/providers/idb/repository/ref-messages.d.ts +0 -12
- package/esm/storage/providers/idb/repository/ref-messages.js +0 -53
- package/esm/storage/providers/idb/repository/ref-messages.js.map +0 -1
- package/esm/storage/providers/idb/utils.d.ts +0 -3
- package/esm/storage/providers/idb/utils.js +0 -21
- package/esm/storage/providers/idb/utils.js.map +0 -1
- package/esm/storage/providers/memory/driver.js.map +0 -1
- package/esm/storage/providers/memory/index.js.map +0 -1
- package/esm/storage/providers/memory/memory.test.d.ts +0 -1
- package/esm/storage/providers/memory/memory.test.js +0 -11
- package/esm/storage/providers/memory/memory.test.js.map +0 -1
- package/esm/storage/providers/memory/repository/auth-keys.js.map +0 -1
- package/esm/storage/providers/memory/repository/kv.js.map +0 -1
- package/esm/storage/providers/memory/repository/peers.js.map +0 -1
- package/esm/storage/providers/memory/repository/ref-messages.js.map +0 -1
- package/esm/storage/service/auth-keys.test.d.ts +0 -1
- package/esm/storage/service/auth-keys.test.js +0 -20
- package/esm/storage/service/auth-keys.test.js.map +0 -1
- package/esm/storage/service/updates.test.d.ts +0 -1
- package/esm/storage/service/updates.test.js +0 -58
- package/esm/storage/service/updates.test.js.map +0 -1
- package/esm/storage/service/utils.test-utils.d.ts +0 -2
- package/esm/storage/service/utils.test-utils.js +0 -15
- package/esm/storage/service/utils.test-utils.js.map +0 -1
- package/esm/utils/async-lock.test.d.ts +0 -1
- package/esm/utils/async-lock.test.js +0 -23
- package/esm/utils/async-lock.test.js.map +0 -1
- package/esm/utils/bigint-utils.test.d.ts +0 -1
- package/esm/utils/bigint-utils.test.js +0 -148
- package/esm/utils/bigint-utils.test.js.map +0 -1
- package/esm/utils/buffer-utils.test.d.ts +0 -1
- package/esm/utils/buffer-utils.test.js +0 -67
- package/esm/utils/buffer-utils.test.js.map +0 -1
- package/esm/utils/condition-variable.test.d.ts +0 -1
- package/esm/utils/condition-variable.test.js +0 -25
- package/esm/utils/condition-variable.test.js.map +0 -1
- package/esm/utils/controllable-promise.test.d.ts +0 -1
- package/esm/utils/controllable-promise.test.js +0 -15
- package/esm/utils/controllable-promise.test.js.map +0 -1
- package/esm/utils/crypto/factorization.test.d.ts +0 -1
- package/esm/utils/crypto/factorization.test.js +0 -17
- package/esm/utils/crypto/factorization.test.js.map +0 -1
- package/esm/utils/crypto/keys.test.d.ts +0 -1
- package/esm/utils/crypto/keys.test.js +0 -38
- package/esm/utils/crypto/keys.test.js.map +0 -1
- package/esm/utils/crypto/miller-rabin.test.d.ts +0 -1
- package/esm/utils/crypto/miller-rabin.test.js +0 -58
- package/esm/utils/crypto/miller-rabin.test.js.map +0 -1
- package/esm/utils/crypto/mtproto.test.d.ts +0 -1
- package/esm/utils/crypto/mtproto.test.js +0 -48
- package/esm/utils/crypto/mtproto.test.js.map +0 -1
- package/esm/utils/crypto/node.d.ts +0 -21
- package/esm/utils/crypto/node.js +0 -69
- package/esm/utils/crypto/node.js.map +0 -1
- package/esm/utils/crypto/node.test.d.ts +0 -1
- package/esm/utils/crypto/node.test.js +0 -12
- package/esm/utils/crypto/node.test.js.map +0 -1
- package/esm/utils/crypto/password.test.d.ts +0 -1
- package/esm/utils/crypto/password.test.js +0 -90
- package/esm/utils/crypto/password.test.js.map +0 -1
- package/esm/utils/crypto/utils.test.d.ts +0 -1
- package/esm/utils/crypto/utils.test.js +0 -47
- package/esm/utils/crypto/utils.test.js.map +0 -1
- package/esm/utils/crypto/wasm.d.ts +0 -22
- package/esm/utils/crypto/wasm.js +0 -37
- package/esm/utils/crypto/wasm.js.map +0 -1
- package/esm/utils/crypto/web.d.ts +0 -11
- package/esm/utils/crypto/web.js +0 -36
- package/esm/utils/crypto/web.js.map +0 -1
- package/esm/utils/crypto/web.test.d.ts +0 -1
- package/esm/utils/crypto/web.test.js +0 -15
- package/esm/utils/crypto/web.test.js.map +0 -1
- package/esm/utils/deque.test.d.ts +0 -1
- package/esm/utils/deque.test.js +0 -126
- package/esm/utils/deque.test.js.map +0 -1
- package/esm/utils/function-utils.test.d.ts +0 -1
- package/esm/utils/function-utils.test.js +0 -21
- package/esm/utils/function-utils.test.js.map +0 -1
- package/esm/utils/linked-list.test.d.ts +0 -1
- package/esm/utils/linked-list.test.js +0 -34
- package/esm/utils/linked-list.test.js.map +0 -1
- package/esm/utils/links/bots.test.d.ts +0 -1
- package/esm/utils/links/bots.test.js +0 -150
- package/esm/utils/links/bots.test.js.map +0 -1
- package/esm/utils/links/chat.test.d.ts +0 -1
- package/esm/utils/links/chat.test.js +0 -82
- package/esm/utils/links/chat.test.js.map +0 -1
- package/esm/utils/links/misc.test.d.ts +0 -1
- package/esm/utils/links/misc.test.js +0 -151
- package/esm/utils/links/misc.test.js.map +0 -1
- package/esm/utils/links/proxy.test.d.ts +0 -1
- package/esm/utils/links/proxy.test.js +0 -72
- package/esm/utils/links/proxy.test.js.map +0 -1
- package/esm/utils/links/user.test.d.ts +0 -1
- package/esm/utils/links/user.test.js +0 -61
- package/esm/utils/links/user.test.js.map +0 -1
- package/esm/utils/logger.test.d.ts +0 -1
- package/esm/utils/logger.test.js +0 -134
- package/esm/utils/logger.test.js.map +0 -1
- package/esm/utils/long-utils.test.d.ts +0 -1
- package/esm/utils/long-utils.test.js +0 -153
- package/esm/utils/long-utils.test.js.map +0 -1
- package/esm/utils/lru-map.test.d.ts +0 -1
- package/esm/utils/lru-map.test.js +0 -94
- package/esm/utils/lru-map.test.js.map +0 -1
- package/esm/utils/lru-set.test.d.ts +0 -1
- package/esm/utils/lru-set.test.js +0 -72
- package/esm/utils/lru-set.test.js.map +0 -1
- package/esm/utils/peer-utils.test.d.ts +0 -1
- package/esm/utils/peer-utils.test.js +0 -105
- package/esm/utils/peer-utils.test.js.map +0 -1
- package/esm/utils/platform/crypto.d.ts +0 -1
- package/esm/utils/platform/crypto.js +0 -4
- package/esm/utils/platform/crypto.js.map +0 -1
- package/esm/utils/platform/crypto.web.d.ts +0 -1
- package/esm/utils/platform/crypto.web.js +0 -10
- package/esm/utils/platform/crypto.web.js.map +0 -1
- package/esm/utils/platform/error-reporting.js.map +0 -1
- package/esm/utils/platform/exit-hook.d.ts +0 -1
- package/esm/utils/platform/exit-hook.js +0 -41
- package/esm/utils/platform/exit-hook.js.map +0 -1
- package/esm/utils/platform/exit-hook.web.d.ts +0 -1
- package/esm/utils/platform/exit-hook.web.js +0 -17
- package/esm/utils/platform/exit-hook.web.js.map +0 -1
- package/esm/utils/platform/logging.d.ts +0 -1
- package/esm/utils/platform/logging.js +0 -31
- package/esm/utils/platform/logging.js.map +0 -1
- package/esm/utils/platform/logging.web.d.ts +0 -1
- package/esm/utils/platform/logging.web.js +0 -31
- package/esm/utils/platform/logging.web.js.map +0 -1
- package/esm/utils/platform/transport.d.ts +0 -1
- package/esm/utils/platform/transport.js +0 -4
- package/esm/utils/platform/transport.js.map +0 -1
- package/esm/utils/platform/transport.web.d.ts +0 -1
- package/esm/utils/platform/transport.web.js +0 -12
- package/esm/utils/platform/transport.web.js.map +0 -1
- package/esm/utils/sorted-array.test.d.ts +0 -1
- package/esm/utils/sorted-array.test.js +0 -64
- package/esm/utils/sorted-array.test.js.map +0 -1
- package/esm/utils/tl-json.test.d.ts +0 -1
- package/esm/utils/tl-json.test.js +0 -81
- package/esm/utils/tl-json.test.js.map +0 -1
- package/esm/utils/type-assertions.test.d.ts +0 -1
- package/esm/utils/type-assertions.test.js +0 -65
- package/esm/utils/type-assertions.test.js.map +0 -1
- /package/cjs/highlevel/{base.test.d.ts → methods/files/download-node-stream.d.ts} +0 -0
- /package/cjs/storage/{providers/memory → memory}/driver.js +0 -0
- /package/cjs/storage/{providers/memory → memory}/index.js +0 -0
- /package/cjs/storage/{providers/memory → memory}/repository/auth-keys.js +0 -0
- /package/cjs/storage/{providers/memory → memory}/repository/kv.js +0 -0
- /package/cjs/storage/{providers/memory → memory}/repository/peers.js +0 -0
- /package/cjs/storage/{providers/memory → memory}/repository/ref-messages.js +0 -0
- /package/cjs/utils/{platform/error-reporting.js → error-reporting.js} +0 -0
- /package/{cjs/highlevel/methods/files/_platform.d.ts → esm/highlevel/methods/files/download-node-stream.d.ts} +0 -0
- /package/esm/storage/{providers/memory → memory}/driver.js +0 -0
- /package/esm/storage/{providers/memory → memory}/index.js +0 -0
- /package/esm/storage/{providers/memory → memory}/repository/auth-keys.js +0 -0
- /package/esm/storage/{providers/memory → memory}/repository/kv.js +0 -0
- /package/esm/storage/{providers/memory → memory}/repository/peers.js +0 -0
- /package/esm/storage/{providers/memory → memory}/repository/ref-messages.js +0 -0
- /package/esm/utils/{platform/error-reporting.js → error-reporting.js} +0 -0
|
@@ -1,380 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BotKeyboard = void 0;
|
|
4
|
-
const tl_1 = require("@mtcute/tl");
|
|
5
|
-
const tl_runtime_1 = require("@mtcute/tl-runtime");
|
|
6
|
-
const utils_js_1 = require("../../../types/utils.js");
|
|
7
|
-
const peer_utils_js_1 = require("../../utils/peer-utils.js");
|
|
8
|
-
const keyboard_builder_js_1 = require("./keyboard-builder.js");
|
|
9
|
-
/**
|
|
10
|
-
* Convenience methods wrapping TL
|
|
11
|
-
* objects creation for bot keyboard buttons.
|
|
12
|
-
*
|
|
13
|
-
* You can also use the type-discriminated objects directly.
|
|
14
|
-
*
|
|
15
|
-
* > **Note**: Button creation functions are intended to be used
|
|
16
|
-
* > with inline reply markup, unless stated otherwise
|
|
17
|
-
* > in the description.
|
|
18
|
-
*/
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
20
|
-
var BotKeyboard;
|
|
21
|
-
(function (BotKeyboard) {
|
|
22
|
-
/** Create a keyboard builder */
|
|
23
|
-
function builder(maxRowWidth) {
|
|
24
|
-
return new keyboard_builder_js_1.BotKeyboardBuilder(maxRowWidth);
|
|
25
|
-
}
|
|
26
|
-
BotKeyboard.builder = builder;
|
|
27
|
-
/**
|
|
28
|
-
* Create an inline keyboard markup
|
|
29
|
-
*
|
|
30
|
-
* @param buttons Two-dimensional array of buttons
|
|
31
|
-
*/
|
|
32
|
-
function inline(buttons) {
|
|
33
|
-
return {
|
|
34
|
-
type: 'inline',
|
|
35
|
-
buttons,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
BotKeyboard.inline = inline;
|
|
39
|
-
/**
|
|
40
|
-
* Create a reply keyboard markup
|
|
41
|
-
*
|
|
42
|
-
* @param buttons Two-dimensional array of buttons
|
|
43
|
-
* @param params Additional parameters for the keyboard
|
|
44
|
-
*/
|
|
45
|
-
function reply(buttons, params = {}) {
|
|
46
|
-
const ret = params;
|
|
47
|
-
ret.type = 'reply';
|
|
48
|
-
ret.buttons = buttons;
|
|
49
|
-
return ret;
|
|
50
|
-
}
|
|
51
|
-
BotKeyboard.reply = reply;
|
|
52
|
-
/**
|
|
53
|
-
* Hide the previously sent reply keyboard
|
|
54
|
-
*
|
|
55
|
-
* @param selective
|
|
56
|
-
* Whether to remove the keyboard for specific users only. Targets:
|
|
57
|
-
* - users that are @mentioned in the text of the Message
|
|
58
|
-
* - in case this is a reply, sender of the original message
|
|
59
|
-
*/
|
|
60
|
-
function hideReply(selective) {
|
|
61
|
-
return {
|
|
62
|
-
type: 'reply_hide',
|
|
63
|
-
selective,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
BotKeyboard.hideReply = hideReply;
|
|
67
|
-
/**
|
|
68
|
-
* Force the user to send a reply
|
|
69
|
-
*/
|
|
70
|
-
function forceReply(params = {}) {
|
|
71
|
-
const ret = params;
|
|
72
|
-
ret.type = 'force_reply';
|
|
73
|
-
return ret;
|
|
74
|
-
}
|
|
75
|
-
BotKeyboard.forceReply = forceReply;
|
|
76
|
-
/**
|
|
77
|
-
* Create a text-only keyboard button.
|
|
78
|
-
*
|
|
79
|
-
* Used for reply keyboards, not inline!
|
|
80
|
-
*
|
|
81
|
-
* @param text Button text
|
|
82
|
-
*/
|
|
83
|
-
function text(text) {
|
|
84
|
-
return {
|
|
85
|
-
_: 'keyboardButton',
|
|
86
|
-
text,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
BotKeyboard.text = text;
|
|
90
|
-
/**
|
|
91
|
-
* Create a keyboard button requesting for user's contact.
|
|
92
|
-
* Available only for private chats.
|
|
93
|
-
*
|
|
94
|
-
* Used for reply keyboards, not inline!
|
|
95
|
-
*
|
|
96
|
-
* @param text Button text
|
|
97
|
-
*/
|
|
98
|
-
function requestContact(text) {
|
|
99
|
-
return {
|
|
100
|
-
_: 'keyboardButtonRequestPhone',
|
|
101
|
-
text,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
BotKeyboard.requestContact = requestContact;
|
|
105
|
-
/**
|
|
106
|
-
* Create a keyboard button requesting for user's geo location.
|
|
107
|
-
* Available only for private chats.
|
|
108
|
-
*
|
|
109
|
-
* Used for reply keyboards, not inline!
|
|
110
|
-
*
|
|
111
|
-
* @param text Button text
|
|
112
|
-
*/
|
|
113
|
-
function requestGeo(text) {
|
|
114
|
-
return {
|
|
115
|
-
_: 'keyboardButtonRequestGeoLocation',
|
|
116
|
-
text,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
BotKeyboard.requestGeo = requestGeo;
|
|
120
|
-
/**
|
|
121
|
-
* Create a keyboard button requesting the user to create and send a poll.
|
|
122
|
-
* Available only for private chats.
|
|
123
|
-
*
|
|
124
|
-
* Used for reply keyboards, not inline!
|
|
125
|
-
*
|
|
126
|
-
* @param text Button text
|
|
127
|
-
* @param quiz If set, only quiz polls can be sent
|
|
128
|
-
*/
|
|
129
|
-
function requestPoll(text, quiz) {
|
|
130
|
-
return {
|
|
131
|
-
_: 'keyboardButtonRequestPoll',
|
|
132
|
-
text,
|
|
133
|
-
quiz,
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
BotKeyboard.requestPoll = requestPoll;
|
|
137
|
-
/**
|
|
138
|
-
* Create a keyboard button with a link.
|
|
139
|
-
*
|
|
140
|
-
* Used for inline keyboards, not reply!
|
|
141
|
-
*
|
|
142
|
-
* @param text Button text
|
|
143
|
-
* @param url URL
|
|
144
|
-
*/
|
|
145
|
-
function url(text, url) {
|
|
146
|
-
return {
|
|
147
|
-
_: 'keyboardButtonUrl',
|
|
148
|
-
text,
|
|
149
|
-
url,
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
BotKeyboard.url = url;
|
|
153
|
-
/**
|
|
154
|
-
* Create a keyboard button with a link.
|
|
155
|
-
*
|
|
156
|
-
* Used for inline keyboards, not reply!
|
|
157
|
-
*
|
|
158
|
-
* @param text Button text
|
|
159
|
-
* @param data Callback data (1-64 bytes). String will be converted to `Buffer`
|
|
160
|
-
* @param requiresPassword
|
|
161
|
-
* Whether the user should verify their identity by entering 2FA password.
|
|
162
|
-
* See more: {@link tl.RawKeyboardButtonCallback#requiresPassword}
|
|
163
|
-
*/
|
|
164
|
-
function callback(text, data, requiresPassword) {
|
|
165
|
-
return {
|
|
166
|
-
_: 'keyboardButtonCallback',
|
|
167
|
-
text,
|
|
168
|
-
requiresPassword,
|
|
169
|
-
data: typeof data === 'string' ? (0, tl_runtime_1.utf8EncodeToBuffer)(data) : data,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
BotKeyboard.callback = callback;
|
|
173
|
-
/**
|
|
174
|
-
* Button to force a user to switch to inline mode.
|
|
175
|
-
*
|
|
176
|
-
* Pressing the button will prompt the user to select
|
|
177
|
-
* one of their chats, open that chat and insert the bot‘s
|
|
178
|
-
* username and the specified inline query (if any) in the input field.
|
|
179
|
-
*
|
|
180
|
-
* Used for inline keyboards, not reply!
|
|
181
|
-
*
|
|
182
|
-
* @param text Button text
|
|
183
|
-
* @param query Inline query (can be empty or omitted)
|
|
184
|
-
* @param currentChat
|
|
185
|
-
* If set, pressing the button will insert the bot's username
|
|
186
|
-
* and the specified inline query in the current chat's input field
|
|
187
|
-
*/
|
|
188
|
-
function switchInline(text, query = '', currentChat) {
|
|
189
|
-
return {
|
|
190
|
-
_: 'keyboardButtonSwitchInline',
|
|
191
|
-
samePeer: currentChat,
|
|
192
|
-
text,
|
|
193
|
-
query,
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
BotKeyboard.switchInline = switchInline;
|
|
197
|
-
/**
|
|
198
|
-
* Button to start a game
|
|
199
|
-
*
|
|
200
|
-
* Used for inline keyboards, not reply!
|
|
201
|
-
*
|
|
202
|
-
* **Note**: This type of button must always be
|
|
203
|
-
* the first button in the first row. ID of the
|
|
204
|
-
* game is inferred from {@link InputMedia.game},
|
|
205
|
-
* thus this button should only be used with it.
|
|
206
|
-
*/
|
|
207
|
-
function game(text) {
|
|
208
|
-
return { _: 'keyboardButtonGame', text };
|
|
209
|
-
}
|
|
210
|
-
BotKeyboard.game = game;
|
|
211
|
-
/**
|
|
212
|
-
* Button to pay for a product.
|
|
213
|
-
*
|
|
214
|
-
* Used for inline keyboards, not reply!
|
|
215
|
-
*
|
|
216
|
-
* **Note**: This type of button must always be
|
|
217
|
-
* the first button in the first row. Related
|
|
218
|
-
* invoice is inferred from {@link InputMedia.invoice},
|
|
219
|
-
* thus this button should only be used with it.
|
|
220
|
-
*/
|
|
221
|
-
function pay(text) {
|
|
222
|
-
return { _: 'keyboardButtonBuy', text };
|
|
223
|
-
}
|
|
224
|
-
BotKeyboard.pay = pay;
|
|
225
|
-
/**
|
|
226
|
-
* Button to authorize a user
|
|
227
|
-
*
|
|
228
|
-
* Used for inline keyboards, not reply!
|
|
229
|
-
*
|
|
230
|
-
* @param text Button label
|
|
231
|
-
* @param url Authorization URL (see {@link tl.RawInputKeyboardButtonUrlAuth})
|
|
232
|
-
* @param params
|
|
233
|
-
*/
|
|
234
|
-
function urlAuth(text, url, params = {}) {
|
|
235
|
-
return {
|
|
236
|
-
_: 'inputKeyboardButtonUrlAuth',
|
|
237
|
-
text,
|
|
238
|
-
url,
|
|
239
|
-
bot: params.bot ?? {
|
|
240
|
-
_: 'inputUserSelf',
|
|
241
|
-
},
|
|
242
|
-
fwdText: params.fwdText,
|
|
243
|
-
requestWriteAccess: params.requestWriteAccess,
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
BotKeyboard.urlAuth = urlAuth;
|
|
247
|
-
/**
|
|
248
|
-
* Button to open webview
|
|
249
|
-
*
|
|
250
|
-
* Used for both inline keyboards and reply ones
|
|
251
|
-
*
|
|
252
|
-
* @param text Button label
|
|
253
|
-
* @param url WebView URL
|
|
254
|
-
*/
|
|
255
|
-
function webView(text, url) {
|
|
256
|
-
return {
|
|
257
|
-
_: 'keyboardButtonWebView',
|
|
258
|
-
text,
|
|
259
|
-
url,
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
BotKeyboard.webView = webView;
|
|
263
|
-
/**
|
|
264
|
-
* Button to open user profile
|
|
265
|
-
*
|
|
266
|
-
* @param text Text of the button
|
|
267
|
-
* @param user User to be opened (use {@link TelegramClient.resolvePeer})
|
|
268
|
-
*/
|
|
269
|
-
function userProfile(text, user) {
|
|
270
|
-
return {
|
|
271
|
-
_: 'inputKeyboardButtonUserProfile',
|
|
272
|
-
text,
|
|
273
|
-
userId: (0, peer_utils_js_1.toInputUser)(user),
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
BotKeyboard.userProfile = userProfile;
|
|
277
|
-
/**
|
|
278
|
-
* Button to request a peer from the user
|
|
279
|
-
*
|
|
280
|
-
* @param text Text of the button
|
|
281
|
-
* @param buttonId ID of the button that will later be passed to the service message
|
|
282
|
-
*/
|
|
283
|
-
function requestPeer(text, buttonId, params) {
|
|
284
|
-
return {
|
|
285
|
-
_: 'keyboardButtonRequestPeer',
|
|
286
|
-
text,
|
|
287
|
-
buttonId,
|
|
288
|
-
peerType: params.peerType,
|
|
289
|
-
maxQuantity: params.count ?? 1,
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
BotKeyboard.requestPeer = requestPeer;
|
|
293
|
-
/**
|
|
294
|
-
* Find a button in the keyboard by its text or by predicate
|
|
295
|
-
*
|
|
296
|
-
* @param buttons Two-dimensional array of buttons
|
|
297
|
-
* @param predicate Button text or predicate function
|
|
298
|
-
*/
|
|
299
|
-
function findButton(buttons, predicate) {
|
|
300
|
-
if (typeof predicate === 'string') {
|
|
301
|
-
const text = predicate;
|
|
302
|
-
predicate = (btn) => {
|
|
303
|
-
return 'text' in btn && btn.text === text;
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
for (const row of buttons) {
|
|
307
|
-
for (const btn of row) {
|
|
308
|
-
if (predicate(btn)) {
|
|
309
|
-
return btn;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
return null;
|
|
314
|
-
}
|
|
315
|
-
BotKeyboard.findButton = findButton;
|
|
316
|
-
/** @internal */
|
|
317
|
-
function _rowsTo2d(rows) {
|
|
318
|
-
return rows.map((it) => it.buttons);
|
|
319
|
-
}
|
|
320
|
-
BotKeyboard._rowsTo2d = _rowsTo2d;
|
|
321
|
-
/** @internal */
|
|
322
|
-
function _2dToRows(arr, inline) {
|
|
323
|
-
return arr.map((row) => {
|
|
324
|
-
if (!inline) {
|
|
325
|
-
// le cringe
|
|
326
|
-
row = row.map((btn) => btn._ === 'keyboardButtonWebView' ?
|
|
327
|
-
{
|
|
328
|
-
...btn,
|
|
329
|
-
_: 'keyboardButtonSimpleWebView',
|
|
330
|
-
} :
|
|
331
|
-
btn);
|
|
332
|
-
}
|
|
333
|
-
return {
|
|
334
|
-
_: 'keyboardButtonRow',
|
|
335
|
-
buttons: row,
|
|
336
|
-
};
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
BotKeyboard._2dToRows = _2dToRows;
|
|
340
|
-
/** @internal */
|
|
341
|
-
function _convertToTl(obj) {
|
|
342
|
-
if (!obj)
|
|
343
|
-
return obj;
|
|
344
|
-
if (tl_1.tl.isAnyReplyMarkup(obj))
|
|
345
|
-
return obj;
|
|
346
|
-
switch (obj.type) {
|
|
347
|
-
case 'reply':
|
|
348
|
-
return {
|
|
349
|
-
_: 'replyKeyboardMarkup',
|
|
350
|
-
resize: obj.resize,
|
|
351
|
-
singleUse: obj.singleUse,
|
|
352
|
-
selective: obj.selective,
|
|
353
|
-
persistent: obj.persistent,
|
|
354
|
-
placeholder: obj.placeholder,
|
|
355
|
-
rows: _2dToRows(obj.buttons, false),
|
|
356
|
-
};
|
|
357
|
-
case 'reply_hide':
|
|
358
|
-
return {
|
|
359
|
-
_: 'replyKeyboardHide',
|
|
360
|
-
selective: obj.selective,
|
|
361
|
-
};
|
|
362
|
-
case 'force_reply':
|
|
363
|
-
return {
|
|
364
|
-
_: 'replyKeyboardForceReply',
|
|
365
|
-
singleUse: obj.singleUse,
|
|
366
|
-
selective: obj.selective,
|
|
367
|
-
placeholder: obj.placeholder,
|
|
368
|
-
};
|
|
369
|
-
case 'inline':
|
|
370
|
-
return {
|
|
371
|
-
_: 'replyInlineMarkup',
|
|
372
|
-
rows: _2dToRows(obj.buttons, true),
|
|
373
|
-
};
|
|
374
|
-
default:
|
|
375
|
-
(0, utils_js_1.assertNever)(obj);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
BotKeyboard._convertToTl = _convertToTl;
|
|
379
|
-
})(BotKeyboard || (exports.BotKeyboard = BotKeyboard = {}));
|
|
380
|
-
//# sourceMappingURL=keyboards.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyboards.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/bots/keyboards.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAC/B,mDAAuD;AAEvD,sDAAqD;AACrD,6DAAuD;AACvD,+DAA0D;AA+C1D;;;;;;;;;GASG;AACH,2DAA2D;AAC3D,IAAiB,WAAW,CA8Z3B;AA9ZD,WAAiB,WAAW;IACxB,gCAAgC;IAChC,SAAgB,OAAO,CAAC,WAA2B;QAC/C,OAAO,IAAI,wCAAkB,CAAC,WAAW,CAAC,CAAA;IAC9C,CAAC;IAFe,mBAAO,UAEtB,CAAA;IAED;;;;OAIG;IACH,SAAgB,MAAM,CAAC,OAAkC;QACrD,OAAO;YACH,IAAI,EAAE,QAAQ;YACd,OAAO;SACV,CAAA;IACL,CAAC;IALe,kBAAM,SAKrB,CAAA;IAED;;;;;OAKG;IACH,SAAgB,KAAK,CACjB,OAAkC,EAClC,SAAwD,EAAE;QAE1D,MAAM,GAAG,GAAG,MAAyC,CAAA;QACrD,GAAG,CAAC,IAAI,GAAG,OAAO,CAAA;QAClB,GAAG,CAAC,OAAO,GAAG,OAAO,CAAA;QAErB,OAAO,GAAG,CAAA;IACd,CAAC;IATe,iBAAK,QASpB,CAAA;IAED;;;;;;;OAOG;IACH,SAAgB,SAAS,CAAC,SAAmB;QACzC,OAAO;YACH,IAAI,EAAE,YAAY;YAClB,SAAS;SACZ,CAAA;IACL,CAAC;IALe,qBAAS,YAKxB,CAAA;IAED;;OAEG;IACH,SAAgB,UAAU,CAAC,SAAgD,EAAE;QACzE,MAAM,GAAG,GAAG,MAA6C,CAAA;QACzD,GAAG,CAAC,IAAI,GAAG,aAAa,CAAA;QAExB,OAAO,GAAG,CAAA;IACd,CAAC;IALe,sBAAU,aAKzB,CAAA;IAED;;;;;;OAMG;IACH,SAAgB,IAAI,CAAC,IAAY;QAC7B,OAAO;YACH,CAAC,EAAE,gBAAgB;YACnB,IAAI;SACP,CAAA;IACL,CAAC;IALe,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;IAED,gBAAgB;IAChB,SAAgB,YAAY,CAAC,GAAiB;QAC1C,IAAI,CAAC,GAAG;YAAE,OAAO,GAAG,CAAA;QACpB,IAAI,OAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC;YAAE,OAAO,GAAG,CAAA;QAExC,QAAQ,GAAG,CAAC,IAAI,EAAE;YACd,KAAK,OAAO;gBACR,OAAO;oBACH,CAAC,EAAE,qBAAqB;oBACxB,MAAM,EAAE,GAAG,CAAC,MAAM;oBAClB,SAAS,EAAE,GAAG,CAAC,SAAS;oBACxB,SAAS,EAAE,GAAG,CAAC,SAAS;oBACxB,UAAU,EAAE,GAAG,CAAC,UAAU;oBAC1B,WAAW,EAAE,GAAG,CAAC,WAAW;oBAC5B,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC;iBACtC,CAAA;YACL,KAAK,YAAY;gBACb,OAAO;oBACH,CAAC,EAAE,mBAAmB;oBACtB,SAAS,EAAE,GAAG,CAAC,SAAS;iBAC3B,CAAA;YACL,KAAK,aAAa;gBACd,OAAO;oBACH,CAAC,EAAE,yBAAyB;oBAC5B,SAAS,EAAE,GAAG,CAAC,SAAS;oBACxB,SAAS,EAAE,GAAG,CAAC,SAAS;oBACxB,WAAW,EAAE,GAAG,CAAC,WAAW;iBAC/B,CAAA;YACL,KAAK,QAAQ;gBACT,OAAO;oBACH,CAAC,EAAE,mBAAmB;oBACtB,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC;iBACrC,CAAA;YACL;gBACI,IAAA,sBAAW,EAAC,GAAG,CAAC,CAAA;SACvB;IACL,CAAC;IAnCe,wBAAY,eAmC3B,CAAA;AACL,CAAC,EA9ZgB,WAAW,2BAAX,WAAW,QA8Z3B","sourcesContent":["import { tl } from '@mtcute/tl'\nimport { utf8EncodeToBuffer } from '@mtcute/tl-runtime'\n\nimport { assertNever } from '../../../types/utils.js'\nimport { toInputUser } from '../../utils/peer-utils.js'\nimport { BotKeyboardBuilder } from './keyboard-builder.js'\n\n/**\n * Reply keyboard markup\n */\nexport interface ReplyKeyboardMarkup extends Omit<tl.RawReplyKeyboardMarkup, '_' | 'rows'> {\n readonly type: 'reply'\n\n /**\n * Two-dimensional array of buttons\n */\n readonly buttons: tl.TypeKeyboardButton[][]\n}\n\n/**\n * Hide previously sent bot keyboard\n */\nexport interface ReplyKeyboardHide extends Omit<tl.RawReplyKeyboardHide, '_'> {\n readonly type: 'reply_hide'\n}\n\n/**\n * Force the user to send a reply\n */\nexport interface ReplyKeyboardForceReply extends Omit<tl.RawReplyKeyboardForceReply, '_'> {\n readonly type: 'force_reply'\n}\n\n/**\n * Inline keyboard markup\n */\nexport interface InlineKeyboardMarkup {\n readonly type: 'inline'\n\n /**\n * Two-dimensional array of buttons\n */\n readonly buttons: tl.TypeKeyboardButton[][]\n}\n\nexport type ReplyMarkup =\n | ReplyKeyboardMarkup\n | ReplyKeyboardHide\n | ReplyKeyboardForceReply\n | InlineKeyboardMarkup\n | tl.TypeReplyMarkup\n\n/**\n * Convenience methods wrapping TL\n * objects creation for bot keyboard buttons.\n *\n * You can also use the type-discriminated objects directly.\n *\n * > **Note**: Button creation functions are intended to be used\n * > with inline reply markup, unless stated otherwise\n * > in the description.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace BotKeyboard {\n /** Create a keyboard builder */\n export function builder(maxRowWidth?: number | null): BotKeyboardBuilder {\n return new BotKeyboardBuilder(maxRowWidth)\n }\n\n /**\n * Create an inline keyboard markup\n *\n * @param buttons Two-dimensional array of buttons\n */\n export function inline(buttons: tl.TypeKeyboardButton[][]): InlineKeyboardMarkup {\n return {\n type: 'inline',\n buttons,\n }\n }\n\n /**\n * Create a reply keyboard markup\n *\n * @param buttons Two-dimensional array of buttons\n * @param params Additional parameters for the keyboard\n */\n export function reply(\n buttons: tl.TypeKeyboardButton[][],\n params: Omit<ReplyKeyboardMarkup, 'type' | 'buttons'> = {},\n ): ReplyKeyboardMarkup {\n const ret = params as tl.Mutable<ReplyKeyboardMarkup>\n ret.type = 'reply'\n ret.buttons = buttons\n\n return ret\n }\n\n /**\n * Hide the previously sent reply keyboard\n *\n * @param selective\n * Whether to remove the keyboard for specific users only. Targets:\n * - users that are @mentioned in the text of the Message\n * - in case this is a reply, sender of the original message\n */\n export function hideReply(selective?: boolean): ReplyKeyboardHide {\n return {\n type: 'reply_hide',\n selective,\n }\n }\n\n /**\n * Force the user to send a reply\n */\n export function forceReply(params: Omit<ReplyKeyboardForceReply, 'type'> = {}): ReplyKeyboardForceReply {\n const ret = params as tl.Mutable<ReplyKeyboardForceReply>\n ret.type = 'force_reply'\n\n return ret\n }\n\n /**\n * Create a text-only keyboard button.\n *\n * Used for reply keyboards, not inline!\n *\n * @param text Button text\n */\n export function text(text: string): tl.RawKeyboardButton {\n return {\n _: 'keyboardButton',\n text,\n }\n }\n\n /**\n * Create a keyboard button requesting for user's contact.\n * Available only for private chats.\n *\n * Used for reply keyboards, not inline!\n *\n * @param text Button text\n */\n export function requestContact(text: string): tl.RawKeyboardButtonRequestPhone {\n return {\n _: 'keyboardButtonRequestPhone',\n text,\n }\n }\n\n /**\n * Create a keyboard button requesting for user's geo location.\n * Available only for private chats.\n *\n * Used for reply keyboards, not inline!\n *\n * @param text Button text\n */\n export function requestGeo(text: string): tl.RawKeyboardButtonRequestGeoLocation {\n return {\n _: 'keyboardButtonRequestGeoLocation',\n text,\n }\n }\n\n /**\n * Create a keyboard button requesting the user to create and send a poll.\n * Available only for private chats.\n *\n * Used for reply keyboards, not inline!\n *\n * @param text Button text\n * @param quiz If set, only quiz polls can be sent\n */\n export function requestPoll(text: string, quiz?: boolean): tl.RawKeyboardButtonRequestPoll {\n return {\n _: 'keyboardButtonRequestPoll',\n text,\n quiz,\n }\n }\n\n /**\n * Create a keyboard button with a link.\n *\n * Used for inline keyboards, not reply!\n *\n * @param text Button text\n * @param url URL\n */\n export function url(text: string, url: string): tl.RawKeyboardButtonUrl {\n return {\n _: 'keyboardButtonUrl',\n text,\n url,\n }\n }\n\n /**\n * Create a keyboard button with a link.\n *\n * Used for inline keyboards, not reply!\n *\n * @param text Button text\n * @param data Callback data (1-64 bytes). String will be converted to `Buffer`\n * @param requiresPassword\n * Whether the user should verify their identity by entering 2FA password.\n * See more: {@link tl.RawKeyboardButtonCallback#requiresPassword}\n */\n export function callback(\n text: string,\n data: string | Uint8Array,\n requiresPassword?: boolean,\n ): tl.RawKeyboardButtonCallback {\n return {\n _: 'keyboardButtonCallback',\n text,\n requiresPassword,\n data: typeof data === 'string' ? utf8EncodeToBuffer(data) : data,\n }\n }\n\n /**\n * Button to force a user to switch to inline mode.\n *\n * Pressing the button will prompt the user to select\n * one of their chats, open that chat and insert the bot‘s\n * username and the specified inline query (if any) in the input field.\n *\n * Used for inline keyboards, not reply!\n *\n * @param text Button text\n * @param query Inline query (can be empty or omitted)\n * @param currentChat\n * If set, pressing the button will insert the bot's username\n * and the specified inline query in the current chat's input field\n */\n export function switchInline(text: string, query = '', currentChat?: boolean): tl.RawKeyboardButtonSwitchInline {\n return {\n _: 'keyboardButtonSwitchInline',\n samePeer: currentChat,\n text,\n query,\n }\n }\n\n /**\n * Button to start a game\n *\n * Used for inline keyboards, not reply!\n *\n * **Note**: This type of button must always be\n * the first button in the first row. ID of the\n * game is inferred from {@link InputMedia.game},\n * thus this button should only be used with it.\n */\n export function game(text: string): tl.RawKeyboardButtonGame {\n return { _: 'keyboardButtonGame', text }\n }\n\n /**\n * Button to pay for a product.\n *\n * Used for inline keyboards, not reply!\n *\n * **Note**: This type of button must always be\n * the first button in the first row. Related\n * invoice is inferred from {@link InputMedia.invoice},\n * thus this button should only be used with it.\n */\n export function pay(text: string): tl.RawKeyboardButtonBuy {\n return { _: 'keyboardButtonBuy', text }\n }\n\n /**\n * Button to authorize a user\n *\n * Used for inline keyboards, not reply!\n *\n * @param text Button label\n * @param url Authorization URL (see {@link tl.RawInputKeyboardButtonUrlAuth})\n * @param params\n */\n export function urlAuth(\n text: string,\n url: string,\n params: {\n /**\n * Button label when forwarded\n */\n fwdText?: string\n\n /**\n * Whether to request the permission for\n * your bot to send messages to the user\n */\n requestWriteAccess?: boolean\n\n /**\n * Bot, which will be used for user authorization.\n * `url` domain must be the same as the domain linked\n * with the bot.\n *\n * @default current bot\n */\n bot?: tl.TypeInputUser\n } = {},\n ): tl.RawInputKeyboardButtonUrlAuth {\n return {\n _: 'inputKeyboardButtonUrlAuth',\n text,\n url,\n bot: params.bot ?? {\n _: 'inputUserSelf',\n },\n fwdText: params.fwdText,\n requestWriteAccess: params.requestWriteAccess,\n }\n }\n\n /**\n * Button to open webview\n *\n * Used for both inline keyboards and reply ones\n *\n * @param text Button label\n * @param url WebView URL\n */\n export function webView(text: string, url: string): tl.RawKeyboardButtonWebView {\n return {\n _: 'keyboardButtonWebView',\n text,\n url,\n }\n }\n\n /**\n * Button to open user profile\n *\n * @param text Text of the button\n * @param user User to be opened (use {@link TelegramClient.resolvePeer})\n */\n export function userProfile(text: string, user: tl.TypeInputPeer): tl.RawInputKeyboardButtonUserProfile {\n return {\n _: 'inputKeyboardButtonUserProfile',\n text,\n userId: toInputUser(user),\n }\n }\n\n /**\n * Button to request a peer from the user\n *\n * @param text Text of the button\n * @param buttonId ID of the button that will later be passed to the service message\n */\n export function requestPeer(\n text: string,\n buttonId: number,\n params: {\n /**\n * Peer type, along with filters\n */\n peerType: tl.TypeRequestPeerType\n\n /**\n * Maximum number of peers to be selected\n *\n * @default 1\n */\n count?: number\n },\n ): tl.RawKeyboardButtonRequestPeer {\n return {\n _: 'keyboardButtonRequestPeer',\n text,\n buttonId,\n peerType: params.peerType,\n maxQuantity: params.count ?? 1,\n }\n }\n\n /**\n * Find a button in the keyboard by its text or by predicate\n *\n * @param buttons Two-dimensional array of buttons\n * @param predicate Button text or predicate function\n */\n export function findButton(\n buttons: tl.TypeKeyboardButton[][],\n predicate: string | ((btn: tl.TypeKeyboardButton) => boolean),\n ): tl.TypeKeyboardButton | null {\n if (typeof predicate === 'string') {\n const text = predicate\n\n predicate = (btn) => {\n return 'text' in btn && btn.text === text\n }\n }\n\n for (const row of buttons) {\n for (const btn of row) {\n if (predicate(btn)) {\n return btn\n }\n }\n }\n\n return null\n }\n\n /** @internal */\n export function _rowsTo2d(rows: tl.RawKeyboardButtonRow[]): tl.TypeKeyboardButton[][] {\n return rows.map((it) => it.buttons)\n }\n\n /** @internal */\n export function _2dToRows(arr: tl.TypeKeyboardButton[][], inline: boolean): tl.RawKeyboardButtonRow[] {\n return arr.map((row) => {\n if (!inline) {\n // le cringe\n row = row.map((btn) =>\n btn._ === 'keyboardButtonWebView' ?\n {\n ...btn,\n _: 'keyboardButtonSimpleWebView',\n } :\n btn,\n )\n }\n\n return {\n _: 'keyboardButtonRow',\n buttons: row,\n }\n })\n }\n\n /** @internal */\n export function _convertToTl(obj?: ReplyMarkup): tl.TypeReplyMarkup | undefined {\n if (!obj) return obj\n if (tl.isAnyReplyMarkup(obj)) return obj\n\n switch (obj.type) {\n case 'reply':\n return {\n _: 'replyKeyboardMarkup',\n resize: obj.resize,\n singleUse: obj.singleUse,\n selective: obj.selective,\n persistent: obj.persistent,\n placeholder: obj.placeholder,\n rows: _2dToRows(obj.buttons, false),\n }\n case 'reply_hide':\n return {\n _: 'replyKeyboardHide',\n selective: obj.selective,\n }\n case 'force_reply':\n return {\n _: 'replyKeyboardForceReply',\n singleUse: obj.singleUse,\n selective: obj.selective,\n placeholder: obj.placeholder,\n }\n case 'inline':\n return {\n _: 'replyInlineMarkup',\n rows: _2dToRows(obj.buttons, true),\n }\n default:\n assertNever(obj)\n }\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const vitest_1 = require("vitest");
|
|
4
|
-
const keyboards_js_1 = require("./keyboards.js");
|
|
5
|
-
(0, vitest_1.describe)('findButton', () => {
|
|
6
|
-
const kb = [
|
|
7
|
-
[{ _: 'keyboardButton', text: 'aaa' }],
|
|
8
|
-
[{ _: 'keyboardButton', text: 'a' }],
|
|
9
|
-
[{ _: 'keyboardButton', text: 'b' }],
|
|
10
|
-
];
|
|
11
|
-
(0, vitest_1.it)('should find buttons by text', () => {
|
|
12
|
-
(0, vitest_1.expect)(keyboards_js_1.BotKeyboard.findButton(kb, 'a')).toEqual({
|
|
13
|
-
_: 'keyboardButton',
|
|
14
|
-
text: 'a',
|
|
15
|
-
});
|
|
16
|
-
(0, vitest_1.expect)(keyboards_js_1.BotKeyboard.findButton(kb, 'c')).toBeNull();
|
|
17
|
-
});
|
|
18
|
-
(0, vitest_1.it)('should find buttons by predicate', () => {
|
|
19
|
-
(0, vitest_1.expect)(keyboards_js_1.BotKeyboard.findButton(kb, (s) => s._ === 'keyboardButton')).toEqual({
|
|
20
|
-
_: 'keyboardButton',
|
|
21
|
-
text: 'aaa',
|
|
22
|
-
});
|
|
23
|
-
(0, vitest_1.expect)(keyboards_js_1.BotKeyboard.findButton(kb, 'c')).toBeNull();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
(0, vitest_1.describe)('_convertToTl', () => {
|
|
27
|
-
(0, vitest_1.it)('should convert reply markup', () => {
|
|
28
|
-
(0, vitest_1.expect)(keyboards_js_1.BotKeyboard._convertToTl({
|
|
29
|
-
type: 'reply',
|
|
30
|
-
buttons: [
|
|
31
|
-
[
|
|
32
|
-
{ _: 'keyboardButton', text: 'a' },
|
|
33
|
-
{ _: 'keyboardButton', text: 'b' },
|
|
34
|
-
],
|
|
35
|
-
],
|
|
36
|
-
resize: true,
|
|
37
|
-
singleUse: true,
|
|
38
|
-
selective: true,
|
|
39
|
-
persistent: true,
|
|
40
|
-
placeholder: 'whatever',
|
|
41
|
-
})).toEqual({
|
|
42
|
-
_: 'replyKeyboardMarkup',
|
|
43
|
-
rows: [
|
|
44
|
-
{
|
|
45
|
-
_: 'keyboardButtonRow',
|
|
46
|
-
buttons: [
|
|
47
|
-
{ _: 'keyboardButton', text: 'a' },
|
|
48
|
-
{ _: 'keyboardButton', text: 'b' },
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
resize: true,
|
|
53
|
-
singleUse: true,
|
|
54
|
-
selective: true,
|
|
55
|
-
persistent: true,
|
|
56
|
-
placeholder: 'whatever',
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
(0, vitest_1.it)('should convert inline markup', () => {
|
|
60
|
-
(0, vitest_1.expect)(keyboards_js_1.BotKeyboard._convertToTl({
|
|
61
|
-
type: 'inline',
|
|
62
|
-
buttons: [
|
|
63
|
-
[
|
|
64
|
-
{ _: 'keyboardButton', text: 'a' },
|
|
65
|
-
{ _: 'keyboardButton', text: 'b' },
|
|
66
|
-
],
|
|
67
|
-
],
|
|
68
|
-
})).toEqual({
|
|
69
|
-
_: 'replyInlineMarkup',
|
|
70
|
-
rows: [
|
|
71
|
-
{
|
|
72
|
-
_: 'keyboardButtonRow',
|
|
73
|
-
buttons: [
|
|
74
|
-
{ _: 'keyboardButton', text: 'a' },
|
|
75
|
-
{ _: 'keyboardButton', text: 'b' },
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
(0, vitest_1.it)('should convert reply hide markup', () => {
|
|
82
|
-
(0, vitest_1.expect)(keyboards_js_1.BotKeyboard._convertToTl({
|
|
83
|
-
type: 'reply_hide',
|
|
84
|
-
selective: true,
|
|
85
|
-
})).toEqual({
|
|
86
|
-
_: 'replyKeyboardHide',
|
|
87
|
-
selective: true,
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
(0, vitest_1.it)('should convert force reply markup', () => {
|
|
91
|
-
(0, vitest_1.expect)(keyboards_js_1.BotKeyboard._convertToTl({
|
|
92
|
-
type: 'force_reply',
|
|
93
|
-
selective: true,
|
|
94
|
-
})).toEqual({
|
|
95
|
-
_: 'replyKeyboardForceReply',
|
|
96
|
-
selective: true,
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
(0, vitest_1.describe)('webview', () => {
|
|
100
|
-
(0, vitest_1.it)('should replace keyboardButtonWebView with keyboardButtonSimpleWebView for reply keyboards', () => {
|
|
101
|
-
(0, vitest_1.expect)(keyboards_js_1.BotKeyboard._convertToTl({
|
|
102
|
-
type: 'reply',
|
|
103
|
-
buttons: [
|
|
104
|
-
[
|
|
105
|
-
{ _: 'keyboardButtonWebView', text: 'a', url: 'https://google.com' },
|
|
106
|
-
{ _: 'keyboardButtonWebView', text: 'b', url: 'https://google.com' },
|
|
107
|
-
],
|
|
108
|
-
],
|
|
109
|
-
})).toEqual({
|
|
110
|
-
_: 'replyKeyboardMarkup',
|
|
111
|
-
rows: [
|
|
112
|
-
{
|
|
113
|
-
_: 'keyboardButtonRow',
|
|
114
|
-
buttons: [
|
|
115
|
-
{ _: 'keyboardButtonSimpleWebView', text: 'a', url: 'https://google.com' },
|
|
116
|
-
{ _: 'keyboardButtonSimpleWebView', text: 'b', url: 'https://google.com' },
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
(0, vitest_1.it)('should keep keyboardButtonWebView for inline keyboards', () => {
|
|
123
|
-
(0, vitest_1.expect)(keyboards_js_1.BotKeyboard._convertToTl({
|
|
124
|
-
type: 'inline',
|
|
125
|
-
buttons: [
|
|
126
|
-
[
|
|
127
|
-
{ _: 'keyboardButtonWebView', text: 'a', url: 'https://google.com' },
|
|
128
|
-
{ _: 'keyboardButtonWebView', text: 'b', url: 'https://google.com' },
|
|
129
|
-
],
|
|
130
|
-
],
|
|
131
|
-
})).toEqual({
|
|
132
|
-
_: 'replyInlineMarkup',
|
|
133
|
-
rows: [
|
|
134
|
-
{
|
|
135
|
-
_: 'keyboardButtonRow',
|
|
136
|
-
buttons: [
|
|
137
|
-
{ _: 'keyboardButtonWebView', text: 'a', url: 'https://google.com' },
|
|
138
|
-
{ _: 'keyboardButtonWebView', text: 'b', url: 'https://google.com' },
|
|
139
|
-
],
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
//# sourceMappingURL=keyboards.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyboards.test.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/bots/keyboards.test.ts"],"names":[],"mappings":";;AAAA,mCAA6C;AAI7C,iDAA4C;AAE5C,IAAA,iBAAQ,EAAC,YAAY,EAAE,GAAG,EAAE;IACxB,MAAM,EAAE,GAA8B;QAClC,CAAC,EAAE,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QACtC,CAAC,EAAE,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QACpC,CAAC,EAAE,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;KACvC,CAAA;IAED,IAAA,WAAE,EAAC,6BAA6B,EAAE,GAAG,EAAE;QACnC,IAAA,eAAM,EAAC,0BAAW,CAAC,UAAU,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC;YAC5C,CAAC,EAAE,gBAAgB;YACnB,IAAI,EAAE,GAAG;SACZ,CAAC,CAAA;QACF,IAAA,eAAM,EAAC,0BAAW,CAAC,UAAU,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IACtD,CAAC,CAAC,CAAA;IAEF,IAAA,WAAE,EAAC,kCAAkC,EAAE,GAAG,EAAE;QACxC,IAAA,eAAM,EAAC,0BAAW,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC;YACxE,CAAC,EAAE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C,CAAA;QACN,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA","sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport { tl } from '@mtcute/tl'\n\nimport { BotKeyboard } from './keyboards.js'\n\ndescribe('findButton', () => {\n const kb: tl.TypeKeyboardButton[][] = [\n [{ _: 'keyboardButton', text: 'aaa' }],\n [{ _: 'keyboardButton', text: 'a' }],\n [{ _: 'keyboardButton', text: 'b' }],\n ]\n\n it('should find buttons by text', () => {\n expect(BotKeyboard.findButton(kb, 'a')).toEqual({\n _: 'keyboardButton',\n text: 'a',\n })\n expect(BotKeyboard.findButton(kb, 'c')).toBeNull()\n })\n\n it('should find buttons by predicate', () => {\n expect(BotKeyboard.findButton(kb, (s) => s._ === 'keyboardButton')).toEqual({\n _: 'keyboardButton',\n text: 'aaa',\n })\n expect(BotKeyboard.findButton(kb, 'c')).toBeNull()\n })\n})\n\ndescribe('_convertToTl', () => {\n it('should convert reply markup', () => {\n expect(\n BotKeyboard._convertToTl({\n type: 'reply',\n buttons: [\n [\n { _: 'keyboardButton', text: 'a' },\n { _: 'keyboardButton', text: 'b' },\n ],\n ],\n resize: true,\n singleUse: true,\n selective: true,\n persistent: true,\n placeholder: 'whatever',\n }),\n ).toEqual({\n _: 'replyKeyboardMarkup',\n rows: [\n {\n _: 'keyboardButtonRow',\n buttons: [\n { _: 'keyboardButton', text: 'a' },\n { _: 'keyboardButton', text: 'b' },\n ],\n },\n ],\n resize: true,\n singleUse: true,\n selective: true,\n persistent: true,\n placeholder: 'whatever',\n })\n })\n\n it('should convert inline markup', () => {\n expect(\n BotKeyboard._convertToTl({\n type: 'inline',\n buttons: [\n [\n { _: 'keyboardButton', text: 'a' },\n { _: 'keyboardButton', text: 'b' },\n ],\n ],\n }),\n ).toEqual({\n _: 'replyInlineMarkup',\n rows: [\n {\n _: 'keyboardButtonRow',\n buttons: [\n { _: 'keyboardButton', text: 'a' },\n { _: 'keyboardButton', text: 'b' },\n ],\n },\n ],\n })\n })\n\n it('should convert reply hide markup', () => {\n expect(\n BotKeyboard._convertToTl({\n type: 'reply_hide',\n selective: true,\n }),\n ).toEqual({\n _: 'replyKeyboardHide',\n selective: true,\n })\n })\n\n it('should convert force reply markup', () => {\n expect(\n BotKeyboard._convertToTl({\n type: 'force_reply',\n selective: true,\n }),\n ).toEqual({\n _: 'replyKeyboardForceReply',\n selective: true,\n })\n })\n\n describe('webview', () => {\n it('should replace keyboardButtonWebView with keyboardButtonSimpleWebView for reply keyboards', () => {\n expect(\n BotKeyboard._convertToTl({\n type: 'reply',\n buttons: [\n [\n { _: 'keyboardButtonWebView', text: 'a', url: 'https://google.com' },\n { _: 'keyboardButtonWebView', text: 'b', url: 'https://google.com' },\n ],\n ],\n }),\n ).toEqual({\n _: 'replyKeyboardMarkup',\n rows: [\n {\n _: 'keyboardButtonRow',\n buttons: [\n { _: 'keyboardButtonSimpleWebView', text: 'a', url: 'https://google.com' },\n { _: 'keyboardButtonSimpleWebView', text: 'b', url: 'https://google.com' },\n ],\n },\n ],\n })\n })\n\n it('should keep keyboardButtonWebView for inline keyboards', () => {\n expect(\n BotKeyboard._convertToTl({\n type: 'inline',\n buttons: [\n [\n { _: 'keyboardButtonWebView', text: 'a', url: 'https://google.com' },\n { _: 'keyboardButtonWebView', text: 'b', url: 'https://google.com' },\n ],\n ],\n }),\n ).toEqual({\n _: 'replyInlineMarkup',\n rows: [\n {\n _: 'keyboardButtonRow',\n buttons: [\n { _: 'keyboardButtonWebView', text: 'a', url: 'https://google.com' },\n { _: 'keyboardButtonWebView', text: 'b', url: 'https://google.com' },\n ],\n },\n ],\n })\n })\n })\n})\n"]}
|