@deffa5556/bail 1.0.6 → 1.0.9
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/WAProto/index.cjs +106053 -0
- package/cjs/deffa/config.cjs +14 -0
- package/cjs/deffa/plugins/ai/deepseekr1.cjs +35 -0
- package/cjs/deffa/plugins/ai/gita.cjs +26 -0
- package/cjs/deffa/plugins/ai/glm47flash.cjs +35 -0
- package/cjs/deffa/plugins/ai/gptoss120b.cjs +35 -0
- package/cjs/deffa/plugins/ai/qwq32b.cjs +35 -0
- package/cjs/deffa/plugins/berita/antara.cjs +25 -0
- package/cjs/deffa/plugins/berita/cnbcindonesia.cjs +25 -0
- package/cjs/deffa/plugins/berita/cnn.cjs +25 -0
- package/cjs/deffa/plugins/berita/kompas.cjs +25 -0
- package/cjs/deffa/plugins/berita/liputan6.cjs +25 -0
- package/cjs/deffa/plugins/berita/merdeka.cjs +25 -0
- package/cjs/deffa/plugins/berita/sindonews.cjs +25 -0
- package/cjs/deffa/plugins/berita/tribunnews.cjs +25 -0
- package/cjs/deffa/plugins/downloader/douyin.cjs +30 -0
- package/cjs/deffa/plugins/downloader/facebook.cjs +30 -0
- package/cjs/deffa/plugins/downloader/github.cjs +35 -0
- package/cjs/deffa/plugins/downloader/lahelu.cjs +30 -0
- package/cjs/deffa/plugins/downloader/snackvideo.cjs +30 -0
- package/cjs/deffa/plugins/downloader/soundcloud.cjs +30 -0
- package/cjs/deffa/plugins/downloader/tiktok.cjs +30 -0
- package/cjs/deffa/plugins/downloader/tiktokhd.cjs +30 -0
- package/cjs/deffa/plugins/downloader/twitter.cjs +30 -0
- package/cjs/deffa/plugins/downloader/ummy.cjs +36 -0
- package/cjs/deffa/plugins/index.cjs +213 -0
- package/cjs/deffa/plugins/info/bmkg.cjs +34 -0
- package/cjs/deffa/plugins/info/cuaca.cjs +31 -0
- package/cjs/deffa/plugins/info/jadwaltv.cjs +29 -0
- package/cjs/deffa/plugins/maker/brat.cjs +45 -0
- package/cjs/deffa/plugins/maker/bratvid.cjs +52 -0
- package/cjs/deffa/plugins/search/8font.cjs +28 -0
- package/cjs/deffa/plugins/search/applemusic.cjs +28 -0
- package/cjs/deffa/plugins/search/bimg.cjs +30 -0
- package/cjs/deffa/plugins/search/brave.cjs +34 -0
- package/cjs/deffa/plugins/search/duckduckgo.cjs +28 -0
- package/cjs/deffa/plugins/search/lahelu.cjs +28 -0
- package/cjs/deffa/plugins/search/mangatoon.cjs +28 -0
- package/cjs/deffa/plugins/search/mcpedl.cjs +28 -0
- package/cjs/deffa/plugins/search/myinstants.cjs +28 -0
- package/cjs/deffa/plugins/search/otakotaku.cjs +28 -0
- package/cjs/deffa/plugins/search/pinterest.cjs +30 -0
- package/cjs/deffa/plugins/search/resep.cjs +28 -0
- package/cjs/deffa/plugins/search/seegore.cjs +30 -0
- package/cjs/deffa/plugins/search/soundcloud.cjs +28 -0
- package/cjs/deffa/plugins/search/youtube.cjs +28 -0
- package/cjs/deffa/plugins/stalk/github.cjs +38 -0
- package/cjs/deffa/plugins/stalk/pinterest.cjs +37 -0
- package/cjs/deffa/plugins/stalk/threads.cjs +34 -0
- package/cjs/deffa/plugins/stalk/tiktok.cjs +37 -0
- package/cjs/deffa/plugins/stalk/twitter.cjs +37 -0
- package/cjs/deffa/plugins/stalk/youtube.cjs +37 -0
- package/cjs/lib/Defaults/index.cjs +158 -0
- package/cjs/lib/Discord/Client.cjs +263 -0
- package/cjs/lib/Discord/Constants.cjs +1842 -0
- package/cjs/lib/Discord/connect-dc.cjs +11 -0
- package/cjs/lib/Discord/esm-bridge.cjs +136 -0
- package/cjs/lib/Discord/gateway/Dispatcher.cjs +93 -0
- package/cjs/lib/Discord/gateway/Shard.cjs +695 -0
- package/cjs/lib/Discord/gateway/ShardManager.cjs +344 -0
- package/cjs/lib/Discord/gateway/compression/base.cjs +13 -0
- package/cjs/lib/Discord/gateway/compression/config.cjs +47 -0
- package/cjs/lib/Discord/gateway/compression/pako.cjs +44 -0
- package/cjs/lib/Discord/gateway/compression/zlib-native.cjs +47 -0
- package/cjs/lib/Discord/gateway/compression/zlib-sync.cjs +31 -0
- package/cjs/lib/Discord/gateway/compression/zstd-napi.cjs +80 -0
- package/cjs/lib/Discord/gateway/compression/zstd-native.cjs +46 -0
- package/cjs/lib/Discord/gateway/events.cjs +956 -0
- package/cjs/lib/Discord/index.cjs +238 -0
- package/cjs/lib/Discord/rest/Bucket.cjs +69 -0
- package/cjs/lib/Discord/rest/DiscordHTTPError.cjs +63 -0
- package/cjs/lib/Discord/rest/DiscordRESTError.cjs +84 -0
- package/cjs/lib/Discord/rest/OAuthHelper.cjs +226 -0
- package/cjs/lib/Discord/rest/RESTManager.cjs +116 -0
- package/cjs/lib/Discord/rest/RequestHandler.cjs +320 -0
- package/cjs/lib/Discord/rest/SequentialBucket.cjs +69 -0
- package/cjs/lib/Discord/routes/Applications.cjs +625 -0
- package/cjs/lib/Discord/routes/Channels.cjs +1199 -0
- package/cjs/lib/Discord/routes/Guilds.cjs +1792 -0
- package/cjs/lib/Discord/routes/Interactions.cjs +212 -0
- package/cjs/lib/Discord/routes/Lobbies.cjs +197 -0
- package/cjs/lib/Discord/routes/Miscellaneous.cjs +120 -0
- package/cjs/lib/Discord/routes/OAuth.cjs +350 -0
- package/cjs/lib/Discord/routes/Users.cjs +107 -0
- package/cjs/lib/Discord/routes/Webhooks.cjs +308 -0
- package/cjs/lib/Discord/structures/AnnouncementChannel.cjs +46 -0
- package/cjs/lib/Discord/structures/AnnouncementThreadChannel.cjs +28 -0
- package/cjs/lib/Discord/structures/Application.cjs +345 -0
- package/cjs/lib/Discord/structures/ApplicationCommand.cjs +109 -0
- package/cjs/lib/Discord/structures/Attachment.cjs +46 -0
- package/cjs/lib/Discord/structures/AuditLogEntry.cjs +41 -0
- package/cjs/lib/Discord/structures/AutoModerationRule.cjs +117 -0
- package/cjs/lib/Discord/structures/AutocompleteInteraction.cjs +90 -0
- package/cjs/lib/Discord/structures/Base.cjs +56 -0
- package/cjs/lib/Discord/structures/BaseEntitlement.cjs +40 -0
- package/cjs/lib/Discord/structures/CategoryChannel.cjs +102 -0
- package/cjs/lib/Discord/structures/Channel.cjs +89 -0
- package/cjs/lib/Discord/structures/ClientApplication.cjs +269 -0
- package/cjs/lib/Discord/structures/CommandInteraction.cjs +294 -0
- package/cjs/lib/Discord/structures/ComponentInteraction.cjs +306 -0
- package/cjs/lib/Discord/structures/Entitlement.cjs +24 -0
- package/cjs/lib/Discord/structures/ExtendedUser.cjs +48 -0
- package/cjs/lib/Discord/structures/ForumChannel.cjs +20 -0
- package/cjs/lib/Discord/structures/GroupChannel.cjs +160 -0
- package/cjs/lib/Discord/structures/Guild.cjs +1289 -0
- package/cjs/lib/Discord/structures/GuildChannel.cjs +82 -0
- package/cjs/lib/Discord/structures/GuildPreview.cjs +141 -0
- package/cjs/lib/Discord/structures/GuildScheduledEvent.cjs +166 -0
- package/cjs/lib/Discord/structures/GuildTemplate.cjs +96 -0
- package/cjs/lib/Discord/structures/Integration.cjs +123 -0
- package/cjs/lib/Discord/structures/Interaction.cjs +78 -0
- package/cjs/lib/Discord/structures/InteractionResolvedChannel.cjs +36 -0
- package/cjs/lib/Discord/structures/Invite.cjs +196 -0
- package/cjs/lib/Discord/structures/InviteGuild.cjs +117 -0
- package/cjs/lib/Discord/structures/InviteRole.cjs +88 -0
- package/cjs/lib/Discord/structures/Lobby.cjs +84 -0
- package/cjs/lib/Discord/structures/LobbyMember.cjs +30 -0
- package/cjs/lib/Discord/structures/MediaChannel.cjs +20 -0
- package/cjs/lib/Discord/structures/Member.cjs +300 -0
- package/cjs/lib/Discord/structures/Message.cjs +553 -0
- package/cjs/lib/Discord/structures/ModalSubmitInteraction.cjs +263 -0
- package/cjs/lib/Discord/structures/OAuthApplication.cjs +203 -0
- package/cjs/lib/Discord/structures/OAuthGuild.cjs +98 -0
- package/cjs/lib/Discord/structures/PartialApplication.cjs +97 -0
- package/cjs/lib/Discord/structures/Permission.cjs +61 -0
- package/cjs/lib/Discord/structures/PermissionOverwrite.cjs +46 -0
- package/cjs/lib/Discord/structures/PingInteraction.cjs +27 -0
- package/cjs/lib/Discord/structures/Poll.cjs +69 -0
- package/cjs/lib/Discord/structures/PrimaryGuild.cjs +93 -0
- package/cjs/lib/Discord/structures/PrivateChannel.cjs +131 -0
- package/cjs/lib/Discord/structures/PrivateThreadChannel.cjs +28 -0
- package/cjs/lib/Discord/structures/PublicThreadChannel.cjs +36 -0
- package/cjs/lib/Discord/structures/Role.cjs +126 -0
- package/cjs/lib/Discord/structures/SKU.cjs +58 -0
- package/cjs/lib/Discord/structures/Soundboard.cjs +58 -0
- package/cjs/lib/Discord/structures/StageChannel.cjs +45 -0
- package/cjs/lib/Discord/structures/StageInstance.cjs +80 -0
- package/cjs/lib/Discord/structures/Subscription.cjs +21 -0
- package/cjs/lib/Discord/structures/Team.cjs +70 -0
- package/cjs/lib/Discord/structures/TestEntitlement.cjs +22 -0
- package/cjs/lib/Discord/structures/TextChannel.cjs +48 -0
- package/cjs/lib/Discord/structures/TextableChannel.cjs +265 -0
- package/cjs/lib/Discord/structures/TextableVoiceChannel.cjs +70 -0
- package/cjs/lib/Discord/structures/ThreadChannel.cjs +276 -0
- package/cjs/lib/Discord/structures/ThreadOnlyChannel.cjs +205 -0
- package/cjs/lib/Discord/structures/ThreadableChannel.cjs +57 -0
- package/cjs/lib/Discord/structures/UnavailableGuild.cjs +21 -0
- package/cjs/lib/Discord/structures/User.cjs +223 -0
- package/cjs/lib/Discord/structures/VoiceChannel.cjs +34 -0
- package/cjs/lib/Discord/structures/VoiceState.cjs +113 -0
- package/cjs/lib/Discord/structures/Webhook.cjs +224 -0
- package/cjs/lib/Discord/util/Collection.cjs +77 -0
- package/cjs/lib/Discord/util/Errors.cjs +81 -0
- package/cjs/lib/Discord/util/QueryBuilder.cjs +20 -0
- package/cjs/lib/Discord/util/Routes.cjs +293 -0
- package/cjs/lib/Discord/util/SimpleCollection.cjs +78 -0
- package/cjs/lib/Discord/util/Time.cjs +92 -0
- package/cjs/lib/Discord/util/TypedCollection.cjs +78 -0
- package/cjs/lib/Discord/util/TypedEmitter.cjs +20 -0
- package/cjs/lib/Discord/util/Util.cjs +906 -0
- package/cjs/lib/Discord/util/interactions/InteractionOptionsWrapper.cjs +207 -0
- package/cjs/lib/Discord/util/interactions/MessageInteractionResponse.cjs +26 -0
- package/cjs/lib/Discord/util/interactions/ModalSubmitInteractionComponentsWrapper.cjs +98 -0
- package/cjs/lib/Discord/util/interactions/SelectMenuValuesWrapper.cjs +77 -0
- package/cjs/lib/Discord/util/interactions/shared.cjs +20 -0
- package/cjs/lib/Discord/util/warning.cjs +34 -0
- package/cjs/lib/Signal/Group/ciphertext-message.cjs +16 -0
- package/cjs/lib/Signal/Group/group-session-builder.cjs +67 -0
- package/cjs/lib/Signal/Group/group_cipher.cjs +86 -0
- package/cjs/lib/Signal/Group/index.cjs +58 -0
- package/cjs/lib/Signal/Group/keyhelper.cjs +56 -0
- package/cjs/lib/Signal/Group/sender-chain-key.cjs +30 -0
- package/cjs/lib/Signal/Group/sender-key-distribution-message.cjs +67 -0
- package/cjs/lib/Signal/Group/sender-key-message.cjs +70 -0
- package/cjs/lib/Signal/Group/sender-key-name.cjs +52 -0
- package/cjs/lib/Signal/Group/sender-key-record.cjs +45 -0
- package/cjs/lib/Signal/Group/sender-key-state.cjs +88 -0
- package/cjs/lib/Signal/Group/sender-message-key.cjs +30 -0
- package/cjs/lib/Signal/libsignal.cjs +467 -0
- package/cjs/lib/Signal/lid-mapping.cjs +281 -0
- package/cjs/lib/Socket/Client/index.cjs +19 -0
- package/cjs/lib/Socket/Client/types.cjs +15 -0
- package/cjs/lib/Socket/Client/websocket.cjs +61 -0
- package/cjs/lib/Socket/business.cjs +384 -0
- package/cjs/lib/Socket/chats.cjs +1221 -0
- package/cjs/lib/Socket/communities.cjs +440 -0
- package/cjs/lib/Socket/groups.cjs +353 -0
- package/cjs/lib/Socket/index.cjs +14 -0
- package/cjs/lib/Socket/messages-recv.cjs +1772 -0
- package/cjs/lib/Socket/messages-send.cjs +1376 -0
- package/cjs/lib/Socket/mex.cjs +46 -0
- package/cjs/lib/Socket/newsletter.cjs +230 -0
- package/cjs/lib/Socket/socket.cjs +976 -0
- package/cjs/lib/Store/index.cjs +20 -0
- package/cjs/lib/Store/make-in-memory-store.cjs +470 -0
- package/cjs/lib/Store/make-ordered-dictionary.cjs +82 -0
- package/cjs/lib/Store/object-repository.cjs +28 -0
- package/cjs/lib/Telegram/button.cjs +147 -0
- package/cjs/lib/Telegram/composer.cjs +582 -0
- package/cjs/lib/Telegram/context.cjs +853 -0
- package/cjs/lib/Telegram/core/helpers/args.cjs +57 -0
- package/cjs/lib/Telegram/core/helpers/check.cjs +55 -0
- package/cjs/lib/Telegram/core/helpers/compact.cjs +16 -0
- package/cjs/lib/Telegram/core/helpers/deunionize.cjs +12 -0
- package/cjs/lib/Telegram/core/helpers/formatting.cjs +91 -0
- package/cjs/lib/Telegram/core/helpers/util.cjs +50 -0
- package/cjs/lib/Telegram/core/network/client.cjs +338 -0
- package/cjs/lib/Telegram/core/network/error.cjs +21 -0
- package/cjs/lib/Telegram/core/network/multipart-stream.cjs +79 -0
- package/cjs/lib/Telegram/core/network/polling.cjs +87 -0
- package/cjs/lib/Telegram/core/network/webhook.cjs +54 -0
- package/cjs/lib/Telegram/core/types/typegram.cjs +31 -0
- package/cjs/lib/Telegram/deffa-telegraf.cjs +264 -0
- package/cjs/lib/Telegram/esm-bridge.cjs +20 -0
- package/cjs/lib/Telegram/filters.cjs +69 -0
- package/cjs/lib/Telegram/format.cjs +58 -0
- package/cjs/lib/Telegram/future.cjs +140 -0
- package/cjs/lib/Telegram/index.cjs +67 -0
- package/cjs/lib/Telegram/input.cjs +61 -0
- package/cjs/lib/Telegram/markup.cjs +129 -0
- package/cjs/lib/Telegram/middleware.cjs +2 -0
- package/cjs/lib/Telegram/reactions.cjs +84 -0
- package/cjs/lib/Telegram/router.cjs +46 -0
- package/cjs/lib/Telegram/scenes/base.cjs +39 -0
- package/cjs/lib/Telegram/scenes/context.cjs +104 -0
- package/cjs/lib/Telegram/scenes/index.cjs +21 -0
- package/cjs/lib/Telegram/scenes/stage.cjs +49 -0
- package/cjs/lib/Telegram/scenes/wizard/context.cjs +31 -0
- package/cjs/lib/Telegram/scenes/wizard/index.cjs +45 -0
- package/cjs/lib/Telegram/scenes.cjs +21 -0
- package/cjs/lib/Telegram/session.cjs +166 -0
- package/cjs/lib/Telegram/telegram-types.cjs +6 -0
- package/cjs/lib/Telegram/telegram.cjs +945 -0
- package/cjs/lib/Telegram/types.cjs +2 -0
- package/cjs/lib/Telegram/utils.cjs +5 -0
- package/cjs/lib/Types/Auth.cjs +3 -0
- package/cjs/lib/Types/Bussines.cjs +3 -0
- package/cjs/lib/Types/Call.cjs +3 -0
- package/cjs/lib/Types/Chat.cjs +11 -0
- package/cjs/lib/Types/Contact.cjs +3 -0
- package/cjs/lib/Types/Events.cjs +4 -0
- package/cjs/lib/Types/GroupMetadata.cjs +3 -0
- package/cjs/lib/Types/Label.cjs +26 -0
- package/cjs/lib/Types/LabelAssociation.cjs +8 -0
- package/cjs/lib/Types/Message.cjs +19 -0
- package/cjs/lib/Types/Mex.cjs +40 -0
- package/cjs/lib/Types/Product.cjs +3 -0
- package/cjs/lib/Types/RichType.cjs +24 -0
- package/cjs/lib/Types/Signal.cjs +4 -0
- package/cjs/lib/Types/Socket.cjs +4 -0
- package/cjs/lib/Types/State.cjs +54 -0
- package/cjs/lib/Types/USync.cjs +4 -0
- package/cjs/lib/Types/index.cjs +42 -0
- package/cjs/lib/Utils/auth-utils.cjs +312 -0
- package/cjs/lib/Utils/browser-utils.cjs +39 -0
- package/cjs/lib/Utils/business.cjs +241 -0
- package/cjs/lib/Utils/chat-utils.cjs +890 -0
- package/cjs/lib/Utils/companion-reg-client-utils.cjs +51 -0
- package/cjs/lib/Utils/crypto.cjs +170 -0
- package/cjs/lib/Utils/decode-wa-message.cjs +330 -0
- package/cjs/lib/Utils/event-buffer.cjs +629 -0
- package/cjs/lib/Utils/generics.cjs +427 -0
- package/cjs/lib/Utils/history.cjs +141 -0
- package/cjs/lib/Utils/identity-change-handler.cjs +56 -0
- package/cjs/lib/Utils/index.cjs +43 -0
- package/cjs/lib/Utils/link-preview.cjs +122 -0
- package/cjs/lib/Utils/logger.cjs +8 -0
- package/cjs/lib/Utils/lt-hash.cjs +11 -0
- package/cjs/lib/Utils/make-mutex.cjs +38 -0
- package/cjs/lib/Utils/message-retry-manager.cjs +267 -0
- package/cjs/lib/Utils/messages-media.cjs +906 -0
- package/cjs/lib/Utils/messages.cjs +1909 -0
- package/cjs/lib/Utils/noise-handler.cjs +205 -0
- package/cjs/lib/Utils/offline-node-processor.cjs +43 -0
- package/cjs/lib/Utils/pre-key-manager.cjs +113 -0
- package/cjs/lib/Utils/process-message.cjs +755 -0
- package/cjs/lib/Utils/reporting-utils.cjs +263 -0
- package/cjs/lib/Utils/rich-message-utils.cjs +434 -0
- package/cjs/lib/Utils/session-guard.cjs +163 -0
- package/cjs/lib/Utils/signal.cjs +214 -0
- package/cjs/lib/Utils/stanza-ack.cjs +41 -0
- package/cjs/lib/Utils/sync-action-utils.cjs +54 -0
- package/cjs/lib/Utils/tc-token-utils.cjs +174 -0
- package/cjs/lib/Utils/text-sticker.cjs +174 -0
- package/cjs/lib/Utils/use-multi-file-auth-state.cjs +125 -0
- package/cjs/lib/Utils/use-single-file-auth-state.cjs +113 -0
- package/cjs/lib/Utils/use-sqlite-auth-state.cjs +145 -0
- package/cjs/lib/Utils/validate-connection.cjs +210 -0
- package/cjs/lib/WABinary/constants.cjs +1470 -0
- package/cjs/lib/WABinary/decode.cjs +301 -0
- package/cjs/lib/WABinary/encode.cjs +257 -0
- package/cjs/lib/WABinary/generic-utils.cjs +240 -0
- package/cjs/lib/WABinary/index.cjs +22 -0
- package/cjs/lib/WABinary/jid-utils.cjs +114 -0
- package/cjs/lib/WABinary/types.cjs +37 -0
- package/cjs/lib/WAM/BinaryInfo.cjs +14 -0
- package/cjs/lib/WAM/constants.cjs +22856 -0
- package/cjs/lib/WAM/encode.cjs +154 -0
- package/cjs/lib/WAM/index.cjs +20 -0
- package/cjs/lib/WAUSync/Protocols/USyncContactProtocol.cjs +56 -0
- package/cjs/lib/WAUSync/Protocols/USyncDeviceProtocol.cjs +58 -0
- package/cjs/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.cjs +31 -0
- package/cjs/lib/WAUSync/Protocols/USyncStatusProtocol.cjs +42 -0
- package/cjs/lib/WAUSync/Protocols/USyncUsernameProtocol.cjs +29 -0
- package/cjs/lib/WAUSync/Protocols/UsyncBotProfileProtocol.cjs +55 -0
- package/cjs/lib/WAUSync/Protocols/UsyncLIDProtocol.cjs +33 -0
- package/cjs/lib/WAUSync/Protocols/index.cjs +22 -0
- package/cjs/lib/WAUSync/USyncQuery.cjs +102 -0
- package/cjs/lib/WAUSync/USyncUser.cjs +35 -0
- package/cjs/lib/WAUSync/index.cjs +20 -0
- package/cjs/lib/index.cjs +372 -0
- package/cjs/lib/plugins/loader.cjs +117 -0
- package/lib/Defaults/index.js +1 -1
- package/lib/Socket/socket.js +3 -3
- package/lib/Telegram/esm-bridge.mjs +1 -1
- package/package.json +11 -6
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeWMexQuery = void 0;
|
|
4
|
+
const boom_1 = require("@hapi/boom");
|
|
5
|
+
const index_js_1 = require("../WABinary/index.cjs");
|
|
6
|
+
const wMexQuery = (variables, queryId, query, generateMessageTag) => {
|
|
7
|
+
return query({
|
|
8
|
+
tag: 'iq',
|
|
9
|
+
attrs: {
|
|
10
|
+
id: generateMessageTag(),
|
|
11
|
+
type: 'get',
|
|
12
|
+
to: index_js_1.S_WHATSAPP_NET,
|
|
13
|
+
xmlns: 'w:mex'
|
|
14
|
+
},
|
|
15
|
+
content: [
|
|
16
|
+
{
|
|
17
|
+
tag: 'query',
|
|
18
|
+
attrs: { query_id: queryId },
|
|
19
|
+
content: Buffer.from(JSON.stringify({ variables }), 'utf-8')
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const executeWMexQuery = async (variables, queryId, dataPath, query, generateMessageTag) => {
|
|
25
|
+
const result = await wMexQuery(variables, queryId, query, generateMessageTag);
|
|
26
|
+
const child = (0, index_js_1.getBinaryNodeChild)(result, 'result');
|
|
27
|
+
if (child?.content) {
|
|
28
|
+
const data = JSON.parse(child.content.toString());
|
|
29
|
+
if (data.errors && data.errors.length > 0) {
|
|
30
|
+
const errorMessages = data.errors.map((err) => err.message || 'Unknown error').join(', ');
|
|
31
|
+
const firstError = data.errors[0];
|
|
32
|
+
const errorCode = firstError.extensions?.error_code || 400;
|
|
33
|
+
throw new boom_1.Boom(`GraphQL server error: ${errorMessages}`, { statusCode: errorCode, data: firstError });
|
|
34
|
+
}
|
|
35
|
+
const response = dataPath ? data?.data?.[dataPath] : data?.data;
|
|
36
|
+
if (typeof response !== 'undefined') {
|
|
37
|
+
return response;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const action = (dataPath || '').startsWith('xwa2_')
|
|
41
|
+
? dataPath.substring(5).replace(/_/g, ' ')
|
|
42
|
+
: dataPath?.replace(/_/g, ' ');
|
|
43
|
+
throw new boom_1.Boom(`Failed to ${action}, unexpected response structure.`, { statusCode: 400, data: result });
|
|
44
|
+
};
|
|
45
|
+
exports.executeWMexQuery = executeWMexQuery;
|
|
46
|
+
//# sourceMappingURL=mex.js.map
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeNewsletterSocket = void 0;
|
|
4
|
+
const index_js_1 = require("../../WAProto/index.cjs");
|
|
5
|
+
const index_js_2 = require("../Types/index.cjs");
|
|
6
|
+
const messages_media_js_1 = require("../Utils/messages-media.cjs");
|
|
7
|
+
const index_js_3 = require("../WABinary/index.cjs");
|
|
8
|
+
const groups_js_1 = require("./groups.cjs");
|
|
9
|
+
const mex_js_1 = require("./mex.cjs");
|
|
10
|
+
const parseNewsletterCreateResponse = (response) => {
|
|
11
|
+
const { id, thread_metadata: thread, viewer_metadata: viewer } = response;
|
|
12
|
+
return {
|
|
13
|
+
id: id,
|
|
14
|
+
owner: undefined,
|
|
15
|
+
name: thread.name.text,
|
|
16
|
+
creation_time: parseInt(thread.creation_time, 10),
|
|
17
|
+
description: thread.description.text,
|
|
18
|
+
invite: thread.invite,
|
|
19
|
+
subscribers: parseInt(thread.subscribers_count, 10),
|
|
20
|
+
verification: thread.verification,
|
|
21
|
+
picture: {
|
|
22
|
+
id: thread.picture?.id,
|
|
23
|
+
directPath: thread.picture?.direct_path
|
|
24
|
+
},
|
|
25
|
+
mute_state: viewer.mute
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const parseNewsletterMetadata = (result) => {
|
|
29
|
+
if (typeof result !== 'object' || result === null) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
if ('id' in result && typeof result.id === 'string') {
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
if ('result' in result && typeof result.result === 'object' && result.result !== null && 'id' in result.result) {
|
|
36
|
+
return result.result;
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
};
|
|
40
|
+
const makeNewsletterSocket = (config) => {
|
|
41
|
+
const sock = (0, groups_js_1.makeGroupsSocket)(config);
|
|
42
|
+
const { query, generateMessageTag } = sock;
|
|
43
|
+
const executeWMexQuery = (variables, queryId, dataPath) => {
|
|
44
|
+
return (0, mex_js_1.executeWMexQuery)(variables, queryId, dataPath, query, generateMessageTag);
|
|
45
|
+
};
|
|
46
|
+
const newsletterUpdate = async (jid, updates) => {
|
|
47
|
+
const variables = {
|
|
48
|
+
newsletter_id: jid,
|
|
49
|
+
updates: {
|
|
50
|
+
...updates,
|
|
51
|
+
settings: null
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return executeWMexQuery(variables, index_js_2.QueryIds.UPDATE_METADATA, 'xwa2_newsletter_update');
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
...sock,
|
|
58
|
+
executeWMexQuery,
|
|
59
|
+
newsletterCreate: async (name, description) => {
|
|
60
|
+
const variables = {
|
|
61
|
+
input: {
|
|
62
|
+
name,
|
|
63
|
+
description: description ?? null
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const rawResponse = await executeWMexQuery(variables, index_js_2.QueryIds.CREATE, index_js_2.XWAPaths.xwa2_newsletter_create);
|
|
67
|
+
return parseNewsletterCreateResponse(rawResponse);
|
|
68
|
+
},
|
|
69
|
+
newsletterUpdate,
|
|
70
|
+
newsletterSubscribers: async (jid) => {
|
|
71
|
+
return executeWMexQuery({ newsletter_id: jid }, index_js_2.QueryIds.SUBSCRIBERS, index_js_2.XWAPaths.xwa2_newsletter_subscribers);
|
|
72
|
+
},
|
|
73
|
+
// Lia@Changes 29-01-26 --- Add newsletterSubscribed to fetch all subscribed newsletters (similar to groupFetchAllParticipating ( ╹▽╹ ))
|
|
74
|
+
newsletterSubscribed: async () => {
|
|
75
|
+
return executeWMexQuery({}, index_js_2.QueryIds.SUBSCRIBED, index_js_2.XWAPaths.xwa2_newsletter_subscribed);
|
|
76
|
+
},
|
|
77
|
+
newsletterMetadata: async (type, key) => {
|
|
78
|
+
const variables = {
|
|
79
|
+
fetch_creation_time: true,
|
|
80
|
+
fetch_full_image: true,
|
|
81
|
+
fetch_viewer_metadata: true,
|
|
82
|
+
input: {
|
|
83
|
+
key,
|
|
84
|
+
type: type.toUpperCase()
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const result = await executeWMexQuery(variables, index_js_2.QueryIds.METADATA, index_js_2.XWAPaths.xwa2_newsletter_metadata);
|
|
88
|
+
return parseNewsletterMetadata(result);
|
|
89
|
+
},
|
|
90
|
+
newsletterFollow: (jid) => {
|
|
91
|
+
return executeWMexQuery({ newsletter_id: jid }, index_js_2.QueryIds.FOLLOW, index_js_2.XWAPaths.xwa2_newsletter_join_v2);
|
|
92
|
+
},
|
|
93
|
+
newsletterUnfollow: (jid) => {
|
|
94
|
+
return executeWMexQuery({ newsletter_id: jid }, index_js_2.QueryIds.UNFOLLOW, index_js_2.XWAPaths.xwa2_newsletter_leave_v2);
|
|
95
|
+
},
|
|
96
|
+
newsletterMute: (jid) => {
|
|
97
|
+
return executeWMexQuery({ newsletter_id: jid }, index_js_2.QueryIds.MUTE, index_js_2.XWAPaths.xwa2_newsletter_mute_v2);
|
|
98
|
+
},
|
|
99
|
+
newsletterUnmute: (jid) => {
|
|
100
|
+
return executeWMexQuery({ newsletter_id: jid }, index_js_2.QueryIds.UNMUTE, index_js_2.XWAPaths.xwa2_newsletter_unmute_v2);
|
|
101
|
+
},
|
|
102
|
+
newsletterUpdateName: async (jid, name) => {
|
|
103
|
+
return await newsletterUpdate(jid, { name });
|
|
104
|
+
},
|
|
105
|
+
newsletterUpdateDescription: async (jid, description) => {
|
|
106
|
+
return await newsletterUpdate(jid, { description });
|
|
107
|
+
},
|
|
108
|
+
newsletterUpdatePicture: async (jid, content) => {
|
|
109
|
+
const { img } = await (0, messages_media_js_1.generateProfilePicture)(content);
|
|
110
|
+
return await newsletterUpdate(jid, { picture: img.toString('base64') });
|
|
111
|
+
},
|
|
112
|
+
newsletterRemovePicture: async (jid) => {
|
|
113
|
+
return await newsletterUpdate(jid, { picture: '' });
|
|
114
|
+
},
|
|
115
|
+
newsletterReactMessage: async (jid, serverId, reaction) => {
|
|
116
|
+
await query({
|
|
117
|
+
tag: 'message',
|
|
118
|
+
attrs: {
|
|
119
|
+
to: jid,
|
|
120
|
+
...(reaction ? {} : { edit: '7' }),
|
|
121
|
+
type: 'reaction',
|
|
122
|
+
server_id: serverId,
|
|
123
|
+
id: generateMessageTag()
|
|
124
|
+
},
|
|
125
|
+
content: [
|
|
126
|
+
{
|
|
127
|
+
tag: 'reaction',
|
|
128
|
+
attrs: reaction ? { code: reaction } : {}
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
newsletterFetchMessages: async (type, key, count, after, before) => {
|
|
134
|
+
// WA Web: GetNewsletterMessages endpoint
|
|
135
|
+
// Request: iq(to=s.whatsapp.net) -> messages(count, type, jid|key, [after|before])
|
|
136
|
+
const messagesAttrs = {
|
|
137
|
+
count: count.toString(),
|
|
138
|
+
type,
|
|
139
|
+
[type === 'jid' ? 'jid' : 'key']: key
|
|
140
|
+
};
|
|
141
|
+
if (after) {
|
|
142
|
+
messagesAttrs.after = after.toString();
|
|
143
|
+
}
|
|
144
|
+
if (before) {
|
|
145
|
+
messagesAttrs.before = before.toString();
|
|
146
|
+
}
|
|
147
|
+
const result = await query({
|
|
148
|
+
tag: 'iq',
|
|
149
|
+
attrs: {
|
|
150
|
+
id: generateMessageTag(),
|
|
151
|
+
type: 'get',
|
|
152
|
+
xmlns: 'newsletter',
|
|
153
|
+
to: index_js_3.S_WHATSAPP_NET
|
|
154
|
+
},
|
|
155
|
+
content: [
|
|
156
|
+
{
|
|
157
|
+
tag: 'messages',
|
|
158
|
+
attrs: messagesAttrs
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
});
|
|
162
|
+
// Response: iq -> messages(jid="newsletter_jid") -> message[]
|
|
163
|
+
const messagesNode = (0, index_js_3.getBinaryNodeChild)(result, 'messages');
|
|
164
|
+
if (!messagesNode) {
|
|
165
|
+
return [];
|
|
166
|
+
}
|
|
167
|
+
// The response messages node carries the newsletter JID
|
|
168
|
+
const newsletterJid = messagesNode.attrs.jid || (type === 'jid' ? key : undefined);
|
|
169
|
+
const messages = [];
|
|
170
|
+
// WA Web: mapChildrenWithTag(messages, "message", 0, 300, ...)
|
|
171
|
+
for (const child of (0, index_js_3.getBinaryNodeChildren)(messagesNode, 'message')) {
|
|
172
|
+
const plaintextNode = (0, index_js_3.getBinaryNodeChild)(child, 'plaintext');
|
|
173
|
+
if (!plaintextNode?.content) {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
const contentBuf = typeof plaintextNode.content === 'string'
|
|
178
|
+
? Buffer.from(plaintextNode.content, 'binary')
|
|
179
|
+
: Buffer.from(plaintextNode.content);
|
|
180
|
+
const messageProto = index_js_1.proto.Message.decode(contentBuf).toJSON();
|
|
181
|
+
const fullMessage = index_js_1.proto.WebMessageInfo.fromObject({
|
|
182
|
+
key: {
|
|
183
|
+
remoteJid: newsletterJid,
|
|
184
|
+
id: child.attrs.id || child.attrs.server_id,
|
|
185
|
+
server_id: child.attrs.server_id,
|
|
186
|
+
fromMe: false
|
|
187
|
+
},
|
|
188
|
+
message: messageProto,
|
|
189
|
+
messageTimestamp: child.attrs.t ? +child.attrs.t : undefined
|
|
190
|
+
}).toJSON();
|
|
191
|
+
messages.push(fullMessage);
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
logger.error({ error }, 'Failed to decode newsletter message');
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return messages;
|
|
198
|
+
},
|
|
199
|
+
subscribeNewsletterUpdates: async (jid) => {
|
|
200
|
+
const result = await query({
|
|
201
|
+
tag: 'iq',
|
|
202
|
+
attrs: {
|
|
203
|
+
id: generateMessageTag(),
|
|
204
|
+
type: 'set',
|
|
205
|
+
xmlns: 'newsletter',
|
|
206
|
+
to: jid
|
|
207
|
+
},
|
|
208
|
+
content: [{ tag: 'live_updates', attrs: {}, content: [] }]
|
|
209
|
+
});
|
|
210
|
+
const liveUpdatesNode = (0, index_js_3.getBinaryNodeChild)(result, 'live_updates');
|
|
211
|
+
const duration = liveUpdatesNode?.attrs?.duration;
|
|
212
|
+
return duration ? { duration: duration } : null;
|
|
213
|
+
},
|
|
214
|
+
newsletterAdminCount: async (jid) => {
|
|
215
|
+
const response = await executeWMexQuery({ newsletter_id: jid }, index_js_2.QueryIds.ADMIN_COUNT, index_js_2.XWAPaths.xwa2_newsletter_admin_count);
|
|
216
|
+
return response.admin_count;
|
|
217
|
+
},
|
|
218
|
+
newsletterChangeOwner: async (jid, newOwnerJid) => {
|
|
219
|
+
await executeWMexQuery({ newsletter_id: jid, user_id: newOwnerJid }, index_js_2.QueryIds.CHANGE_OWNER, index_js_2.XWAPaths.xwa2_newsletter_change_owner);
|
|
220
|
+
},
|
|
221
|
+
newsletterDemote: async (jid, userJid) => {
|
|
222
|
+
await executeWMexQuery({ newsletter_id: jid, user_id: userJid }, index_js_2.QueryIds.DEMOTE, index_js_2.XWAPaths.xwa2_newsletter_demote);
|
|
223
|
+
},
|
|
224
|
+
newsletterDelete: async (jid) => {
|
|
225
|
+
await executeWMexQuery({ newsletter_id: jid }, index_js_2.QueryIds.DELETE, index_js_2.XWAPaths.xwa2_newsletter_delete_v2);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
exports.makeNewsletterSocket = makeNewsletterSocket;
|
|
230
|
+
//# sourceMappingURL=newsletter.js.map
|