@deffa5556/bail 1.0.6 → 1.0.7
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/package.json +11 -6
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function (o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined)
|
|
4
|
+
k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function () { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function (o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined)
|
|
12
|
+
k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function (o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function (o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
21
|
+
var ownKeys = function (o) {
|
|
22
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
23
|
+
var ar = [];
|
|
24
|
+
for (var k in o)
|
|
25
|
+
if (Object.prototype.hasOwnProperty.call(o, k))
|
|
26
|
+
ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule)
|
|
33
|
+
return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null)
|
|
36
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++)
|
|
37
|
+
if (k[i] !== "default")
|
|
38
|
+
__createBinding(result, mod, k[i]);
|
|
39
|
+
__setModuleDefault(result, mod);
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
})();
|
|
43
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
44
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
/** @module Message */
|
|
48
|
+
const Base_1 = __importDefault(require("./Base"));
|
|
49
|
+
const Attachment_1 = __importDefault(require("./Attachment"));
|
|
50
|
+
const User_1 = __importDefault(require("./User"));
|
|
51
|
+
const PartialApplication_1 = __importDefault(require("./PartialApplication"));
|
|
52
|
+
const GuildChannel_1 = __importDefault(require("./GuildChannel"));
|
|
53
|
+
const Poll_1 = __importDefault(require("./Poll"));
|
|
54
|
+
const TypedCollection_1 = __importDefault(require("../util/TypedCollection"));
|
|
55
|
+
const Constants_1 = require("../Constants");
|
|
56
|
+
const Routes = __importStar(require("../util/Routes"));
|
|
57
|
+
const Errors_1 = require("../util/Errors");
|
|
58
|
+
/** Represents a message. */
|
|
59
|
+
class Message extends Base_1.default {
|
|
60
|
+
constructor(data, client) {
|
|
61
|
+
super(data.id, client);
|
|
62
|
+
this.attachments = new TypedCollection_1.default(Attachment_1.default, client);
|
|
63
|
+
this.channelID = data.channel_id;
|
|
64
|
+
this.components = [];
|
|
65
|
+
this.content = data.content ?? "";
|
|
66
|
+
this.editedTimestamp = null;
|
|
67
|
+
this.embeds = [];
|
|
68
|
+
this.flags = 0;
|
|
69
|
+
this.guildID = (data.guild_id === undefined ? null : data.guild_id);
|
|
70
|
+
this.member = (data.member === undefined ? undefined : this.client.util.updateMember(data.guild_id, data.author.id, { ...data.member, user: data.author }));
|
|
71
|
+
this.mentions = {
|
|
72
|
+
channels: [],
|
|
73
|
+
everyone: false,
|
|
74
|
+
members: [],
|
|
75
|
+
roles: [],
|
|
76
|
+
users: []
|
|
77
|
+
};
|
|
78
|
+
this.pinned = !!data.pinned;
|
|
79
|
+
this.poll = data.poll ? new Poll_1.default(data.poll, client, this) : undefined;
|
|
80
|
+
this.reactions = [];
|
|
81
|
+
// message updates can be missing a timestamp
|
|
82
|
+
this.timestamp = data.timestamp === undefined ? Base_1.default.getCreatedAt(this.id) : new Date(data.timestamp);
|
|
83
|
+
this.tts = !!data.tts;
|
|
84
|
+
this.type = data.type;
|
|
85
|
+
this.webhookID = data.webhook_id;
|
|
86
|
+
this.update(data);
|
|
87
|
+
// don't add webhook users to the cache
|
|
88
|
+
this.author = data.webhook_id === undefined ? client.users.update(data.author) : new User_1.default(data.author, client);
|
|
89
|
+
if (data.application_id === undefined) {
|
|
90
|
+
this.applicationID = null;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
if (client["_application"] && client.application.id === data.application_id) {
|
|
94
|
+
if (data.application) {
|
|
95
|
+
client.application["update"](data.application);
|
|
96
|
+
}
|
|
97
|
+
this.application = client.application;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this.application = data.application ? new PartialApplication_1.default(data.application, client) : undefined;
|
|
101
|
+
}
|
|
102
|
+
this.applicationID = data.application_id;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
update(data) {
|
|
106
|
+
if (data.mention_everyone !== undefined) {
|
|
107
|
+
this.mentions.everyone = data.mention_everyone;
|
|
108
|
+
}
|
|
109
|
+
if (data.mention_roles !== undefined) {
|
|
110
|
+
this.mentions.roles = data.mention_roles;
|
|
111
|
+
}
|
|
112
|
+
if (data.mentions !== undefined) {
|
|
113
|
+
const members = [];
|
|
114
|
+
this.mentions.users = data.mentions.map(user => {
|
|
115
|
+
if (this.channel && "guildID" in this.channel && user.member) {
|
|
116
|
+
members.push(this.client.util.updateMember(this.channel.guildID, user.id, { ...user.member, user }));
|
|
117
|
+
}
|
|
118
|
+
return this.client.users.update(user);
|
|
119
|
+
});
|
|
120
|
+
this.mentions.members = members;
|
|
121
|
+
}
|
|
122
|
+
if (data.activity !== undefined) {
|
|
123
|
+
this.activity = data.activity;
|
|
124
|
+
}
|
|
125
|
+
if (data.attachments !== undefined) {
|
|
126
|
+
if (this.attachments.size !== 0) {
|
|
127
|
+
for (const id of this.attachments.keys()) {
|
|
128
|
+
if (!data.attachments.some(attachment => attachment.id === id)) {
|
|
129
|
+
this.attachments.delete(id);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
for (const attachment of data.attachments) {
|
|
134
|
+
this.attachments.update(attachment);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (data.call !== undefined) {
|
|
138
|
+
this.call = {
|
|
139
|
+
endedTimestamp: data.call.ended_timestamp ? new Date(data.call.ended_timestamp) : null,
|
|
140
|
+
participants: data.call.participants
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
if (data.components !== undefined) {
|
|
144
|
+
this.components = this.client.util.componentsToParsed(data.components);
|
|
145
|
+
}
|
|
146
|
+
if (data.content !== undefined) {
|
|
147
|
+
this.content = data.content;
|
|
148
|
+
this.mentions.channels = (data.content.match(/<#\d{17,21}>/g) ?? []).map(mention => mention.slice(2, -1));
|
|
149
|
+
}
|
|
150
|
+
if (data.edited_timestamp !== undefined) {
|
|
151
|
+
this.editedTimestamp = data.edited_timestamp ? new Date(data.edited_timestamp) : null;
|
|
152
|
+
}
|
|
153
|
+
if (data.embeds !== undefined) {
|
|
154
|
+
this.embeds = this.client.util.embedsToParsed(data.embeds);
|
|
155
|
+
const pollResultEmbed = this.embeds.find(embed => embed.type === "poll_result");
|
|
156
|
+
if (pollResultEmbed) {
|
|
157
|
+
const questionText = pollResultEmbed.fields.find(field => field.name === "poll_question_text").value;
|
|
158
|
+
const totalVotes = pollResultEmbed.fields.find(field => field.name === "total_votes").value;
|
|
159
|
+
const victorAnswerID = pollResultEmbed.fields.find(field => field.name === "victor_answer_id")?.value;
|
|
160
|
+
const victorAnswerText = pollResultEmbed.fields.find(field => field.name === "victor_answer_text")?.value;
|
|
161
|
+
const victorAnswerVotes = pollResultEmbed.fields.find(field => field.name === "victor_answer_votes").value;
|
|
162
|
+
this.pollResults = {
|
|
163
|
+
questionText,
|
|
164
|
+
totalVotes: Number(totalVotes),
|
|
165
|
+
victorAnswerID: victorAnswerID === undefined ? undefined : Number(victorAnswerID),
|
|
166
|
+
victorAnswerText: victorAnswerText === undefined ? undefined : victorAnswerText,
|
|
167
|
+
victorAnswerVotes: Number(victorAnswerVotes)
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (data.flags !== undefined) {
|
|
172
|
+
this.flags = data.flags;
|
|
173
|
+
}
|
|
174
|
+
if (data.interaction !== undefined) {
|
|
175
|
+
let member;
|
|
176
|
+
if (data.interaction.member) {
|
|
177
|
+
member = {
|
|
178
|
+
...data.interaction.member,
|
|
179
|
+
user: data.interaction.user
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
this.interaction = {
|
|
183
|
+
id: data.interaction.id,
|
|
184
|
+
member: member ? this.client.util.updateMember(data.guild_id, member.user.id, member) : undefined,
|
|
185
|
+
name: data.interaction.name,
|
|
186
|
+
type: data.interaction.type,
|
|
187
|
+
user: this.client.users.update(data.interaction.user)
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
if (data.interaction_metadata !== undefined) {
|
|
191
|
+
this.interactionMetadata = {
|
|
192
|
+
authorizingIntegrationOwners: data.interaction_metadata.authorizing_integration_owners,
|
|
193
|
+
id: data.interaction_metadata.id,
|
|
194
|
+
interactedMessageID: data.interaction_metadata.interacted_message_id,
|
|
195
|
+
name: data.interaction_metadata.name,
|
|
196
|
+
originalResponseMessageID: data.interaction_metadata.original_response_message_id,
|
|
197
|
+
targetMessageID: data.interaction_metadata.target_message_id,
|
|
198
|
+
targetUser: data.interaction_metadata.target_user ? this.client.users.update(data.interaction_metadata.target_user) : undefined,
|
|
199
|
+
type: data.interaction_metadata.type,
|
|
200
|
+
user: this.client.users.update(data.interaction_metadata.user),
|
|
201
|
+
triggeringInteractionMetadata: data.interaction_metadata.triggering_interaction_metadata === undefined ? undefined : {
|
|
202
|
+
authorizingIntegrationOwners: data.interaction_metadata.triggering_interaction_metadata.authorizing_integration_owners,
|
|
203
|
+
id: data.interaction_metadata.triggering_interaction_metadata.id,
|
|
204
|
+
interactedMessageID: data.interaction_metadata.triggering_interaction_metadata.interacted_message_id,
|
|
205
|
+
originalResponseMessageID: data.interaction_metadata.triggering_interaction_metadata.original_response_message_id,
|
|
206
|
+
targetMessageID: data.interaction_metadata.triggering_interaction_metadata.target_message_id,
|
|
207
|
+
targetUser: data.interaction_metadata.triggering_interaction_metadata.target_user ? this.client.users.update(data.interaction_metadata.triggering_interaction_metadata.target_user) : undefined,
|
|
208
|
+
type: data.interaction_metadata.triggering_interaction_metadata.type,
|
|
209
|
+
user: this.client.users.update(data.interaction_metadata.triggering_interaction_metadata.user)
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
if (data.message_reference) {
|
|
214
|
+
this.messageReference = {
|
|
215
|
+
channelID: data.message_reference.channel_id,
|
|
216
|
+
failIfNotExists: data.message_reference.fail_if_not_exists,
|
|
217
|
+
guildID: data.message_reference.guild_id,
|
|
218
|
+
messageID: data.message_reference.message_id
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
if (data.message_snapshots) {
|
|
222
|
+
this.messageSnapshots = data.message_snapshots.map(s => ({
|
|
223
|
+
message: {
|
|
224
|
+
attachments: s.message.attachments.map(a => new Attachment_1.default(a, this.client)),
|
|
225
|
+
components: s.message.components ? this.client.util.componentsToParsed(s.message.components) : [],
|
|
226
|
+
content: s.message.content,
|
|
227
|
+
editedTimestamp: s.message.edited_timestamp ? new Date(s.message.edited_timestamp) : null,
|
|
228
|
+
embeds: this.client.util.embedsToParsed(s.message.embeds),
|
|
229
|
+
flags: s.message.flags ?? 0,
|
|
230
|
+
mentions: {
|
|
231
|
+
channels: (s.message.content.match(/<#\d{17,21}>/g) ?? []).map(mention => mention.slice(2, -1)),
|
|
232
|
+
roles: s.message.mention_roles,
|
|
233
|
+
users: s.message.mentions.map(u => this.client.users.update(u))
|
|
234
|
+
},
|
|
235
|
+
stickerItems: s.message.sticker_items ?? [],
|
|
236
|
+
timestamp: new Date(s.message.timestamp),
|
|
237
|
+
type: s.message.type
|
|
238
|
+
}
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
241
|
+
if (data.nonce !== undefined) {
|
|
242
|
+
this.nonce = data.nonce;
|
|
243
|
+
}
|
|
244
|
+
if (data.pinned !== undefined) {
|
|
245
|
+
this.pinned = data.pinned;
|
|
246
|
+
}
|
|
247
|
+
if (data.position !== undefined) {
|
|
248
|
+
this.position = data.position;
|
|
249
|
+
}
|
|
250
|
+
if (data.reactions) {
|
|
251
|
+
this.reactions = data.reactions.map(r => ({
|
|
252
|
+
burstColors: r.burst_colors,
|
|
253
|
+
count: r.count,
|
|
254
|
+
countDetails: r.count_details,
|
|
255
|
+
emoji: r.emoji,
|
|
256
|
+
me: r.me,
|
|
257
|
+
meBurst: r.me_burst
|
|
258
|
+
}));
|
|
259
|
+
}
|
|
260
|
+
if (data.referenced_message !== undefined) {
|
|
261
|
+
if (data.referenced_message === null) {
|
|
262
|
+
this.referencedMessage = null;
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
this.referencedMessage = this.channel ? this.channel.messages?.update(data.referenced_message) : new Message(data.referenced_message, this.client);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (data.role_subscription_data !== undefined) {
|
|
269
|
+
this.roleSubscriptionData = {
|
|
270
|
+
isRenewal: data.role_subscription_data.is_renewal,
|
|
271
|
+
roleSubscriptionListingID: data.role_subscription_data.role_subscription_listing_id,
|
|
272
|
+
tierName: data.role_subscription_data.tier_name,
|
|
273
|
+
totalMonthsSubscribed: data.role_subscription_data.total_months_subscribed
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
if (data.sticker_items !== undefined) {
|
|
277
|
+
this.stickerItems = data.sticker_items;
|
|
278
|
+
}
|
|
279
|
+
if (data.thread !== undefined) {
|
|
280
|
+
this.thread = this.client.util.updateThread(data.thread);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
/** The channel this message was created in. */
|
|
284
|
+
get channel() {
|
|
285
|
+
return this._cachedChannel ?? (this._cachedChannel = this.client.getChannel(this.channelID));
|
|
286
|
+
}
|
|
287
|
+
/** The guild this message is in. This will throw an error if the guild is not cached. */
|
|
288
|
+
get guild() {
|
|
289
|
+
if (this.guildID !== null && this._cachedGuild !== null) {
|
|
290
|
+
this._cachedGuild ?? (this._cachedGuild = this.client.guilds.get(this.guildID));
|
|
291
|
+
if (!this._cachedGuild) {
|
|
292
|
+
if (this.client.options.restMode) {
|
|
293
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present when rest mode is enabled.`);
|
|
294
|
+
}
|
|
295
|
+
if (!this.client.shards.connected) {
|
|
296
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present without a gateway connection.`);
|
|
297
|
+
}
|
|
298
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present.`);
|
|
299
|
+
}
|
|
300
|
+
return this._cachedGuild;
|
|
301
|
+
}
|
|
302
|
+
return this._cachedGuild === null ? this._cachedGuild : (this._cachedGuild = null);
|
|
303
|
+
}
|
|
304
|
+
/** A link to this message. */
|
|
305
|
+
get jumpLink() {
|
|
306
|
+
return `${Constants_1.BASE_URL}${Routes.MESSAGE_LINK(this.guildID ?? "@me", this.channelID, this.id)}`;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Add a reaction to this message.
|
|
310
|
+
* @param emoji The reaction to add to the message. `name:id` for custom emojis, and the unicode codepoint for default emojis.
|
|
311
|
+
*/
|
|
312
|
+
async createReaction(emoji) {
|
|
313
|
+
return this.client.rest.channels.createReaction(this.channelID, this.id, emoji);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Crosspost this message in an announcement channel.
|
|
317
|
+
*/
|
|
318
|
+
async crosspost() {
|
|
319
|
+
return this.client.rest.channels.crosspostMessage(this.channelID, this.id);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Delete this message.
|
|
323
|
+
* @param reason The reason for deleting the message.
|
|
324
|
+
*/
|
|
325
|
+
async delete(reason) {
|
|
326
|
+
return this.client.rest.channels.deleteMessage(this.channelID, this.id, reason);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Remove a reaction from this message.
|
|
330
|
+
* @param emoji The reaction to remove from the message. `name:id` for custom emojis, and the unicode codepoint for default emojis.
|
|
331
|
+
* @param user The user to remove the reaction from, `@me` for the current user (default).
|
|
332
|
+
*/
|
|
333
|
+
async deleteReaction(emoji, user = "@me") {
|
|
334
|
+
return this.client.rest.channels.deleteReaction(this.channelID, this.id, emoji, user);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Remove all, or a specific emoji's reactions from this message.
|
|
338
|
+
* @param emoji The reaction to remove from the message. `name:id` for custom emojis, and the unicode codepoint for default emojis. Omit to remove all reactions.
|
|
339
|
+
*/
|
|
340
|
+
async deleteReactions(emoji) {
|
|
341
|
+
return this.client.rest.channels.deleteReactions(this.channelID, this.id, emoji);
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Delete this message as a webhook.
|
|
345
|
+
* @param token The token of the webhook.
|
|
346
|
+
* @param options Options for deleting the message.
|
|
347
|
+
*/
|
|
348
|
+
async deleteWebhook(token, options) {
|
|
349
|
+
if (!this.webhookID) {
|
|
350
|
+
throw new TypeError("This message is not a webhook message.");
|
|
351
|
+
}
|
|
352
|
+
return this.client.rest.webhooks.deleteMessage(this.webhookID, token, this.id, options);
|
|
353
|
+
}
|
|
354
|
+
async edit(content, options) {
|
|
355
|
+
if (typeof content === "string") {
|
|
356
|
+
options = {
|
|
357
|
+
...options,
|
|
358
|
+
content
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
else
|
|
362
|
+
options = content;
|
|
363
|
+
return this.client.rest.channels.editMessage(this.channelID, this.id, options);
|
|
364
|
+
}
|
|
365
|
+
async editWebhook(token, content, options) {
|
|
366
|
+
if (typeof content === "string") {
|
|
367
|
+
options = {
|
|
368
|
+
...options,
|
|
369
|
+
content
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
else
|
|
373
|
+
options = content;
|
|
374
|
+
if (!this.webhookID) {
|
|
375
|
+
throw new TypeError("This message is not a webhook message.");
|
|
376
|
+
}
|
|
377
|
+
return this.client.rest.webhooks.editMessage(this.webhookID, token, this.id, options);
|
|
378
|
+
}
|
|
379
|
+
/** End the poll on this message now. */
|
|
380
|
+
async expire() {
|
|
381
|
+
if (this.poll === undefined) {
|
|
382
|
+
throw new TypeError("Message does not have a poll.");
|
|
383
|
+
}
|
|
384
|
+
await this.poll.expire();
|
|
385
|
+
}
|
|
386
|
+
async forward(channelID, content, options) {
|
|
387
|
+
if (typeof content === "string") {
|
|
388
|
+
options = {
|
|
389
|
+
...options,
|
|
390
|
+
content
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
else
|
|
394
|
+
options = content;
|
|
395
|
+
return this.client.rest.channels.createMessage(channelID, {
|
|
396
|
+
...options,
|
|
397
|
+
messageReference: {
|
|
398
|
+
channelID: this.channelID,
|
|
399
|
+
messageID: this.id,
|
|
400
|
+
type: Constants_1.MessageReferenceType.FORWARD
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Get the users that voted on a poll answer.
|
|
406
|
+
* @param answerID The ID of the poll answer to get voters for.
|
|
407
|
+
* @param options The options for getting the voters.
|
|
408
|
+
*/
|
|
409
|
+
async getPollAnswerUsers(answerID, options) {
|
|
410
|
+
if (this.poll === undefined) {
|
|
411
|
+
throw new TypeError("Message does not have a poll.");
|
|
412
|
+
}
|
|
413
|
+
return this.poll.getAnswerUsers(answerID, options);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Get the users who reacted with a specific emoji on this message.
|
|
417
|
+
* @param emoji The reaction to remove from the message. `name:id` for custom emojis, and the unicode codepoint for default emojis.
|
|
418
|
+
* @param options The options for getting the reactions.
|
|
419
|
+
*/
|
|
420
|
+
async getReactions(emoji, options) {
|
|
421
|
+
return this.client.rest.channels.getReactions(this.channelID, this.id, emoji, options);
|
|
422
|
+
}
|
|
423
|
+
/** Whether this message belongs to a cached guild channel. The only difference on using this method over a simple if statement is to easily update all the message properties typing definitions based on the channel it belongs to. */
|
|
424
|
+
inCachedGuildChannel() {
|
|
425
|
+
return this.channel instanceof GuildChannel_1.default;
|
|
426
|
+
}
|
|
427
|
+
/** Whether this message belongs to a direct message channel (PrivateChannel or uncached). The only difference on using this method over a simple if statement is to easily update all the message properties typing definitions based on the channel it belongs to. */
|
|
428
|
+
inDirectMessageChannel() {
|
|
429
|
+
return this.guildID === null;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Pin this message.
|
|
433
|
+
* @param reason The reason for pinning the message.
|
|
434
|
+
*/
|
|
435
|
+
async pin(reason) {
|
|
436
|
+
return this.client.rest.channels.pinMessage(this.channelID, this.id, reason);
|
|
437
|
+
}
|
|
438
|
+
async reply(content, options) {
|
|
439
|
+
if (typeof content === "string") {
|
|
440
|
+
options = {
|
|
441
|
+
...options,
|
|
442
|
+
content
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
else
|
|
446
|
+
options = content;
|
|
447
|
+
return this.client.rest.channels.createMessage(this.channelID, {
|
|
448
|
+
...options,
|
|
449
|
+
messageReference: {
|
|
450
|
+
messageID: this.id,
|
|
451
|
+
type: Constants_1.MessageReferenceType.DEFAULT
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Create a thread from this message.
|
|
457
|
+
* @param options The options for creating the thread.
|
|
458
|
+
*/
|
|
459
|
+
async startThread(options) {
|
|
460
|
+
return this.client.rest.channels.startThreadFromMessage(this.channelID, this.id, options);
|
|
461
|
+
}
|
|
462
|
+
toJSON() {
|
|
463
|
+
const im = this.interactionMetadata;
|
|
464
|
+
return {
|
|
465
|
+
...super.toJSON(),
|
|
466
|
+
activity: this.activity,
|
|
467
|
+
applicationID: this.applicationID ?? undefined,
|
|
468
|
+
attachments: this.attachments.map(attachment => attachment.toJSON()),
|
|
469
|
+
author: this.author.toJSON(),
|
|
470
|
+
channelID: this.channelID,
|
|
471
|
+
components: this.components,
|
|
472
|
+
content: this.content,
|
|
473
|
+
editedTimestamp: this.editedTimestamp?.getTime() ?? null,
|
|
474
|
+
embeds: this.embeds,
|
|
475
|
+
flags: this.flags,
|
|
476
|
+
guildID: this.guildID ?? undefined,
|
|
477
|
+
interaction: this.interaction === undefined ? undefined : {
|
|
478
|
+
id: this.interaction.id,
|
|
479
|
+
member: this.interaction.member?.toJSON(),
|
|
480
|
+
name: this.interaction.name,
|
|
481
|
+
type: this.interaction.type,
|
|
482
|
+
user: this.interaction.user.toJSON()
|
|
483
|
+
},
|
|
484
|
+
interactionMetadata: im === undefined ? undefined : {
|
|
485
|
+
authorizingIntegrationOwners: im.authorizingIntegrationOwners,
|
|
486
|
+
id: im.id,
|
|
487
|
+
interactedMessageID: im.interactedMessageID,
|
|
488
|
+
name: im.name,
|
|
489
|
+
originalResponseMessageID: im.originalResponseMessageID,
|
|
490
|
+
targetMessageID: im.targetMessageID,
|
|
491
|
+
targetUser: im.targetUser instanceof User_1.default ? im.targetUser.toJSON() : im.targetUser,
|
|
492
|
+
type: im.type,
|
|
493
|
+
user: im.user instanceof User_1.default ? im.user.toJSON() : im.user,
|
|
494
|
+
triggeringInteractionMetadata: im.triggeringInteractionMetadata === undefined ? undefined : {
|
|
495
|
+
authorizingIntegrationOwners: im.triggeringInteractionMetadata.authorizingIntegrationOwners,
|
|
496
|
+
id: im.triggeringInteractionMetadata.id,
|
|
497
|
+
interactedMessageID: im.triggeringInteractionMetadata.interactedMessageID,
|
|
498
|
+
originalResponseMessageID: im.triggeringInteractionMetadata.originalResponseMessageID,
|
|
499
|
+
targetMessageID: im.triggeringInteractionMetadata.targetMessageID,
|
|
500
|
+
targetUser: im.triggeringInteractionMetadata.targetUser instanceof User_1.default ? im.triggeringInteractionMetadata.targetUser.toJSON() : im.triggeringInteractionMetadata.targetUser,
|
|
501
|
+
type: im.triggeringInteractionMetadata.type,
|
|
502
|
+
user: im.triggeringInteractionMetadata.user instanceof User_1.default ? im.triggeringInteractionMetadata.user.toJSON() : im.triggeringInteractionMetadata.user
|
|
503
|
+
}
|
|
504
|
+
},
|
|
505
|
+
mentionChannels: this.mentionChannels,
|
|
506
|
+
mentions: {
|
|
507
|
+
channels: this.mentions.channels,
|
|
508
|
+
everyone: this.mentions.everyone,
|
|
509
|
+
members: this.mentions.members.map(member => member.toJSON()),
|
|
510
|
+
roles: this.mentions.roles,
|
|
511
|
+
users: this.mentions.users.map(user => user.toJSON())
|
|
512
|
+
},
|
|
513
|
+
messageReference: this.messageReference,
|
|
514
|
+
messageSnapshots: this.messageSnapshots?.map(s => ({
|
|
515
|
+
message: {
|
|
516
|
+
attachments: s.message.attachments.map(a => a.toJSON()),
|
|
517
|
+
content: s.message.content,
|
|
518
|
+
editedTimestamp: s.message.editedTimestamp?.getTime() ?? null,
|
|
519
|
+
embeds: s.message.embeds,
|
|
520
|
+
flags: s.message.flags,
|
|
521
|
+
mentions: {
|
|
522
|
+
channels: s.message.mentions.channels,
|
|
523
|
+
roles: s.message.mentions.roles,
|
|
524
|
+
users: s.message.mentions.users.map(u => u.toJSON())
|
|
525
|
+
},
|
|
526
|
+
timestamp: s.message.timestamp.getTime(),
|
|
527
|
+
type: s.message.type
|
|
528
|
+
}
|
|
529
|
+
})),
|
|
530
|
+
nonce: this.nonce,
|
|
531
|
+
pinned: this.pinned,
|
|
532
|
+
position: this.position,
|
|
533
|
+
poll: this.poll?.toJSON(),
|
|
534
|
+
pollResults: this.pollResults,
|
|
535
|
+
reactions: this.reactions,
|
|
536
|
+
referencedMessage: this.referencedMessage?.toJSON(),
|
|
537
|
+
stickerItems: this.stickerItems,
|
|
538
|
+
thread: this.thread?.toJSON(),
|
|
539
|
+
timestamp: this.timestamp.getTime(),
|
|
540
|
+
tts: this.tts,
|
|
541
|
+
type: this.type,
|
|
542
|
+
webhook: this.webhookID
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Unpin this message.
|
|
547
|
+
* @param reason The reason for unpinning the message.
|
|
548
|
+
*/
|
|
549
|
+
async unpin(reason) {
|
|
550
|
+
return this.client.rest.channels.unpinMessage(this.channelID, this.id, reason);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
exports.default = Message;
|