@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,223 @@
|
|
|
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 User */
|
|
48
|
+
const Base_1 = __importDefault(require("./Base"));
|
|
49
|
+
const PrimaryGuild_1 = __importDefault(require("./PrimaryGuild"));
|
|
50
|
+
const Constants_1 = require("../Constants");
|
|
51
|
+
const Routes = __importStar(require("../util/Routes"));
|
|
52
|
+
const Errors_1 = require("../util/Errors");
|
|
53
|
+
/** Represents a user. */
|
|
54
|
+
class User extends Base_1.default {
|
|
55
|
+
constructor(data, client) {
|
|
56
|
+
super(data.id, client);
|
|
57
|
+
this.avatar = null;
|
|
58
|
+
this.avatarDecorationData = null;
|
|
59
|
+
this.bot = !!data.bot;
|
|
60
|
+
this.collectibles = null;
|
|
61
|
+
this.discriminator = data.discriminator;
|
|
62
|
+
this.displayNameStyles = null;
|
|
63
|
+
this.globalName = data.global_name;
|
|
64
|
+
this.primaryGuild = null;
|
|
65
|
+
this.publicFlags = 0;
|
|
66
|
+
this.system = !!data.system;
|
|
67
|
+
this.username = data.username;
|
|
68
|
+
this.update(data);
|
|
69
|
+
}
|
|
70
|
+
update(data) {
|
|
71
|
+
if (data.accent_color !== undefined) {
|
|
72
|
+
this.accentColor = data.accent_color;
|
|
73
|
+
}
|
|
74
|
+
if (data.avatar !== undefined) {
|
|
75
|
+
this.avatar = data.avatar;
|
|
76
|
+
}
|
|
77
|
+
if (data.avatar_decoration_data !== undefined) {
|
|
78
|
+
this.avatarDecorationData = data.avatar_decoration_data ? {
|
|
79
|
+
asset: data.avatar_decoration_data.asset,
|
|
80
|
+
skuID: data.avatar_decoration_data.sku_id
|
|
81
|
+
} : null;
|
|
82
|
+
}
|
|
83
|
+
if (data.banner !== undefined) {
|
|
84
|
+
this.banner = data.banner;
|
|
85
|
+
}
|
|
86
|
+
if (data.collectibles !== undefined) {
|
|
87
|
+
this.collectibles = data.collectibles ? {
|
|
88
|
+
nameplate: data.collectibles.nameplate ? {
|
|
89
|
+
asset: data.collectibles.nameplate.asset,
|
|
90
|
+
label: data.collectibles.nameplate.label,
|
|
91
|
+
palette: data.collectibles.nameplate.palette,
|
|
92
|
+
skuID: data.collectibles.nameplate.sku_id
|
|
93
|
+
} : undefined
|
|
94
|
+
} : null;
|
|
95
|
+
}
|
|
96
|
+
if (data.discriminator !== undefined) {
|
|
97
|
+
this.discriminator = data.discriminator;
|
|
98
|
+
}
|
|
99
|
+
if (data.display_name_styles !== undefined) {
|
|
100
|
+
this.displayNameStyles = data.display_name_styles === null ? null : {
|
|
101
|
+
colors: data.display_name_styles.colors,
|
|
102
|
+
effectID: data.display_name_styles.effect_id,
|
|
103
|
+
fontID: data.display_name_styles.font_id
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (data.global_name !== undefined) {
|
|
107
|
+
this.globalName = data.global_name;
|
|
108
|
+
}
|
|
109
|
+
if (data.username !== undefined) {
|
|
110
|
+
this.username = data.username;
|
|
111
|
+
}
|
|
112
|
+
if (data.primary_guild !== undefined) {
|
|
113
|
+
this.primaryGuild = data.primary_guild ? new PrimaryGuild_1.default(data.primary_guild, this.client) : null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The primary guild this user is in.
|
|
118
|
+
* @deprecated Use {@link primaryGuild}
|
|
119
|
+
*/
|
|
120
|
+
get clan() {
|
|
121
|
+
return this.primaryGuild;
|
|
122
|
+
}
|
|
123
|
+
/** The default avatar value of this user. */
|
|
124
|
+
get defaultAvatar() {
|
|
125
|
+
if (this.isMigrated) {
|
|
126
|
+
return Number(BigInt(this.id) >> 22n) % 6;
|
|
127
|
+
}
|
|
128
|
+
return Number(this.discriminator) % 5;
|
|
129
|
+
}
|
|
130
|
+
/** If this user has migrated to the new username system. */
|
|
131
|
+
get isMigrated() {
|
|
132
|
+
return (this.discriminator === undefined || this.discriminator === "0");
|
|
133
|
+
}
|
|
134
|
+
/** A string that will mention this user. */
|
|
135
|
+
get mention() {
|
|
136
|
+
return `<@${this.id}>`;
|
|
137
|
+
}
|
|
138
|
+
/** This user's unique username, if migrated, else a combination of the user's username and discriminator. */
|
|
139
|
+
get tag() {
|
|
140
|
+
if (this.isMigrated) {
|
|
141
|
+
return this.username;
|
|
142
|
+
}
|
|
143
|
+
return `${this.username}#${this.discriminator}`;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The url of this user's avatar decoration. This will always be a png.
|
|
147
|
+
* Discord does not combine the decoration and their current avatar for you. This is ONLY the decoration.
|
|
148
|
+
* @param size The dimensions of the image.
|
|
149
|
+
*/
|
|
150
|
+
avatarDecorationURL(size) {
|
|
151
|
+
return this.avatarDecorationData ? this.client.util.formatImage(Routes.AVATAR_DECORATION(this.avatarDecorationData.asset), "png", size) : null;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The url of this user's avatar (or default avatar, if they have not set an avatar).
|
|
155
|
+
* @param format The format the url should be.
|
|
156
|
+
* @param size The dimensions of the image.
|
|
157
|
+
*/
|
|
158
|
+
avatarURL(format, size) {
|
|
159
|
+
return this.avatar === null ? this.defaultAvatarURL() : this.client.util.formatImage(Routes.USER_AVATAR(this.id, this.avatar), format, size);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The url of this user's banner.
|
|
163
|
+
* @param format The format the url should be.
|
|
164
|
+
* @param size The dimensions of the image.
|
|
165
|
+
*/
|
|
166
|
+
bannerURL(format, size) {
|
|
167
|
+
return this.banner ? this.client.util.formatImage(Routes.BANNER(this.id, this.banner), format, size) : null;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Create a direct message with this user.
|
|
171
|
+
*/
|
|
172
|
+
async createDM() {
|
|
173
|
+
return this.client.rest.channels.createDM(this.id);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Create a test entitlement for this user.
|
|
177
|
+
* @param skuID The ID of the SKU to create an entitlement for.
|
|
178
|
+
* @param applicationID The ID of the application to create the entitlement for. If present, defaults to the logged in client's application id.
|
|
179
|
+
*/
|
|
180
|
+
async createTestEntitlement(skuID, applicationID) {
|
|
181
|
+
if (applicationID === undefined && this.client["_application"] === undefined) {
|
|
182
|
+
throw new Errors_1.UncachedError("Client#application is not present, you must provide an applicationID as a second argument. To not need to provide an ID, only call this after at least one shard is READY, or restMode is enabled.");
|
|
183
|
+
}
|
|
184
|
+
return this.client.rest.applications.createTestEntitlement(applicationID ?? this.client.application.id, {
|
|
185
|
+
ownerID: this.id,
|
|
186
|
+
ownerType: Constants_1.EntitlementOwnerTypes.USER,
|
|
187
|
+
skuID
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The url of this user's default avatar.
|
|
192
|
+
*/
|
|
193
|
+
defaultAvatarURL() {
|
|
194
|
+
return this.client.util.formatImage(Routes.EMBED_AVATAR(this.defaultAvatar), "png");
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Get the entitlements for this guild.
|
|
198
|
+
* @param options The options for getting the entitlements.
|
|
199
|
+
*/
|
|
200
|
+
async getEntitlements(options, applicationID) {
|
|
201
|
+
if (applicationID === undefined && this.client["_application"] === undefined) {
|
|
202
|
+
throw new Errors_1.UncachedError("Client#application is not present, you must provide an applicationID as a second argument. To not need to provide an ID, only call this after at least one shard is READY, or restMode is enabled.");
|
|
203
|
+
}
|
|
204
|
+
return this.client.rest.applications.getEntitlements(applicationID ?? this.client.application.id, { userID: this.id, ...options });
|
|
205
|
+
}
|
|
206
|
+
toJSON() {
|
|
207
|
+
return {
|
|
208
|
+
...super.toJSON(),
|
|
209
|
+
accentColor: this.accentColor,
|
|
210
|
+
avatar: this.avatar,
|
|
211
|
+
avatarDecorationData: this.avatarDecorationData,
|
|
212
|
+
banner: this.banner,
|
|
213
|
+
bot: this.bot,
|
|
214
|
+
collectibles: this.collectibles,
|
|
215
|
+
discriminator: this.discriminator,
|
|
216
|
+
globalName: this.globalName,
|
|
217
|
+
publicFlags: this.publicFlags,
|
|
218
|
+
system: this.system,
|
|
219
|
+
username: this.username
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
exports.default = User;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/** @module VoiceChannel */
|
|
7
|
+
const TextableVoiceChannel_1 = __importDefault(require("./TextableVoiceChannel"));
|
|
8
|
+
/** Represents a guild voice channel. */
|
|
9
|
+
class VoiceChannel extends TextableVoiceChannel_1.default {
|
|
10
|
+
constructor(data, client) {
|
|
11
|
+
super(data, client);
|
|
12
|
+
this.status = null;
|
|
13
|
+
this.update(data);
|
|
14
|
+
}
|
|
15
|
+
update(data) {
|
|
16
|
+
this.status = data.status ?? null;
|
|
17
|
+
super.update(data);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Set a voice status in this channel.
|
|
21
|
+
* @param status The voice status to set.
|
|
22
|
+
*/
|
|
23
|
+
async setStatus(status) {
|
|
24
|
+
return this.client.rest.channels.setVoiceStatus(this.id, status);
|
|
25
|
+
}
|
|
26
|
+
toJSON() {
|
|
27
|
+
return {
|
|
28
|
+
...super.toJSON(),
|
|
29
|
+
status: this.status,
|
|
30
|
+
type: this.type
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.default = VoiceChannel;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/** @module VoiceState */
|
|
7
|
+
const Base_1 = __importDefault(require("./Base"));
|
|
8
|
+
const Errors_1 = require("../util/Errors");
|
|
9
|
+
/** Represents a guild member's voice state. */
|
|
10
|
+
class VoiceState extends Base_1.default {
|
|
11
|
+
constructor(data, client) {
|
|
12
|
+
super(data.user_id, client);
|
|
13
|
+
this.channelID = data.channel_id;
|
|
14
|
+
this.deaf = false;
|
|
15
|
+
this.guildID = data.guild_id;
|
|
16
|
+
this.mute = false;
|
|
17
|
+
this.requestToSpeakTimestamp = null;
|
|
18
|
+
this.selfDeaf = false;
|
|
19
|
+
this.selfMute = false;
|
|
20
|
+
this.selfStream = false;
|
|
21
|
+
this.selfVideo = false;
|
|
22
|
+
this.suppress = false;
|
|
23
|
+
this.userID = this.id;
|
|
24
|
+
this.update(data);
|
|
25
|
+
}
|
|
26
|
+
update(data) {
|
|
27
|
+
if (data.channel_id !== undefined) {
|
|
28
|
+
this.channelID = data.channel_id;
|
|
29
|
+
this._cachedChannel = null;
|
|
30
|
+
}
|
|
31
|
+
if (data.deaf !== undefined) {
|
|
32
|
+
this.deaf = data.deaf;
|
|
33
|
+
}
|
|
34
|
+
if (data.guild_id !== undefined) {
|
|
35
|
+
this.guildID = data.guild_id;
|
|
36
|
+
}
|
|
37
|
+
if (data.member !== undefined) {
|
|
38
|
+
this._cachedMember = this.client.util.updateMember(data.guild_id, this.id, data.member);
|
|
39
|
+
}
|
|
40
|
+
if (data.mute !== undefined) {
|
|
41
|
+
this.mute = data.mute;
|
|
42
|
+
}
|
|
43
|
+
if (data.request_to_speak_timestamp !== undefined) {
|
|
44
|
+
this.requestToSpeakTimestamp = data.request_to_speak_timestamp === null ? null : new Date(data.request_to_speak_timestamp);
|
|
45
|
+
}
|
|
46
|
+
if (data.self_deaf !== undefined) {
|
|
47
|
+
this.selfDeaf = data.self_deaf;
|
|
48
|
+
}
|
|
49
|
+
if (data.self_mute !== undefined) {
|
|
50
|
+
this.selfMute = data.self_mute;
|
|
51
|
+
}
|
|
52
|
+
if (data.self_stream !== undefined) {
|
|
53
|
+
this.selfStream = data.self_stream;
|
|
54
|
+
}
|
|
55
|
+
if (data.self_video !== undefined) {
|
|
56
|
+
this.selfVideo = data.self_video;
|
|
57
|
+
}
|
|
58
|
+
if (data.suppress !== undefined) {
|
|
59
|
+
this.suppress = data.suppress;
|
|
60
|
+
}
|
|
61
|
+
if (data.user_id !== undefined) {
|
|
62
|
+
this.userID = data.user_id;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** The channel the user is connected to. */
|
|
66
|
+
get channel() {
|
|
67
|
+
if (this.channelID !== null) {
|
|
68
|
+
return this._cachedChannel ?? (this._cachedChannel = this.client.getChannel(this.channelID));
|
|
69
|
+
}
|
|
70
|
+
return (this._cachedChannel ?? (this._cachedChannel = null));
|
|
71
|
+
}
|
|
72
|
+
/** The guild this voice state is a part of. This will throw an error if the guild is not cached. */
|
|
73
|
+
get guild() {
|
|
74
|
+
this._cachedGuild ?? (this._cachedGuild = this.client.guilds.get(this.guildID));
|
|
75
|
+
if (!this._cachedGuild) {
|
|
76
|
+
if (this.client.options.restMode) {
|
|
77
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present when rest mode is enabled.`);
|
|
78
|
+
}
|
|
79
|
+
if (!this.client.shards.connected) {
|
|
80
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present without a gateway connection.`);
|
|
81
|
+
}
|
|
82
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present.`);
|
|
83
|
+
}
|
|
84
|
+
return this._cachedGuild;
|
|
85
|
+
}
|
|
86
|
+
/** The member associated with this voice state. */
|
|
87
|
+
get member() {
|
|
88
|
+
return this._cachedMember ?? (this._cachedMember = this["_cachedGuild"]?.members.get(this.userID));
|
|
89
|
+
}
|
|
90
|
+
/** TThe user associated with this voice state. */
|
|
91
|
+
get user() {
|
|
92
|
+
return this._cachedUser ?? (this._cachedUser = this.client.users.get(this.userID));
|
|
93
|
+
}
|
|
94
|
+
toJSON() {
|
|
95
|
+
return {
|
|
96
|
+
...super.toJSON(),
|
|
97
|
+
channelID: this.channelID,
|
|
98
|
+
deaf: this.deaf,
|
|
99
|
+
guildID: this.guildID ?? undefined,
|
|
100
|
+
member: this.member?.toJSON(),
|
|
101
|
+
mute: this.mute,
|
|
102
|
+
requestToSpeakTimestamp: this.requestToSpeakTimestamp ? this.requestToSpeakTimestamp.getTime() : null,
|
|
103
|
+
selfDeaf: this.selfDeaf,
|
|
104
|
+
selfMute: this.selfMute,
|
|
105
|
+
selfStream: this.selfStream,
|
|
106
|
+
selfVideo: this.selfVideo,
|
|
107
|
+
sessionID: this.sessionID,
|
|
108
|
+
suppress: this.suppress,
|
|
109
|
+
user: this.user?.toJSON()
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.default = VoiceState;
|
|
@@ -0,0 +1,224 @@
|
|
|
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 Webhook */
|
|
48
|
+
const Base_1 = __importDefault(require("./Base"));
|
|
49
|
+
const Constants_1 = require("../Constants");
|
|
50
|
+
const Routes = __importStar(require("../util/Routes"));
|
|
51
|
+
const Errors_1 = require("../util/Errors");
|
|
52
|
+
/** Represents a webhook. */
|
|
53
|
+
class Webhook extends Base_1.default {
|
|
54
|
+
constructor(data, client) {
|
|
55
|
+
super(data.id, client);
|
|
56
|
+
this.application = (!client["_application"] || data.application_id === null) ? null : (client.application.id === data.application_id ? client.application : undefined);
|
|
57
|
+
this.applicationID = data.application_id;
|
|
58
|
+
this.avatar = data.avatar ?? null;
|
|
59
|
+
this.channelID = data.channel_id;
|
|
60
|
+
this.guildID = data.guild_id ?? null;
|
|
61
|
+
this.name = data.name;
|
|
62
|
+
this.sourceChannel = data.source_channel;
|
|
63
|
+
this.sourceGuild = data.source_guild;
|
|
64
|
+
this.token = data.token;
|
|
65
|
+
this.type = data.type;
|
|
66
|
+
this.user = data.user === undefined ? null : client.users.update(data.user);
|
|
67
|
+
}
|
|
68
|
+
/** The channel this webhook is for, if applicable. */
|
|
69
|
+
get channel() {
|
|
70
|
+
if (this.channelID !== null && this._cachedChannel !== null) {
|
|
71
|
+
return this._cachedChannel ?? (this._cachedChannel = this.client.getChannel(this.channelID));
|
|
72
|
+
}
|
|
73
|
+
return this._cachedChannel === null ? this._cachedChannel : (this._cachedChannel = null);
|
|
74
|
+
}
|
|
75
|
+
/** The guild this webhook is for, if applicable. This will throw an error if the guild is not cached. */
|
|
76
|
+
get guild() {
|
|
77
|
+
if (this.guildID !== null && this._cachedGuild !== null) {
|
|
78
|
+
this._cachedGuild ?? (this._cachedGuild = this.client.guilds.get(this.guildID));
|
|
79
|
+
if (!this._cachedGuild) {
|
|
80
|
+
if (this.client.options.restMode) {
|
|
81
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present when rest mode is enabled.`);
|
|
82
|
+
}
|
|
83
|
+
if (!this.client.shards.connected) {
|
|
84
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present without a gateway connection.`);
|
|
85
|
+
}
|
|
86
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present.`);
|
|
87
|
+
}
|
|
88
|
+
return this._cachedGuild;
|
|
89
|
+
}
|
|
90
|
+
return this._cachedGuild === null ? this._cachedGuild : (this._cachedGuild = null);
|
|
91
|
+
}
|
|
92
|
+
get url() {
|
|
93
|
+
return `${Constants_1.API_URL}${Routes.WEBHOOK(this.id, this.token)}`;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The url of this webhook's avatar.
|
|
97
|
+
* @param format The format the url should be.
|
|
98
|
+
* @param size The dimensions of the image.
|
|
99
|
+
*/
|
|
100
|
+
avatarURL(format, size) {
|
|
101
|
+
return this.avatar === null ? null : this.client.util.formatImage(Routes.USER_AVATAR(this.id, this.avatar), format, size);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Delete this webhook (requires a bot user, see `deleteToken`).
|
|
105
|
+
* @param reason The reason for deleting this webhook.
|
|
106
|
+
*/
|
|
107
|
+
async delete(reason) {
|
|
108
|
+
return this.client.rest.webhooks.delete(this.id, reason);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Delete a message from this webhook.
|
|
112
|
+
* @param messageID The ID of the message.
|
|
113
|
+
* @param options The options for deleting the message.
|
|
114
|
+
* @param token The token for the webhook, if not already present.
|
|
115
|
+
*/
|
|
116
|
+
async deleteMessage(messageID, options, token) {
|
|
117
|
+
const t = this.token ?? token;
|
|
118
|
+
if (!t) {
|
|
119
|
+
throw new TypeError("Token is not present on webhook, and was not provided in options.");
|
|
120
|
+
}
|
|
121
|
+
return this.client.rest.webhooks.deleteMessage(this.id, t, messageID, options);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Delete this webhook via its token.
|
|
125
|
+
* @param token The token for the webhook, if not already present.
|
|
126
|
+
*/
|
|
127
|
+
async deleteToken(token) {
|
|
128
|
+
const t = this.token ?? token;
|
|
129
|
+
if (!t) {
|
|
130
|
+
throw new TypeError("Token is not present on webhook, and was not provided in options.");
|
|
131
|
+
}
|
|
132
|
+
return this.client.rest.webhooks.deleteToken(this.id, t);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Edit this webhook (requires a bot user, see `editToken`).
|
|
136
|
+
* @param options The options for editing the webhook.
|
|
137
|
+
*/
|
|
138
|
+
async edit(options) {
|
|
139
|
+
return this.client.rest.webhooks.edit(this.id, options);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Edit a webhook message.
|
|
143
|
+
* @param messageID The ID of the message to edit.
|
|
144
|
+
* @param token The token of the webhook.
|
|
145
|
+
* @param options The options for editing the message.
|
|
146
|
+
*/
|
|
147
|
+
async editMessage(messageID, options, token) {
|
|
148
|
+
const t = this.token ?? token;
|
|
149
|
+
if (!t) {
|
|
150
|
+
throw new TypeError("Token is not present on webhook, and was not provided in options.");
|
|
151
|
+
}
|
|
152
|
+
return this.client.rest.webhooks.editMessage(this.id, t, messageID, options);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Edit a webhook via its token.
|
|
156
|
+
* @param options The options for editing the webhook.
|
|
157
|
+
* @param token The token for the webhook, if not already present.
|
|
158
|
+
*/
|
|
159
|
+
async editToken(options, token) {
|
|
160
|
+
const t = this.token ?? token;
|
|
161
|
+
if (!t) {
|
|
162
|
+
throw new TypeError("Token is not present on webhook, and was not provided in options.");
|
|
163
|
+
}
|
|
164
|
+
return this.client.rest.webhooks.editToken(this.id, t, options);
|
|
165
|
+
}
|
|
166
|
+
async execute(options, token) {
|
|
167
|
+
const t = this.token ?? token;
|
|
168
|
+
if (!t) {
|
|
169
|
+
throw new TypeError("Token is not present on webhook, and was not provided in options.");
|
|
170
|
+
}
|
|
171
|
+
return this.client.rest.webhooks.execute(this.id, t, options);
|
|
172
|
+
}
|
|
173
|
+
async executeGithub(options, token) {
|
|
174
|
+
const t = this.token ?? token;
|
|
175
|
+
if (!t) {
|
|
176
|
+
throw new TypeError("Token is not present on webhook, and was not provided in options.");
|
|
177
|
+
}
|
|
178
|
+
return this.client.rest.webhooks.executeGithub(this.id, t, options);
|
|
179
|
+
}
|
|
180
|
+
async executeSlack(options, token) {
|
|
181
|
+
const t = this.token ?? token;
|
|
182
|
+
if (!t) {
|
|
183
|
+
throw new TypeError("Token is not present on webhook, and was not provided in options.");
|
|
184
|
+
}
|
|
185
|
+
return this.client.rest.webhooks.executeSlack(this.id, t, options);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get a webhook message.
|
|
189
|
+
* @param messageID The ID of the message.
|
|
190
|
+
* @param threadID The ID of the thread the message is in.
|
|
191
|
+
* @param token The token for the webhook, if not already present.
|
|
192
|
+
*/
|
|
193
|
+
async getMessage(messageID, threadID, token) {
|
|
194
|
+
const t = this.token ?? token;
|
|
195
|
+
if (!t) {
|
|
196
|
+
throw new TypeError("Token is not present on webhook, and was not provided in options.");
|
|
197
|
+
}
|
|
198
|
+
return this.client.rest.webhooks.getMessage(this.id, t, messageID, threadID);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* The url of this webhook's `sourceGuild` icon (only present on channel follower webhooks).
|
|
202
|
+
* @param format The format the url should be.
|
|
203
|
+
* @param size The dimensions of the image.
|
|
204
|
+
*/
|
|
205
|
+
sourceGuildIconURL(format, size) {
|
|
206
|
+
return this.sourceGuild?.icon ? this.client.util.formatImage(Routes.GUILD_ICON(this.id, this.sourceGuild?.icon), format, size) : null;
|
|
207
|
+
}
|
|
208
|
+
toJSON() {
|
|
209
|
+
return {
|
|
210
|
+
...super.toJSON(),
|
|
211
|
+
applicationID: this.applicationID,
|
|
212
|
+
avatar: this.avatar,
|
|
213
|
+
channelID: this.channelID ?? null,
|
|
214
|
+
guildID: this.guildID,
|
|
215
|
+
name: this.name,
|
|
216
|
+
sourceChannel: this.sourceChannel,
|
|
217
|
+
sourceGuild: this.sourceGuild,
|
|
218
|
+
token: this.token,
|
|
219
|
+
type: this.type,
|
|
220
|
+
user: this.user?.toJSON()
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
exports.default = Webhook;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/** @module Collection */
|
|
4
|
+
/** A {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map | Map} with some Array-like additions. */
|
|
5
|
+
class Collection extends Map {
|
|
6
|
+
/** If this collection is empty. */
|
|
7
|
+
get empty() {
|
|
8
|
+
return this.size === 0;
|
|
9
|
+
}
|
|
10
|
+
every(predicate, thisArg) {
|
|
11
|
+
return this.toArray().every(predicate, thisArg);
|
|
12
|
+
}
|
|
13
|
+
filter(predicate, thisArg) {
|
|
14
|
+
return this.toArray().filter(predicate, thisArg);
|
|
15
|
+
}
|
|
16
|
+
find(predicate, thisArg) {
|
|
17
|
+
return this.toArray().find(predicate, thisArg);
|
|
18
|
+
}
|
|
19
|
+
/** See: {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex | Array#findIndex } */
|
|
20
|
+
findIndex(predicate, thisArg) {
|
|
21
|
+
return this.toArray().findIndex(predicate, thisArg);
|
|
22
|
+
}
|
|
23
|
+
first(amount) {
|
|
24
|
+
if (amount === undefined) {
|
|
25
|
+
const iterable = this.values();
|
|
26
|
+
return iterable.next().value;
|
|
27
|
+
}
|
|
28
|
+
if (amount < 0) {
|
|
29
|
+
return this.last(amount * -1);
|
|
30
|
+
}
|
|
31
|
+
amount = Math.min(amount, this.size);
|
|
32
|
+
const iterable = this.values();
|
|
33
|
+
return Array.from({ length: amount }, () => iterable.next().value);
|
|
34
|
+
}
|
|
35
|
+
last(amount) {
|
|
36
|
+
const iterator = Array.from(this.values());
|
|
37
|
+
if (amount === undefined) {
|
|
38
|
+
return iterator.at(-1);
|
|
39
|
+
}
|
|
40
|
+
if (amount < 0) {
|
|
41
|
+
return this.first(amount * -1);
|
|
42
|
+
}
|
|
43
|
+
if (!amount) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
return iterator.slice(-amount);
|
|
47
|
+
}
|
|
48
|
+
/** See: {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array#map } */
|
|
49
|
+
map(predicate, thisArg) {
|
|
50
|
+
return this.toArray().map(predicate, thisArg);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Pick a random element from the collection, or undefined if the collection is empty.
|
|
54
|
+
*/
|
|
55
|
+
random() {
|
|
56
|
+
if (this.empty) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const iterable = Array.from(this.values());
|
|
60
|
+
return iterable[Math.floor(Math.random() * iterable.length)];
|
|
61
|
+
}
|
|
62
|
+
reduce(predicate, initialValue) {
|
|
63
|
+
return this.toArray().reduce(predicate, initialValue);
|
|
64
|
+
}
|
|
65
|
+
reduceRight(predicate, initialValue) {
|
|
66
|
+
return this.toArray().reduceRight(predicate, initialValue);
|
|
67
|
+
}
|
|
68
|
+
/** See: {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some | Array#some } */
|
|
69
|
+
some(predicate, thisArg) {
|
|
70
|
+
return this.toArray().some(predicate, thisArg);
|
|
71
|
+
}
|
|
72
|
+
/** Get the values of this collection as an array. */
|
|
73
|
+
toArray() {
|
|
74
|
+
return Array.from(this.values());
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.default = Collection;
|