@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,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** @module Errors */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.FrozenModificationError = exports.NotImplementedError = exports.RateLimitedError = exports.GatewayError = exports.DependencyError = exports.WrapperError = exports.UncachedError = exports.UncaughtError = void 0;
|
|
5
|
+
/** An error that is thrown when we encounter an error, and no `error` listeners are present. */
|
|
6
|
+
class UncaughtError extends Error {
|
|
7
|
+
constructor(error) {
|
|
8
|
+
super("Uncaught 'error' event", { cause: error });
|
|
9
|
+
this.name = "UncaughtError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.UncaughtError = UncaughtError;
|
|
13
|
+
/** An error ancountered when an object is unexpectedly not cached. */
|
|
14
|
+
class UncachedError extends Error {
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
|
16
|
+
constructor(...args) {
|
|
17
|
+
let message;
|
|
18
|
+
if (args.length === 1) {
|
|
19
|
+
[message] = args;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const [clazz, property, intent, client] = args;
|
|
23
|
+
message = client && client.options.restMode ? `${clazz.constructor.name}#${property} is not present in rest mode.` : `${clazz.constructor.name}#${property} is not present if you don't have the ${intent} intent.`;
|
|
24
|
+
}
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = "UncachedError";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.UncachedError = UncachedError;
|
|
30
|
+
/** An error encountered within {@link InteractionOptionsWrapper | InteractionOptionsWrapper} & {@link SelectMenuValuesWrapper | SelectMenuValuesWrapper}. */
|
|
31
|
+
class WrapperError extends Error {
|
|
32
|
+
constructor(message) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.name = "WrapperError";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.WrapperError = WrapperError;
|
|
38
|
+
/** An error encountered when a needed dependency is missing. */
|
|
39
|
+
class DependencyError extends Error {
|
|
40
|
+
constructor(message) {
|
|
41
|
+
super(message);
|
|
42
|
+
this.name = "DependencyError";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.DependencyError = DependencyError;
|
|
46
|
+
/** A gateway error. */
|
|
47
|
+
class GatewayError extends Error {
|
|
48
|
+
constructor(message, code) {
|
|
49
|
+
super(message);
|
|
50
|
+
this.name = "GatewayError";
|
|
51
|
+
this.code = code;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.GatewayError = GatewayError;
|
|
55
|
+
class RateLimitedError extends Error {
|
|
56
|
+
constructor(message, delay) {
|
|
57
|
+
super(message);
|
|
58
|
+
this.name = "RateLimitedError";
|
|
59
|
+
this.delay = delay;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.RateLimitedError = RateLimitedError;
|
|
63
|
+
class NotImplementedError extends Error {
|
|
64
|
+
constructor(message = "Not implemented") {
|
|
65
|
+
super(message);
|
|
66
|
+
this.name = "NotImplementedError";
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.NotImplementedError = NotImplementedError;
|
|
70
|
+
class FrozenModificationError extends Error {
|
|
71
|
+
constructor(detail, prop) {
|
|
72
|
+
let message = "An attempt was made to modify a frozen object";
|
|
73
|
+
if (detail) {
|
|
74
|
+
message += `: ${detail}`;
|
|
75
|
+
}
|
|
76
|
+
super(message);
|
|
77
|
+
this.name = "FrozenModificationError";
|
|
78
|
+
this.property = prop;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.FrozenModificationError = FrozenModificationError;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class QueryBuilder extends URLSearchParams {
|
|
4
|
+
set(name, value) {
|
|
5
|
+
if (value === undefined) {
|
|
6
|
+
if (this.has(name)) {
|
|
7
|
+
this.delete(name);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
super.set(name, String(value));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
setIfPresent(name, value) {
|
|
15
|
+
if (value !== undefined) {
|
|
16
|
+
this.set(name, value);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.default = QueryBuilder;
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CHANNEL_BULK_DELETE_MESSAGES = exports.CHANNEL = exports.SOUNDBOARD_SOUND = exports.SOUNDBOARD_SOUNDS = exports.GUILD_BULK_BAN = exports.GUILD_INCIDENT_ACTIONS = exports.GUILD_ONBOARDING = exports.GUILD_STICKERS = exports.GUILD_STICKER = exports.GUILD_VOICE_STATE = exports.GUILD_WELCOME_SCREEN = exports.GUILD_WIDGET_JSON = exports.GUILD_WIDGET_IMAGE = exports.GUILD_VANITY_URL = exports.GUILD_WIDGET = exports.GUILD_INTEGRATIONS = exports.GUILD_INTEGRATION = exports.GUILD_INVITES = exports.GUILD_PRUNE = exports.GUILD_ROLE_MEMBER_COUNTS = exports.GUILD_ROLE = exports.GUILD_ROLES = exports.GUILD_MEMBER_ROLE = exports.GUILD_MEMBERS_SEARCH = exports.GUILD_SEARCH_MEMBERS = exports.GUILD_MEMBER = exports.GUILD_MEMBERS = exports.GUILD_ACTIVE_THREADS = exports.GUILD_CHANNELS = exports.GUILD_PREVIEW = exports.GUILD_TEMPLATES = exports.GUILD_TEMPLATE = exports.GUILD_TEMPLATE_CODE = exports.GUILD_SCHEDULED_EVENT_USERS = exports.GUILD_SCHEDULED_EVENTS = exports.GUILD_SCHEDULED_EVENT = exports.GUILD_AUDIT_LOG = exports.GUILD_EMOJIS = exports.GUILD_EMOJI = exports.GUILD_AUTOMOD_RULES = exports.GUILD_AUTOMOD_RULE = exports.GUILD_BAN = exports.GUILD_BANS = exports.GUILD = exports.WEBHOOK_PLATFORM = exports.WEBHOOK_MESSAGE = exports.WEBHOOK = exports.GUILD_WEBHOOKS = exports.CHANNEL_WEBHOOKS = exports.CDN_URL = void 0;
|
|
4
|
+
exports.GUILD_ICON = exports.GUILD_DISCOVERY_SPLASH = exports.GUILD_AVATAR = exports.EMBED_AVATAR = exports.CUSTOM_EMOJI = exports.BANNER = exports.APPLICATION_ICON = exports.APPLICATION_COVER = exports.APPLICATION_ASSET = exports.ACHIEVEMENT_ICON = exports.ROLE_CONNECTIONS_METADATA = exports.OAUTH_ROLE_CONNECTION = exports.OAUTH_TOKEN_REVOKE = exports.OAUTH_TOKEN = exports.OAUTH_GUILDS = exports.OAUTH_GUILD_MEMBER = exports.OAUTH_GUILD = exports.OAUTH_CONNECTIONS = exports.OAUTH_CHANNELS = exports.OAUTH_CURRENT_USER = exports.OAUTH_INFO = exports.OAUTH_AUTHORIZE = exports.OAUTH_APPLICATION = exports.SEND_SOUNDBOARD_SOUND = exports.POLL_EXPIRE = exports.POLL_ANSWER_USERS = exports.VOICE_STATUS = exports.GUILD_VOICE_REGIONS = exports.VOICE_REGIONS = exports.GROUP_RECIPIENT = exports.CHANNEL_TYPING = exports.CHANNEL_THREAD_MEMBERS = exports.CHANNEL_THREAD_MEMBER = exports.CHANNEL_THREADS = exports.CHANNEL_REACTION_USER = exports.CHANNEL_REACTIONS = exports.CHANNEL_REACTION = exports.CHANNEL_PUBLIC_ARCHIVED_THREADS = exports.CHANNEL_PRIVATE_ARCHIVED_THREADS = exports.CHANNEL_PINS = exports.CHANNEL_PINNED_MESSAGE = exports.CHANNEL_PERMISSIONS = exports.CHANNEL_PERMISSION = exports.CHANNEL_MESSAGE_THREADS = exports.CHANNEL_MESSAGES_CROSSPOST = exports.CHANNEL_MESSAGES = exports.CHANNEL_MESSAGE = exports.CHANNEL_JOINED_PRIVATE_ARCHIVED_THREADS = exports.CHANNEL_INVITES = exports.CHANNEL_FOLLOWERS = void 0;
|
|
5
|
+
exports.REFRESH_ATTACHMENT_URLS = exports.STAGE_INSTANCE = exports.STAGE_INSTANCES = exports.SOUNDBOARD_DEFAULT_SOUNDS = exports.INVITE_TARGET_USERS_JOB_STATUS = exports.INVITE_TARGET_USERS = exports.INVITE = exports.STICKER_PACKS = exports.MESSAGE_LINK = exports.USER = exports.GATEWAY_BOT = exports.GATEWAY = exports.LOBBY_MESSAGE_MODERATION_METADATA = exports.LOBBY_CHANNEL_LINKING = exports.LOBBY_MEMBER = exports.LOBBY = exports.LOBBIES = exports.APPLICATION_ACTIVITY_INSTANCE = exports.APPLICATION_EMOJI = exports.APPLICATION_EMOJIS = exports.SKU_SUBSCRIPTION = exports.SKU_SUBSCRIPTIONS = exports.SKUS = exports.CONSUME_ENTITLEMENT = exports.ENTITLEMENT = exports.ENTITLEMENTS = exports.APPLICATION = exports.INTERACTION_CALLBACK = exports.GUILD_APPLICATION_COMMAND_PERMISSIONS = exports.GUILD_APPLICATION_COMMAND_PERMISSION = exports.GUILD_APPLICATION_COMMANDS = exports.GUILD_APPLICATION_COMMAND = exports.APPLICATION_COMMANDS = exports.APPLICATION_COMMAND = exports.AVATAR_DECORATION = exports.USER_AVATAR = exports.TEAM_ICON = exports.STICKER_PACK_BANNER = exports.STICKER = exports.ROLE_ICON = exports.MEMBER_BANNER = exports.GUILD_SPLASH = exports.GUILD_SCHEDULED_EVENT_COVER = exports.CLAN_ICON = void 0;
|
|
6
|
+
/** @module Routes */
|
|
7
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
8
|
+
exports.CDN_URL = "https://cdn.discordapp.com";
|
|
9
|
+
const SAFE_CHARACTERS = new Set([":", "?", "@"]);
|
|
10
|
+
function encode(strings, ...args) {
|
|
11
|
+
return strings.reduce((acc, str, i) => {
|
|
12
|
+
acc += str;
|
|
13
|
+
if (args[i] !== undefined && args[i] !== null) {
|
|
14
|
+
acc += Array.from(String(args[i]), char => SAFE_CHARACTERS.has(char) ? char : (decodeURIComponent(char) === char ? encodeURIComponent(char) : char)).join("");
|
|
15
|
+
}
|
|
16
|
+
return acc;
|
|
17
|
+
}, "");
|
|
18
|
+
}
|
|
19
|
+
// Webhooks
|
|
20
|
+
const CHANNEL_WEBHOOKS = (channelID) => encode `/channels/${channelID}/webhooks`;
|
|
21
|
+
exports.CHANNEL_WEBHOOKS = CHANNEL_WEBHOOKS;
|
|
22
|
+
const GUILD_WEBHOOKS = (guildID) => encode `/guilds/${guildID}/webhooks`;
|
|
23
|
+
exports.GUILD_WEBHOOKS = GUILD_WEBHOOKS;
|
|
24
|
+
const WEBHOOK = (webhookID, webhookToken) => (webhookToken ? encode `/webhooks/${webhookID}/${webhookToken}` : `/webhooks/${webhookID}`);
|
|
25
|
+
exports.WEBHOOK = WEBHOOK;
|
|
26
|
+
const WEBHOOK_MESSAGE = (webhookID, webhookToken, messageID) => encode `/webhooks/${webhookID}/${webhookToken}/messages/${messageID}`;
|
|
27
|
+
exports.WEBHOOK_MESSAGE = WEBHOOK_MESSAGE;
|
|
28
|
+
const WEBHOOK_PLATFORM = (webhookID, webhookToken, platform) => encode `/webhooks/${webhookID}/${webhookToken}/${platform}`;
|
|
29
|
+
exports.WEBHOOK_PLATFORM = WEBHOOK_PLATFORM;
|
|
30
|
+
// Guilds
|
|
31
|
+
const GUILD = (userID) => encode `/guilds/${userID}`;
|
|
32
|
+
exports.GUILD = GUILD;
|
|
33
|
+
const GUILD_BANS = (guildID) => encode `/guilds/${guildID}/bans`;
|
|
34
|
+
exports.GUILD_BANS = GUILD_BANS;
|
|
35
|
+
const GUILD_BAN = (guildID, userID) => encode `/guilds/${guildID}/bans/${userID}`;
|
|
36
|
+
exports.GUILD_BAN = GUILD_BAN;
|
|
37
|
+
const GUILD_AUTOMOD_RULE = (guildID, autoModerationRuleID) => encode `/guilds/${guildID}/auto-moderation/rules/${autoModerationRuleID}`;
|
|
38
|
+
exports.GUILD_AUTOMOD_RULE = GUILD_AUTOMOD_RULE;
|
|
39
|
+
const GUILD_AUTOMOD_RULES = (guildID) => encode `/guilds/${guildID}/auto-moderation/rules`;
|
|
40
|
+
exports.GUILD_AUTOMOD_RULES = GUILD_AUTOMOD_RULES;
|
|
41
|
+
const GUILD_EMOJI = (guildID, emojiID) => encode `/guilds/${guildID}/emojis/${emojiID}`;
|
|
42
|
+
exports.GUILD_EMOJI = GUILD_EMOJI;
|
|
43
|
+
const GUILD_EMOJIS = (guildID) => encode `/guilds/${guildID}/emojis`;
|
|
44
|
+
exports.GUILD_EMOJIS = GUILD_EMOJIS;
|
|
45
|
+
const GUILD_AUDIT_LOG = (guildID) => encode `/guilds/${guildID}/audit-logs`;
|
|
46
|
+
exports.GUILD_AUDIT_LOG = GUILD_AUDIT_LOG;
|
|
47
|
+
const GUILD_SCHEDULED_EVENT = (guildID, eventID) => encode `/guilds/${guildID}/scheduled-events/${eventID}`;
|
|
48
|
+
exports.GUILD_SCHEDULED_EVENT = GUILD_SCHEDULED_EVENT;
|
|
49
|
+
const GUILD_SCHEDULED_EVENTS = (guildID) => encode `/guilds/${guildID}/scheduled-events`;
|
|
50
|
+
exports.GUILD_SCHEDULED_EVENTS = GUILD_SCHEDULED_EVENTS;
|
|
51
|
+
const GUILD_SCHEDULED_EVENT_USERS = (guildID, eventID) => encode `/guilds/${guildID}/scheduled-events/${eventID}/users`;
|
|
52
|
+
exports.GUILD_SCHEDULED_EVENT_USERS = GUILD_SCHEDULED_EVENT_USERS;
|
|
53
|
+
const GUILD_TEMPLATE_CODE = (code) => encode `/guilds/templates/${code}`;
|
|
54
|
+
exports.GUILD_TEMPLATE_CODE = GUILD_TEMPLATE_CODE;
|
|
55
|
+
const GUILD_TEMPLATE = (guildID, templateID) => encode `/guilds/${guildID}/templates/${templateID}`;
|
|
56
|
+
exports.GUILD_TEMPLATE = GUILD_TEMPLATE;
|
|
57
|
+
const GUILD_TEMPLATES = (guildID) => encode `/guilds/${guildID}/templates`;
|
|
58
|
+
exports.GUILD_TEMPLATES = GUILD_TEMPLATES;
|
|
59
|
+
const GUILD_PREVIEW = (guildID) => encode `/guilds/${guildID}/preview`;
|
|
60
|
+
exports.GUILD_PREVIEW = GUILD_PREVIEW;
|
|
61
|
+
const GUILD_CHANNELS = (guildID) => encode `/guilds/${guildID}/channels`;
|
|
62
|
+
exports.GUILD_CHANNELS = GUILD_CHANNELS;
|
|
63
|
+
const GUILD_ACTIVE_THREADS = (guildID) => encode `/guilds/${guildID}/threads/active`;
|
|
64
|
+
exports.GUILD_ACTIVE_THREADS = GUILD_ACTIVE_THREADS;
|
|
65
|
+
const GUILD_MEMBERS = (guildID) => encode `/guilds/${guildID}/members`;
|
|
66
|
+
exports.GUILD_MEMBERS = GUILD_MEMBERS;
|
|
67
|
+
const GUILD_MEMBER = (guildID, userID) => encode `/guilds/${guildID}/members/${userID}`;
|
|
68
|
+
exports.GUILD_MEMBER = GUILD_MEMBER;
|
|
69
|
+
const GUILD_SEARCH_MEMBERS = (guildID) => encode `/guilds/${guildID}/members/search`;
|
|
70
|
+
exports.GUILD_SEARCH_MEMBERS = GUILD_SEARCH_MEMBERS;
|
|
71
|
+
const GUILD_MEMBERS_SEARCH = (guildID) => encode `/guilds/${guildID}/members-search`;
|
|
72
|
+
exports.GUILD_MEMBERS_SEARCH = GUILD_MEMBERS_SEARCH;
|
|
73
|
+
const GUILD_MEMBER_ROLE = (guildID, userID, roleID) => encode `/guilds/${guildID}/members/${userID}/roles/${roleID}`;
|
|
74
|
+
exports.GUILD_MEMBER_ROLE = GUILD_MEMBER_ROLE;
|
|
75
|
+
const GUILD_ROLES = (guildID) => encode `/guilds/${guildID}/roles`;
|
|
76
|
+
exports.GUILD_ROLES = GUILD_ROLES;
|
|
77
|
+
const GUILD_ROLE = (guildID, roleID) => encode `/guilds/${guildID}/roles/${roleID}`;
|
|
78
|
+
exports.GUILD_ROLE = GUILD_ROLE;
|
|
79
|
+
const GUILD_ROLE_MEMBER_COUNTS = (guildID) => encode `/guilds/${guildID}/roles/member-counts`;
|
|
80
|
+
exports.GUILD_ROLE_MEMBER_COUNTS = GUILD_ROLE_MEMBER_COUNTS;
|
|
81
|
+
const GUILD_PRUNE = (guildID) => encode `/guilds/${guildID}/prune`;
|
|
82
|
+
exports.GUILD_PRUNE = GUILD_PRUNE;
|
|
83
|
+
const GUILD_INVITES = (guildID) => encode `/guilds/${guildID}/invites`;
|
|
84
|
+
exports.GUILD_INVITES = GUILD_INVITES;
|
|
85
|
+
const GUILD_INTEGRATION = (guildID, integrationID) => encode `/guilds/${guildID}/integrations/${integrationID}`;
|
|
86
|
+
exports.GUILD_INTEGRATION = GUILD_INTEGRATION;
|
|
87
|
+
const GUILD_INTEGRATIONS = (guildID) => encode `/guilds/${guildID}/integrations`;
|
|
88
|
+
exports.GUILD_INTEGRATIONS = GUILD_INTEGRATIONS;
|
|
89
|
+
const GUILD_WIDGET = (guildID) => encode `/guilds/${guildID}/widget`;
|
|
90
|
+
exports.GUILD_WIDGET = GUILD_WIDGET;
|
|
91
|
+
const GUILD_VANITY_URL = (guildID) => encode `/guilds/${guildID}/vanity-url`;
|
|
92
|
+
exports.GUILD_VANITY_URL = GUILD_VANITY_URL;
|
|
93
|
+
const GUILD_WIDGET_IMAGE = (guildID) => encode `/guilds/${guildID}/widget.png`;
|
|
94
|
+
exports.GUILD_WIDGET_IMAGE = GUILD_WIDGET_IMAGE;
|
|
95
|
+
const GUILD_WIDGET_JSON = (guildID) => encode `/guilds/${guildID}/widget.json`;
|
|
96
|
+
exports.GUILD_WIDGET_JSON = GUILD_WIDGET_JSON;
|
|
97
|
+
const GUILD_WELCOME_SCREEN = (guildID) => encode `/guilds/${guildID}/welcome-screen`;
|
|
98
|
+
exports.GUILD_WELCOME_SCREEN = GUILD_WELCOME_SCREEN;
|
|
99
|
+
const GUILD_VOICE_STATE = (guildID, userID) => encode `/guilds/${guildID}/voice-states/${userID}`;
|
|
100
|
+
exports.GUILD_VOICE_STATE = GUILD_VOICE_STATE;
|
|
101
|
+
const GUILD_STICKER = (guildID, stickerID) => encode `/guilds/${guildID}/stickers/${stickerID}`;
|
|
102
|
+
exports.GUILD_STICKER = GUILD_STICKER;
|
|
103
|
+
const GUILD_STICKERS = (guildID) => encode `/guilds/${guildID}/stickers`;
|
|
104
|
+
exports.GUILD_STICKERS = GUILD_STICKERS;
|
|
105
|
+
const GUILD_ONBOARDING = (guildID) => encode `/guilds/${guildID}/onboarding`;
|
|
106
|
+
exports.GUILD_ONBOARDING = GUILD_ONBOARDING;
|
|
107
|
+
const GUILD_INCIDENT_ACTIONS = (guildID) => encode `/guilds/${guildID}/incident-actions`;
|
|
108
|
+
exports.GUILD_INCIDENT_ACTIONS = GUILD_INCIDENT_ACTIONS;
|
|
109
|
+
const GUILD_BULK_BAN = (guildID) => encode `/guilds/${guildID}/bulk-ban`;
|
|
110
|
+
exports.GUILD_BULK_BAN = GUILD_BULK_BAN;
|
|
111
|
+
const SOUNDBOARD_SOUNDS = (guildID) => encode `/guilds/${guildID}/soundboard-sounds`;
|
|
112
|
+
exports.SOUNDBOARD_SOUNDS = SOUNDBOARD_SOUNDS;
|
|
113
|
+
const SOUNDBOARD_SOUND = (guildID, soundID) => encode `/guilds/${guildID}/soundboard-sounds/${soundID}`;
|
|
114
|
+
exports.SOUNDBOARD_SOUND = SOUNDBOARD_SOUND;
|
|
115
|
+
// Channels
|
|
116
|
+
const CHANNEL = (channelID) => encode `/channels/${channelID}`;
|
|
117
|
+
exports.CHANNEL = CHANNEL;
|
|
118
|
+
const CHANNEL_BULK_DELETE_MESSAGES = (channelID) => encode `/channels/${channelID}/messages/bulk-delete`;
|
|
119
|
+
exports.CHANNEL_BULK_DELETE_MESSAGES = CHANNEL_BULK_DELETE_MESSAGES;
|
|
120
|
+
const CHANNEL_FOLLOWERS = (channelID) => encode `/channels/${channelID}/followers`;
|
|
121
|
+
exports.CHANNEL_FOLLOWERS = CHANNEL_FOLLOWERS;
|
|
122
|
+
const CHANNEL_INVITES = (channelID) => encode `/channels/${channelID}/invites`;
|
|
123
|
+
exports.CHANNEL_INVITES = CHANNEL_INVITES;
|
|
124
|
+
const CHANNEL_JOINED_PRIVATE_ARCHIVED_THREADS = (channelID) => encode `/channels/${channelID}/users/@me/threads/archived/private`;
|
|
125
|
+
exports.CHANNEL_JOINED_PRIVATE_ARCHIVED_THREADS = CHANNEL_JOINED_PRIVATE_ARCHIVED_THREADS;
|
|
126
|
+
const CHANNEL_MESSAGE = (channelID, messageID) => encode `/channels/${channelID}/messages/${messageID}`;
|
|
127
|
+
exports.CHANNEL_MESSAGE = CHANNEL_MESSAGE;
|
|
128
|
+
const CHANNEL_MESSAGES = (channelID) => encode `/channels/${channelID}/messages`;
|
|
129
|
+
exports.CHANNEL_MESSAGES = CHANNEL_MESSAGES;
|
|
130
|
+
const CHANNEL_MESSAGES_CROSSPOST = (channelID, messageID) => encode `/channels/${channelID}/messages/${messageID}/crosspost`;
|
|
131
|
+
exports.CHANNEL_MESSAGES_CROSSPOST = CHANNEL_MESSAGES_CROSSPOST;
|
|
132
|
+
const CHANNEL_MESSAGE_THREADS = (channelID, messageID) => encode `/channels/${channelID}/messages/${messageID}/threads`;
|
|
133
|
+
exports.CHANNEL_MESSAGE_THREADS = CHANNEL_MESSAGE_THREADS;
|
|
134
|
+
const CHANNEL_PERMISSION = (channelID, overwriteID) => encode `/channels/${channelID}/permissions/${overwriteID}`;
|
|
135
|
+
exports.CHANNEL_PERMISSION = CHANNEL_PERMISSION;
|
|
136
|
+
const CHANNEL_PERMISSIONS = (channelID) => encode `/channels/${channelID}/permissions`;
|
|
137
|
+
exports.CHANNEL_PERMISSIONS = CHANNEL_PERMISSIONS;
|
|
138
|
+
const CHANNEL_PINNED_MESSAGE = (channelID, messageID) => encode `/channels/${channelID}/pins/${messageID}`;
|
|
139
|
+
exports.CHANNEL_PINNED_MESSAGE = CHANNEL_PINNED_MESSAGE;
|
|
140
|
+
const CHANNEL_PINS = (channelID) => encode `/channels/${channelID}/pins`;
|
|
141
|
+
exports.CHANNEL_PINS = CHANNEL_PINS;
|
|
142
|
+
const CHANNEL_PRIVATE_ARCHIVED_THREADS = (channelID) => encode `/channels/${channelID}/threads/archived/private`;
|
|
143
|
+
exports.CHANNEL_PRIVATE_ARCHIVED_THREADS = CHANNEL_PRIVATE_ARCHIVED_THREADS;
|
|
144
|
+
const CHANNEL_PUBLIC_ARCHIVED_THREADS = (channelID) => encode `/channels/${channelID}/threads/archived/public`;
|
|
145
|
+
exports.CHANNEL_PUBLIC_ARCHIVED_THREADS = CHANNEL_PUBLIC_ARCHIVED_THREADS;
|
|
146
|
+
const CHANNEL_REACTION = (channelID, messageID, reaction) => encode `/channels/${channelID}/messages/${messageID}/reactions/${reaction}`;
|
|
147
|
+
exports.CHANNEL_REACTION = CHANNEL_REACTION;
|
|
148
|
+
const CHANNEL_REACTIONS = (channelID, messageID) => encode `/channels/${channelID}/messages/${messageID}/reactions`;
|
|
149
|
+
exports.CHANNEL_REACTIONS = CHANNEL_REACTIONS;
|
|
150
|
+
const CHANNEL_REACTION_USER = (channelID, messageID, reaction, user) => encode `/channels/${channelID}/messages/${messageID}/reactions/${reaction}/${user}`;
|
|
151
|
+
exports.CHANNEL_REACTION_USER = CHANNEL_REACTION_USER;
|
|
152
|
+
const CHANNEL_THREADS = (channelID) => encode `/channels/${channelID}/threads`;
|
|
153
|
+
exports.CHANNEL_THREADS = CHANNEL_THREADS;
|
|
154
|
+
const CHANNEL_THREAD_MEMBER = (channelID, userID) => encode `/channels/${channelID}/thread-members/${userID}`;
|
|
155
|
+
exports.CHANNEL_THREAD_MEMBER = CHANNEL_THREAD_MEMBER;
|
|
156
|
+
const CHANNEL_THREAD_MEMBERS = (channelID) => encode `/channels/${channelID}/thread-members`;
|
|
157
|
+
exports.CHANNEL_THREAD_MEMBERS = CHANNEL_THREAD_MEMBERS;
|
|
158
|
+
const CHANNEL_TYPING = (channelID) => encode `/channels/${channelID}/typing`;
|
|
159
|
+
exports.CHANNEL_TYPING = CHANNEL_TYPING;
|
|
160
|
+
const GROUP_RECIPIENT = (channelID, userID) => encode `/channels/${channelID}/recipients/${userID}`;
|
|
161
|
+
exports.GROUP_RECIPIENT = GROUP_RECIPIENT;
|
|
162
|
+
exports.VOICE_REGIONS = "/voice/regions";
|
|
163
|
+
const GUILD_VOICE_REGIONS = (guildID) => encode `/guilds/${guildID}/regions`;
|
|
164
|
+
exports.GUILD_VOICE_REGIONS = GUILD_VOICE_REGIONS;
|
|
165
|
+
const VOICE_STATUS = (channelID) => encode `/channels/${channelID}/voice-status`;
|
|
166
|
+
exports.VOICE_STATUS = VOICE_STATUS;
|
|
167
|
+
const POLL_ANSWER_USERS = (channelID, pollID, answerID) => encode `/channels/${channelID}/polls/${pollID}/answers/${answerID}`;
|
|
168
|
+
exports.POLL_ANSWER_USERS = POLL_ANSWER_USERS;
|
|
169
|
+
const POLL_EXPIRE = (channelID, pollID) => encode `/channels/${channelID}/polls/${pollID}/expire`;
|
|
170
|
+
exports.POLL_EXPIRE = POLL_EXPIRE;
|
|
171
|
+
const SEND_SOUNDBOARD_SOUND = (channelID) => encode `/channels/${channelID}/send-soundboard-sound`;
|
|
172
|
+
exports.SEND_SOUNDBOARD_SOUND = SEND_SOUNDBOARD_SOUND;
|
|
173
|
+
// OAuth
|
|
174
|
+
exports.OAUTH_APPLICATION = "/oauth2/applications/@me";
|
|
175
|
+
exports.OAUTH_AUTHORIZE = "/oauth2/authorize";
|
|
176
|
+
exports.OAUTH_INFO = "/oauth2/@me";
|
|
177
|
+
exports.OAUTH_CURRENT_USER = "/users/@me";
|
|
178
|
+
exports.OAUTH_CHANNELS = "/users/@me/channels";
|
|
179
|
+
exports.OAUTH_CONNECTIONS = "/users/@me/connections";
|
|
180
|
+
const OAUTH_GUILD = (guildID) => encode `/users/@me/guilds/${guildID}`;
|
|
181
|
+
exports.OAUTH_GUILD = OAUTH_GUILD;
|
|
182
|
+
const OAUTH_GUILD_MEMBER = (guildID) => encode `${(0, exports.OAUTH_GUILD)(guildID)}/member`;
|
|
183
|
+
exports.OAUTH_GUILD_MEMBER = OAUTH_GUILD_MEMBER;
|
|
184
|
+
exports.OAUTH_GUILDS = "/users/@me/guilds";
|
|
185
|
+
exports.OAUTH_TOKEN = "/oauth2/token";
|
|
186
|
+
exports.OAUTH_TOKEN_REVOKE = "/oauth2/token/revoke";
|
|
187
|
+
const OAUTH_ROLE_CONNECTION = (applicationID) => encode `/users/@me/applications/${applicationID}/role-connection`;
|
|
188
|
+
exports.OAUTH_ROLE_CONNECTION = OAUTH_ROLE_CONNECTION;
|
|
189
|
+
const ROLE_CONNECTIONS_METADATA = (applicationID) => encode `/applications/${applicationID}/role-connections/metadata`;
|
|
190
|
+
exports.ROLE_CONNECTIONS_METADATA = ROLE_CONNECTIONS_METADATA;
|
|
191
|
+
// Images
|
|
192
|
+
const ACHIEVEMENT_ICON = (applicationID, achievementID, hash) => encode `/app-assets/${applicationID}/achievements/${achievementID}/icons/${hash}`;
|
|
193
|
+
exports.ACHIEVEMENT_ICON = ACHIEVEMENT_ICON;
|
|
194
|
+
const APPLICATION_ASSET = (applicationID, assetID) => encode `/applications/${applicationID}/assets/${assetID}`;
|
|
195
|
+
exports.APPLICATION_ASSET = APPLICATION_ASSET;
|
|
196
|
+
const APPLICATION_COVER = (applicationID, hash) => encode `/app-icons/${applicationID}/${hash}`;
|
|
197
|
+
exports.APPLICATION_COVER = APPLICATION_COVER;
|
|
198
|
+
exports.APPLICATION_ICON = exports.APPLICATION_COVER;
|
|
199
|
+
const BANNER = (guildOrUserID, hash) => encode `/banners/${guildOrUserID}/${hash}`;
|
|
200
|
+
exports.BANNER = BANNER;
|
|
201
|
+
const CUSTOM_EMOJI = (emojiID) => encode `/emojis/${emojiID}`;
|
|
202
|
+
exports.CUSTOM_EMOJI = CUSTOM_EMOJI;
|
|
203
|
+
const EMBED_AVATAR = (mod) => encode `/embed/avatars/${mod}`;
|
|
204
|
+
exports.EMBED_AVATAR = EMBED_AVATAR;
|
|
205
|
+
const GUILD_AVATAR = (guildID, userID, hash) => encode `/guilds/${guildID}/users/${userID}/avatars/${hash}`;
|
|
206
|
+
exports.GUILD_AVATAR = GUILD_AVATAR;
|
|
207
|
+
const GUILD_DISCOVERY_SPLASH = (guildID, hash) => encode `/guilds/${guildID}/splashes/${hash}`;
|
|
208
|
+
exports.GUILD_DISCOVERY_SPLASH = GUILD_DISCOVERY_SPLASH;
|
|
209
|
+
const GUILD_ICON = (guildID, hash) => encode `/icons/${guildID}/${hash}`;
|
|
210
|
+
exports.GUILD_ICON = GUILD_ICON;
|
|
211
|
+
const CLAN_ICON = (guildID, hash) => encode `/clan-badges/${guildID}/${hash}`;
|
|
212
|
+
exports.CLAN_ICON = CLAN_ICON;
|
|
213
|
+
const GUILD_SCHEDULED_EVENT_COVER = (eventID, hash) => encode `/guild-events/${eventID}/${hash}`;
|
|
214
|
+
exports.GUILD_SCHEDULED_EVENT_COVER = GUILD_SCHEDULED_EVENT_COVER;
|
|
215
|
+
const GUILD_SPLASH = (guildID, hash) => encode `/splashes/${guildID}/${hash}`;
|
|
216
|
+
exports.GUILD_SPLASH = GUILD_SPLASH;
|
|
217
|
+
const MEMBER_BANNER = (guildID, userID, hash) => encode `/guilds/${guildID}/users/${userID}/banners/${hash}`;
|
|
218
|
+
exports.MEMBER_BANNER = MEMBER_BANNER;
|
|
219
|
+
const ROLE_ICON = (roleID, hash) => encode `/role-icons/${roleID}/${hash}`;
|
|
220
|
+
exports.ROLE_ICON = ROLE_ICON;
|
|
221
|
+
const STICKER = (stickerID) => encode `/stickers/${stickerID}`;
|
|
222
|
+
exports.STICKER = STICKER;
|
|
223
|
+
const STICKER_PACK_BANNER = (assetID) => (0, exports.APPLICATION_ASSET)("710982414301790216", assetID);
|
|
224
|
+
exports.STICKER_PACK_BANNER = STICKER_PACK_BANNER;
|
|
225
|
+
const TEAM_ICON = (teamID, hash) => encode `/team-icons/${teamID}/${hash}`;
|
|
226
|
+
exports.TEAM_ICON = TEAM_ICON;
|
|
227
|
+
const USER_AVATAR = (userID, hash) => encode `/avatars/${userID}/${hash}`;
|
|
228
|
+
exports.USER_AVATAR = USER_AVATAR;
|
|
229
|
+
const AVATAR_DECORATION = (hash) => encode `/avatar-decoration-presets/${hash}`;
|
|
230
|
+
exports.AVATAR_DECORATION = AVATAR_DECORATION;
|
|
231
|
+
// Applications
|
|
232
|
+
const APPLICATION_COMMAND = (applicationID, commandID) => encode `/applications/${applicationID}/commands/${commandID}`;
|
|
233
|
+
exports.APPLICATION_COMMAND = APPLICATION_COMMAND;
|
|
234
|
+
const APPLICATION_COMMANDS = (applicationID) => encode `/applications/${applicationID}/commands`;
|
|
235
|
+
exports.APPLICATION_COMMANDS = APPLICATION_COMMANDS;
|
|
236
|
+
const GUILD_APPLICATION_COMMAND = (applicationID, guildID, commandID) => encode `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}`;
|
|
237
|
+
exports.GUILD_APPLICATION_COMMAND = GUILD_APPLICATION_COMMAND;
|
|
238
|
+
const GUILD_APPLICATION_COMMANDS = (applicationID, guildID) => encode `/applications/${applicationID}/guilds/${guildID}/commands`;
|
|
239
|
+
exports.GUILD_APPLICATION_COMMANDS = GUILD_APPLICATION_COMMANDS;
|
|
240
|
+
const GUILD_APPLICATION_COMMAND_PERMISSION = (applicationID, guildID, commandID) => encode `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}/permissions`;
|
|
241
|
+
exports.GUILD_APPLICATION_COMMAND_PERMISSION = GUILD_APPLICATION_COMMAND_PERMISSION;
|
|
242
|
+
const GUILD_APPLICATION_COMMAND_PERMISSIONS = (applicationID, guildID) => encode `/applications/${applicationID}/guilds/${guildID}/commands/permissions`;
|
|
243
|
+
exports.GUILD_APPLICATION_COMMAND_PERMISSIONS = GUILD_APPLICATION_COMMAND_PERMISSIONS;
|
|
244
|
+
const INTERACTION_CALLBACK = (interactionID, interactionToken) => encode `/interactions/${interactionID}/${interactionToken}/callback`;
|
|
245
|
+
exports.INTERACTION_CALLBACK = INTERACTION_CALLBACK;
|
|
246
|
+
exports.APPLICATION = "/applications/@me";
|
|
247
|
+
const ENTITLEMENTS = (applicationID) => encode `/applications/${applicationID}/entitlements`;
|
|
248
|
+
exports.ENTITLEMENTS = ENTITLEMENTS;
|
|
249
|
+
const ENTITLEMENT = (applicationID, entitlementID) => encode `/applications/${applicationID}/entitlements/${entitlementID}`;
|
|
250
|
+
exports.ENTITLEMENT = ENTITLEMENT;
|
|
251
|
+
const CONSUME_ENTITLEMENT = (applicationID, entitlementID) => encode `/applications/${applicationID}/entitlements/${entitlementID}/consume`;
|
|
252
|
+
exports.CONSUME_ENTITLEMENT = CONSUME_ENTITLEMENT;
|
|
253
|
+
const SKUS = (applicationID) => encode `/applications/${applicationID}/skus`;
|
|
254
|
+
exports.SKUS = SKUS;
|
|
255
|
+
const SKU_SUBSCRIPTIONS = (skuID) => encode `/skus/${skuID}/subscriptions`;
|
|
256
|
+
exports.SKU_SUBSCRIPTIONS = SKU_SUBSCRIPTIONS;
|
|
257
|
+
const SKU_SUBSCRIPTION = (skuID, subscriptionID) => encode `/skus/${skuID}/subscriptions/${subscriptionID}`;
|
|
258
|
+
exports.SKU_SUBSCRIPTION = SKU_SUBSCRIPTION;
|
|
259
|
+
const APPLICATION_EMOJIS = (applicationID) => encode `/applications/${applicationID}/emojis`;
|
|
260
|
+
exports.APPLICATION_EMOJIS = APPLICATION_EMOJIS;
|
|
261
|
+
const APPLICATION_EMOJI = (applicationID, emojiID) => encode `/applications/${applicationID}/emojis/${emojiID}`;
|
|
262
|
+
exports.APPLICATION_EMOJI = APPLICATION_EMOJI;
|
|
263
|
+
const APPLICATION_ACTIVITY_INSTANCE = (applicationID, instanceID) => encode `/applications/${applicationID}/activity-instances/${instanceID}`;
|
|
264
|
+
exports.APPLICATION_ACTIVITY_INSTANCE = APPLICATION_ACTIVITY_INSTANCE;
|
|
265
|
+
// Lobbies
|
|
266
|
+
exports.LOBBIES = "/lobbies";
|
|
267
|
+
const LOBBY = (lobbyID) => encode `/lobbies/${lobbyID}`;
|
|
268
|
+
exports.LOBBY = LOBBY;
|
|
269
|
+
const LOBBY_MEMBER = (lobbyID, userID) => encode `/lobbies/${lobbyID}/members/${userID}`;
|
|
270
|
+
exports.LOBBY_MEMBER = LOBBY_MEMBER;
|
|
271
|
+
const LOBBY_CHANNEL_LINKING = (lobbyID) => encode `/lobbies/${lobbyID}/channel-linking`;
|
|
272
|
+
exports.LOBBY_CHANNEL_LINKING = LOBBY_CHANNEL_LINKING;
|
|
273
|
+
const LOBBY_MESSAGE_MODERATION_METADATA = (lobbyID, messageID) => encode `/lobbies/${lobbyID}/messages/${messageID}/moderation-metadata`;
|
|
274
|
+
exports.LOBBY_MESSAGE_MODERATION_METADATA = LOBBY_MESSAGE_MODERATION_METADATA;
|
|
275
|
+
// Misc
|
|
276
|
+
exports.GATEWAY = "/gateway";
|
|
277
|
+
exports.GATEWAY_BOT = "/gateway/bot";
|
|
278
|
+
const USER = (userID) => encode `/users/${userID}`;
|
|
279
|
+
exports.USER = USER;
|
|
280
|
+
const MESSAGE_LINK = (guildID, channelID, messageID) => encode `/channels/${guildID}/${channelID}/${messageID}`;
|
|
281
|
+
exports.MESSAGE_LINK = MESSAGE_LINK;
|
|
282
|
+
exports.STICKER_PACKS = "/sticker-packs";
|
|
283
|
+
const INVITE = (code) => encode `/invites/${code}`;
|
|
284
|
+
exports.INVITE = INVITE;
|
|
285
|
+
const INVITE_TARGET_USERS = (code) => encode `/invites/${code}/target-users`;
|
|
286
|
+
exports.INVITE_TARGET_USERS = INVITE_TARGET_USERS;
|
|
287
|
+
const INVITE_TARGET_USERS_JOB_STATUS = (code) => encode `/invites/${code}/target-users/job-status`;
|
|
288
|
+
exports.INVITE_TARGET_USERS_JOB_STATUS = INVITE_TARGET_USERS_JOB_STATUS;
|
|
289
|
+
exports.SOUNDBOARD_DEFAULT_SOUNDS = "/soundboard-default-sounds";
|
|
290
|
+
exports.STAGE_INSTANCES = "/stage-instances";
|
|
291
|
+
const STAGE_INSTANCE = (channelID) => encode `/stage-instances/${channelID}`;
|
|
292
|
+
exports.STAGE_INSTANCE = STAGE_INSTANCE;
|
|
293
|
+
exports.REFRESH_ATTACHMENT_URLS = "/attachments/refresh-urls";
|
|
@@ -0,0 +1,78 @@
|
|
|
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 SimpleCollection */
|
|
7
|
+
const Collection_1 = __importDefault(require("./Collection.cjs"));
|
|
8
|
+
/** This is an internal class, you should not use it in your projects. If you want a collection type for your own projects, look at {@link Collection}. */
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
class SimpleCollection extends Collection_1.default {
|
|
11
|
+
constructor(conversionFunc, limit = Infinity, onDuplicate = "throw", key) {
|
|
12
|
+
super();
|
|
13
|
+
this.limit = limit;
|
|
14
|
+
Object.defineProperties(this, {
|
|
15
|
+
conversionFunc: { value: conversionFunc, enumerable: false },
|
|
16
|
+
key: { value: key ?? "id", enumerable: false },
|
|
17
|
+
onDuplicate: { value: onDuplicate, enumerable: false }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
add(value) {
|
|
21
|
+
if (this.key in value) {
|
|
22
|
+
if (this.limit === 0) {
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
if (this.has(value[this.key])) {
|
|
26
|
+
switch (this.onDuplicate) {
|
|
27
|
+
case "merge": {
|
|
28
|
+
value = { ...this.get(value[this.key]), ...value };
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
// we don't have the raw data, so we can't update
|
|
32
|
+
case "update":
|
|
33
|
+
case "throw": {
|
|
34
|
+
const err = new Error(`${this.constructor.name}#add: duplicate ${this.key} ${value[this.key]}`);
|
|
35
|
+
Object.defineProperty(err, "_object", { value });
|
|
36
|
+
throw err;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
this.set(value[this.key], value);
|
|
41
|
+
if (this.limit && this.size > this.limit) {
|
|
42
|
+
const iter = this.keys();
|
|
43
|
+
while (this.size > this.limit) {
|
|
44
|
+
this.delete(iter.next().value);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const err = new Error(`${this.constructor.name}#add: value must have a ${this.key} property`);
|
|
51
|
+
Object.defineProperty(err, "_object", { value });
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
update(value) {
|
|
56
|
+
if (this.key in value) {
|
|
57
|
+
if (this.has(value[this.key]) && this.onDuplicate === "update") {
|
|
58
|
+
const obj = this.get(value[this.key]);
|
|
59
|
+
if ("update" in obj && typeof obj.update === "function") {
|
|
60
|
+
obj.update(value);
|
|
61
|
+
return obj;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const err = new Error(`${this.constructor.name}#update: existing object for ${value[this.key]} does not have an update method`);
|
|
65
|
+
Object.defineProperty(err, "_object", { value });
|
|
66
|
+
throw err;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return this.add(this.conversionFunc(value));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
const err = new Error(`${this.constructor.name}#update: value must have a ${this.key} property`);
|
|
73
|
+
Object.defineProperty(err, "_object", { value });
|
|
74
|
+
throw err;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.default = SimpleCollection;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class Time {
|
|
4
|
+
constructor(client) {
|
|
5
|
+
/** When the first shard connect happened, reset if all shards disconnect. */
|
|
6
|
+
this.connect = null;
|
|
7
|
+
/** When all shards disconnected, reset on any shard connect. */
|
|
8
|
+
this.disconnect = null;
|
|
9
|
+
/** When the first shard ready happened, reset if all shards disconnect. */
|
|
10
|
+
this.ready = null;
|
|
11
|
+
/** When the most recent shard connect happened. */
|
|
12
|
+
this.shardConnect = null;
|
|
13
|
+
/** When the most recent shard disconnect happened. */
|
|
14
|
+
this.shardDisconnect = null;
|
|
15
|
+
/** When the most recent shard pre-ready happened. */
|
|
16
|
+
this.shardPreReady = null;
|
|
17
|
+
/** When the most recent shard ready happened. */
|
|
18
|
+
this.shardReady = null;
|
|
19
|
+
/** When the most recent shard resume happened. */
|
|
20
|
+
this.shardResume = null;
|
|
21
|
+
/** When the client started. */
|
|
22
|
+
this.start = null;
|
|
23
|
+
Object.defineProperty(this, "client", {
|
|
24
|
+
value: client,
|
|
25
|
+
writable: false,
|
|
26
|
+
enumerable: false,
|
|
27
|
+
configurable: false
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** @internal */
|
|
31
|
+
_setConnect(value) {
|
|
32
|
+
this.shardConnect = value;
|
|
33
|
+
this.disconnect = null;
|
|
34
|
+
if (!this.connect) {
|
|
35
|
+
this.connect = value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** @internal */
|
|
39
|
+
_setDisconnect(value) {
|
|
40
|
+
this.shardDisconnect = value;
|
|
41
|
+
const noneReady = this.client.shards.every(shard => !shard.ready);
|
|
42
|
+
if (noneReady) {
|
|
43
|
+
this.connect = null;
|
|
44
|
+
this.disconnect = value;
|
|
45
|
+
this.ready = null;
|
|
46
|
+
this.start = null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** @internal */
|
|
50
|
+
_setPreReady(value) {
|
|
51
|
+
this.shardPreReady = value;
|
|
52
|
+
}
|
|
53
|
+
/** @internal */
|
|
54
|
+
_setReady(value) {
|
|
55
|
+
this.shardReady = value;
|
|
56
|
+
if (!this.ready)
|
|
57
|
+
this.ready = value;
|
|
58
|
+
}
|
|
59
|
+
/** @internal */
|
|
60
|
+
_setResume(value) {
|
|
61
|
+
this.shardResume = value;
|
|
62
|
+
}
|
|
63
|
+
/** @internal */
|
|
64
|
+
_setStart(value) {
|
|
65
|
+
if (!this.start) {
|
|
66
|
+
this.start = value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
reset() {
|
|
70
|
+
this.connect = null;
|
|
71
|
+
this.disconnect = null;
|
|
72
|
+
this.ready = null;
|
|
73
|
+
this.start = null;
|
|
74
|
+
this.shardConnect = null;
|
|
75
|
+
this.shardDisconnect = null;
|
|
76
|
+
this.shardPreReady = null;
|
|
77
|
+
this.shardReady = null;
|
|
78
|
+
this.shardResume = null;
|
|
79
|
+
}
|
|
80
|
+
/** @internal */
|
|
81
|
+
set(type, value) {
|
|
82
|
+
switch (type) {
|
|
83
|
+
case "connect": return this._setConnect(value);
|
|
84
|
+
case "disconnect": return this._setDisconnect(value);
|
|
85
|
+
case "preReady": return this._setPreReady(value);
|
|
86
|
+
case "ready": return this._setReady(value);
|
|
87
|
+
case "resume": return this._setResume(value);
|
|
88
|
+
case "start": return this._setStart(value);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.default = Time;
|
|
@@ -0,0 +1,78 @@
|
|
|
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 TypedCollection */
|
|
7
|
+
const Collection_1 = __importDefault(require("./Collection.cjs"));
|
|
8
|
+
const Base_1 = __importDefault(require("../structures/Base.cjs"));
|
|
9
|
+
/** This is an internal class, you should not use it in your projects. If you want a collection type for your own projects, look at {@link Collection}. */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
+
class TypedCollection extends Collection_1.default {
|
|
12
|
+
constructor(baseObject, client, limit = Infinity, extraOptions) {
|
|
13
|
+
super();
|
|
14
|
+
if (!(baseObject.prototype instanceof Base_1.default)) {
|
|
15
|
+
throw new TypeError("baseObject must be a class that extends Base.");
|
|
16
|
+
}
|
|
17
|
+
this._baseObject = baseObject;
|
|
18
|
+
this.limit = limit;
|
|
19
|
+
this.extraOptions = {
|
|
20
|
+
construct: extraOptions?.construct ?? ((data, ...extra) => new baseObject(data, client, ...extra)),
|
|
21
|
+
delete: extraOptions?.delete ?? (() => { })
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** @hidden */
|
|
25
|
+
add(value) {
|
|
26
|
+
if ("id" in value) {
|
|
27
|
+
if (this.limit === 0) {
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
this.set(value.id, value);
|
|
31
|
+
if (this.limit && this.size > this.limit) {
|
|
32
|
+
const iter = this.keys();
|
|
33
|
+
while (this.size > this.limit) {
|
|
34
|
+
const val = iter.next().value;
|
|
35
|
+
if (val === undefined) {
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
this.delete(val);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const err = new Error(`${this.constructor.name}#add: value must have an id property`);
|
|
45
|
+
Object.defineProperty(err, "_object", { value });
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
clear() {
|
|
50
|
+
for (const key of this.keys()) {
|
|
51
|
+
this.extraOptions.delete(key);
|
|
52
|
+
}
|
|
53
|
+
super.clear();
|
|
54
|
+
}
|
|
55
|
+
delete(key) {
|
|
56
|
+
this.extraOptions.delete(key);
|
|
57
|
+
return super.delete(key);
|
|
58
|
+
}
|
|
59
|
+
/** @hidden */
|
|
60
|
+
update(value, ...extra) {
|
|
61
|
+
if (value instanceof this._baseObject) {
|
|
62
|
+
if ("update" in value) {
|
|
63
|
+
value["update"].call(value, value);
|
|
64
|
+
}
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
// if the object does not have a direct id, we're forced to construct a whole new object
|
|
68
|
+
let item = "id" in value && value.id ? this.get(value.id) : undefined;
|
|
69
|
+
if (!item) {
|
|
70
|
+
item = this.add(this.extraOptions.construct(value, ...extra));
|
|
71
|
+
}
|
|
72
|
+
else if ("update" in item) {
|
|
73
|
+
item["update"].call(item, value);
|
|
74
|
+
}
|
|
75
|
+
return item;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.default = TypedCollection;
|