@mtcute/core 0.11.0 → 0.12.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/cjs/highlevel/client.d.ts +198 -18
- package/cjs/highlevel/client.js +53 -0
- package/cjs/highlevel/client.js.map +1 -1
- package/cjs/highlevel/methods/_imports.js.map +1 -1
- package/cjs/highlevel/methods/auth/utils.d.ts +3 -0
- package/cjs/highlevel/methods/bots/normalize-command-scope.d.ts +5 -1
- package/cjs/highlevel/methods/chats/batched-queries.d.ts +10 -1
- package/cjs/highlevel/methods/chats/get-full-chat.d.ts +2 -2
- package/cjs/highlevel/methods/chats/get-full-chat.js +1 -1
- package/cjs/highlevel/methods/chats/get-full-chat.js.map +1 -1
- package/cjs/highlevel/methods/dialogs/get-folders.d.ts +3 -0
- package/cjs/highlevel/methods/files/normalize-file-to-document.d.ts +9 -1
- package/cjs/highlevel/methods/files/normalize-input-media.d.ts +1 -0
- package/cjs/highlevel/methods/files/normalize-input-media.js +11 -10
- package/cjs/highlevel/methods/files/normalize-input-media.js.map +1 -1
- package/cjs/highlevel/methods/messages/_business-connection.d.ts +7 -0
- package/cjs/highlevel/methods/messages/_business-connection.js +42 -0
- package/cjs/highlevel/methods/messages/_business-connection.js.map +1 -0
- package/cjs/highlevel/methods/messages/close-poll.js +1 -1
- package/cjs/highlevel/methods/messages/close-poll.js.map +1 -1
- package/cjs/highlevel/methods/messages/edit-message.d.ts +1 -0
- package/cjs/highlevel/methods/messages/edit-message.js +2 -1
- package/cjs/highlevel/methods/messages/edit-message.js.map +1 -1
- package/cjs/highlevel/methods/messages/find-in-update.d.ts +13 -1
- package/cjs/highlevel/methods/messages/find-in-update.js +7 -2
- package/cjs/highlevel/methods/messages/find-in-update.js.map +1 -1
- package/cjs/highlevel/methods/messages/forward-messages.d.ts +5 -0
- package/cjs/highlevel/methods/messages/forward-messages.js +2 -0
- package/cjs/highlevel/methods/messages/forward-messages.js.map +1 -1
- package/cjs/highlevel/methods/messages/get-all-scheduled-messages.d.ts +8 -0
- package/cjs/highlevel/methods/messages/get-all-scheduled-messages.js +32 -0
- package/cjs/highlevel/methods/messages/get-all-scheduled-messages.js.map +1 -0
- package/cjs/highlevel/methods/messages/get-discussion-message.d.ts +4 -0
- package/cjs/highlevel/methods/messages/iter-search-global.js +2 -1
- package/cjs/highlevel/methods/messages/iter-search-global.js.map +1 -1
- package/cjs/highlevel/methods/messages/search-global.d.ts +4 -0
- package/cjs/highlevel/methods/messages/search-global.js +2 -1
- package/cjs/highlevel/methods/messages/search-global.js.map +1 -1
- package/cjs/highlevel/methods/messages/send-common.d.ts +28 -0
- package/cjs/highlevel/methods/messages/send-common.js +21 -1
- package/cjs/highlevel/methods/messages/send-common.js.map +1 -1
- package/cjs/highlevel/methods/messages/send-media-group.js +5 -2
- package/cjs/highlevel/methods/messages/send-media-group.js.map +1 -1
- package/cjs/highlevel/methods/messages/send-media.js +4 -2
- package/cjs/highlevel/methods/messages/send-media.js.map +1 -1
- package/cjs/highlevel/methods/messages/send-text.js +4 -2
- package/cjs/highlevel/methods/messages/send-text.js.map +1 -1
- package/cjs/highlevel/methods/messages/send-typing.d.ts +4 -0
- package/cjs/highlevel/methods/messages/send-typing.js +2 -1
- package/cjs/highlevel/methods/messages/send-typing.js.map +1 -1
- package/cjs/highlevel/methods/misc/chain-id.d.ts +4 -1
- package/cjs/highlevel/methods/misc/get-collectible-info.d.ts +6 -0
- package/cjs/highlevel/methods/misc/get-collectible-info.js +26 -0
- package/cjs/highlevel/methods/misc/get-collectible-info.js.map +1 -0
- package/cjs/highlevel/methods/misc/normalize-text.d.ts +5 -1
- package/cjs/highlevel/methods/premium/create-business-chat-link.d.ts +12 -0
- package/cjs/highlevel/methods/premium/create-business-chat-link.js +26 -0
- package/cjs/highlevel/methods/premium/create-business-chat-link.js.map +1 -0
- package/cjs/highlevel/methods/premium/edit-business-chat-link.d.ts +20 -0
- package/cjs/highlevel/methods/premium/edit-business-chat-link.js +42 -0
- package/cjs/highlevel/methods/premium/edit-business-chat-link.js.map +1 -0
- package/cjs/highlevel/methods/premium/get-business-chat-links.d.ts +6 -0
- package/cjs/highlevel/methods/premium/get-business-chat-links.js +14 -0
- package/cjs/highlevel/methods/premium/get-business-chat-links.js.map +1 -0
- package/cjs/highlevel/methods/premium/get-business-connection.d.ts +8 -0
- package/cjs/highlevel/methods/premium/get-business-connection.js +25 -0
- package/cjs/highlevel/methods/premium/get-business-connection.js.map +1 -0
- package/cjs/highlevel/methods/premium/set-business-intro.d.ts +22 -0
- package/cjs/highlevel/methods/premium/set-business-intro.js +42 -0
- package/cjs/highlevel/methods/premium/set-business-intro.js.map +1 -0
- package/cjs/highlevel/methods/premium/set-business-work-hours.d.ts +18 -0
- package/cjs/highlevel/methods/premium/set-business-work-hours.js +33 -0
- package/cjs/highlevel/methods/premium/set-business-work-hours.js.map +1 -0
- package/cjs/highlevel/methods/stickers/_utils.d.ts +10 -0
- package/cjs/highlevel/methods/stickers/_utils.js +27 -0
- package/cjs/highlevel/methods/stickers/_utils.js.map +1 -0
- package/cjs/highlevel/methods/stickers/add-sticker-to-set.d.ts +1 -2
- package/cjs/highlevel/methods/stickers/add-sticker-to-set.js +3 -17
- package/cjs/highlevel/methods/stickers/add-sticker-to-set.js.map +1 -1
- package/cjs/highlevel/methods/stickers/create-sticker-set.d.ts +0 -3
- package/cjs/highlevel/methods/stickers/create-sticker-set.js +2 -19
- package/cjs/highlevel/methods/stickers/create-sticker-set.js.map +1 -1
- package/cjs/highlevel/methods/stickers/delete-sticker-from-set.d.ts +1 -2
- package/cjs/highlevel/methods/stickers/delete-sticker-from-set.js +1 -2
- package/cjs/highlevel/methods/stickers/delete-sticker-from-set.js.map +1 -1
- package/cjs/highlevel/methods/stickers/get-installed-stickers.d.ts +1 -2
- package/cjs/highlevel/methods/stickers/get-installed-stickers.js +1 -2
- package/cjs/highlevel/methods/stickers/get-installed-stickers.js.map +1 -1
- package/cjs/highlevel/methods/stickers/get-my-sticker-sets.d.ts +13 -0
- package/cjs/highlevel/methods/stickers/get-my-sticker-sets.js +24 -0
- package/cjs/highlevel/methods/stickers/get-my-sticker-sets.js.map +1 -0
- package/cjs/highlevel/methods/stickers/get-sticker-set.d.ts +2 -2
- package/cjs/highlevel/methods/stickers/get-sticker-set.js +2 -2
- package/cjs/highlevel/methods/stickers/get-sticker-set.js.map +1 -1
- package/cjs/highlevel/methods/stickers/move-sticker-in-set.d.ts +2 -3
- package/cjs/highlevel/methods/stickers/move-sticker-in-set.js +2 -3
- package/cjs/highlevel/methods/stickers/move-sticker-in-set.js.map +1 -1
- package/cjs/highlevel/methods/stickers/replace-sticker-in-set.d.ts +24 -0
- package/cjs/highlevel/methods/stickers/replace-sticker-in-set.js +32 -0
- package/cjs/highlevel/methods/stickers/replace-sticker-in-set.js.map +1 -0
- package/cjs/highlevel/methods/stories/find-in-update.d.ts +5 -1
- package/cjs/highlevel/methods/users/set-my-birthday.d.ts +12 -0
- package/cjs/highlevel/methods/users/set-my-birthday.js +22 -0
- package/cjs/highlevel/methods/users/set-my-birthday.js.map +1 -0
- package/cjs/highlevel/methods.d.ts +12 -0
- package/cjs/highlevel/methods.js +33 -3
- package/cjs/highlevel/methods.js.map +1 -1
- package/cjs/highlevel/storage/storage.d.ts +7 -2
- package/cjs/highlevel/types/auth/sent-code.d.ts +7 -2
- package/cjs/highlevel/types/auth/sent-code.js +14 -0
- package/cjs/highlevel/types/auth/sent-code.js.map +1 -1
- package/cjs/highlevel/types/bots/inline-message/factories.d.ts +5 -1
- package/cjs/highlevel/types/bots/inline-result/factories.d.ts +4 -1
- package/cjs/highlevel/types/bots/keyboards/factories.d.ts +7 -1
- package/cjs/highlevel/types/calls/discard-reason.d.ts +5 -0
- package/cjs/highlevel/types/files/uploaded-file.d.ts +2 -0
- package/cjs/highlevel/types/files/utils.d.ts +6 -5
- package/cjs/highlevel/types/files/utils.js.map +1 -1
- package/cjs/highlevel/types/media/document-utils.d.ts +5 -0
- package/cjs/highlevel/types/media/document-utils.js +9 -2
- package/cjs/highlevel/types/media/document-utils.js.map +1 -1
- package/cjs/highlevel/types/media/input-media/types.d.ts +2 -2
- package/cjs/highlevel/types/media/input-media/types.js.map +1 -1
- package/cjs/highlevel/types/media/poll.d.ts +17 -6
- package/cjs/highlevel/types/media/poll.js +65 -18
- package/cjs/highlevel/types/media/poll.js.map +1 -1
- package/cjs/highlevel/types/messages/dialog.js +1 -12
- package/cjs/highlevel/types/messages/dialog.js.map +1 -1
- package/cjs/highlevel/types/messages/input-message-id.d.ts +5 -0
- package/cjs/highlevel/types/messages/message-action.d.ts +19 -2
- package/cjs/highlevel/types/messages/message-action.js +6 -0
- package/cjs/highlevel/types/messages/message-action.js.map +1 -1
- package/cjs/highlevel/types/messages/message-media.d.ts +4 -0
- package/cjs/highlevel/types/messages/message.d.ts +59 -1
- package/cjs/highlevel/types/messages/message.js +96 -1
- package/cjs/highlevel/types/messages/message.js.map +1 -1
- package/cjs/highlevel/types/misc/collectible-info.d.ts +27 -0
- package/cjs/highlevel/types/misc/collectible-info.js +46 -0
- package/cjs/highlevel/types/misc/collectible-info.js.map +1 -0
- package/cjs/highlevel/types/misc/entities.d.ts +7 -0
- package/cjs/highlevel/types/misc/entities.js +15 -0
- package/cjs/highlevel/types/misc/entities.js.map +1 -1
- package/cjs/highlevel/types/misc/index.d.ts +1 -0
- package/cjs/highlevel/types/misc/index.js +1 -0
- package/cjs/highlevel/types/misc/index.js.map +1 -1
- package/cjs/highlevel/types/misc/sticker-set.d.ts +8 -1
- package/cjs/highlevel/types/misc/sticker-set.js +36 -5
- package/cjs/highlevel/types/misc/sticker-set.js.map +1 -1
- package/cjs/highlevel/types/peers/chat-event/actions.d.ts +3 -0
- package/cjs/highlevel/types/peers/chat-event/filters.d.ts +2 -0
- package/cjs/highlevel/types/peers/chat.d.ts +7 -93
- package/cjs/highlevel/types/peers/chat.js +2 -195
- package/cjs/highlevel/types/peers/chat.js.map +1 -1
- package/cjs/highlevel/types/peers/full-chat.d.ts +103 -0
- package/cjs/highlevel/types/peers/full-chat.js +237 -0
- package/cjs/highlevel/types/peers/full-chat.js.map +1 -0
- package/cjs/highlevel/types/peers/index.d.ts +1 -0
- package/cjs/highlevel/types/peers/index.js +1 -0
- package/cjs/highlevel/types/peers/index.js.map +1 -1
- package/cjs/highlevel/types/peers/user.d.ts +5 -0
- package/cjs/highlevel/types/peers/user.js +7 -0
- package/cjs/highlevel/types/peers/user.js.map +1 -1
- package/cjs/highlevel/types/premium/business-account.d.ts +19 -0
- package/cjs/highlevel/types/premium/business-account.js +45 -0
- package/cjs/highlevel/types/premium/business-account.js.map +1 -0
- package/cjs/highlevel/types/premium/business-chat-link.d.ts +19 -0
- package/cjs/highlevel/types/premium/business-chat-link.js +39 -0
- package/cjs/highlevel/types/premium/business-chat-link.js.map +1 -0
- package/cjs/highlevel/types/premium/business-connection.d.ts +23 -0
- package/cjs/highlevel/types/premium/business-connection.js +45 -0
- package/cjs/highlevel/types/premium/business-connection.js.map +1 -0
- package/cjs/highlevel/types/premium/business-intro.d.ts +22 -0
- package/cjs/highlevel/types/premium/business-intro.js +43 -0
- package/cjs/highlevel/types/premium/business-intro.js.map +1 -0
- package/cjs/highlevel/types/premium/business-location.d.ts +10 -0
- package/cjs/highlevel/types/premium/business-location.js +26 -0
- package/cjs/highlevel/types/premium/business-location.js.map +1 -0
- package/cjs/highlevel/types/premium/business-work-hours.d.ts +42 -0
- package/cjs/highlevel/types/premium/business-work-hours.js +141 -0
- package/cjs/highlevel/types/premium/business-work-hours.js.map +1 -0
- package/cjs/highlevel/types/premium/index.d.ts +5 -0
- package/cjs/highlevel/types/premium/index.js +5 -0
- package/cjs/highlevel/types/premium/index.js.map +1 -1
- package/cjs/highlevel/types/updates/business-message.d.ts +18 -0
- package/cjs/highlevel/types/updates/business-message.js +35 -0
- package/cjs/highlevel/types/updates/business-message.js.map +1 -0
- package/cjs/highlevel/types/updates/delete-business-message-update.d.ts +21 -0
- package/cjs/highlevel/types/updates/delete-business-message-update.js +37 -0
- package/cjs/highlevel/types/updates/delete-business-message-update.js.map +1 -0
- package/cjs/highlevel/types/updates/index.d.ts +19 -2
- package/cjs/highlevel/types/updates/index.js +5 -1
- package/cjs/highlevel/types/updates/index.js.map +1 -1
- package/cjs/highlevel/types/updates/parse-update.d.ts +4 -1
- package/cjs/highlevel/types/updates/parse-update.js +8 -0
- package/cjs/highlevel/types/updates/parse-update.js.map +1 -1
- package/cjs/highlevel/types/updates/poll-update.js +2 -2
- package/cjs/highlevel/types/updates/poll-update.js.map +1 -1
- package/cjs/highlevel/updates/manager.d.ts +0 -1
- package/cjs/highlevel/updates/manager.js +7 -2
- package/cjs/highlevel/updates/manager.js.map +1 -1
- package/cjs/highlevel/updates/parsed.js +8 -2
- package/cjs/highlevel/updates/parsed.js.map +1 -1
- package/cjs/highlevel/updates/types.d.ts +57 -0
- package/cjs/highlevel/updates/utils.d.ts +2 -0
- package/cjs/highlevel/utils/inspectable.js +7 -0
- package/cjs/highlevel/utils/inspectable.js.map +1 -1
- package/cjs/highlevel/worker/index.js +6 -0
- package/cjs/highlevel/worker/protocol.d.ts +0 -1
- package/cjs/index.js +6 -0
- package/cjs/network/client.d.ts +0 -1
- package/cjs/network/mtproto-session.d.ts +0 -1
- package/cjs/network/multi-session-connection.d.ts +0 -1
- package/cjs/network/network-manager.d.ts +8 -0
- package/cjs/network/network-manager.js +9 -4
- package/cjs/network/network-manager.js.map +1 -1
- package/cjs/network/persistent-connection.d.ts +0 -1
- package/cjs/network/session-connection.js +10 -0
- package/cjs/network/session-connection.js.map +1 -1
- package/cjs/network/transports/abstract.d.ts +0 -1
- package/cjs/network/transports/streamed.d.ts +0 -1
- package/cjs/network/transports/wrapped.d.ts +0 -1
- package/cjs/platform.js +6 -0
- package/cjs/storage/sqlite/repository/peers.js +1 -2
- package/cjs/storage/sqlite/repository/peers.js.map +1 -1
- package/cjs/storage/storage.d.ts +21 -0
- package/cjs/types/utils.d.ts +1 -0
- package/cjs/types/utils.js.map +1 -1
- package/cjs/utils/index.js +6 -0
- package/cjs/utils/reloadable.d.ts +0 -1
- package/client.d.ts +1 -0
- package/client.js +1 -0
- package/esm/highlevel/client.d.ts +198 -18
- package/esm/highlevel/client.js +47 -0
- package/esm/highlevel/client.js.map +1 -1
- package/esm/highlevel/methods/_imports.js.map +1 -1
- package/esm/highlevel/methods/auth/utils.d.ts +3 -0
- package/esm/highlevel/methods/bots/normalize-command-scope.d.ts +5 -1
- package/esm/highlevel/methods/chats/batched-queries.d.ts +10 -1
- package/esm/highlevel/methods/chats/get-full-chat.d.ts +2 -2
- package/esm/highlevel/methods/chats/get-full-chat.js +2 -2
- package/esm/highlevel/methods/chats/get-full-chat.js.map +1 -1
- package/esm/highlevel/methods/dialogs/get-folders.d.ts +3 -0
- package/esm/highlevel/methods/files/normalize-file-to-document.d.ts +9 -1
- package/esm/highlevel/methods/files/normalize-input-media.d.ts +1 -0
- package/esm/highlevel/methods/files/normalize-input-media.js +11 -10
- package/esm/highlevel/methods/files/normalize-input-media.js.map +1 -1
- package/esm/highlevel/methods/messages/_business-connection.d.ts +7 -0
- package/esm/highlevel/methods/messages/_business-connection.js +38 -0
- package/esm/highlevel/methods/messages/_business-connection.js.map +1 -0
- package/esm/highlevel/methods/messages/close-poll.js +1 -1
- package/esm/highlevel/methods/messages/close-poll.js.map +1 -1
- package/esm/highlevel/methods/messages/edit-message.d.ts +1 -0
- package/esm/highlevel/methods/messages/edit-message.js +2 -1
- package/esm/highlevel/methods/messages/edit-message.js.map +1 -1
- package/esm/highlevel/methods/messages/find-in-update.d.ts +13 -1
- package/esm/highlevel/methods/messages/find-in-update.js +7 -2
- package/esm/highlevel/methods/messages/find-in-update.js.map +1 -1
- package/esm/highlevel/methods/messages/forward-messages.d.ts +5 -0
- package/esm/highlevel/methods/messages/forward-messages.js +2 -0
- package/esm/highlevel/methods/messages/forward-messages.js.map +1 -1
- package/esm/highlevel/methods/messages/get-all-scheduled-messages.d.ts +8 -0
- package/esm/highlevel/methods/messages/get-all-scheduled-messages.js +25 -0
- package/esm/highlevel/methods/messages/get-all-scheduled-messages.js.map +1 -0
- package/esm/highlevel/methods/messages/get-discussion-message.d.ts +4 -0
- package/esm/highlevel/methods/messages/iter-search-global.js +2 -1
- package/esm/highlevel/methods/messages/iter-search-global.js.map +1 -1
- package/esm/highlevel/methods/messages/search-global.d.ts +4 -0
- package/esm/highlevel/methods/messages/search-global.js +2 -1
- package/esm/highlevel/methods/messages/search-global.js.map +1 -1
- package/esm/highlevel/methods/messages/send-common.d.ts +28 -0
- package/esm/highlevel/methods/messages/send-common.js +19 -0
- package/esm/highlevel/methods/messages/send-common.js.map +1 -1
- package/esm/highlevel/methods/messages/send-media-group.js +5 -2
- package/esm/highlevel/methods/messages/send-media-group.js.map +1 -1
- package/esm/highlevel/methods/messages/send-media.js +4 -2
- package/esm/highlevel/methods/messages/send-media.js.map +1 -1
- package/esm/highlevel/methods/messages/send-text.js +4 -2
- package/esm/highlevel/methods/messages/send-text.js.map +1 -1
- package/esm/highlevel/methods/messages/send-typing.d.ts +4 -0
- package/esm/highlevel/methods/messages/send-typing.js +2 -1
- package/esm/highlevel/methods/messages/send-typing.js.map +1 -1
- package/esm/highlevel/methods/misc/chain-id.d.ts +4 -1
- package/esm/highlevel/methods/misc/get-collectible-info.d.ts +6 -0
- package/esm/highlevel/methods/misc/get-collectible-info.js +22 -0
- package/esm/highlevel/methods/misc/get-collectible-info.js.map +1 -0
- package/esm/highlevel/methods/misc/normalize-text.d.ts +5 -1
- package/esm/highlevel/methods/premium/create-business-chat-link.d.ts +12 -0
- package/esm/highlevel/methods/premium/create-business-chat-link.js +22 -0
- package/esm/highlevel/methods/premium/create-business-chat-link.js.map +1 -0
- package/esm/highlevel/methods/premium/edit-business-chat-link.d.ts +20 -0
- package/esm/highlevel/methods/premium/edit-business-chat-link.js +37 -0
- package/esm/highlevel/methods/premium/edit-business-chat-link.js.map +1 -0
- package/esm/highlevel/methods/premium/get-business-chat-links.d.ts +6 -0
- package/esm/highlevel/methods/premium/get-business-chat-links.js +10 -0
- package/esm/highlevel/methods/premium/get-business-chat-links.js.map +1 -0
- package/esm/highlevel/methods/premium/get-business-connection.d.ts +8 -0
- package/esm/highlevel/methods/premium/get-business-connection.js +21 -0
- package/esm/highlevel/methods/premium/get-business-connection.js.map +1 -0
- package/esm/highlevel/methods/premium/set-business-intro.d.ts +22 -0
- package/esm/highlevel/methods/premium/set-business-intro.js +38 -0
- package/esm/highlevel/methods/premium/set-business-intro.js.map +1 -0
- package/esm/highlevel/methods/premium/set-business-work-hours.d.ts +18 -0
- package/esm/highlevel/methods/premium/set-business-work-hours.js +29 -0
- package/esm/highlevel/methods/premium/set-business-work-hours.js.map +1 -0
- package/esm/highlevel/methods/stickers/_utils.d.ts +10 -0
- package/esm/highlevel/methods/stickers/_utils.js +23 -0
- package/esm/highlevel/methods/stickers/_utils.js.map +1 -0
- package/esm/highlevel/methods/stickers/add-sticker-to-set.d.ts +1 -2
- package/esm/highlevel/methods/stickers/add-sticker-to-set.js +4 -18
- package/esm/highlevel/methods/stickers/add-sticker-to-set.js.map +1 -1
- package/esm/highlevel/methods/stickers/create-sticker-set.d.ts +0 -3
- package/esm/highlevel/methods/stickers/create-sticker-set.js +3 -20
- package/esm/highlevel/methods/stickers/create-sticker-set.js.map +1 -1
- package/esm/highlevel/methods/stickers/delete-sticker-from-set.d.ts +1 -2
- package/esm/highlevel/methods/stickers/delete-sticker-from-set.js +1 -2
- package/esm/highlevel/methods/stickers/delete-sticker-from-set.js.map +1 -1
- package/esm/highlevel/methods/stickers/get-installed-stickers.d.ts +1 -2
- package/esm/highlevel/methods/stickers/get-installed-stickers.js +1 -2
- package/esm/highlevel/methods/stickers/get-installed-stickers.js.map +1 -1
- package/esm/highlevel/methods/stickers/get-my-sticker-sets.d.ts +13 -0
- package/esm/highlevel/methods/stickers/get-my-sticker-sets.js +17 -0
- package/esm/highlevel/methods/stickers/get-my-sticker-sets.js.map +1 -0
- package/esm/highlevel/methods/stickers/get-sticker-set.d.ts +2 -2
- package/esm/highlevel/methods/stickers/get-sticker-set.js +2 -2
- package/esm/highlevel/methods/stickers/get-sticker-set.js.map +1 -1
- package/esm/highlevel/methods/stickers/move-sticker-in-set.d.ts +2 -3
- package/esm/highlevel/methods/stickers/move-sticker-in-set.js +2 -3
- package/esm/highlevel/methods/stickers/move-sticker-in-set.js.map +1 -1
- package/esm/highlevel/methods/stickers/replace-sticker-in-set.d.ts +24 -0
- package/esm/highlevel/methods/stickers/replace-sticker-in-set.js +28 -0
- package/esm/highlevel/methods/stickers/replace-sticker-in-set.js.map +1 -0
- package/esm/highlevel/methods/stories/find-in-update.d.ts +5 -1
- package/esm/highlevel/methods/users/set-my-birthday.d.ts +12 -0
- package/esm/highlevel/methods/users/set-my-birthday.js +18 -0
- package/esm/highlevel/methods/users/set-my-birthday.js.map +1 -0
- package/esm/highlevel/methods.d.ts +12 -0
- package/esm/highlevel/methods.js +12 -0
- package/esm/highlevel/methods.js.map +1 -1
- package/esm/highlevel/storage/storage.d.ts +7 -2
- package/esm/highlevel/types/auth/sent-code.d.ts +7 -2
- package/esm/highlevel/types/auth/sent-code.js +14 -0
- package/esm/highlevel/types/auth/sent-code.js.map +1 -1
- package/esm/highlevel/types/bots/inline-message/factories.d.ts +5 -1
- package/esm/highlevel/types/bots/inline-result/factories.d.ts +4 -1
- package/esm/highlevel/types/bots/keyboards/factories.d.ts +7 -1
- package/esm/highlevel/types/calls/discard-reason.d.ts +5 -0
- package/esm/highlevel/types/files/uploaded-file.d.ts +2 -0
- package/esm/highlevel/types/files/utils.d.ts +6 -5
- package/esm/highlevel/types/files/utils.js.map +1 -1
- package/esm/highlevel/types/media/document-utils.d.ts +5 -0
- package/esm/highlevel/types/media/document-utils.js +7 -1
- package/esm/highlevel/types/media/document-utils.js.map +1 -1
- package/esm/highlevel/types/media/input-media/types.d.ts +2 -2
- package/esm/highlevel/types/media/input-media/types.js.map +1 -1
- package/esm/highlevel/types/media/poll.d.ts +17 -6
- package/esm/highlevel/types/media/poll.js +64 -17
- package/esm/highlevel/types/media/poll.js.map +1 -1
- package/esm/highlevel/types/messages/dialog.js +1 -12
- package/esm/highlevel/types/messages/dialog.js.map +1 -1
- package/esm/highlevel/types/messages/input-message-id.d.ts +5 -0
- package/esm/highlevel/types/messages/message-action.d.ts +19 -2
- package/esm/highlevel/types/messages/message-action.js +6 -0
- package/esm/highlevel/types/messages/message-action.js.map +1 -1
- package/esm/highlevel/types/messages/message-media.d.ts +4 -0
- package/esm/highlevel/types/messages/message.d.ts +59 -1
- package/esm/highlevel/types/messages/message.js +96 -1
- package/esm/highlevel/types/messages/message.js.map +1 -1
- package/esm/highlevel/types/misc/collectible-info.d.ts +27 -0
- package/esm/highlevel/types/misc/collectible-info.js +43 -0
- package/esm/highlevel/types/misc/collectible-info.js.map +1 -0
- package/esm/highlevel/types/misc/entities.d.ts +7 -0
- package/esm/highlevel/types/misc/entities.js +13 -1
- package/esm/highlevel/types/misc/entities.js.map +1 -1
- package/esm/highlevel/types/misc/index.d.ts +1 -0
- package/esm/highlevel/types/misc/index.js +1 -0
- package/esm/highlevel/types/misc/index.js.map +1 -1
- package/esm/highlevel/types/misc/sticker-set.d.ts +8 -1
- package/esm/highlevel/types/misc/sticker-set.js +38 -7
- package/esm/highlevel/types/misc/sticker-set.js.map +1 -1
- package/esm/highlevel/types/peers/chat-event/actions.d.ts +3 -0
- package/esm/highlevel/types/peers/chat-event/filters.d.ts +2 -0
- package/esm/highlevel/types/peers/chat.d.ts +7 -93
- package/esm/highlevel/types/peers/chat.js +2 -195
- package/esm/highlevel/types/peers/chat.js.map +1 -1
- package/esm/highlevel/types/peers/full-chat.d.ts +103 -0
- package/esm/highlevel/types/peers/full-chat.js +234 -0
- package/esm/highlevel/types/peers/full-chat.js.map +1 -0
- package/esm/highlevel/types/peers/index.d.ts +1 -0
- package/esm/highlevel/types/peers/index.js +1 -0
- package/esm/highlevel/types/peers/index.js.map +1 -1
- package/esm/highlevel/types/peers/user.d.ts +5 -0
- package/esm/highlevel/types/peers/user.js +7 -0
- package/esm/highlevel/types/peers/user.js.map +1 -1
- package/esm/highlevel/types/premium/business-account.d.ts +19 -0
- package/esm/highlevel/types/premium/business-account.js +42 -0
- package/esm/highlevel/types/premium/business-account.js.map +1 -0
- package/esm/highlevel/types/premium/business-chat-link.d.ts +19 -0
- package/esm/highlevel/types/premium/business-chat-link.js +36 -0
- package/esm/highlevel/types/premium/business-chat-link.js.map +1 -0
- package/esm/highlevel/types/premium/business-connection.d.ts +23 -0
- package/esm/highlevel/types/premium/business-connection.js +42 -0
- package/esm/highlevel/types/premium/business-connection.js.map +1 -0
- package/esm/highlevel/types/premium/business-intro.d.ts +22 -0
- package/esm/highlevel/types/premium/business-intro.js +40 -0
- package/esm/highlevel/types/premium/business-intro.js.map +1 -0
- package/esm/highlevel/types/premium/business-location.d.ts +10 -0
- package/esm/highlevel/types/premium/business-location.js +23 -0
- package/esm/highlevel/types/premium/business-location.js.map +1 -0
- package/esm/highlevel/types/premium/business-work-hours.d.ts +42 -0
- package/esm/highlevel/types/premium/business-work-hours.js +137 -0
- package/esm/highlevel/types/premium/business-work-hours.js.map +1 -0
- package/esm/highlevel/types/premium/index.d.ts +5 -0
- package/esm/highlevel/types/premium/index.js +5 -0
- package/esm/highlevel/types/premium/index.js.map +1 -1
- package/esm/highlevel/types/updates/business-message.d.ts +18 -0
- package/esm/highlevel/types/updates/business-message.js +31 -0
- package/esm/highlevel/types/updates/business-message.js.map +1 -0
- package/esm/highlevel/types/updates/delete-business-message-update.d.ts +21 -0
- package/esm/highlevel/types/updates/delete-business-message-update.js +34 -0
- package/esm/highlevel/types/updates/delete-business-message-update.js.map +1 -0
- package/esm/highlevel/types/updates/index.d.ts +19 -2
- package/esm/highlevel/types/updates/index.js +3 -1
- package/esm/highlevel/types/updates/index.js.map +1 -1
- package/esm/highlevel/types/updates/parse-update.d.ts +4 -1
- package/esm/highlevel/types/updates/parse-update.js +9 -1
- package/esm/highlevel/types/updates/parse-update.js.map +1 -1
- package/esm/highlevel/types/updates/poll-update.js +2 -2
- package/esm/highlevel/types/updates/poll-update.js.map +1 -1
- package/esm/highlevel/updates/manager.d.ts +0 -1
- package/esm/highlevel/updates/manager.js +7 -2
- package/esm/highlevel/updates/manager.js.map +1 -1
- package/esm/highlevel/updates/parsed.js +8 -2
- package/esm/highlevel/updates/parsed.js.map +1 -1
- package/esm/highlevel/updates/types.d.ts +57 -0
- package/esm/highlevel/updates/utils.d.ts +2 -0
- package/esm/highlevel/utils/inspectable.js +4 -0
- package/esm/highlevel/utils/inspectable.js.map +1 -1
- package/esm/highlevel/worker/protocol.d.ts +0 -1
- package/esm/network/client.d.ts +0 -1
- package/esm/network/mtproto-session.d.ts +0 -1
- package/esm/network/multi-session-connection.d.ts +0 -1
- package/esm/network/network-manager.d.ts +8 -0
- package/esm/network/network-manager.js +9 -4
- package/esm/network/network-manager.js.map +1 -1
- package/esm/network/persistent-connection.d.ts +0 -1
- package/esm/network/session-connection.js +10 -0
- package/esm/network/session-connection.js.map +1 -1
- package/esm/network/transports/abstract.d.ts +0 -1
- package/esm/network/transports/streamed.d.ts +0 -1
- package/esm/network/transports/wrapped.d.ts +0 -1
- package/esm/storage/sqlite/repository/peers.js +1 -2
- package/esm/storage/sqlite/repository/peers.js.map +1 -1
- package/esm/storage/storage.d.ts +21 -0
- package/esm/types/utils.d.ts +1 -0
- package/esm/types/utils.js.map +1 -1
- package/esm/utils/reloadable.d.ts +0 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/methods.d.ts +1 -0
- package/methods.js +1 -0
- package/package.json +5 -5
- package/platform.d.ts +1 -0
- package/platform.js +1 -0
- package/utils.d.ts +1 -0
- package/utils.js +1 -0
- package/worker.d.ts +1 -0
- package/worker.js +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-action.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/messages/message-action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAqB,MAAM,mBAAmB,C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AAC,cAAc;aACpC,CAAA;QACL,KAAK,yBAAyB;YAC1B,OAAO;gBACH,IAAI,EAAE,aAAa;gBACnB,KAAK,EAAE,GAAG,CAAC,MAAM;aACpB,CAAA;QACL;YACI,OAAO,IAAI,CAAA;IACnB,CAAC;AACL,CAAC","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { _callDiscardReasonFromTl, CallDiscardReason } from '../calls/index.js'\nimport { Photo } from '../media/photo.js'\nimport { parsePeer, Peer } from '../peers/peer.js'\nimport type { Message } from './message.js'\n\n/** Group was created */\nexport interface ActionChatCreated {\n readonly type: 'chat_created'\n\n /** Group name */\n readonly title: string\n\n /** IDs of the users in the group */\n readonly users: number[]\n}\n\n/** Channel/supergroup was created */\nexport interface ActionChannelCreated {\n readonly type: 'channel_created'\n\n /** Original channel/supergroup title */\n readonly title: string\n}\n\n/** Chat was migrated to a supergroup with a given ID */\nexport interface ActionChatMigrateTo {\n readonly type: 'chat_migrate_to'\n\n /** Marked ID of the supergroup chat was migrated to */\n readonly id: number\n}\n\n/** Supergroup was migrated from a chat with a given ID */\nexport interface ActionChannelMigrateFrom {\n readonly type: 'channel_migrate_from'\n\n /** Marked ID of the chat this channel was migrated from */\n readonly id: number\n\n /** Old chat's title */\n readonly title: string\n}\n\n/**\n * A message has been pinned.\n *\n * To get the message itself, use {@link Message.getReplyTo}\n */\nexport interface ActionMessagePinned {\n readonly type: 'message_pinned'\n}\n\n/** History was cleared in a private chat. */\nexport interface ActionHistoryCleared {\n readonly type: 'history_cleared'\n}\n\n/** Someone scored in a game (usually only used for newly set high scores) */\nexport interface ActionGameScore {\n readonly type: 'game_score'\n\n /** Game ID */\n readonly gameId: tl.Long\n\n /** Score */\n readonly score: number\n}\n\n/** Contact has joined Telegram */\nexport interface ActionContactJoined {\n readonly type: 'contact_joined'\n}\n\n/** Group title was changed */\nexport interface ActionTitleChanged {\n readonly type: 'title_changed'\n\n /** New group name */\n readonly title: string\n}\n\n/** Group photo was changed */\nexport interface ActionPhotoChanged {\n readonly type: 'photo_changed'\n\n /** New group photo */\n readonly photo: Photo\n}\n\n/** Group photo was deleted */\nexport interface ActionPhotoDeleted {\n readonly type: 'photo_deleted'\n}\n\n/** Users were added to the chat */\nexport interface ActionUsersAdded {\n readonly type: 'users_added'\n\n /** IDs of the users that were added */\n readonly users: number[]\n}\n\n/** User has left the group */\nexport interface ActionUserLeft {\n readonly type: 'user_left'\n}\n\n/** User was removed from the group */\nexport interface ActionUserRemoved {\n readonly type: 'user_removed'\n\n /** ID of the user that was removed from the group */\n readonly user: number\n}\n\n/** User has joined the group via an invite link */\nexport interface ActionUserJoinedLink {\n readonly type: 'user_joined_link'\n\n /** ID of the user who created the link */\n readonly inviter: number\n}\n\n/**\n * User has joined the group via an invite link\n * and was approved by an administrator\n */\nexport interface ActionUserJoinedApproved {\n readonly type: 'user_joined_approved'\n}\n\n/** A payment was received from a user (bot) */\nexport interface ActionPaymentReceived {\n readonly type: 'payment_received'\n\n /** Three-letter ISO 4217 currency code */\n readonly currency: string\n\n /**\n * Price of the product in the smallest units of the currency\n * (integer, not float/double). For example, for a price of\n * `US$ 1.45`, `amount = 145`\n */\n readonly amount: tl.Long\n\n /** Bot specified invoice payload */\n readonly payload: Uint8Array\n\n /** Order information provided by the user */\n readonly info?: tl.TypePaymentRequestedInfo\n\n /** ID of the shipping option chosen by the user */\n readonly shippingOptionId?: string\n\n /** Payment provider ID */\n readonly charge?: tl.TypePaymentCharge\n}\n\n/** A payment was sent to a user */\nexport interface ActionPaymentSent {\n readonly type: 'payment_sent'\n\n /** Three-letter ISO 4217 currency code */\n readonly currency: string\n\n /**\n * Price of the product in the smallest units of the currency\n * (integer, not float/double). For example, for a price of\n * `US$ 1.45`, `amount = 145`\n */\n readonly amount: tl.Long\n}\n\n/** A phone call */\nexport interface ActionCall {\n readonly type: 'call'\n\n /** Call ID */\n readonly id: tl.Long\n\n /** Whether this is a video call */\n readonly isVideo: boolean\n\n /** Duration if the call in seconds (0 if not available) */\n readonly duration: number\n\n /** Call discard reason, if available */\n readonly reason?: CallDiscardReason\n}\n\n/** A screenshot was taken */\nexport interface ActionScreenshotTaken {\n readonly type: 'screenshot_taken'\n}\n\n/** User has authorized via the bot */\nexport interface ActionBotAllowed {\n readonly type: 'bot_allowed'\n\n /** Domain where the user has logged in */\n readonly domain?: string\n}\n\n/**\n * A user is in proximity of another user\n * (see [Proximity alerts](https://core.telegram.org/api/live-location#proximity-alert))\n */\nexport interface ActionGeoProximity {\n readonly type: 'geo_proximity'\n\n /** ID of the user who sent the geolocation with proximity alerts */\n readonly targetId: number\n\n /** ID of the user who has approached `targetId` */\n readonly userId: number\n\n /** Distance between them in meters */\n readonly distance: number\n}\n\n/** Group call has started */\nexport interface ActionGroupCallStarted {\n readonly type: 'group_call_started'\n\n /** TL object representing the call */\n readonly call: tl.TypeInputGroupCall\n}\n\n/** Group call has ended */\nexport interface ActionGroupCallEnded {\n readonly type: 'group_call_ended'\n\n /** TL object representing the call */\n readonly call: tl.TypeInputGroupCall\n\n /** Duration of the call */\n readonly duration: number\n}\n\n/** Group call has been scheduled */\nexport interface ActionGroupCallScheduled {\n readonly type: 'group_call_scheduled'\n\n /** TL object representing the call */\n readonly call: tl.TypeInputGroupCall\n\n /** Date when the call will start */\n readonly date: Date\n}\n\n/** Group call has ended */\nexport interface ActionGroupInvite {\n readonly type: 'group_call_invite'\n\n /** TL object representing the call */\n readonly call: tl.TypeInputGroupCall\n\n /** IDs of the users invited to the call */\n readonly userIds: number[]\n}\n\n/** Messages TTL changed */\nexport interface ActionTtlChanged {\n readonly type: 'ttl_changed'\n\n /** New TTL period */\n readonly period: number\n}\n\n/** Forum topic was created */\nexport interface ActionTopicCreated {\n readonly type: 'topic_created'\n\n /** Title of the topic */\n title: string\n\n /** Icon color of the topic */\n iconColor: number\n\n /** Icon emoji of the topic */\n iconCustomEmoji?: tl.Long\n}\n\n/** Forum topic was modified */\nexport interface ActionTopicEdited {\n readonly type: 'topic_edited'\n\n /** New title of the topic */\n title?: string\n\n /** New icon emoji of the topic (may be empty) */\n iconCustomEmoji?: tl.Long\n\n /** Whether the topic was opened/closed */\n closed?: boolean\n\n /** Whether the topic was (un-)hidden - only for \"General\" topic (`id=1`) */\n hidden?: boolean\n}\n\n/** A non-standard action has happened in the chat */\nexport interface ActionCustom {\n readonly type: 'custom'\n\n /** Text to be shown in the interface */\n action: string\n}\n\n/** Chat theme was changed */\nexport interface ActionThemeChanged {\n readonly type: 'theme_changed'\n\n /** Emoji representing the new theme */\n emoji: string\n}\n\n/** Data was sent from a WebView (user-side action) */\nexport interface ActionWebviewDataSent {\n readonly type: 'webview_sent'\n\n /** Text of the button that was pressed to open the WebView */\n text: string\n}\n\n/** Data was received from a WebView (bot-side action) */\nexport interface ActionWebviewDataReceived {\n readonly type: 'webview_received'\n\n /** Text of the button that was pressed to open the WebView */\n text: string\n\n /** Data received from the WebView */\n data: string\n}\n\n/** Premium subscription was gifted */\nexport interface ActionPremiumGifted {\n readonly type: 'premium_gifted'\n\n /**\n * Currency in which it was paid for.\n * Three-letter ISO 4217 currency code)\n */\n currency: string\n\n /**\n * Price of the product in the smallest units of the currency\n * (integer, not float/double). For example, for a price of\n * `US$ 1.45`, `amount = 145`\n */\n amount: number\n\n /** Duration of the gifted subscription in months */\n months: number\n\n /** If the subscription was bought with crypto, information about it */\n crypto?: {\n /** Crypto currency name */\n currency: string\n /** Price in the smallest units */\n amount: number\n }\n}\n\n/** A photo has been suggested as a profile photo */\nexport interface ActionPhotoSuggested {\n readonly type: 'photo_suggested'\n\n /** Photo that was suggested */\n photo: Photo\n}\n\n/** A peer was chosen by the user after clicking on a RequestPeer button */\nexport interface ActionPeerChosen {\n readonly type: 'peer_chosen'\n\n /** ID of the button passed earlier by the bot */\n buttonId: number\n\n /** Chosen peers */\n peers: Peer[]\n}\n\n/** A wallpaper of the chathas been changed */\nexport interface ActionWallpaperChanged {\n readonly type: 'wallpaper_changed'\n\n /**\n * Whether the user has applied the same wallpaper\n * as the other party previously set in the chat\n */\n same: boolean\n\n /**\n * Whether the wallpaper was forcefully applied for\n * both sides, without explicit confirmation from the other\n * side.\n */\n forBoth: boolean\n\n /** TL object representing the new wallpaper */\n wallpaper: tl.TypeWallPaper\n}\n\n/** A Telergam Premium gift code was received */\nexport interface ActionGiftCode {\n readonly type: 'gift_code'\n\n /** Information about the gift code */\n raw: tl.RawMessageActionGiftCode\n}\n\n/** A Telergam Premium giveaway was started */\nexport interface ActionGiveawayStarted {\n readonly type: 'giveaway_started'\n}\n\n/** A Telergam Premium giveaway was ended and results are available */\nexport interface ActionGiveawayEnded {\n readonly type: 'giveaway_ended'\n\n /** Number of winners in the giveaway */\n winners: number\n\n /** Number of undistributed prizes */\n undistributed: number\n}\n\n/** Boosts were applied to the group */\nexport interface ActionBoostApply {\n readonly type: 'boost_apply'\n\n /** Number of boosts applied */\n count: number\n}\n\nexport type MessageAction =\n | ActionChatCreated\n | ActionChannelCreated\n | ActionChatMigrateTo\n | ActionChannelMigrateFrom\n | ActionMessagePinned\n | ActionHistoryCleared\n | ActionGameScore\n | ActionContactJoined\n | ActionTitleChanged\n | ActionPhotoChanged\n | ActionPhotoDeleted\n | ActionUsersAdded\n | ActionUserLeft\n | ActionUserRemoved\n | ActionUserJoinedLink\n | ActionPaymentReceived\n | ActionPaymentSent\n | ActionCall\n | ActionScreenshotTaken\n | ActionBotAllowed\n | ActionGeoProximity\n | ActionGroupCallStarted\n | ActionGroupCallEnded\n | ActionGroupCallScheduled\n | ActionGroupInvite\n | ActionTtlChanged\n | ActionTopicCreated\n | ActionTopicEdited\n | ActionCustom\n | ActionThemeChanged\n | ActionUserJoinedApproved\n | ActionWebviewDataSent\n | ActionWebviewDataReceived\n | ActionPremiumGifted\n | ActionPhotoSuggested\n | ActionPeerChosen\n | ActionWallpaperChanged\n | ActionGiftCode\n | ActionGiveawayStarted\n | ActionGiveawayEnded\n | ActionBoostApply\n | null\n\n/** @internal */\nexport function _messageActionFromTl(this: Message, act: tl.TypeMessageAction): MessageAction {\n // todo - passport\n // messageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted\n // messageActionSecureValuesSent#d95c6154 types:Vector<SecureValueType>\n\n switch (act._) {\n case 'messageActionChatCreate':\n return {\n type: 'chat_created',\n title: act.title,\n users: act.users,\n }\n case 'messageActionChannelCreate':\n return {\n type: 'channel_created',\n title: act.title,\n }\n case 'messageActionChatMigrateTo':\n return {\n type: 'chat_migrate_to',\n id: act.channelId,\n }\n case 'messageActionChannelMigrateFrom':\n return {\n type: 'channel_migrate_from',\n id: act.chatId,\n title: act.title,\n }\n case 'messageActionPinMessage':\n return {\n type: 'message_pinned',\n }\n case 'messageActionHistoryClear':\n return {\n type: 'history_cleared',\n }\n case 'messageActionGameScore':\n return {\n type: 'game_score',\n gameId: act.gameId,\n score: act.score,\n }\n case 'messageActionContactSignUp':\n return {\n type: 'contact_joined',\n }\n case 'messageActionChatEditTitle':\n return {\n type: 'title_changed',\n title: act.title,\n }\n case 'messageActionChatEditPhoto':\n return {\n type: 'photo_changed',\n photo: new Photo(act.photo as tl.RawPhoto),\n }\n case 'messageActionChatDeletePhoto':\n return {\n type: 'photo_deleted',\n }\n case 'messageActionChatAddUser':\n return {\n type: 'users_added',\n users: act.users,\n }\n case 'messageActionChatDeleteUser':\n if (this.raw.fromId?._ === 'peerUser' && act.userId === this.raw.fromId.userId) {\n return {\n type: 'user_left',\n }\n }\n\n return {\n type: 'user_removed',\n user: act.userId,\n }\n\n case 'messageActionChatJoinedByLink':\n return {\n type: 'user_joined_link',\n inviter: act.inviterId,\n }\n case 'messageActionPaymentSentMe':\n return {\n type: 'payment_received',\n currency: act.currency,\n amount: act.totalAmount,\n payload: act.payload,\n info: act.info,\n shippingOptionId: act.shippingOptionId,\n charge: act.charge,\n }\n case 'messageActionPaymentSent':\n return {\n type: 'payment_sent',\n currency: act.currency,\n amount: act.totalAmount,\n }\n case 'messageActionPhoneCall':\n return {\n type: 'call',\n id: act.callId,\n isVideo: Boolean(act.video),\n reason: act.reason ? _callDiscardReasonFromTl(act.reason) : undefined,\n duration: act.duration ?? 0,\n }\n case 'messageActionScreenshotTaken':\n return {\n type: 'screenshot_taken',\n }\n case 'messageActionBotAllowed':\n return {\n type: 'bot_allowed',\n domain: act.domain,\n }\n case 'messageActionGeoProximityReached':\n if (act.fromId._ !== 'peerUser' || act.toId._ !== 'peerUser') {\n return null\n }\n\n return {\n type: 'geo_proximity',\n targetId: act.toId.userId,\n userId: act.fromId.userId,\n distance: act.distance,\n }\n\n case 'messageActionGroupCall':\n if (act.duration) {\n return {\n type: 'group_call_ended',\n call: act.call,\n duration: act.duration,\n }\n }\n\n return {\n type: 'group_call_started',\n call: act.call,\n }\n case 'messageActionGroupCallScheduled':\n return {\n type: 'group_call_scheduled',\n call: act.call,\n date: new Date(act.scheduleDate * 1000),\n }\n case 'messageActionInviteToGroupCall':\n return {\n type: 'group_call_invite',\n call: act.call,\n userIds: act.users,\n }\n case 'messageActionSetMessagesTTL':\n return {\n type: 'ttl_changed',\n period: act.period,\n }\n case 'messageActionTopicCreate':\n return {\n type: 'topic_created',\n title: act.title,\n iconColor: act.iconColor,\n iconCustomEmoji: act.iconEmojiId,\n }\n case 'messageActionTopicEdit':\n return {\n type: 'topic_edited',\n title: act.title,\n iconCustomEmoji: act.iconEmojiId,\n closed: act.closed,\n hidden: act.hidden,\n }\n case 'messageActionCustomAction':\n return {\n type: 'custom',\n action: act.message,\n }\n case 'messageActionSetChatTheme':\n return {\n type: 'theme_changed',\n emoji: act.emoticon,\n }\n case 'messageActionChatJoinedByRequest':\n return {\n type: 'user_joined_approved',\n }\n case 'messageActionWebViewDataSent':\n return {\n type: 'webview_sent',\n text: act.text,\n }\n case 'messageActionWebViewDataSentMe':\n return {\n type: 'webview_received',\n text: act.text,\n data: act.data,\n }\n case 'messageActionGiftPremium':\n return {\n type: 'premium_gifted',\n currency: act.currency,\n amount: act.amount.toNumber(),\n months: act.months,\n crypto: act.cryptoAmount ?\n {\n currency: act.cryptoCurrency!,\n amount: act.cryptoAmount.toNumber(),\n } :\n undefined,\n }\n case 'messageActionSuggestProfilePhoto':\n return {\n type: 'photo_suggested',\n photo: new Photo(act.photo as tl.RawPhoto),\n }\n case 'messageActionRequestedPeer':\n return {\n type: 'peer_chosen',\n buttonId: act.buttonId,\n peers: act.peers.map((it) => parsePeer(it, this._peers)),\n }\n case 'messageActionSetChatWallPaper':\n return {\n type: 'wallpaper_changed',\n same: act.same!,\n forBoth: act.forBoth!,\n wallpaper: act.wallpaper,\n }\n case 'messageActionGiftCode':\n return {\n type: 'gift_code',\n raw: act,\n }\n case 'messageActionGiveawayLaunch':\n return {\n type: 'giveaway_started',\n }\n case 'messageActionGiveawayResults':\n return {\n type: 'giveaway_ended',\n winners: act.winnersCount,\n undistributed: act.unclaimedCount,\n }\n case 'messageActionBoostApply':\n return {\n type: 'boost_apply',\n count: act.boosts,\n }\n default:\n return null\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"message-action.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/messages/message-action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAqB,MAAM,mBAAmB,CAAA;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,SAAS,EAAQ,MAAM,kBAAkB,CAAA;AAgflD,gBAAgB;AAChB,MAAM,UAAU,oBAAoB,CAAgB,GAAyB;IACzE,kBAAkB;IAClB,6GAA6G;IAC7G,uEAAuE;IAEvE,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC;QACZ,KAAK,yBAAyB;YAC1B,OAAO;gBACH,IAAI,EAAE,cAAc;gBACpB,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,KAAK,EAAE,GAAG,CAAC,KAAK;aACnB,CAAA;QACL,KAAK,4BAA4B;YAC7B,OAAO;gBACH,IAAI,EAAE,iBAAiB;gBACvB,KAAK,EAAE,GAAG,CAAC,KAAK;aACnB,CAAA;QACL,KAAK,4BA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K,kCAAkC;YACnC,OAAO;gBACH,IAAI,EAAE,WAAW;gBACjB,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,KAAK,EAAE,GAAG,CAAC,KAAK;aACnB,CAAA;QACL,KAAK,4BAA4B;YAC7B,OAAO;gBACH,IAAI,EAAE,aAAa;gBACnB,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;aAC3D,CAAA;QACL,KAAK,+BAA+B;YAChC,OAAO;gBACH,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE,GAAG,CAAC,IAAK;gBACf,OAAO,EAAE,GAAG,CAAC,OAAQ;gBACrB,SAAS,EAAE,GAAG,CAAC,SAAS;aAC3B,CAAA;QACL,KAAK,uBAAuB;YACxB,OAAO;gBACH,IAAI,EAAE,WAAW;gBACjB,GAAG,EAAE,GAAG;aACX,CAAA;QACL,KAAK,6BAA6B;YAC9B,OAAO;gBACH,IAAI,EAAE,kBAAkB;aAC3B,CAAA;QACL,KAAK,8BAA8B;YAC/B,OAAO;gBACH,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,GAAG,CAAC,YAAY;gBACzB,aAAa,EAAE,GAAG,CAAC,cAAc;aACpC,CAAA;QACL,KAAK,yBAAyB;YAC1B,OAAO;gBACH,IAAI,EAAE,aAAa;gBACnB,KAAK,EAAE,GAAG,CAAC,MAAM;aACpB,CAAA;QACL;YACI,OAAO,IAAI,CAAA;IACnB,CAAC;AACL,CAAC","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { _callDiscardReasonFromTl, CallDiscardReason } from '../calls/index.js'\nimport { Photo } from '../media/photo.js'\nimport { parsePeer, Peer } from '../peers/peer.js'\nimport type { Message } from './message.js'\n\n/** Group was created */\nexport interface ActionChatCreated {\n readonly type: 'chat_created'\n\n /** Group name */\n readonly title: string\n\n /** IDs of the users in the group */\n readonly users: number[]\n}\n\n/** Channel/supergroup was created */\nexport interface ActionChannelCreated {\n readonly type: 'channel_created'\n\n /** Original channel/supergroup title */\n readonly title: string\n}\n\n/** Chat was migrated to a supergroup with a given ID */\nexport interface ActionChatMigrateTo {\n readonly type: 'chat_migrate_to'\n\n /** Marked ID of the supergroup chat was migrated to */\n readonly id: number\n}\n\n/** Supergroup was migrated from a chat with a given ID */\nexport interface ActionChannelMigrateFrom {\n readonly type: 'channel_migrate_from'\n\n /** Marked ID of the chat this channel was migrated from */\n readonly id: number\n\n /** Old chat's title */\n readonly title: string\n}\n\n/**\n * A message has been pinned.\n *\n * To get the message itself, use {@link Message.getReplyTo}\n */\nexport interface ActionMessagePinned {\n readonly type: 'message_pinned'\n}\n\n/** History was cleared in a private chat. */\nexport interface ActionHistoryCleared {\n readonly type: 'history_cleared'\n}\n\n/** Someone scored in a game (usually only used for newly set high scores) */\nexport interface ActionGameScore {\n readonly type: 'game_score'\n\n /** Game ID */\n readonly gameId: tl.Long\n\n /** Score */\n readonly score: number\n}\n\n/** Contact has joined Telegram */\nexport interface ActionContactJoined {\n readonly type: 'contact_joined'\n}\n\n/** Group title was changed */\nexport interface ActionTitleChanged {\n readonly type: 'title_changed'\n\n /** New group name */\n readonly title: string\n}\n\n/** Group photo was changed */\nexport interface ActionPhotoChanged {\n readonly type: 'photo_changed'\n\n /** New group photo */\n readonly photo: Photo\n}\n\n/** Group photo was deleted */\nexport interface ActionPhotoDeleted {\n readonly type: 'photo_deleted'\n}\n\n/** Users were added to the chat */\nexport interface ActionUsersAdded {\n readonly type: 'users_added'\n\n /** IDs of the users that were added */\n readonly users: number[]\n}\n\n/** User has left the group */\nexport interface ActionUserLeft {\n readonly type: 'user_left'\n}\n\n/** User was removed from the group */\nexport interface ActionUserRemoved {\n readonly type: 'user_removed'\n\n /** ID of the user that was removed from the group */\n readonly user: number\n}\n\n/** User has joined the group via an invite link */\nexport interface ActionUserJoinedLink {\n readonly type: 'user_joined_link'\n\n /** ID of the user who created the link */\n readonly inviter: number\n}\n\n/**\n * User has joined the group via an invite link\n * and was approved by an administrator\n */\nexport interface ActionUserJoinedApproved {\n readonly type: 'user_joined_approved'\n}\n\n/** A payment was received from a user (bot) */\nexport interface ActionPaymentReceived {\n readonly type: 'payment_received'\n\n /** Three-letter ISO 4217 currency code */\n readonly currency: string\n\n /**\n * Price of the product in the smallest units of the currency\n * (integer, not float/double). For example, for a price of\n * `US$ 1.45`, `amount = 145`\n */\n readonly amount: tl.Long\n\n /** Bot specified invoice payload */\n readonly payload: Uint8Array\n\n /** Order information provided by the user */\n readonly info?: tl.TypePaymentRequestedInfo\n\n /** ID of the shipping option chosen by the user */\n readonly shippingOptionId?: string\n\n /** Payment provider ID */\n readonly charge?: tl.TypePaymentCharge\n}\n\n/** A payment was sent to a user */\nexport interface ActionPaymentSent {\n readonly type: 'payment_sent'\n\n /** Three-letter ISO 4217 currency code */\n readonly currency: string\n\n /**\n * Price of the product in the smallest units of the currency\n * (integer, not float/double). For example, for a price of\n * `US$ 1.45`, `amount = 145`\n */\n readonly amount: tl.Long\n}\n\n/** A phone call */\nexport interface ActionCall {\n readonly type: 'call'\n\n /** Call ID */\n readonly id: tl.Long\n\n /** Whether this is a video call */\n readonly isVideo: boolean\n\n /** Duration if the call in seconds (0 if not available) */\n readonly duration: number\n\n /** Call discard reason, if available */\n readonly reason?: CallDiscardReason\n}\n\n/** A screenshot was taken */\nexport interface ActionScreenshotTaken {\n readonly type: 'screenshot_taken'\n}\n\n/** User has authorized via the bot */\nexport interface ActionBotAllowed {\n readonly type: 'bot_allowed'\n\n /** Domain where the user has logged in */\n readonly domain?: string\n}\n\n/**\n * A user is in proximity of another user\n * (see [Proximity alerts](https://core.telegram.org/api/live-location#proximity-alert))\n */\nexport interface ActionGeoProximity {\n readonly type: 'geo_proximity'\n\n /** ID of the user who sent the geolocation with proximity alerts */\n readonly targetId: number\n\n /** ID of the user who has approached `targetId` */\n readonly userId: number\n\n /** Distance between them in meters */\n readonly distance: number\n}\n\n/** Group call has started */\nexport interface ActionGroupCallStarted {\n readonly type: 'group_call_started'\n\n /** TL object representing the call */\n readonly call: tl.TypeInputGroupCall\n}\n\n/** Group call has ended */\nexport interface ActionGroupCallEnded {\n readonly type: 'group_call_ended'\n\n /** TL object representing the call */\n readonly call: tl.TypeInputGroupCall\n\n /** Duration of the call */\n readonly duration: number\n}\n\n/** Group call has been scheduled */\nexport interface ActionGroupCallScheduled {\n readonly type: 'group_call_scheduled'\n\n /** TL object representing the call */\n readonly call: tl.TypeInputGroupCall\n\n /** Date when the call will start */\n readonly date: Date\n}\n\n/** Group call has ended */\nexport interface ActionGroupInvite {\n readonly type: 'group_call_invite'\n\n /** TL object representing the call */\n readonly call: tl.TypeInputGroupCall\n\n /** IDs of the users invited to the call */\n readonly userIds: number[]\n}\n\n/** Messages TTL changed */\nexport interface ActionTtlChanged {\n readonly type: 'ttl_changed'\n\n /** New TTL period */\n readonly period: number\n}\n\n/** Forum topic was created */\nexport interface ActionTopicCreated {\n readonly type: 'topic_created'\n\n /** Title of the topic */\n title: string\n\n /** Icon color of the topic */\n iconColor: number\n\n /** Icon emoji of the topic */\n iconCustomEmoji?: tl.Long\n}\n\n/** Forum topic was modified */\nexport interface ActionTopicEdited {\n readonly type: 'topic_edited'\n\n /** New title of the topic */\n title?: string\n\n /** New icon emoji of the topic (may be empty) */\n iconCustomEmoji?: tl.Long\n\n /** Whether the topic was opened/closed */\n closed?: boolean\n\n /** Whether the topic was (un-)hidden - only for \"General\" topic (`id=1`) */\n hidden?: boolean\n}\n\n/** A non-standard action has happened in the chat */\nexport interface ActionCustom {\n readonly type: 'custom'\n\n /** Text to be shown in the interface */\n action: string\n}\n\n/** Chat theme was changed */\nexport interface ActionThemeChanged {\n readonly type: 'theme_changed'\n\n /** Emoji representing the new theme */\n emoji: string\n}\n\n/** Data was sent from a WebView (user-side action) */\nexport interface ActionWebviewDataSent {\n readonly type: 'webview_sent'\n\n /** Text of the button that was pressed to open the WebView */\n text: string\n}\n\n/** Data was received from a WebView (bot-side action) */\nexport interface ActionWebviewDataReceived {\n readonly type: 'webview_received'\n\n /** Text of the button that was pressed to open the WebView */\n text: string\n\n /** Data received from the WebView */\n data: string\n}\n\n/** Premium subscription was gifted */\nexport interface ActionPremiumGifted {\n readonly type: 'premium_gifted'\n\n /**\n * Currency in which it was paid for.\n * Three-letter ISO 4217 currency code)\n */\n currency: string\n\n /**\n * Price of the product in the smallest units of the currency\n * (integer, not float/double). For example, for a price of\n * `US$ 1.45`, `amount = 145`\n */\n amount: number\n\n /** Duration of the gifted subscription in months */\n months: number\n\n /** If the subscription was bought with crypto, information about it */\n crypto?: {\n /** Crypto currency name */\n currency: string\n /** Price in the smallest units */\n amount: number\n }\n}\n\n/** A photo has been suggested as a profile photo */\nexport interface ActionPhotoSuggested {\n readonly type: 'photo_suggested'\n\n /** Photo that was suggested */\n photo: Photo\n}\n\n/**\n * A peer was chosen by the user after clicking on a RequestPeer button.\n * The user-side version of {@link ActionPeerChosen}\n */\nexport interface ActionPeerSent {\n readonly type: 'peer_sent'\n\n /** ID of the button passed earlier by the bot */\n buttonId: number\n\n /** Brief information about the chosen peers */\n peers: tl.TypeRequestedPeer[]\n}\n\n/**\n * A peer was chosen by the user after clicking on a RequestPeer button\n * The bot-side version of {@link ActionPeerSent}\n */\nexport interface ActionPeerChosen {\n readonly type: 'peer_chosen'\n\n /** ID of the button passed earlier by the bot */\n buttonId: number\n\n /** Chosen peers */\n peers: Peer[]\n}\n\n/** A wallpaper of the chathas been changed */\nexport interface ActionWallpaperChanged {\n readonly type: 'wallpaper_changed'\n\n /**\n * Whether the user has applied the same wallpaper\n * as the other party previously set in the chat\n */\n same: boolean\n\n /**\n * Whether the wallpaper was forcefully applied for\n * both sides, without explicit confirmation from the other\n * side.\n */\n forBoth: boolean\n\n /** TL object representing the new wallpaper */\n wallpaper: tl.TypeWallPaper\n}\n\n/** A Telergam Premium gift code was received */\nexport interface ActionGiftCode {\n readonly type: 'gift_code'\n\n /** Information about the gift code */\n raw: tl.RawMessageActionGiftCode\n}\n\n/** A Telergam Premium giveaway was started */\nexport interface ActionGiveawayStarted {\n readonly type: 'giveaway_started'\n}\n\n/** A Telergam Premium giveaway was ended and results are available */\nexport interface ActionGiveawayEnded {\n readonly type: 'giveaway_ended'\n\n /** Number of winners in the giveaway */\n winners: number\n\n /** Number of undistributed prizes */\n undistributed: number\n}\n\n/** Boosts were applied to the group */\nexport interface ActionBoostApply {\n readonly type: 'boost_apply'\n\n /** Number of boosts applied */\n count: number\n}\n\nexport type MessageAction =\n | ActionChatCreated\n | ActionChannelCreated\n | ActionChatMigrateTo\n | ActionChannelMigrateFrom\n | ActionMessagePinned\n | ActionHistoryCleared\n | ActionGameScore\n | ActionContactJoined\n | ActionTitleChanged\n | ActionPhotoChanged\n | ActionPhotoDeleted\n | ActionUsersAdded\n | ActionUserLeft\n | ActionUserRemoved\n | ActionUserJoinedLink\n | ActionPaymentReceived\n | ActionPaymentSent\n | ActionCall\n | ActionScreenshotTaken\n | ActionBotAllowed\n | ActionGeoProximity\n | ActionGroupCallStarted\n | ActionGroupCallEnded\n | ActionGroupCallScheduled\n | ActionGroupInvite\n | ActionTtlChanged\n | ActionTopicCreated\n | ActionTopicEdited\n | ActionCustom\n | ActionThemeChanged\n | ActionUserJoinedApproved\n | ActionWebviewDataSent\n | ActionWebviewDataReceived\n | ActionPremiumGifted\n | ActionPhotoSuggested\n | ActionPeerSent\n | ActionPeerChosen\n | ActionWallpaperChanged\n | ActionGiftCode\n | ActionGiveawayStarted\n | ActionGiveawayEnded\n | ActionBoostApply\n | null\n\n/** @internal */\nexport function _messageActionFromTl(this: Message, act: tl.TypeMessageAction): MessageAction {\n // todo - passport\n // messageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted\n // messageActionSecureValuesSent#d95c6154 types:Vector<SecureValueType>\n\n switch (act._) {\n case 'messageActionChatCreate':\n return {\n type: 'chat_created',\n title: act.title,\n users: act.users,\n }\n case 'messageActionChannelCreate':\n return {\n type: 'channel_created',\n title: act.title,\n }\n case 'messageActionChatMigrateTo':\n return {\n type: 'chat_migrate_to',\n id: act.channelId,\n }\n case 'messageActionChannelMigrateFrom':\n return {\n type: 'channel_migrate_from',\n id: act.chatId,\n title: act.title,\n }\n case 'messageActionPinMessage':\n return {\n type: 'message_pinned',\n }\n case 'messageActionHistoryClear':\n return {\n type: 'history_cleared',\n }\n case 'messageActionGameScore':\n return {\n type: 'game_score',\n gameId: act.gameId,\n score: act.score,\n }\n case 'messageActionContactSignUp':\n return {\n type: 'contact_joined',\n }\n case 'messageActionChatEditTitle':\n return {\n type: 'title_changed',\n title: act.title,\n }\n case 'messageActionChatEditPhoto':\n return {\n type: 'photo_changed',\n photo: new Photo(act.photo as tl.RawPhoto),\n }\n case 'messageActionChatDeletePhoto':\n return {\n type: 'photo_deleted',\n }\n case 'messageActionChatAddUser':\n return {\n type: 'users_added',\n users: act.users,\n }\n case 'messageActionChatDeleteUser':\n if (this.raw.fromId?._ === 'peerUser' && act.userId === this.raw.fromId.userId) {\n return {\n type: 'user_left',\n }\n }\n\n return {\n type: 'user_removed',\n user: act.userId,\n }\n\n case 'messageActionChatJoinedByLink':\n return {\n type: 'user_joined_link',\n inviter: act.inviterId,\n }\n case 'messageActionPaymentSentMe':\n return {\n type: 'payment_received',\n currency: act.currency,\n amount: act.totalAmount,\n payload: act.payload,\n info: act.info,\n shippingOptionId: act.shippingOptionId,\n charge: act.charge,\n }\n case 'messageActionPaymentSent':\n return {\n type: 'payment_sent',\n currency: act.currency,\n amount: act.totalAmount,\n }\n case 'messageActionPhoneCall':\n return {\n type: 'call',\n id: act.callId,\n isVideo: Boolean(act.video),\n reason: act.reason ? _callDiscardReasonFromTl(act.reason) : undefined,\n duration: act.duration ?? 0,\n }\n case 'messageActionScreenshotTaken':\n return {\n type: 'screenshot_taken',\n }\n case 'messageActionBotAllowed':\n return {\n type: 'bot_allowed',\n domain: act.domain,\n }\n case 'messageActionGeoProximityReached':\n if (act.fromId._ !== 'peerUser' || act.toId._ !== 'peerUser') {\n return null\n }\n\n return {\n type: 'geo_proximity',\n targetId: act.toId.userId,\n userId: act.fromId.userId,\n distance: act.distance,\n }\n\n case 'messageActionGroupCall':\n if (act.duration) {\n return {\n type: 'group_call_ended',\n call: act.call,\n duration: act.duration,\n }\n }\n\n return {\n type: 'group_call_started',\n call: act.call,\n }\n case 'messageActionGroupCallScheduled':\n return {\n type: 'group_call_scheduled',\n call: act.call,\n date: new Date(act.scheduleDate * 1000),\n }\n case 'messageActionInviteToGroupCall':\n return {\n type: 'group_call_invite',\n call: act.call,\n userIds: act.users,\n }\n case 'messageActionSetMessagesTTL':\n return {\n type: 'ttl_changed',\n period: act.period,\n }\n case 'messageActionTopicCreate':\n return {\n type: 'topic_created',\n title: act.title,\n iconColor: act.iconColor,\n iconCustomEmoji: act.iconEmojiId,\n }\n case 'messageActionTopicEdit':\n return {\n type: 'topic_edited',\n title: act.title,\n iconCustomEmoji: act.iconEmojiId,\n closed: act.closed,\n hidden: act.hidden,\n }\n case 'messageActionCustomAction':\n return {\n type: 'custom',\n action: act.message,\n }\n case 'messageActionSetChatTheme':\n return {\n type: 'theme_changed',\n emoji: act.emoticon,\n }\n case 'messageActionChatJoinedByRequest':\n return {\n type: 'user_joined_approved',\n }\n case 'messageActionWebViewDataSent':\n return {\n type: 'webview_sent',\n text: act.text,\n }\n case 'messageActionWebViewDataSentMe':\n return {\n type: 'webview_received',\n text: act.text,\n data: act.data,\n }\n case 'messageActionGiftPremium':\n return {\n type: 'premium_gifted',\n currency: act.currency,\n amount: act.amount.toNumber(),\n months: act.months,\n crypto: act.cryptoAmount ?\n {\n currency: act.cryptoCurrency!,\n amount: act.cryptoAmount.toNumber(),\n } :\n undefined,\n }\n case 'messageActionSuggestProfilePhoto':\n return {\n type: 'photo_suggested',\n photo: new Photo(act.photo as tl.RawPhoto),\n }\n case 'messageActionRequestedPeerSentMe':\n return {\n type: 'peer_sent',\n buttonId: act.buttonId,\n peers: act.peers,\n }\n case 'messageActionRequestedPeer':\n return {\n type: 'peer_chosen',\n buttonId: act.buttonId,\n peers: act.peers.map((it) => parsePeer(it, this._peers)),\n }\n case 'messageActionSetChatWallPaper':\n return {\n type: 'wallpaper_changed',\n same: act.same!,\n forBoth: act.forBoth!,\n wallpaper: act.wallpaper,\n }\n case 'messageActionGiftCode':\n return {\n type: 'gift_code',\n raw: act,\n }\n case 'messageActionGiveawayLaunch':\n return {\n type: 'giveaway_started',\n }\n case 'messageActionGiveawayResults':\n return {\n type: 'giveaway_ended',\n winners: act.winnersCount,\n undistributed: act.unclaimedCount,\n }\n case 'messageActionBoostApply':\n return {\n type: 'boost_apply',\n count: act.boosts,\n }\n default:\n return null\n }\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
1
2
|
import { Audio } from '../media/audio.js';
|
|
2
3
|
import { Contact } from '../media/contact.js';
|
|
3
4
|
import { Dice } from '../media/dice.js';
|
|
@@ -13,6 +14,9 @@ import { Venue } from '../media/venue.js';
|
|
|
13
14
|
import { Video } from '../media/video.js';
|
|
14
15
|
import { Voice } from '../media/voice.js';
|
|
15
16
|
import { WebPage } from '../media/web-page.js';
|
|
17
|
+
import { PeersIndex } from '../peers/peers-index.js';
|
|
16
18
|
/** A media inside of a {@link Message} */
|
|
17
19
|
export type MessageMedia = Photo | Dice | Contact | Audio | Voice | Sticker | Document | Video | Location | LiveLocation | Game | WebPage | Venue | Poll | Invoice | MediaStory | null;
|
|
18
20
|
export type MessageMediaType = Exclude<MessageMedia, null>['type'];
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare function _messageMediaFromTl(peers: PeersIndex | null, m: tl.TypeMessageMedia): MessageMedia;
|
|
@@ -40,6 +40,17 @@ export declare class Message {
|
|
|
40
40
|
* `null` for service messages and non-post messages.
|
|
41
41
|
*/
|
|
42
42
|
get views(): number | null;
|
|
43
|
+
/**
|
|
44
|
+
* For channel posts, number of forwards
|
|
45
|
+
*
|
|
46
|
+
* `null` for service messages and non-post messages, or
|
|
47
|
+
* if the current user is not an admin in the channel
|
|
48
|
+
*/
|
|
49
|
+
get forwards(): number | null;
|
|
50
|
+
/**
|
|
51
|
+
* For channel posts with signatures enabled, name of the post author
|
|
52
|
+
*/
|
|
53
|
+
get signature(): string | null;
|
|
43
54
|
/**
|
|
44
55
|
* Whether the message is incoming or outgoing:
|
|
45
56
|
* - Messages received from other chats are incoming (`outgoing = false`)
|
|
@@ -53,6 +64,32 @@ export declare class Message {
|
|
|
53
64
|
get isService(): boolean;
|
|
54
65
|
/** Whether this message has content protection (i.e. disabled forwards) */
|
|
55
66
|
get isContentProtected(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the message was sent by an implicit action, for example,
|
|
69
|
+
* as an away or a greeting business message, or as a scheduled message
|
|
70
|
+
*/
|
|
71
|
+
get isFromOffline(): boolean;
|
|
72
|
+
/** Whether this is a silent message (no notification triggered) */
|
|
73
|
+
get isSilent(): boolean;
|
|
74
|
+
/** Whether there are unread media attachments in this message */
|
|
75
|
+
get hasUnreadMedia(): boolean;
|
|
76
|
+
/** Whether this is a broadcast channel post */
|
|
77
|
+
get isChannelPost(): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether this message was automatically sent from a scheduled message.
|
|
80
|
+
*
|
|
81
|
+
* **Note**: for messages sent by other users, this is always `false`.
|
|
82
|
+
*/
|
|
83
|
+
get isFromScheduled(): boolean;
|
|
84
|
+
/** Whether the message is pinned in the current chat */
|
|
85
|
+
get isPinned(): boolean;
|
|
86
|
+
/** Whether the message should be considered unedited, even if {@link editDate} ≠ null */
|
|
87
|
+
get hideEditMark(): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* If set, any eventual webpage preview should be shown on top of
|
|
90
|
+
* the message instead of at the bottom.
|
|
91
|
+
*/
|
|
92
|
+
get invertMedia(): boolean;
|
|
56
93
|
/**
|
|
57
94
|
* Multiple media messages with the same grouped ID
|
|
58
95
|
* indicate an album or media group
|
|
@@ -78,14 +115,22 @@ export declare class Message {
|
|
|
78
115
|
* sender is the channel itself.
|
|
79
116
|
*/
|
|
80
117
|
get sender(): Peer;
|
|
118
|
+
/**
|
|
119
|
+
* Number of boosts applied to this {@link chat} by the sender
|
|
120
|
+
*/
|
|
121
|
+
get senderBoostCount(): number;
|
|
81
122
|
/**
|
|
82
123
|
* Conversation the message belongs to
|
|
83
124
|
*/
|
|
84
125
|
get chat(): Chat;
|
|
85
126
|
/**
|
|
86
|
-
* Date the message was sent
|
|
127
|
+
* Date when the message was sent
|
|
87
128
|
*/
|
|
88
129
|
get date(): Date;
|
|
130
|
+
/**
|
|
131
|
+
* Date when the message was last edited
|
|
132
|
+
*/
|
|
133
|
+
get editDate(): Date | null;
|
|
89
134
|
/**
|
|
90
135
|
* If this message is a forward, contains info about it.
|
|
91
136
|
*/
|
|
@@ -117,11 +162,24 @@ export declare class Message {
|
|
|
117
162
|
* Whether this message contains mention of the current user
|
|
118
163
|
*/
|
|
119
164
|
get isMention(): boolean;
|
|
165
|
+
/**
|
|
166
|
+
* If non-null, this message is not actually sent, and is
|
|
167
|
+
* instead inside a group of "quick reply" messages
|
|
168
|
+
* under the given shortcut ID
|
|
169
|
+
*/
|
|
170
|
+
get quickReplyShortcutId(): number | null;
|
|
120
171
|
/**
|
|
121
172
|
* If this message is generated from an inline query,
|
|
122
173
|
* information about the bot which generated it
|
|
123
174
|
*/
|
|
124
175
|
get viaBot(): User | null;
|
|
176
|
+
/**
|
|
177
|
+
* If this message was sent by a business bot on behalf of {@link sender},
|
|
178
|
+
* information about the business bot.
|
|
179
|
+
*
|
|
180
|
+
* **Note**: only available to the business account and the bot itself.
|
|
181
|
+
*/
|
|
182
|
+
get viaBusinessBot(): User | null;
|
|
125
183
|
/**
|
|
126
184
|
* Message text or media caption.
|
|
127
185
|
*
|
|
@@ -48,6 +48,21 @@ class Message {
|
|
|
48
48
|
get views() {
|
|
49
49
|
return this.raw._ === 'message' ? this.raw.views ?? null : null;
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* For channel posts, number of forwards
|
|
53
|
+
*
|
|
54
|
+
* `null` for service messages and non-post messages, or
|
|
55
|
+
* if the current user is not an admin in the channel
|
|
56
|
+
*/
|
|
57
|
+
get forwards() {
|
|
58
|
+
return this.raw._ === 'message' ? this.raw.forwards ?? null : null;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* For channel posts with signatures enabled, name of the post author
|
|
62
|
+
*/
|
|
63
|
+
get signature() {
|
|
64
|
+
return this.raw._ === 'message' ? this.raw.postAuthor ?? null : null;
|
|
65
|
+
}
|
|
51
66
|
/**
|
|
52
67
|
* Whether the message is incoming or outgoing:
|
|
53
68
|
* - Messages received from other chats are incoming (`outgoing = false`)
|
|
@@ -67,6 +82,48 @@ class Message {
|
|
|
67
82
|
get isContentProtected() {
|
|
68
83
|
return this.raw._ === 'message' && this.raw.noforwards;
|
|
69
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Whether the message was sent by an implicit action, for example,
|
|
87
|
+
* as an away or a greeting business message, or as a scheduled message
|
|
88
|
+
*/
|
|
89
|
+
get isFromOffline() {
|
|
90
|
+
return this.raw._ === 'message' && this.raw.offline;
|
|
91
|
+
}
|
|
92
|
+
/** Whether this is a silent message (no notification triggered) */
|
|
93
|
+
get isSilent() {
|
|
94
|
+
return this.raw.silent;
|
|
95
|
+
}
|
|
96
|
+
/** Whether there are unread media attachments in this message */
|
|
97
|
+
get hasUnreadMedia() {
|
|
98
|
+
return this.raw.mediaUnread;
|
|
99
|
+
}
|
|
100
|
+
/** Whether this is a broadcast channel post */
|
|
101
|
+
get isChannelPost() {
|
|
102
|
+
return this.raw._ === 'message' && this.raw.post;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Whether this message was automatically sent from a scheduled message.
|
|
106
|
+
*
|
|
107
|
+
* **Note**: for messages sent by other users, this is always `false`.
|
|
108
|
+
*/
|
|
109
|
+
get isFromScheduled() {
|
|
110
|
+
return this.raw._ === 'message' && this.raw.fromScheduled;
|
|
111
|
+
}
|
|
112
|
+
/** Whether the message is pinned in the current chat */
|
|
113
|
+
get isPinned() {
|
|
114
|
+
return this.raw._ === 'message' && this.raw.pinned;
|
|
115
|
+
}
|
|
116
|
+
/** Whether the message should be considered unedited, even if {@link editDate} ≠ null */
|
|
117
|
+
get hideEditMark() {
|
|
118
|
+
return this.raw._ === 'message' && this.raw.editHide;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* If set, any eventual webpage preview should be shown on top of
|
|
122
|
+
* the message instead of at the bottom.
|
|
123
|
+
*/
|
|
124
|
+
get invertMedia() {
|
|
125
|
+
return this.raw._ === 'message' && this.raw.invertMedia;
|
|
126
|
+
}
|
|
70
127
|
/**
|
|
71
128
|
* Multiple media messages with the same grouped ID
|
|
72
129
|
* indicate an album or media group
|
|
@@ -108,6 +165,14 @@ class Message {
|
|
|
108
165
|
}
|
|
109
166
|
return parsePeer(from, this._peers);
|
|
110
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Number of boosts applied to this {@link chat} by the sender
|
|
170
|
+
*/
|
|
171
|
+
get senderBoostCount() {
|
|
172
|
+
if (this.raw._ !== 'message')
|
|
173
|
+
return 0;
|
|
174
|
+
return this.raw.fromBoostsApplied ?? 0;
|
|
175
|
+
}
|
|
111
176
|
/**
|
|
112
177
|
* Conversation the message belongs to
|
|
113
178
|
*/
|
|
@@ -115,11 +180,19 @@ class Message {
|
|
|
115
180
|
return Chat._parseFromMessage(this.raw, this._peers);
|
|
116
181
|
}
|
|
117
182
|
/**
|
|
118
|
-
* Date the message was sent
|
|
183
|
+
* Date when the message was sent
|
|
119
184
|
*/
|
|
120
185
|
get date() {
|
|
121
186
|
return new Date(this.raw.date * 1000);
|
|
122
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Date when the message was last edited
|
|
190
|
+
*/
|
|
191
|
+
get editDate() {
|
|
192
|
+
if (this.raw._ === 'messageService')
|
|
193
|
+
return null;
|
|
194
|
+
return this.raw.editDate ? new Date(this.raw.editDate * 1000) : null;
|
|
195
|
+
}
|
|
123
196
|
/**
|
|
124
197
|
* If this message is a forward, contains info about it.
|
|
125
198
|
*/
|
|
@@ -182,6 +255,16 @@ class Message {
|
|
|
182
255
|
get isMention() {
|
|
183
256
|
return this.raw.mentioned;
|
|
184
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* If non-null, this message is not actually sent, and is
|
|
260
|
+
* instead inside a group of "quick reply" messages
|
|
261
|
+
* under the given shortcut ID
|
|
262
|
+
*/
|
|
263
|
+
get quickReplyShortcutId() {
|
|
264
|
+
if (this.raw._ === 'messageService')
|
|
265
|
+
return null;
|
|
266
|
+
return this.raw.quickReplyShortcutId ?? null;
|
|
267
|
+
}
|
|
185
268
|
/**
|
|
186
269
|
* If this message is generated from an inline query,
|
|
187
270
|
* information about the bot which generated it
|
|
@@ -192,6 +275,18 @@ class Message {
|
|
|
192
275
|
}
|
|
193
276
|
return new User(this._peers.user(this.raw.viaBotId));
|
|
194
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* If this message was sent by a business bot on behalf of {@link sender},
|
|
280
|
+
* information about the business bot.
|
|
281
|
+
*
|
|
282
|
+
* **Note**: only available to the business account and the bot itself.
|
|
283
|
+
*/
|
|
284
|
+
get viaBusinessBot() {
|
|
285
|
+
if (this.raw._ === 'messageService' || !this.raw.viaBusinessBotId) {
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
return new User(this._peers.user(this.raw.viaBusinessBotId));
|
|
289
|
+
}
|
|
195
290
|
/**
|
|
196
291
|
* Message text or media caption.
|
|
197
292
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/messages/message.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AA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C,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,EAAE,EAAE,CAAA;YAC1D,CAAC;YAED,OAAO,kBAAkB,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE,CAAA;QAC3E,CAAC;QAED,MAAM,IAAI,eAAe,CAAC,oCAAoC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;IACvF,CAAC;CACJ;AAED,cAAc,CAAC,OAAO,EAAE;IACpB,QAAQ;IACR,MAAM;IACN,SAAS;IACT,SAAS;IACT,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,WAAW;CACd,CAAC,CAAA;AACF,eAAe,CAAC,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { MtArgumentError } from '../../../types/errors.js'\nimport { assertNever } from '../../../types/utils.js'\nimport { getMarkedPeerId, toggleChannelIdMark } from '../../../utils/peer-utils.js'\nimport { assertTypeIsNot } from '../../../utils/type-assertions.js'\nimport { makeInspectable } from '../../utils/index.js'\nimport { memoizeGetters } from '../../utils/memoize.js'\nimport { BotKeyboard, ReplyMarkup } from '../bots/keyboards/index.js'\nimport { TextWithEntities } from '../misc/index.js'\nimport { Chat } from '../peers/chat.js'\nimport { parsePeer, Peer } from '../peers/peer.js'\nimport { PeersIndex } from '../peers/peers-index.js'\nimport { User } from '../peers/user.js'\nimport { _messageActionFromTl, MessageAction } from './message-action.js'\nimport { MessageEntity } from './message-entity.js'\nimport { MessageForwardInfo } from './message-forward.js'\nimport { _messageMediaFromTl, MessageMedia } from './message-media.js'\nimport { MessageReactions } from './message-reactions.js'\nimport { MessageRepliesInfo } from './message-replies.js'\nimport { RepliedMessageInfo } from './replied-message.js'\n\n/**\n * A Telegram message.\n */\nexport class Message {\n /**\n * Raw TL object.\n */\n readonly raw: tl.RawMessage | tl.RawMessageService\n\n constructor(\n raw: tl.TypeMessage,\n readonly _peers: PeersIndex,\n /**\n * Whether the message is scheduled.\n * If it is, then its {@link date} is set to future.\n */\n readonly isScheduled = false,\n ) {\n assertTypeIsNot('Message#ctor', raw, 'messageEmpty')\n\n this.raw = raw\n }\n\n /** Unique message identifier inside this chat */\n get id(): number {\n return this.raw.id\n }\n\n /**\n * For channel posts, number of views\n *\n * `null` for service messages and non-post messages.\n */\n get views(): number | null {\n return this.raw._ === 'message' ? this.raw.views ?? null : null\n }\n\n /**\n * Whether the message is incoming or outgoing:\n * - Messages received from other chats are incoming (`outgoing = false`)\n * - Messages sent by you to other chats are outgoing (`outgoing = true`)\n * - Messages to yourself (i.e. *Saved Messages*) are incoming (`outgoing = false`)\n */\n get isOutgoing(): boolean {\n return this.raw.out!\n }\n\n /**\n * Whether this message is a service message\n */\n get isService(): boolean {\n return this.raw._ === 'messageService'\n }\n\n /** Whether this message has content protection (i.e. disabled forwards) */\n get isContentProtected(): boolean {\n return this.raw._ === 'message' && this.raw.noforwards!\n }\n\n /**\n * Multiple media messages with the same grouped ID\n * indicate an album or media group\n *\n * `null` for service messages and non-grouped messages\n */\n get groupedId(): tl.Long | null {\n return this.raw._ === 'message' ? this.raw.groupedId ?? null : null\n }\n\n /**\n * Same as {@link groupedId}, but is globally unique across chats.\n */\n get groupedIdUnique(): string | null {\n if (!(this.raw._ === 'message' && this.raw.groupedId !== undefined)) return null\n\n return `${this.raw.groupedId.low}|${this.raw.groupedId.high}|${getMarkedPeerId(this.raw.peerId)}`\n }\n\n /**\n * Message sender.\n *\n * Usually is a {@link User}, but can be a {@link Chat}\n * in case the message was sent by an anonymous admin, anonymous premium user,\n * or if the message is a forwarded channel post.\n *\n * If the message was sent by an anonymous admin,\n * sender will equal to {@link chat}.\n *\n * If the message is a forwarded channel post,\n * sender is the channel itself.\n */\n get sender(): Peer {\n const from = this.raw.fromId\n\n if (!from) {\n if (this.raw.peerId._ === 'peerUser') {\n return new User(this._peers.user(this.raw.peerId.userId))\n }\n\n // anon admin, return the chat\n return this.chat\n }\n\n return parsePeer(from, this._peers)\n }\n\n /**\n * Conversation the message belongs to\n */\n get chat(): Chat {\n return Chat._parseFromMessage(this.raw, this._peers)\n }\n\n /**\n * Date the message was sent\n */\n get date(): Date {\n return new Date(this.raw.date * 1000)\n }\n\n /**\n * If this message is a forward, contains info about it.\n */\n get forward(): MessageForwardInfo | null {\n if (this.raw._ !== 'message' || !this.raw.fwdFrom) {\n return null\n }\n\n return new MessageForwardInfo(this.raw.fwdFrom, this._peers)\n }\n\n /**\n * Whether the message is a channel post that was\n * automatically forwarded to the connected discussion group\n */\n get isAutomaticForward(): boolean {\n if (this.raw._ === 'messageService' || !this.raw.fwdFrom) return false\n\n const fwd = this.raw.fwdFrom\n\n return Boolean(\n this.chat.chatType === 'supergroup' &&\n fwd.savedFromMsgId &&\n fwd.savedFromPeer?._ === 'peerChannel' &&\n getMarkedPeerId(fwd.savedFromPeer) !== getMarkedPeerId(this.raw.peerId),\n )\n }\n\n /**\n * Information about comments (for channels) or replies (for groups)\n */\n get replies(): MessageRepliesInfo | null {\n if (this.raw._ !== 'message' || !this.raw.replies) return null\n\n return new MessageRepliesInfo(this.raw.replies, this._peers)\n }\n\n /**\n * For replies, information about the that is being replied to.\n *\n * Mutually exclusive with {@link replyToStory}\n */\n get replyToMessage(): RepliedMessageInfo | null {\n if (this.raw.replyTo?._ !== 'messageReplyHeader') return null\n\n return new RepliedMessageInfo(this.raw.replyTo, this._peers)\n }\n\n /**\n * For replies, information about the story that is being replied to\n *\n * Mutually exclusive with {@link replyToMessage}\n */\n get replyToStory(): tl.RawMessageReplyStoryHeader | null {\n if (this.raw.replyTo?._ !== 'messageReplyStoryHeader') return null\n\n return this.raw.replyTo\n }\n\n /** Whether this message is in a forum topic */\n get isTopicMessage(): boolean {\n if (this.raw.replyTo?._ !== 'messageReplyHeader') return false\n\n return this.raw.replyTo.forumTopic!\n }\n\n /**\n * Whether this message contains mention of the current user\n */\n get isMention(): boolean {\n return this.raw.mentioned!\n }\n\n /**\n * If this message is generated from an inline query,\n * information about the bot which generated it\n */\n get viaBot(): User | null {\n if (this.raw._ === 'messageService' || !this.raw.viaBotId) {\n return null\n }\n\n return new User(this._peers.user(this.raw.viaBotId))\n }\n\n /**\n * Message text or media caption.\n *\n * Empty string for service messages\n * (you should handle i18n yourself)\n */\n get text(): string {\n return this.raw._ === 'messageService' ? '' : this.raw.message\n }\n\n /**\n * Message text/caption entities (may be empty)\n */\n get entities(): ReadonlyArray<MessageEntity> {\n const entities: MessageEntity[] = []\n\n if (this.raw._ === 'message' && this.raw.entities?.length) {\n for (const ent of this.raw.entities) {\n entities.push(new MessageEntity(ent, this.raw.message))\n }\n }\n\n return entities\n }\n\n get textWithEntities(): TextWithEntities {\n if (this.raw._ === 'messageService') return { text: '', entities: [] }\n\n return {\n text: this.raw.message,\n entities: this.raw.entities,\n }\n }\n\n /**\n * Message action. `null` for non-service messages\n * or for unsupported events.\n *\n * For unsupported events, use `.raw.action` directly.\n */\n get action(): MessageAction | null {\n if (this.raw._ === 'message') {\n return null\n }\n\n return _messageActionFromTl.call(this, this.raw.action)\n }\n\n /**\n * Message media. `null` for text-only and service messages\n * and for unsupported media types.\n *\n * For unsupported media types, use `.raw.media` directly.\n */\n get media(): MessageMedia {\n if (this.raw._ === 'messageService' || !this.raw.media || this.raw.media._ === 'messageMediaEmpty') {\n return null\n }\n\n return _messageMediaFromTl(this._peers, this.raw.media)\n }\n\n /**\n * Whether this is a premium media\n * (e.g. >2gb file or fullscreen sticker)\n * that was forwarded without author by a non-premium user\n */\n get isForwardedPremiumMedia(): boolean {\n return this.raw._ === 'message' && this.raw.media?._ === 'messageMediaDocument' && this.raw.media.nopremium!\n }\n\n /**\n * TTL period of the message, in seconds.\n */\n get ttlPeriod(): number | null {\n return this.raw.ttlPeriod ?? null\n }\n\n /**\n * Reply markup provided with this message, if any.\n */\n get markup(): ReplyMarkup | null {\n if (this.raw._ === 'messageService' || !this.raw.replyMarkup) {\n return null\n }\n\n const rm = this.raw.replyMarkup\n\n switch (rm._) {\n case 'replyKeyboardHide':\n return {\n type: 'reply_hide',\n selective: rm.selective,\n }\n case 'replyKeyboardForceReply':\n return {\n type: 'force_reply',\n singleUse: rm.singleUse,\n selective: rm.selective,\n }\n case 'replyKeyboardMarkup':\n return {\n type: 'reply',\n resize: rm.resize,\n singleUse: rm.singleUse,\n selective: rm.selective,\n buttons: BotKeyboard._rowsTo2d(rm.rows),\n }\n case 'replyInlineMarkup':\n return {\n type: 'inline',\n buttons: BotKeyboard._rowsTo2d(rm.rows),\n }\n default:\n assertNever(rm)\n }\n }\n\n /**\n * Whether this message can be forwarded\n *\n * `false` for service mesasges and private restricted chats/chanenls\n */\n get canBeForwarded(): boolean {\n return this.raw._ === 'message' && !this.raw.noforwards\n }\n\n get reactions(): MessageReactions | null {\n if (this.raw._ === 'messageService' || !this.raw.reactions) {\n return null\n }\n\n return new MessageReactions(this.raw.id, getMarkedPeerId(this.raw.peerId), this.raw.reactions, this._peers)\n }\n\n /**\n * Generated permalink to this message, only for groups and channels\n *\n * @throws MtArgumentError In case the chat does not support message links\n */\n get link(): string {\n if (this.chat.chatType === 'supergroup' || this.chat.chatType === 'channel') {\n if (this.chat.username) {\n return `https://t.me/${this.chat.username}/${this.id}`\n }\n\n return `https://t.me/c/${toggleChannelIdMark(this.chat.id)}/${this.id}`\n }\n\n throw new MtArgumentError(`Cannot generate message link for ${this.chat.chatType}`)\n }\n}\n\nmemoizeGetters(Message, [\n 'sender',\n 'chat',\n 'forward',\n 'replies',\n 'viaBot',\n 'entities',\n 'action',\n 'media',\n 'markup',\n 'reactions',\n])\nmakeInspectable(Message, ['isScheduled'], ['link'])\n"]}
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/messages/message.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,WA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C,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE,CAAA;QAC3E,CAAC;QAED,MAAM,IAAI,eAAe,CAAC,oCAAoC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;IACvF,CAAC;CACJ;AAED,cAAc,CAAC,OAAO,EAAE;IACpB,QAAQ;IACR,MAAM;IACN,SAAS;IACT,SAAS;IACT,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,WAAW;CACd,CAAC,CAAA;AACF,eAAe,CAAC,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { MtArgumentError } from '../../../types/errors.js'\nimport { assertNever } from '../../../types/utils.js'\nimport { getMarkedPeerId, toggleChannelIdMark } from '../../../utils/peer-utils.js'\nimport { assertTypeIsNot } from '../../../utils/type-assertions.js'\nimport { makeInspectable } from '../../utils/index.js'\nimport { memoizeGetters } from '../../utils/memoize.js'\nimport { BotKeyboard, ReplyMarkup } from '../bots/keyboards/index.js'\nimport { TextWithEntities } from '../misc/index.js'\nimport { Chat } from '../peers/chat.js'\nimport { parsePeer, Peer } from '../peers/peer.js'\nimport { PeersIndex } from '../peers/peers-index.js'\nimport { User } from '../peers/user.js'\nimport { _messageActionFromTl, MessageAction } from './message-action.js'\nimport { MessageEntity } from './message-entity.js'\nimport { MessageForwardInfo } from './message-forward.js'\nimport { _messageMediaFromTl, MessageMedia } from './message-media.js'\nimport { MessageReactions } from './message-reactions.js'\nimport { MessageRepliesInfo } from './message-replies.js'\nimport { RepliedMessageInfo } from './replied-message.js'\n\n/**\n * A Telegram message.\n */\nexport class Message {\n /**\n * Raw TL object.\n */\n readonly raw: tl.RawMessage | tl.RawMessageService\n\n constructor(\n raw: tl.TypeMessage,\n readonly _peers: PeersIndex,\n /**\n * Whether the message is scheduled.\n * If it is, then its {@link date} is set to future.\n */\n readonly isScheduled = false,\n ) {\n assertTypeIsNot('Message#ctor', raw, 'messageEmpty')\n\n this.raw = raw\n }\n\n /** Unique message identifier inside this chat */\n get id(): number {\n return this.raw.id\n }\n\n /**\n * For channel posts, number of views\n *\n * `null` for service messages and non-post messages.\n */\n get views(): number | null {\n return this.raw._ === 'message' ? this.raw.views ?? null : null\n }\n\n /**\n * For channel posts, number of forwards\n *\n * `null` for service messages and non-post messages, or\n * if the current user is not an admin in the channel\n */\n get forwards(): number | null {\n return this.raw._ === 'message' ? this.raw.forwards ?? null : null\n }\n\n /**\n * For channel posts with signatures enabled, name of the post author\n */\n get signature(): string | null {\n return this.raw._ === 'message' ? this.raw.postAuthor ?? null : null\n }\n\n /**\n * Whether the message is incoming or outgoing:\n * - Messages received from other chats are incoming (`outgoing = false`)\n * - Messages sent by you to other chats are outgoing (`outgoing = true`)\n * - Messages to yourself (i.e. *Saved Messages*) are incoming (`outgoing = false`)\n */\n get isOutgoing(): boolean {\n return this.raw.out!\n }\n\n /**\n * Whether this message is a service message\n */\n get isService(): boolean {\n return this.raw._ === 'messageService'\n }\n\n /** Whether this message has content protection (i.e. disabled forwards) */\n get isContentProtected(): boolean {\n return this.raw._ === 'message' && this.raw.noforwards!\n }\n\n /**\n * Whether the message was sent by an implicit action, for example,\n * as an away or a greeting business message, or as a scheduled message\n */\n get isFromOffline(): boolean {\n return this.raw._ === 'message' && this.raw.offline!\n }\n\n /** Whether this is a silent message (no notification triggered) */\n get isSilent(): boolean {\n return this.raw.silent!\n }\n\n /** Whether there are unread media attachments in this message */\n get hasUnreadMedia(): boolean {\n return this.raw.mediaUnread!\n }\n\n /** Whether this is a broadcast channel post */\n get isChannelPost(): boolean {\n return this.raw._ === 'message' && this.raw.post!\n }\n\n /**\n * Whether this message was automatically sent from a scheduled message.\n *\n * **Note**: for messages sent by other users, this is always `false`.\n */\n get isFromScheduled(): boolean {\n return this.raw._ === 'message' && this.raw.fromScheduled!\n }\n\n /** Whether the message is pinned in the current chat */\n get isPinned(): boolean {\n return this.raw._ === 'message' && this.raw.pinned!\n }\n\n /** Whether the message should be considered unedited, even if {@link editDate} ≠ null */\n get hideEditMark(): boolean {\n return this.raw._ === 'message' && this.raw.editHide!\n }\n\n /**\n * If set, any eventual webpage preview should be shown on top of\n * the message instead of at the bottom.\n */\n get invertMedia(): boolean {\n return this.raw._ === 'message' && this.raw.invertMedia!\n }\n\n /**\n * Multiple media messages with the same grouped ID\n * indicate an album or media group\n *\n * `null` for service messages and non-grouped messages\n */\n get groupedId(): tl.Long | null {\n return this.raw._ === 'message' ? this.raw.groupedId ?? null : null\n }\n\n /**\n * Same as {@link groupedId}, but is globally unique across chats.\n */\n get groupedIdUnique(): string | null {\n if (!(this.raw._ === 'message' && this.raw.groupedId !== undefined)) return null\n\n return `${this.raw.groupedId.low}|${this.raw.groupedId.high}|${getMarkedPeerId(this.raw.peerId)}`\n }\n\n /**\n * Message sender.\n *\n * Usually is a {@link User}, but can be a {@link Chat}\n * in case the message was sent by an anonymous admin, anonymous premium user,\n * or if the message is a forwarded channel post.\n *\n * If the message was sent by an anonymous admin,\n * sender will equal to {@link chat}.\n *\n * If the message is a forwarded channel post,\n * sender is the channel itself.\n */\n get sender(): Peer {\n const from = this.raw.fromId\n\n if (!from) {\n if (this.raw.peerId._ === 'peerUser') {\n return new User(this._peers.user(this.raw.peerId.userId))\n }\n\n // anon admin, return the chat\n return this.chat\n }\n\n return parsePeer(from, this._peers)\n }\n\n /**\n * Number of boosts applied to this {@link chat} by the sender\n */\n get senderBoostCount(): number {\n if (this.raw._ !== 'message') return 0\n\n return this.raw.fromBoostsApplied ?? 0\n }\n\n /**\n * Conversation the message belongs to\n */\n get chat(): Chat {\n return Chat._parseFromMessage(this.raw, this._peers)\n }\n\n /**\n * Date when the message was sent\n */\n get date(): Date {\n return new Date(this.raw.date * 1000)\n }\n\n /**\n * Date when the message was last edited\n */\n get editDate(): Date | null {\n if (this.raw._ === 'messageService') return null\n\n return this.raw.editDate ? new Date(this.raw.editDate * 1000) : null\n }\n\n /**\n * If this message is a forward, contains info about it.\n */\n get forward(): MessageForwardInfo | null {\n if (this.raw._ !== 'message' || !this.raw.fwdFrom) {\n return null\n }\n\n return new MessageForwardInfo(this.raw.fwdFrom, this._peers)\n }\n\n /**\n * Whether the message is a channel post that was\n * automatically forwarded to the connected discussion group\n */\n get isAutomaticForward(): boolean {\n if (this.raw._ === 'messageService' || !this.raw.fwdFrom) return false\n\n const fwd = this.raw.fwdFrom\n\n return Boolean(\n this.chat.chatType === 'supergroup' &&\n fwd.savedFromMsgId &&\n fwd.savedFromPeer?._ === 'peerChannel' &&\n getMarkedPeerId(fwd.savedFromPeer) !== getMarkedPeerId(this.raw.peerId),\n )\n }\n\n /**\n * Information about comments (for channels) or replies (for groups)\n */\n get replies(): MessageRepliesInfo | null {\n if (this.raw._ !== 'message' || !this.raw.replies) return null\n\n return new MessageRepliesInfo(this.raw.replies, this._peers)\n }\n\n /**\n * For replies, information about the that is being replied to.\n *\n * Mutually exclusive with {@link replyToStory}\n */\n get replyToMessage(): RepliedMessageInfo | null {\n if (this.raw.replyTo?._ !== 'messageReplyHeader') return null\n\n return new RepliedMessageInfo(this.raw.replyTo, this._peers)\n }\n\n /**\n * For replies, information about the story that is being replied to\n *\n * Mutually exclusive with {@link replyToMessage}\n */\n get replyToStory(): tl.RawMessageReplyStoryHeader | null {\n if (this.raw.replyTo?._ !== 'messageReplyStoryHeader') return null\n\n return this.raw.replyTo\n }\n\n /** Whether this message is in a forum topic */\n get isTopicMessage(): boolean {\n if (this.raw.replyTo?._ !== 'messageReplyHeader') return false\n\n return this.raw.replyTo.forumTopic!\n }\n\n /**\n * Whether this message contains mention of the current user\n */\n get isMention(): boolean {\n return this.raw.mentioned!\n }\n\n /**\n * If non-null, this message is not actually sent, and is\n * instead inside a group of \"quick reply\" messages\n * under the given shortcut ID\n */\n get quickReplyShortcutId(): number | null {\n if (this.raw._ === 'messageService') return null\n\n return this.raw.quickReplyShortcutId ?? null\n }\n\n /**\n * If this message is generated from an inline query,\n * information about the bot which generated it\n */\n get viaBot(): User | null {\n if (this.raw._ === 'messageService' || !this.raw.viaBotId) {\n return null\n }\n\n return new User(this._peers.user(this.raw.viaBotId))\n }\n\n /**\n * If this message was sent by a business bot on behalf of {@link sender},\n * information about the business bot.\n *\n * **Note**: only available to the business account and the bot itself.\n */\n get viaBusinessBot(): User | null {\n if (this.raw._ === 'messageService' || !this.raw.viaBusinessBotId) {\n return null\n }\n\n return new User(this._peers.user(this.raw.viaBusinessBotId))\n }\n\n /**\n * Message text or media caption.\n *\n * Empty string for service messages\n * (you should handle i18n yourself)\n */\n get text(): string {\n return this.raw._ === 'messageService' ? '' : this.raw.message\n }\n\n /**\n * Message text/caption entities (may be empty)\n */\n get entities(): ReadonlyArray<MessageEntity> {\n const entities: MessageEntity[] = []\n\n if (this.raw._ === 'message' && this.raw.entities?.length) {\n for (const ent of this.raw.entities) {\n entities.push(new MessageEntity(ent, this.raw.message))\n }\n }\n\n return entities\n }\n\n get textWithEntities(): TextWithEntities {\n if (this.raw._ === 'messageService') return { text: '', entities: [] }\n\n return {\n text: this.raw.message,\n entities: this.raw.entities,\n }\n }\n\n /**\n * Message action. `null` for non-service messages\n * or for unsupported events.\n *\n * For unsupported events, use `.raw.action` directly.\n */\n get action(): MessageAction | null {\n if (this.raw._ === 'message') {\n return null\n }\n\n return _messageActionFromTl.call(this, this.raw.action)\n }\n\n /**\n * Message media. `null` for text-only and service messages\n * and for unsupported media types.\n *\n * For unsupported media types, use `.raw.media` directly.\n */\n get media(): MessageMedia {\n if (this.raw._ === 'messageService' || !this.raw.media || this.raw.media._ === 'messageMediaEmpty') {\n return null\n }\n\n return _messageMediaFromTl(this._peers, this.raw.media)\n }\n\n /**\n * Whether this is a premium media\n * (e.g. >2gb file or fullscreen sticker)\n * that was forwarded without author by a non-premium user\n */\n get isForwardedPremiumMedia(): boolean {\n return this.raw._ === 'message' && this.raw.media?._ === 'messageMediaDocument' && this.raw.media.nopremium!\n }\n\n /**\n * TTL period of the message, in seconds.\n */\n get ttlPeriod(): number | null {\n return this.raw.ttlPeriod ?? null\n }\n\n /**\n * Reply markup provided with this message, if any.\n */\n get markup(): ReplyMarkup | null {\n if (this.raw._ === 'messageService' || !this.raw.replyMarkup) {\n return null\n }\n\n const rm = this.raw.replyMarkup\n\n switch (rm._) {\n case 'replyKeyboardHide':\n return {\n type: 'reply_hide',\n selective: rm.selective,\n }\n case 'replyKeyboardForceReply':\n return {\n type: 'force_reply',\n singleUse: rm.singleUse,\n selective: rm.selective,\n }\n case 'replyKeyboardMarkup':\n return {\n type: 'reply',\n resize: rm.resize,\n singleUse: rm.singleUse,\n selective: rm.selective,\n buttons: BotKeyboard._rowsTo2d(rm.rows),\n }\n case 'replyInlineMarkup':\n return {\n type: 'inline',\n buttons: BotKeyboard._rowsTo2d(rm.rows),\n }\n default:\n assertNever(rm)\n }\n }\n\n /**\n * Whether this message can be forwarded\n *\n * `false` for service mesasges and private restricted chats/chanenls\n */\n get canBeForwarded(): boolean {\n return this.raw._ === 'message' && !this.raw.noforwards\n }\n\n get reactions(): MessageReactions | null {\n if (this.raw._ === 'messageService' || !this.raw.reactions) {\n return null\n }\n\n return new MessageReactions(this.raw.id, getMarkedPeerId(this.raw.peerId), this.raw.reactions, this._peers)\n }\n\n /**\n * Generated permalink to this message, only for groups and channels\n *\n * @throws MtArgumentError In case the chat does not support message links\n */\n get link(): string {\n if (this.chat.chatType === 'supergroup' || this.chat.chatType === 'channel') {\n if (this.chat.username) {\n return `https://t.me/${this.chat.username}/${this.id}`\n }\n\n return `https://t.me/c/${toggleChannelIdMark(this.chat.id)}/${this.id}`\n }\n\n throw new MtArgumentError(`Cannot generate message link for ${this.chat.chatType}`)\n }\n}\n\nmemoizeGetters(Message, [\n 'sender',\n 'chat',\n 'forward',\n 'replies',\n 'viaBot',\n 'entities',\n 'action',\n 'media',\n 'markup',\n 'reactions',\n])\nmakeInspectable(Message, ['isScheduled'], ['link'])\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Long from 'long';
|
|
2
|
+
import { tl } from '@mtcute/tl';
|
|
3
|
+
/**
|
|
4
|
+
* Information about a Fragment collectible
|
|
5
|
+
*/
|
|
6
|
+
export declare class CollectibleInfo {
|
|
7
|
+
readonly raw: tl.fragment.RawCollectibleInfo;
|
|
8
|
+
constructor(raw: tl.fragment.RawCollectibleInfo);
|
|
9
|
+
/** Date when the item was purchased */
|
|
10
|
+
get purchaseDate(): Date;
|
|
11
|
+
/** Crypto currency used to purchase the item */
|
|
12
|
+
get cryptoCurrency(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Amount of crypto currency used to purchase the item,
|
|
15
|
+
* in the smallest units
|
|
16
|
+
*/
|
|
17
|
+
get cryptoAmount(): Long;
|
|
18
|
+
/** Fiat currency to which the crypto currency was converted */
|
|
19
|
+
get currency(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Converted amount in fiat currency,
|
|
22
|
+
* in the smallest units (e.g. cents)
|
|
23
|
+
*/
|
|
24
|
+
get amount(): Long;
|
|
25
|
+
/** URL to the collectible on Fragment */
|
|
26
|
+
get url(): string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { makeInspectable } from '../../utils/inspectable.js';
|
|
2
|
+
/**
|
|
3
|
+
* Information about a Fragment collectible
|
|
4
|
+
*/
|
|
5
|
+
class CollectibleInfo {
|
|
6
|
+
raw;
|
|
7
|
+
constructor(raw) {
|
|
8
|
+
this.raw = raw;
|
|
9
|
+
}
|
|
10
|
+
/** Date when the item was purchased */
|
|
11
|
+
get purchaseDate() {
|
|
12
|
+
return new Date(this.raw.purchaseDate * 1000);
|
|
13
|
+
}
|
|
14
|
+
/** Crypto currency used to purchase the item */
|
|
15
|
+
get cryptoCurrency() {
|
|
16
|
+
return this.raw.cryptoCurrency;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Amount of crypto currency used to purchase the item,
|
|
20
|
+
* in the smallest units
|
|
21
|
+
*/
|
|
22
|
+
get cryptoAmount() {
|
|
23
|
+
return this.raw.cryptoAmount;
|
|
24
|
+
}
|
|
25
|
+
/** Fiat currency to which the crypto currency was converted */
|
|
26
|
+
get currency() {
|
|
27
|
+
return this.raw.currency;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Converted amount in fiat currency,
|
|
31
|
+
* in the smallest units (e.g. cents)
|
|
32
|
+
*/
|
|
33
|
+
get amount() {
|
|
34
|
+
return this.raw.amount;
|
|
35
|
+
}
|
|
36
|
+
/** URL to the collectible on Fragment */
|
|
37
|
+
get url() {
|
|
38
|
+
return this.raw.url;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const CollectibleInfo$1 = /*#__PURE__*/makeInspectable(CollectibleInfo, );
|
|
42
|
+
//# sourceMappingURL=collectible-info.js.map
|
|
43
|
+
export { CollectibleInfo$1 as CollectibleInfo }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectible-info.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/misc/collectible-info.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D;;GAEG;AACH,MAAM,OAAO,eAAe;IACH;IAArB,YAAqB,GAAmC;QAAnC,QAAG,GAAH,GAAG,CAAgC;IAAG,CAAC;IAE5D,uCAAuC;IACvC,IAAI,YAAY;QACZ,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;IACjD,CAAC;IAED,gDAAgD;IAChD,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,GAAG,CAAC,cAAc,CAAA;IAClC,CAAC;IAED;;;OAGG;IACH,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,CAAA;IAChC,CAAC;IAED,+DAA+D;IAC/D,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAA;IAC5B,CAAC;IAED;;;OAGG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAA;IAC1B,CAAC;IAED,yCAAyC;IACzC,IAAI,GAAG;QACH,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;IACvB,CAAC;CACJ;AAED,eAAe,CAAC,eAAe,CAAC,CAAA","sourcesContent":["import Long from 'long'\n\nimport { tl } from '@mtcute/tl'\n\nimport { makeInspectable } from '../../utils/inspectable.js'\n\n/**\n * Information about a Fragment collectible\n */\nexport class CollectibleInfo {\n constructor(readonly raw: tl.fragment.RawCollectibleInfo) {}\n\n /** Date when the item was purchased */\n get purchaseDate(): Date {\n return new Date(this.raw.purchaseDate * 1000)\n }\n\n /** Crypto currency used to purchase the item */\n get cryptoCurrency(): string {\n return this.raw.cryptoCurrency\n }\n\n /**\n * Amount of crypto currency used to purchase the item,\n * in the smallest units\n */\n get cryptoAmount(): Long {\n return this.raw.cryptoAmount\n }\n\n /** Fiat currency to which the crypto currency was converted */\n get currency(): string {\n return this.raw.currency\n }\n\n /**\n * Converted amount in fiat currency,\n * in the smallest units (e.g. cents)\n */\n get amount(): Long {\n return this.raw.amount\n }\n\n /** URL to the collectible on Fragment */\n get url(): string {\n return this.raw.url\n }\n}\n\nmakeInspectable(CollectibleInfo)\n"]}
|
|
@@ -13,3 +13,10 @@ export interface TextWithEntities {
|
|
|
13
13
|
* Can be either a plain string or an object with `text` and `entities` fields.
|
|
14
14
|
*/
|
|
15
15
|
export type InputText = string | TextWithEntities;
|
|
16
|
+
/**
|
|
17
|
+
* Convert {@link InputText} to a {@link tl.RawTextWithEntities} object
|
|
18
|
+
*
|
|
19
|
+
* @param text Input text
|
|
20
|
+
* @returns TL object
|
|
21
|
+
*/
|
|
22
|
+
export declare function inputTextToTl(text: InputText): tl.RawTextWithEntities;
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Convert {@link InputText} to a {@link tl.RawTextWithEntities} object
|
|
3
|
+
*
|
|
4
|
+
* @param text Input text
|
|
5
|
+
* @returns TL object
|
|
6
|
+
*/
|
|
7
|
+
export function inputTextToTl(text) {
|
|
8
|
+
return {
|
|
9
|
+
_: 'textWithEntities',
|
|
10
|
+
text: typeof text === 'string' ? text : text.text,
|
|
11
|
+
entities: typeof text === 'string' ? [] : text.entities ?? [],
|
|
12
|
+
};
|
|
13
|
+
}
|
|
2
14
|
//# sourceMappingURL=entities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/misc/entities.ts"],"names":[],"mappings":"","sourcesContent":["import { tl } from '@mtcute/tl'\n\n/**\n * Formatted text with entities\n */\nexport interface TextWithEntities {\n readonly text: string\n readonly entities?: tl.TypeMessageEntity[]\n}\n\n/**\n * Type to be used as a parameter for methods that accept\n * a formatted text with entities.\n *\n * Can be either a plain string or an object with `text` and `entities` fields.\n */\nexport type InputText = string | TextWithEntities\n"]}
|
|
1
|
+
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/misc/entities.ts"],"names":[],"mappings":"AAkBA;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,IAAe;IACzC,OAAO;QACH,CAAC,EAAE,kBAAkB;QACrB,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;QACjD,QAAQ,EAAE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE;KAChE,CAAA;AACL,CAAC","sourcesContent":["import { tl } from '@mtcute/tl'\n\n/**\n * Formatted text with entities\n */\nexport interface TextWithEntities {\n readonly text: string\n readonly entities?: tl.TypeMessageEntity[]\n}\n\n/**\n * Type to be used as a parameter for methods that accept\n * a formatted text with entities.\n *\n * Can be either a plain string or an object with `text` and `entities` fields.\n */\nexport type InputText = string | TextWithEntities\n\n/**\n * Convert {@link InputText} to a {@link tl.RawTextWithEntities} object\n *\n * @param text Input text\n * @returns TL object\n */\nexport function inputTextToTl(text: InputText): tl.RawTextWithEntities {\n return {\n _: 'textWithEntities',\n text: typeof text === 'string' ? text : text.text,\n entities: typeof text === 'string' ? [] : text.entities ?? [],\n }\n}\n"]}
|