@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,345 @@
|
|
|
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 Application */
|
|
48
|
+
const ClientApplication_1 = __importDefault(require("./ClientApplication.cjs"));
|
|
49
|
+
const OAuthGuild_1 = __importDefault(require("./OAuthGuild.cjs"));
|
|
50
|
+
const User_1 = __importDefault(require("./User.cjs"));
|
|
51
|
+
const Team_1 = __importDefault(require("./Team.cjs"));
|
|
52
|
+
const SKU_1 = __importDefault(require("./SKU.cjs"));
|
|
53
|
+
const Routes = __importStar(require("../util/Routes.cjs"));
|
|
54
|
+
/** Represents an application. */
|
|
55
|
+
class Application extends ClientApplication_1.default {
|
|
56
|
+
constructor(data, client) {
|
|
57
|
+
super(data, client);
|
|
58
|
+
this.description = data.description;
|
|
59
|
+
this.hook = data.hook;
|
|
60
|
+
this.icon = data.icon;
|
|
61
|
+
this.isDiscoverable = data.is_discoverable;
|
|
62
|
+
this.isMonetized = data.is_monetized;
|
|
63
|
+
this.isVerified = data.is_verified;
|
|
64
|
+
this.name = data.name;
|
|
65
|
+
this.storefrontAvailable = data.storefront_available;
|
|
66
|
+
this.type = data.type;
|
|
67
|
+
this.verifyKey = data.verify_key;
|
|
68
|
+
this.update(data);
|
|
69
|
+
}
|
|
70
|
+
update(data) {
|
|
71
|
+
super.update(data);
|
|
72
|
+
if (data.aliases !== undefined)
|
|
73
|
+
this.aliases = data.aliases;
|
|
74
|
+
if (data.approved_consoles !== undefined)
|
|
75
|
+
this.approvedConsoles = data.approved_consoles;
|
|
76
|
+
if (data.approximate_guild_count !== undefined)
|
|
77
|
+
this.approximateGuildCount = data.approximate_guild_count;
|
|
78
|
+
if (data.approximate_user_authorization_count !== undefined)
|
|
79
|
+
this.approximateUserAuthorizationCount = data.approximate_user_authorization_count;
|
|
80
|
+
if (data.approximate_user_install_count !== undefined)
|
|
81
|
+
this.approximateUserInstallCount = data.approximate_user_install_count;
|
|
82
|
+
if (data.bot_approximate_guild_count !== undefined)
|
|
83
|
+
this.botApproximateGuildCount = data.bot_approximate_guild_count;
|
|
84
|
+
if (data.bot_disabled !== undefined)
|
|
85
|
+
this.botDisabled = !data.bot_disabled;
|
|
86
|
+
if (data.bot_quarantined !== undefined)
|
|
87
|
+
this.botQuarantined = !data.bot_disabled;
|
|
88
|
+
if (data.bot_public !== undefined)
|
|
89
|
+
this.botPublic = data.bot_public;
|
|
90
|
+
if (data.bot_quarantined !== undefined)
|
|
91
|
+
this.botQuarantined = data.bot_quarantined;
|
|
92
|
+
if (data.bot_require_code_grant !== undefined)
|
|
93
|
+
this.botRequireCodeGrant = data.bot_require_code_grant;
|
|
94
|
+
if (data.connection_entrypoint_url !== undefined)
|
|
95
|
+
this.connectionEntrypointURL = data.connection_entrypoint_url;
|
|
96
|
+
if (data.cover_image !== undefined)
|
|
97
|
+
this.coverImage = data.cover_image;
|
|
98
|
+
if (data.creator_monetization_state !== undefined)
|
|
99
|
+
this.creatorMonetizationState = data.creator_monetization_state;
|
|
100
|
+
if (data.custom_install_url !== undefined)
|
|
101
|
+
this.customInstallURL = data.custom_install_url;
|
|
102
|
+
if (data.deeplink_uri !== undefined)
|
|
103
|
+
this.deeplinkURI = data.deeplink_uri;
|
|
104
|
+
if (data.description !== undefined)
|
|
105
|
+
this.description = data.description;
|
|
106
|
+
if (data.developers !== undefined)
|
|
107
|
+
this.developers = data.developers;
|
|
108
|
+
if (data.discoverability_state !== undefined)
|
|
109
|
+
this.discoverabilityState = data.discoverability_state;
|
|
110
|
+
if (data.discovery_eligibility_flags !== undefined)
|
|
111
|
+
this.discoveryEligibilityFlags = data.discovery_eligibility_flags;
|
|
112
|
+
if (data.embedded_activity_config !== undefined) {
|
|
113
|
+
this.embeddedActivityConfig = {
|
|
114
|
+
activityPreviewVideoAssetID: data.embedded_activity_config.activity_preview_video_asset_id,
|
|
115
|
+
applicationID: data.embedded_activity_config.application_id,
|
|
116
|
+
blockedLocales: data.embedded_activity_config.blocked_locales,
|
|
117
|
+
clientPlatformConfig: Object.entries(data.embedded_activity_config.client_platform_config).reduce((obj, [key, value]) => {
|
|
118
|
+
obj[key] = {
|
|
119
|
+
labelType: value.label_type,
|
|
120
|
+
labelUntil: value.label_until ? new Date(value.label_until) : null,
|
|
121
|
+
omitBadgeFromSurfaces: value.omit_badge_from_surfaces,
|
|
122
|
+
releasePhase: value.release_phase
|
|
123
|
+
};
|
|
124
|
+
return obj;
|
|
125
|
+
}, {}),
|
|
126
|
+
defaultOrientationLockState: data.embedded_activity_config.default_orientation_lock_state,
|
|
127
|
+
displaysAdvertisements: data.embedded_activity_config.displays_advertisements,
|
|
128
|
+
freePeriodEndsAt: data.embedded_activity_config.free_period_ends_at ? new Date(data.embedded_activity_config.free_period_ends_at) : null,
|
|
129
|
+
freePeriodStartsAt: data.embedded_activity_config.free_period_starts_at ? new Date(data.embedded_activity_config.free_period_starts_at) : null,
|
|
130
|
+
hasCspException: data.embedded_activity_config.has_csp_exception,
|
|
131
|
+
legacyResponsiveAspectRatio: data.embedded_activity_config.legacy_responsive_aspect_ratio,
|
|
132
|
+
premiumTierRequirement: data.embedded_activity_config.premium_tier_requirement,
|
|
133
|
+
requiresAgeGate: data.embedded_activity_config.requires_age_gate,
|
|
134
|
+
shelfRank: data.embedded_activity_config.shelf_rank,
|
|
135
|
+
supportedLocales: data.embedded_activity_config.supported_locales,
|
|
136
|
+
supportedPlatforms: data.embedded_activity_config.supported_platforms,
|
|
137
|
+
tabletDefaultOrientationLockState: data.embedded_activity_config.tablet_default_orientation_lock_state
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
if (data.eula_id !== undefined)
|
|
141
|
+
this.eulaID = data.eula_id;
|
|
142
|
+
if (data.event_webhooks_status !== undefined)
|
|
143
|
+
this.eventWebhooksStatus = data.event_webhooks_status;
|
|
144
|
+
if (data.event_webhooks_types !== undefined)
|
|
145
|
+
this.eventWebhooksTypes = data.event_webhooks_types;
|
|
146
|
+
if (data.event_webhooks_url !== undefined)
|
|
147
|
+
this.eventWebhooksURL = data.event_webhooks_url;
|
|
148
|
+
if (data.executables !== undefined) {
|
|
149
|
+
this.executables = data.executables.map(executable => ({
|
|
150
|
+
isLauncher: executable.is_launcher,
|
|
151
|
+
name: executable.name,
|
|
152
|
+
os: executable.os
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
if (data.explicit_content_filter !== undefined)
|
|
156
|
+
this.explicitContentFilter = data.explicit_content_filter;
|
|
157
|
+
if (data.flags !== undefined)
|
|
158
|
+
this.flags = data.flags;
|
|
159
|
+
if (data.guild !== undefined)
|
|
160
|
+
this.guild = data.guild ? new OAuthGuild_1.default(data.guild, this.client) : null;
|
|
161
|
+
if (data.guild_id !== undefined)
|
|
162
|
+
this.guildID = data.guild_id;
|
|
163
|
+
if (data.hook !== undefined)
|
|
164
|
+
this.hook = data.hook;
|
|
165
|
+
if (data.icon !== undefined)
|
|
166
|
+
this.icon = data.icon;
|
|
167
|
+
if (data.install_params !== undefined)
|
|
168
|
+
this.installParams = data.install_params;
|
|
169
|
+
if (data.integration_public !== undefined)
|
|
170
|
+
this.integrationPublic = data.integration_public;
|
|
171
|
+
if (data.integration_require_code_grant !== undefined)
|
|
172
|
+
this.integrationRequireCodeGrant = data.integration_require_code_grant;
|
|
173
|
+
if (data.integration_types !== undefined)
|
|
174
|
+
this.integrationTypes = data.integration_types;
|
|
175
|
+
if (data.integration_types_config !== undefined)
|
|
176
|
+
this.integrationTypesConfig = Object.entries(data.integration_types_config).reduce((obj, [key, value]) => {
|
|
177
|
+
obj[key] = {
|
|
178
|
+
oauth2InstallParams: value.oauth2_install_params
|
|
179
|
+
};
|
|
180
|
+
return obj;
|
|
181
|
+
}, {});
|
|
182
|
+
if (data.interactions_endpoint_url !== undefined)
|
|
183
|
+
this.interactionsEndpointURL = data.interactions_endpoint_url;
|
|
184
|
+
if (data.interactions_event_types !== undefined)
|
|
185
|
+
this.interactionsEventTypes = data.interactions_event_types;
|
|
186
|
+
if (data.interactions_version !== undefined)
|
|
187
|
+
this.interactionsVersion = data.interactions_version;
|
|
188
|
+
if (data.internal_guild_restriction !== undefined)
|
|
189
|
+
this.internalGuildRestriction = data.internal_guild_restriction;
|
|
190
|
+
if (data.is_discoverable !== undefined)
|
|
191
|
+
this.isDiscoverable = data.is_discoverable;
|
|
192
|
+
if (data.is_monetized !== undefined)
|
|
193
|
+
this.isMonetized = data.is_monetized;
|
|
194
|
+
if (data.is_verified !== undefined)
|
|
195
|
+
this.isVerified = data.is_verified;
|
|
196
|
+
if (data.max_participants !== undefined)
|
|
197
|
+
this.maxParticipants = data.max_participants;
|
|
198
|
+
if (data.monetization_eligibility_flags !== undefined)
|
|
199
|
+
this.monetizationEligibilityFlags = data.monetization_eligibility_flags;
|
|
200
|
+
if (data.monetization_state !== undefined)
|
|
201
|
+
this.monetizationState = data.monetization_state;
|
|
202
|
+
if (data.name !== undefined)
|
|
203
|
+
this.name = data.name;
|
|
204
|
+
if (data.overlay !== undefined)
|
|
205
|
+
this.overlay = data.overlay;
|
|
206
|
+
if (data.overlay_compatibility_hook !== undefined)
|
|
207
|
+
this.overlayCompatibilityHook = data.overlay_compatibility_hook;
|
|
208
|
+
if (data.overlay_methods !== undefined)
|
|
209
|
+
this.overlayMethods = data.overlay_methods;
|
|
210
|
+
if (data.overlay_warn !== undefined)
|
|
211
|
+
this.overlayWarn = data.overlay_warn;
|
|
212
|
+
if (data.owner !== undefined)
|
|
213
|
+
this.owner = data.owner ? new User_1.default(data.owner, this.client) : null;
|
|
214
|
+
if (data.parent_id !== undefined)
|
|
215
|
+
this.parentID = data.parent_id;
|
|
216
|
+
if (data.pricing_localization_strategy !== undefined)
|
|
217
|
+
this.pricingLocalizationStrategy = data.pricing_localization_strategy;
|
|
218
|
+
if (data.primary_sku_id !== undefined)
|
|
219
|
+
this.primarySKUID = data.primary_sku_id;
|
|
220
|
+
if (data.privacy_policy_url !== undefined)
|
|
221
|
+
this.privacyPolicyURL = data.privacy_policy_url;
|
|
222
|
+
if (data.publishers !== undefined)
|
|
223
|
+
this.publishers = data.publishers;
|
|
224
|
+
if (data.redirect_uris !== undefined)
|
|
225
|
+
this.redirectURIs = data.redirect_uris;
|
|
226
|
+
if (data.role_connections_verification_url !== undefined)
|
|
227
|
+
this.roleConnectionsVerificationURL = data.role_connections_verification_url;
|
|
228
|
+
if (data.rpc_application_state !== undefined)
|
|
229
|
+
this.rpcApplicationState = data.rpc_application_state;
|
|
230
|
+
if (data.rpc_origins !== undefined)
|
|
231
|
+
this.rpcOrigins = data.rpc_origins;
|
|
232
|
+
if (data.slug !== undefined)
|
|
233
|
+
this.slug = data.slug;
|
|
234
|
+
if (data.store_application_state !== undefined)
|
|
235
|
+
this.storeApplicationState = data.store_application_state;
|
|
236
|
+
if (data.storefront_available !== undefined)
|
|
237
|
+
this.storefrontAvailable = data.storefront_available;
|
|
238
|
+
if (data.tags !== undefined)
|
|
239
|
+
this.tags = data.tags;
|
|
240
|
+
if (data.team !== undefined)
|
|
241
|
+
this.team = data.team ? new Team_1.default(data.team, this.client) : null;
|
|
242
|
+
if (data.terms_of_service_url !== undefined)
|
|
243
|
+
this.termsOfServiceURL = data.terms_of_service_url;
|
|
244
|
+
if (data.third_party_skus !== undefined)
|
|
245
|
+
this.thirdPartySKUs = data.third_party_skus.map(sku => new SKU_1.default(sku, this.client));
|
|
246
|
+
if (data.type !== undefined)
|
|
247
|
+
this.type = data.type;
|
|
248
|
+
if (data.verification_state !== undefined)
|
|
249
|
+
this.verificationState = data.verification_state;
|
|
250
|
+
if (data.verify_key !== undefined)
|
|
251
|
+
this.verifyKey = data.verify_key;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* The url of this application's cover image.
|
|
255
|
+
* @param format The format the url should be.
|
|
256
|
+
* @param size The dimensions of the image.
|
|
257
|
+
*/
|
|
258
|
+
coverImageURL(format, size) {
|
|
259
|
+
return this.coverImage ? this.client.util.formatImage(Routes.APPLICATION_COVER(this.id, this.coverImage), format, size) : null;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* The url of this application's icon.
|
|
263
|
+
* @param format The format the url should be.
|
|
264
|
+
* @param size The dimensions of the image.
|
|
265
|
+
*/
|
|
266
|
+
iconURL(format, size) {
|
|
267
|
+
return this.icon === null ? null : this.client.util.formatImage(Routes.APPLICATION_ICON(this.id, this.icon), format, size);
|
|
268
|
+
}
|
|
269
|
+
toJSON() {
|
|
270
|
+
return {
|
|
271
|
+
...super.toJSON(),
|
|
272
|
+
aliases: this.aliases,
|
|
273
|
+
approvedConsoles: this.approvedConsoles,
|
|
274
|
+
approximateGuildCount: this.approximateGuildCount,
|
|
275
|
+
approximateUserAuthorizationCount: this.approximateUserAuthorizationCount,
|
|
276
|
+
approximateUserInstallCount: this.approximateUserInstallCount,
|
|
277
|
+
botApproximateGuildCount: this.botApproximateGuildCount,
|
|
278
|
+
botDisabled: this.botDisabled,
|
|
279
|
+
botPublic: this.botPublic,
|
|
280
|
+
botQuarantined: this.botQuarantined,
|
|
281
|
+
botRequireCodeGrant: this.botRequireCodeGrant,
|
|
282
|
+
connectionEntrypointURL: this.connectionEntrypointURL,
|
|
283
|
+
coverImage: this.coverImage,
|
|
284
|
+
creatorMonetizationState: this.creatorMonetizationState,
|
|
285
|
+
customInstallURL: this.customInstallURL,
|
|
286
|
+
deeplinkURI: this.deeplinkURI,
|
|
287
|
+
description: this.description,
|
|
288
|
+
developers: this.developers,
|
|
289
|
+
discoverabilityState: this.discoverabilityState,
|
|
290
|
+
discoveryEligibilityFlags: this.discoveryEligibilityFlags,
|
|
291
|
+
embeddedActivityConfig: this.embeddedActivityConfig,
|
|
292
|
+
eulaID: this.eulaID,
|
|
293
|
+
eventWebhooksStatus: this.eventWebhooksStatus,
|
|
294
|
+
eventWebhooksTypes: this.eventWebhooksTypes,
|
|
295
|
+
eventWebhooksURL: this.eventWebhooksURL,
|
|
296
|
+
executables: this.executables,
|
|
297
|
+
explicitContentFilter: this.explicitContentFilter,
|
|
298
|
+
guild: this.guild?.toJSON() ?? null,
|
|
299
|
+
guildID: this.guildID,
|
|
300
|
+
hook: this.hook,
|
|
301
|
+
icon: this.icon,
|
|
302
|
+
installParams: this.installParams,
|
|
303
|
+
integrationPublic: this.integrationPublic,
|
|
304
|
+
integrationRequireCodeGrant: this.integrationRequireCodeGrant,
|
|
305
|
+
integrationTypes: this.integrationTypes,
|
|
306
|
+
integrationTypesConfig: this.integrationTypesConfig,
|
|
307
|
+
interactionsEndpointURL: this.interactionsEndpointURL,
|
|
308
|
+
interactionsEventTypes: this.interactionsEventTypes,
|
|
309
|
+
interactionsVersion: this.interactionsVersion,
|
|
310
|
+
internalGuildRestriction: this.internalGuildRestriction,
|
|
311
|
+
isDiscoverable: this.isDiscoverable,
|
|
312
|
+
isMonetized: this.isMonetized,
|
|
313
|
+
isVerified: this.isVerified,
|
|
314
|
+
maxParticipants: this.maxParticipants,
|
|
315
|
+
monetizationEligibilityFlags: this.monetizationEligibilityFlags,
|
|
316
|
+
monetizationState: this.monetizationState,
|
|
317
|
+
name: this.name,
|
|
318
|
+
overlay: this.overlay,
|
|
319
|
+
overlayCompatibilityHook: this.overlayCompatibilityHook,
|
|
320
|
+
overlayMethods: this.overlayMethods,
|
|
321
|
+
overlayWarn: this.overlayWarn,
|
|
322
|
+
owner: this.owner?.toJSON() ?? null,
|
|
323
|
+
parentID: this.parentID,
|
|
324
|
+
pricingLocalizationStrategy: this.pricingLocalizationStrategy,
|
|
325
|
+
primarySKUID: this.primarySKUID,
|
|
326
|
+
privacyPolicyURL: this.privacyPolicyURL,
|
|
327
|
+
publishers: this.publishers,
|
|
328
|
+
redirectURIs: this.redirectURIs,
|
|
329
|
+
roleConnectionsVerificationURL: this.roleConnectionsVerificationURL,
|
|
330
|
+
rpcApplicationState: this.rpcApplicationState,
|
|
331
|
+
rpcOrigins: this.rpcOrigins,
|
|
332
|
+
slug: this.slug,
|
|
333
|
+
storeApplicationState: this.storeApplicationState,
|
|
334
|
+
storefrontAvailable: this.storefrontAvailable,
|
|
335
|
+
tags: this.tags,
|
|
336
|
+
team: this.team?.toJSON() ?? null,
|
|
337
|
+
termsOfServiceURL: this.termsOfServiceURL,
|
|
338
|
+
thirdPartySKUs: this.thirdPartySKUs?.map(sku => sku.toJSON()),
|
|
339
|
+
type: this.type,
|
|
340
|
+
verificationState: this.verificationState,
|
|
341
|
+
verifyKey: this.verifyKey
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
exports.default = Application;
|
|
@@ -0,0 +1,109 @@
|
|
|
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 ApplicationCommand */
|
|
7
|
+
const Base_1 = __importDefault(require("./Base.cjs"));
|
|
8
|
+
const Permission_1 = __importDefault(require("./Permission.cjs"));
|
|
9
|
+
const Constants_1 = require("../Constants.cjs");
|
|
10
|
+
const Errors_1 = require("../util/Errors.cjs");
|
|
11
|
+
/** Represents an application command. */
|
|
12
|
+
class ApplicationCommand extends Base_1.default {
|
|
13
|
+
constructor(data, client) {
|
|
14
|
+
super(data.id, client);
|
|
15
|
+
this.application = client["_application"] && client.application.id === data.application_id ? client.application : undefined;
|
|
16
|
+
this.applicationID = data.application_id;
|
|
17
|
+
this.contexts = data.contexts;
|
|
18
|
+
this.defaultMemberPermissions = data.default_member_permissions ? new Permission_1.default(data.default_member_permissions) : null;
|
|
19
|
+
this.description = data.description;
|
|
20
|
+
this.descriptionLocalizations = data.description_localizations;
|
|
21
|
+
this.descriptionLocalized = data.description_localized;
|
|
22
|
+
this.dmPermission = data.dm_permission;
|
|
23
|
+
this.guildID = data.guild_id ?? null;
|
|
24
|
+
this.handler = data.handler;
|
|
25
|
+
this.integrationTypes = data.integration_types;
|
|
26
|
+
this.name = data.name;
|
|
27
|
+
this.nameLocalizations = data.name_localizations;
|
|
28
|
+
this.nameLocalized = data.name_localized;
|
|
29
|
+
this.nsfw = data.nsfw;
|
|
30
|
+
this.options = data.options?.map(o => client.util.optionToParsed(o));
|
|
31
|
+
this.type = (data.type ?? Constants_1.ApplicationCommandTypes.CHAT_INPUT);
|
|
32
|
+
this.version = data.version;
|
|
33
|
+
}
|
|
34
|
+
/** The guild this command is in (guild commands only). This will throw an error if the guild is not cached. */
|
|
35
|
+
get guild() {
|
|
36
|
+
if (this.guildID !== null && this._cachedGuild !== null) {
|
|
37
|
+
this._cachedGuild ?? (this._cachedGuild = this.client.guilds.get(this.guildID));
|
|
38
|
+
if (!this._cachedGuild) {
|
|
39
|
+
throw new Errors_1.UncachedError(this, "guild", "GUILDS", this.client);
|
|
40
|
+
}
|
|
41
|
+
return this._cachedGuild;
|
|
42
|
+
}
|
|
43
|
+
return this._cachedGuild === null ? this._cachedGuild : (this._cachedGuild = null);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Delete this command.
|
|
47
|
+
*/
|
|
48
|
+
async delete() {
|
|
49
|
+
return this.guildID ? this.client.rest.applications.deleteGuildCommand(this.applicationID, this.guildID, this.id) : this.client.rest.applications.deleteGlobalCommand(this.applicationID, this.id);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Edit this command.
|
|
53
|
+
* @param options The options for editing the command.
|
|
54
|
+
*/
|
|
55
|
+
async edit(options) {
|
|
56
|
+
return this.guildID ? this.client.rest.applications.editGuildCommand(this.applicationID, this.guildID, this.id, options) : this.client.rest.applications.editGlobalCommand(this.applicationID, this.id, options);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Edit this command's permissions (guild commands only). This requires a bearer token with the `applications.commands.permissions.update` scope.
|
|
60
|
+
* @param options The options for editing the permissions.
|
|
61
|
+
*/
|
|
62
|
+
async editGuildCommandPermissions(options) {
|
|
63
|
+
if (!this.guildID) {
|
|
64
|
+
throw new TypeError("editGuildCommandPermissions cannot be used on global commands.");
|
|
65
|
+
}
|
|
66
|
+
return this.client.rest.applications.editGuildCommandPermissions(this.applicationID, this.guildID, this.id, options);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get this command's permissions (guild commands only).
|
|
70
|
+
*/
|
|
71
|
+
async getGuildPermission() {
|
|
72
|
+
if (!this.guildID) {
|
|
73
|
+
throw new TypeError("getGuildPermission cannot be used on global commands.");
|
|
74
|
+
}
|
|
75
|
+
return this.client.rest.applications.getGuildPermission(this.applicationID, this.guildID, this.id);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get a mention for this command.
|
|
79
|
+
* @param sub The subcommand group and/or subcommand to include (["subcommand"] or ["subcommand-group", "subcommand"]).
|
|
80
|
+
*/
|
|
81
|
+
mention(sub) {
|
|
82
|
+
let text = `${this.name}`;
|
|
83
|
+
if (sub?.length) {
|
|
84
|
+
text += ` ${sub.slice(0, 2).join(" ")}`;
|
|
85
|
+
}
|
|
86
|
+
return `</${text}:${this.id}>`;
|
|
87
|
+
}
|
|
88
|
+
toJSON() {
|
|
89
|
+
return {
|
|
90
|
+
...super.toJSON(),
|
|
91
|
+
applicationID: this.applicationID,
|
|
92
|
+
contexts: this.contexts,
|
|
93
|
+
defaultMemberPermissions: this.defaultMemberPermissions?.toJSON(),
|
|
94
|
+
description: this.description,
|
|
95
|
+
descriptionLocalizations: this.descriptionLocalizations,
|
|
96
|
+
dmPermission: this.dmPermission,
|
|
97
|
+
guildID: this.guildID ?? undefined,
|
|
98
|
+
handler: this.handler,
|
|
99
|
+
integrationTypes: this.integrationTypes,
|
|
100
|
+
name: this.name,
|
|
101
|
+
nameLocalizations: this.nameLocalizations,
|
|
102
|
+
nsfw: this.nsfw,
|
|
103
|
+
options: this.options,
|
|
104
|
+
type: this.type,
|
|
105
|
+
version: this.version
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.default = ApplicationCommand;
|
|
@@ -0,0 +1,46 @@
|
|
|
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 Attachment */
|
|
7
|
+
const Base_1 = __importDefault(require("./Base.cjs"));
|
|
8
|
+
const Application_1 = __importDefault(require("./Application.cjs"));
|
|
9
|
+
/** Represents a file attachment. */
|
|
10
|
+
class Attachment extends Base_1.default {
|
|
11
|
+
constructor(data, client) {
|
|
12
|
+
super(data.id, client);
|
|
13
|
+
this.application = data.application ? new Application_1.default(data.application, client) : undefined;
|
|
14
|
+
this.clipCreatedAt = data.clip_created_at ? new Date(data.clip_created_at) : undefined;
|
|
15
|
+
this.clipParticipants = data.clip_participants ? data.clip_participants.map(user => client.users.update(user)) : undefined;
|
|
16
|
+
this.contentType = data.content_type;
|
|
17
|
+
this.description = data.description;
|
|
18
|
+
this.durationSecs = data.duration_secs;
|
|
19
|
+
this.ephemeral = data.ephemeral;
|
|
20
|
+
this.filename = data.filename;
|
|
21
|
+
this.flags = data.flags ?? 0;
|
|
22
|
+
this.height = data.height;
|
|
23
|
+
this.proxyURL = data.proxy_url;
|
|
24
|
+
this.size = data.size;
|
|
25
|
+
this.url = data.url;
|
|
26
|
+
this.waveform = data.waveform;
|
|
27
|
+
this.width = data.width;
|
|
28
|
+
}
|
|
29
|
+
toJSON() {
|
|
30
|
+
return {
|
|
31
|
+
...super.toJSON(),
|
|
32
|
+
contentType: this.contentType,
|
|
33
|
+
description: this.description,
|
|
34
|
+
ephemeral: this.ephemeral,
|
|
35
|
+
filename: this.filename,
|
|
36
|
+
flags: this.flags,
|
|
37
|
+
height: this.height,
|
|
38
|
+
proxyURL: this.proxyURL,
|
|
39
|
+
size: this.size,
|
|
40
|
+
title: this.title,
|
|
41
|
+
url: this.url,
|
|
42
|
+
width: this.width
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.default = Attachment;
|
|
@@ -0,0 +1,41 @@
|
|
|
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 AuditLogEntry */
|
|
7
|
+
const Base_1 = __importDefault(require("./Base.cjs"));
|
|
8
|
+
/** Represents a guild audit log entry. */
|
|
9
|
+
class AuditLogEntry extends Base_1.default {
|
|
10
|
+
constructor(data, client) {
|
|
11
|
+
super(data.id, client);
|
|
12
|
+
this.actionType = data.action_type;
|
|
13
|
+
this.changes = data.changes;
|
|
14
|
+
this.options = {
|
|
15
|
+
applicationID: data.options?.application_id,
|
|
16
|
+
autoModerationRuleName: data.options?.auto_moderation_rule_name,
|
|
17
|
+
autoModerationRuleTriggerType: data.options?.auto_moderation_rule_trigger_type,
|
|
18
|
+
channelID: data.options?.channel_id,
|
|
19
|
+
count: data.options?.count,
|
|
20
|
+
deleteMemberDays: data.options?.delete_member_days,
|
|
21
|
+
id: data.options?.id,
|
|
22
|
+
integrationType: data.options?.integration_type,
|
|
23
|
+
membersRemoved: data.options?.members_removed,
|
|
24
|
+
messageID: data.options?.message_id,
|
|
25
|
+
roleName: data.options?.role_name,
|
|
26
|
+
status: data.options?.status,
|
|
27
|
+
type: data.options?.type
|
|
28
|
+
};
|
|
29
|
+
this.reason = data.reason;
|
|
30
|
+
this.targetID = data.target_id;
|
|
31
|
+
this.userID = data.user_id;
|
|
32
|
+
}
|
|
33
|
+
/** The user or application that made the changes. */
|
|
34
|
+
get user() {
|
|
35
|
+
if (this.userID !== null && this._cachedUser !== null) {
|
|
36
|
+
return this._cachedUser ?? (this._cachedUser = this.client.users.get(this.userID));
|
|
37
|
+
}
|
|
38
|
+
return this._cachedUser === null ? this._cachedUser : (this._cachedUser = null);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.default = AuditLogEntry;
|
|
@@ -0,0 +1,117 @@
|
|
|
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 AutoModerationRule */
|
|
7
|
+
const Base_1 = __importDefault(require("./Base.cjs"));
|
|
8
|
+
const Errors_1 = require("../util/Errors.cjs");
|
|
9
|
+
/** Represents an auto moderation rule. */
|
|
10
|
+
class AutoModerationRule extends Base_1.default {
|
|
11
|
+
constructor(data, client) {
|
|
12
|
+
super(data.id, client);
|
|
13
|
+
this.actions = data.actions.map(a => ({
|
|
14
|
+
metadata: {
|
|
15
|
+
channelID: a.metadata.channel_id,
|
|
16
|
+
customMessage: a.metadata.custom_message,
|
|
17
|
+
durationSeconds: a.metadata.duration_seconds
|
|
18
|
+
},
|
|
19
|
+
type: a.type
|
|
20
|
+
}));
|
|
21
|
+
this.creator = client.users.get(data.creator_id);
|
|
22
|
+
this.creatorID = data.creator_id;
|
|
23
|
+
this.enabled = data.enabled;
|
|
24
|
+
this.eventType = data.event_type;
|
|
25
|
+
this.exemptChannels = data.exempt_channels;
|
|
26
|
+
this.exemptRoles = data.exempt_roles;
|
|
27
|
+
this.guildID = data.guild_id;
|
|
28
|
+
this.name = data.name;
|
|
29
|
+
this.triggerMetadata = {
|
|
30
|
+
allowList: data.trigger_metadata.allow_list,
|
|
31
|
+
keywordFilter: data.trigger_metadata.keyword_filter,
|
|
32
|
+
mentionRaidProtectionEnabled: data.trigger_metadata.mention_raid_protection_enabled,
|
|
33
|
+
mentionTotalLimit: data.trigger_metadata.mention_total_limit,
|
|
34
|
+
presets: data.trigger_metadata.presets,
|
|
35
|
+
regexPatterns: data.trigger_metadata.regex_patterns
|
|
36
|
+
};
|
|
37
|
+
this.triggerType = data.trigger_type;
|
|
38
|
+
this.update(data);
|
|
39
|
+
}
|
|
40
|
+
update(data) {
|
|
41
|
+
if (data.actions !== undefined) {
|
|
42
|
+
this.actions = data.actions.map(a => ({
|
|
43
|
+
metadata: {
|
|
44
|
+
channelID: a.metadata.channel_id,
|
|
45
|
+
customMessage: a.metadata.custom_message,
|
|
46
|
+
durationSeconds: a.metadata.duration_seconds
|
|
47
|
+
},
|
|
48
|
+
type: a.type
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
if (data.enabled !== undefined) {
|
|
52
|
+
this.enabled = data.enabled;
|
|
53
|
+
}
|
|
54
|
+
if (data.event_type !== undefined) {
|
|
55
|
+
this.eventType = data.event_type;
|
|
56
|
+
}
|
|
57
|
+
if (data.exempt_channels !== undefined) {
|
|
58
|
+
this.exemptChannels = data.exempt_channels;
|
|
59
|
+
}
|
|
60
|
+
if (data.exempt_roles !== undefined) {
|
|
61
|
+
this.exemptRoles = data.exempt_roles;
|
|
62
|
+
}
|
|
63
|
+
if (data.name !== undefined) {
|
|
64
|
+
this.name = data.name;
|
|
65
|
+
}
|
|
66
|
+
if (data.trigger_metadata !== undefined) {
|
|
67
|
+
this.triggerMetadata = {
|
|
68
|
+
allowList: data.trigger_metadata.allow_list,
|
|
69
|
+
keywordFilter: data.trigger_metadata.keyword_filter,
|
|
70
|
+
mentionTotalLimit: data.trigger_metadata.mention_total_limit,
|
|
71
|
+
presets: data.trigger_metadata.presets,
|
|
72
|
+
regexPatterns: data.trigger_metadata.regex_patterns
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (data.trigger_type !== undefined) {
|
|
76
|
+
this.triggerType = data.trigger_type;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** The guild this rule is in. This will throw an error if the guild is not cached. */
|
|
80
|
+
get guild() {
|
|
81
|
+
this._cachedGuild ?? (this._cachedGuild = this.client.guilds.get(this.guildID));
|
|
82
|
+
if (!this._cachedGuild) {
|
|
83
|
+
throw new Errors_1.UncachedError(this, "guild", "GUILDS", this.client);
|
|
84
|
+
}
|
|
85
|
+
return this._cachedGuild;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Delete this auto moderation rule.
|
|
89
|
+
* @param reason The reason for deleting this rule.
|
|
90
|
+
*/
|
|
91
|
+
async deleteAutoModerationRule(reason) {
|
|
92
|
+
return this.client.rest.guilds.deleteAutoModerationRule(this.guildID, this.id, reason);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Edit this auto moderation rule.
|
|
96
|
+
* @param options The options for editing the rule.
|
|
97
|
+
*/
|
|
98
|
+
async edit(options) {
|
|
99
|
+
return this.client.rest.guilds.editAutoModerationRule(this.guildID, this.id, options);
|
|
100
|
+
}
|
|
101
|
+
toJSON() {
|
|
102
|
+
return {
|
|
103
|
+
...super.toJSON(),
|
|
104
|
+
actions: this.actions,
|
|
105
|
+
creatorID: this.creatorID,
|
|
106
|
+
enabled: this.enabled,
|
|
107
|
+
eventType: this.eventType,
|
|
108
|
+
exemptChannels: this.exemptChannels,
|
|
109
|
+
exemptRoles: this.exemptRoles,
|
|
110
|
+
guildID: this.guildID,
|
|
111
|
+
name: this.name,
|
|
112
|
+
triggerMetadata: this.triggerMetadata,
|
|
113
|
+
triggerType: this.triggerType
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.default = AutoModerationRule;
|