@deffa5556/bail 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/WAProto/index.cjs +106053 -0
- package/cjs/deffa/config.cjs +14 -0
- package/cjs/deffa/plugins/ai/deepseekr1.cjs +35 -0
- package/cjs/deffa/plugins/ai/gita.cjs +26 -0
- package/cjs/deffa/plugins/ai/glm47flash.cjs +35 -0
- package/cjs/deffa/plugins/ai/gptoss120b.cjs +35 -0
- package/cjs/deffa/plugins/ai/qwq32b.cjs +35 -0
- package/cjs/deffa/plugins/berita/antara.cjs +25 -0
- package/cjs/deffa/plugins/berita/cnbcindonesia.cjs +25 -0
- package/cjs/deffa/plugins/berita/cnn.cjs +25 -0
- package/cjs/deffa/plugins/berita/kompas.cjs +25 -0
- package/cjs/deffa/plugins/berita/liputan6.cjs +25 -0
- package/cjs/deffa/plugins/berita/merdeka.cjs +25 -0
- package/cjs/deffa/plugins/berita/sindonews.cjs +25 -0
- package/cjs/deffa/plugins/berita/tribunnews.cjs +25 -0
- package/cjs/deffa/plugins/downloader/douyin.cjs +30 -0
- package/cjs/deffa/plugins/downloader/facebook.cjs +30 -0
- package/cjs/deffa/plugins/downloader/github.cjs +35 -0
- package/cjs/deffa/plugins/downloader/lahelu.cjs +30 -0
- package/cjs/deffa/plugins/downloader/snackvideo.cjs +30 -0
- package/cjs/deffa/plugins/downloader/soundcloud.cjs +30 -0
- package/cjs/deffa/plugins/downloader/tiktok.cjs +30 -0
- package/cjs/deffa/plugins/downloader/tiktokhd.cjs +30 -0
- package/cjs/deffa/plugins/downloader/twitter.cjs +30 -0
- package/cjs/deffa/plugins/downloader/ummy.cjs +36 -0
- package/cjs/deffa/plugins/index.cjs +213 -0
- package/cjs/deffa/plugins/info/bmkg.cjs +34 -0
- package/cjs/deffa/plugins/info/cuaca.cjs +31 -0
- package/cjs/deffa/plugins/info/jadwaltv.cjs +29 -0
- package/cjs/deffa/plugins/maker/brat.cjs +45 -0
- package/cjs/deffa/plugins/maker/bratvid.cjs +52 -0
- package/cjs/deffa/plugins/search/8font.cjs +28 -0
- package/cjs/deffa/plugins/search/applemusic.cjs +28 -0
- package/cjs/deffa/plugins/search/bimg.cjs +30 -0
- package/cjs/deffa/plugins/search/brave.cjs +34 -0
- package/cjs/deffa/plugins/search/duckduckgo.cjs +28 -0
- package/cjs/deffa/plugins/search/lahelu.cjs +28 -0
- package/cjs/deffa/plugins/search/mangatoon.cjs +28 -0
- package/cjs/deffa/plugins/search/mcpedl.cjs +28 -0
- package/cjs/deffa/plugins/search/myinstants.cjs +28 -0
- package/cjs/deffa/plugins/search/otakotaku.cjs +28 -0
- package/cjs/deffa/plugins/search/pinterest.cjs +30 -0
- package/cjs/deffa/plugins/search/resep.cjs +28 -0
- package/cjs/deffa/plugins/search/seegore.cjs +30 -0
- package/cjs/deffa/plugins/search/soundcloud.cjs +28 -0
- package/cjs/deffa/plugins/search/youtube.cjs +28 -0
- package/cjs/deffa/plugins/stalk/github.cjs +38 -0
- package/cjs/deffa/plugins/stalk/pinterest.cjs +37 -0
- package/cjs/deffa/plugins/stalk/threads.cjs +34 -0
- package/cjs/deffa/plugins/stalk/tiktok.cjs +37 -0
- package/cjs/deffa/plugins/stalk/twitter.cjs +37 -0
- package/cjs/deffa/plugins/stalk/youtube.cjs +37 -0
- package/cjs/lib/Defaults/index.cjs +158 -0
- package/cjs/lib/Discord/Client.cjs +263 -0
- package/cjs/lib/Discord/Constants.cjs +1842 -0
- package/cjs/lib/Discord/connect-dc.cjs +11 -0
- package/cjs/lib/Discord/esm-bridge.cjs +136 -0
- package/cjs/lib/Discord/gateway/Dispatcher.cjs +93 -0
- package/cjs/lib/Discord/gateway/Shard.cjs +695 -0
- package/cjs/lib/Discord/gateway/ShardManager.cjs +344 -0
- package/cjs/lib/Discord/gateway/compression/base.cjs +13 -0
- package/cjs/lib/Discord/gateway/compression/config.cjs +47 -0
- package/cjs/lib/Discord/gateway/compression/pako.cjs +44 -0
- package/cjs/lib/Discord/gateway/compression/zlib-native.cjs +47 -0
- package/cjs/lib/Discord/gateway/compression/zlib-sync.cjs +31 -0
- package/cjs/lib/Discord/gateway/compression/zstd-napi.cjs +80 -0
- package/cjs/lib/Discord/gateway/compression/zstd-native.cjs +46 -0
- package/cjs/lib/Discord/gateway/events.cjs +956 -0
- package/cjs/lib/Discord/index.cjs +238 -0
- package/cjs/lib/Discord/rest/Bucket.cjs +69 -0
- package/cjs/lib/Discord/rest/DiscordHTTPError.cjs +63 -0
- package/cjs/lib/Discord/rest/DiscordRESTError.cjs +84 -0
- package/cjs/lib/Discord/rest/OAuthHelper.cjs +226 -0
- package/cjs/lib/Discord/rest/RESTManager.cjs +116 -0
- package/cjs/lib/Discord/rest/RequestHandler.cjs +320 -0
- package/cjs/lib/Discord/rest/SequentialBucket.cjs +69 -0
- package/cjs/lib/Discord/routes/Applications.cjs +625 -0
- package/cjs/lib/Discord/routes/Channels.cjs +1199 -0
- package/cjs/lib/Discord/routes/Guilds.cjs +1792 -0
- package/cjs/lib/Discord/routes/Interactions.cjs +212 -0
- package/cjs/lib/Discord/routes/Lobbies.cjs +197 -0
- package/cjs/lib/Discord/routes/Miscellaneous.cjs +120 -0
- package/cjs/lib/Discord/routes/OAuth.cjs +350 -0
- package/cjs/lib/Discord/routes/Users.cjs +107 -0
- package/cjs/lib/Discord/routes/Webhooks.cjs +308 -0
- package/cjs/lib/Discord/structures/AnnouncementChannel.cjs +46 -0
- package/cjs/lib/Discord/structures/AnnouncementThreadChannel.cjs +28 -0
- package/cjs/lib/Discord/structures/Application.cjs +345 -0
- package/cjs/lib/Discord/structures/ApplicationCommand.cjs +109 -0
- package/cjs/lib/Discord/structures/Attachment.cjs +46 -0
- package/cjs/lib/Discord/structures/AuditLogEntry.cjs +41 -0
- package/cjs/lib/Discord/structures/AutoModerationRule.cjs +117 -0
- package/cjs/lib/Discord/structures/AutocompleteInteraction.cjs +90 -0
- package/cjs/lib/Discord/structures/Base.cjs +56 -0
- package/cjs/lib/Discord/structures/BaseEntitlement.cjs +40 -0
- package/cjs/lib/Discord/structures/CategoryChannel.cjs +102 -0
- package/cjs/lib/Discord/structures/Channel.cjs +89 -0
- package/cjs/lib/Discord/structures/ClientApplication.cjs +269 -0
- package/cjs/lib/Discord/structures/CommandInteraction.cjs +294 -0
- package/cjs/lib/Discord/structures/ComponentInteraction.cjs +306 -0
- package/cjs/lib/Discord/structures/Entitlement.cjs +24 -0
- package/cjs/lib/Discord/structures/ExtendedUser.cjs +48 -0
- package/cjs/lib/Discord/structures/ForumChannel.cjs +20 -0
- package/cjs/lib/Discord/structures/GroupChannel.cjs +160 -0
- package/cjs/lib/Discord/structures/Guild.cjs +1289 -0
- package/cjs/lib/Discord/structures/GuildChannel.cjs +82 -0
- package/cjs/lib/Discord/structures/GuildPreview.cjs +141 -0
- package/cjs/lib/Discord/structures/GuildScheduledEvent.cjs +166 -0
- package/cjs/lib/Discord/structures/GuildTemplate.cjs +96 -0
- package/cjs/lib/Discord/structures/Integration.cjs +123 -0
- package/cjs/lib/Discord/structures/Interaction.cjs +78 -0
- package/cjs/lib/Discord/structures/InteractionResolvedChannel.cjs +36 -0
- package/cjs/lib/Discord/structures/Invite.cjs +196 -0
- package/cjs/lib/Discord/structures/InviteGuild.cjs +117 -0
- package/cjs/lib/Discord/structures/InviteRole.cjs +88 -0
- package/cjs/lib/Discord/structures/Lobby.cjs +84 -0
- package/cjs/lib/Discord/structures/LobbyMember.cjs +30 -0
- package/cjs/lib/Discord/structures/MediaChannel.cjs +20 -0
- package/cjs/lib/Discord/structures/Member.cjs +300 -0
- package/cjs/lib/Discord/structures/Message.cjs +553 -0
- package/cjs/lib/Discord/structures/ModalSubmitInteraction.cjs +263 -0
- package/cjs/lib/Discord/structures/OAuthApplication.cjs +203 -0
- package/cjs/lib/Discord/structures/OAuthGuild.cjs +98 -0
- package/cjs/lib/Discord/structures/PartialApplication.cjs +97 -0
- package/cjs/lib/Discord/structures/Permission.cjs +61 -0
- package/cjs/lib/Discord/structures/PermissionOverwrite.cjs +46 -0
- package/cjs/lib/Discord/structures/PingInteraction.cjs +27 -0
- package/cjs/lib/Discord/structures/Poll.cjs +69 -0
- package/cjs/lib/Discord/structures/PrimaryGuild.cjs +93 -0
- package/cjs/lib/Discord/structures/PrivateChannel.cjs +131 -0
- package/cjs/lib/Discord/structures/PrivateThreadChannel.cjs +28 -0
- package/cjs/lib/Discord/structures/PublicThreadChannel.cjs +36 -0
- package/cjs/lib/Discord/structures/Role.cjs +126 -0
- package/cjs/lib/Discord/structures/SKU.cjs +58 -0
- package/cjs/lib/Discord/structures/Soundboard.cjs +58 -0
- package/cjs/lib/Discord/structures/StageChannel.cjs +45 -0
- package/cjs/lib/Discord/structures/StageInstance.cjs +80 -0
- package/cjs/lib/Discord/structures/Subscription.cjs +21 -0
- package/cjs/lib/Discord/structures/Team.cjs +70 -0
- package/cjs/lib/Discord/structures/TestEntitlement.cjs +22 -0
- package/cjs/lib/Discord/structures/TextChannel.cjs +48 -0
- package/cjs/lib/Discord/structures/TextableChannel.cjs +265 -0
- package/cjs/lib/Discord/structures/TextableVoiceChannel.cjs +70 -0
- package/cjs/lib/Discord/structures/ThreadChannel.cjs +276 -0
- package/cjs/lib/Discord/structures/ThreadOnlyChannel.cjs +205 -0
- package/cjs/lib/Discord/structures/ThreadableChannel.cjs +57 -0
- package/cjs/lib/Discord/structures/UnavailableGuild.cjs +21 -0
- package/cjs/lib/Discord/structures/User.cjs +223 -0
- package/cjs/lib/Discord/structures/VoiceChannel.cjs +34 -0
- package/cjs/lib/Discord/structures/VoiceState.cjs +113 -0
- package/cjs/lib/Discord/structures/Webhook.cjs +224 -0
- package/cjs/lib/Discord/util/Collection.cjs +77 -0
- package/cjs/lib/Discord/util/Errors.cjs +81 -0
- package/cjs/lib/Discord/util/QueryBuilder.cjs +20 -0
- package/cjs/lib/Discord/util/Routes.cjs +293 -0
- package/cjs/lib/Discord/util/SimpleCollection.cjs +78 -0
- package/cjs/lib/Discord/util/Time.cjs +92 -0
- package/cjs/lib/Discord/util/TypedCollection.cjs +78 -0
- package/cjs/lib/Discord/util/TypedEmitter.cjs +20 -0
- package/cjs/lib/Discord/util/Util.cjs +906 -0
- package/cjs/lib/Discord/util/interactions/InteractionOptionsWrapper.cjs +207 -0
- package/cjs/lib/Discord/util/interactions/MessageInteractionResponse.cjs +26 -0
- package/cjs/lib/Discord/util/interactions/ModalSubmitInteractionComponentsWrapper.cjs +98 -0
- package/cjs/lib/Discord/util/interactions/SelectMenuValuesWrapper.cjs +77 -0
- package/cjs/lib/Discord/util/interactions/shared.cjs +20 -0
- package/cjs/lib/Discord/util/warning.cjs +34 -0
- package/cjs/lib/Signal/Group/ciphertext-message.cjs +16 -0
- package/cjs/lib/Signal/Group/group-session-builder.cjs +67 -0
- package/cjs/lib/Signal/Group/group_cipher.cjs +86 -0
- package/cjs/lib/Signal/Group/index.cjs +58 -0
- package/cjs/lib/Signal/Group/keyhelper.cjs +56 -0
- package/cjs/lib/Signal/Group/sender-chain-key.cjs +30 -0
- package/cjs/lib/Signal/Group/sender-key-distribution-message.cjs +67 -0
- package/cjs/lib/Signal/Group/sender-key-message.cjs +70 -0
- package/cjs/lib/Signal/Group/sender-key-name.cjs +52 -0
- package/cjs/lib/Signal/Group/sender-key-record.cjs +45 -0
- package/cjs/lib/Signal/Group/sender-key-state.cjs +88 -0
- package/cjs/lib/Signal/Group/sender-message-key.cjs +30 -0
- package/cjs/lib/Signal/libsignal.cjs +467 -0
- package/cjs/lib/Signal/lid-mapping.cjs +281 -0
- package/cjs/lib/Socket/Client/index.cjs +19 -0
- package/cjs/lib/Socket/Client/types.cjs +15 -0
- package/cjs/lib/Socket/Client/websocket.cjs +61 -0
- package/cjs/lib/Socket/business.cjs +384 -0
- package/cjs/lib/Socket/chats.cjs +1221 -0
- package/cjs/lib/Socket/communities.cjs +440 -0
- package/cjs/lib/Socket/groups.cjs +353 -0
- package/cjs/lib/Socket/index.cjs +14 -0
- package/cjs/lib/Socket/messages-recv.cjs +1772 -0
- package/cjs/lib/Socket/messages-send.cjs +1376 -0
- package/cjs/lib/Socket/mex.cjs +46 -0
- package/cjs/lib/Socket/newsletter.cjs +230 -0
- package/cjs/lib/Socket/socket.cjs +976 -0
- package/cjs/lib/Store/index.cjs +20 -0
- package/cjs/lib/Store/make-in-memory-store.cjs +470 -0
- package/cjs/lib/Store/make-ordered-dictionary.cjs +82 -0
- package/cjs/lib/Store/object-repository.cjs +28 -0
- package/cjs/lib/Telegram/button.cjs +147 -0
- package/cjs/lib/Telegram/composer.cjs +582 -0
- package/cjs/lib/Telegram/context.cjs +853 -0
- package/cjs/lib/Telegram/core/helpers/args.cjs +57 -0
- package/cjs/lib/Telegram/core/helpers/check.cjs +55 -0
- package/cjs/lib/Telegram/core/helpers/compact.cjs +16 -0
- package/cjs/lib/Telegram/core/helpers/deunionize.cjs +12 -0
- package/cjs/lib/Telegram/core/helpers/formatting.cjs +91 -0
- package/cjs/lib/Telegram/core/helpers/util.cjs +50 -0
- package/cjs/lib/Telegram/core/network/client.cjs +338 -0
- package/cjs/lib/Telegram/core/network/error.cjs +21 -0
- package/cjs/lib/Telegram/core/network/multipart-stream.cjs +79 -0
- package/cjs/lib/Telegram/core/network/polling.cjs +87 -0
- package/cjs/lib/Telegram/core/network/webhook.cjs +54 -0
- package/cjs/lib/Telegram/core/types/typegram.cjs +31 -0
- package/cjs/lib/Telegram/deffa-telegraf.cjs +264 -0
- package/cjs/lib/Telegram/esm-bridge.cjs +20 -0
- package/cjs/lib/Telegram/filters.cjs +69 -0
- package/cjs/lib/Telegram/format.cjs +58 -0
- package/cjs/lib/Telegram/future.cjs +140 -0
- package/cjs/lib/Telegram/index.cjs +67 -0
- package/cjs/lib/Telegram/input.cjs +61 -0
- package/cjs/lib/Telegram/markup.cjs +129 -0
- package/cjs/lib/Telegram/middleware.cjs +2 -0
- package/cjs/lib/Telegram/reactions.cjs +84 -0
- package/cjs/lib/Telegram/router.cjs +46 -0
- package/cjs/lib/Telegram/scenes/base.cjs +39 -0
- package/cjs/lib/Telegram/scenes/context.cjs +104 -0
- package/cjs/lib/Telegram/scenes/index.cjs +21 -0
- package/cjs/lib/Telegram/scenes/stage.cjs +49 -0
- package/cjs/lib/Telegram/scenes/wizard/context.cjs +31 -0
- package/cjs/lib/Telegram/scenes/wizard/index.cjs +45 -0
- package/cjs/lib/Telegram/scenes.cjs +21 -0
- package/cjs/lib/Telegram/session.cjs +166 -0
- package/cjs/lib/Telegram/telegram-types.cjs +6 -0
- package/cjs/lib/Telegram/telegram.cjs +945 -0
- package/cjs/lib/Telegram/types.cjs +2 -0
- package/cjs/lib/Telegram/utils.cjs +5 -0
- package/cjs/lib/Types/Auth.cjs +3 -0
- package/cjs/lib/Types/Bussines.cjs +3 -0
- package/cjs/lib/Types/Call.cjs +3 -0
- package/cjs/lib/Types/Chat.cjs +11 -0
- package/cjs/lib/Types/Contact.cjs +3 -0
- package/cjs/lib/Types/Events.cjs +4 -0
- package/cjs/lib/Types/GroupMetadata.cjs +3 -0
- package/cjs/lib/Types/Label.cjs +26 -0
- package/cjs/lib/Types/LabelAssociation.cjs +8 -0
- package/cjs/lib/Types/Message.cjs +19 -0
- package/cjs/lib/Types/Mex.cjs +40 -0
- package/cjs/lib/Types/Product.cjs +3 -0
- package/cjs/lib/Types/RichType.cjs +24 -0
- package/cjs/lib/Types/Signal.cjs +4 -0
- package/cjs/lib/Types/Socket.cjs +4 -0
- package/cjs/lib/Types/State.cjs +54 -0
- package/cjs/lib/Types/USync.cjs +4 -0
- package/cjs/lib/Types/index.cjs +42 -0
- package/cjs/lib/Utils/auth-utils.cjs +312 -0
- package/cjs/lib/Utils/browser-utils.cjs +39 -0
- package/cjs/lib/Utils/business.cjs +241 -0
- package/cjs/lib/Utils/chat-utils.cjs +890 -0
- package/cjs/lib/Utils/companion-reg-client-utils.cjs +51 -0
- package/cjs/lib/Utils/crypto.cjs +170 -0
- package/cjs/lib/Utils/decode-wa-message.cjs +330 -0
- package/cjs/lib/Utils/event-buffer.cjs +629 -0
- package/cjs/lib/Utils/generics.cjs +427 -0
- package/cjs/lib/Utils/history.cjs +141 -0
- package/cjs/lib/Utils/identity-change-handler.cjs +56 -0
- package/cjs/lib/Utils/index.cjs +43 -0
- package/cjs/lib/Utils/link-preview.cjs +122 -0
- package/cjs/lib/Utils/logger.cjs +8 -0
- package/cjs/lib/Utils/lt-hash.cjs +11 -0
- package/cjs/lib/Utils/make-mutex.cjs +38 -0
- package/cjs/lib/Utils/message-retry-manager.cjs +267 -0
- package/cjs/lib/Utils/messages-media.cjs +906 -0
- package/cjs/lib/Utils/messages.cjs +1909 -0
- package/cjs/lib/Utils/noise-handler.cjs +205 -0
- package/cjs/lib/Utils/offline-node-processor.cjs +43 -0
- package/cjs/lib/Utils/pre-key-manager.cjs +113 -0
- package/cjs/lib/Utils/process-message.cjs +755 -0
- package/cjs/lib/Utils/reporting-utils.cjs +263 -0
- package/cjs/lib/Utils/rich-message-utils.cjs +434 -0
- package/cjs/lib/Utils/session-guard.cjs +163 -0
- package/cjs/lib/Utils/signal.cjs +214 -0
- package/cjs/lib/Utils/stanza-ack.cjs +41 -0
- package/cjs/lib/Utils/sync-action-utils.cjs +54 -0
- package/cjs/lib/Utils/tc-token-utils.cjs +174 -0
- package/cjs/lib/Utils/text-sticker.cjs +174 -0
- package/cjs/lib/Utils/use-multi-file-auth-state.cjs +125 -0
- package/cjs/lib/Utils/use-single-file-auth-state.cjs +113 -0
- package/cjs/lib/Utils/use-sqlite-auth-state.cjs +145 -0
- package/cjs/lib/Utils/validate-connection.cjs +210 -0
- package/cjs/lib/WABinary/constants.cjs +1470 -0
- package/cjs/lib/WABinary/decode.cjs +301 -0
- package/cjs/lib/WABinary/encode.cjs +257 -0
- package/cjs/lib/WABinary/generic-utils.cjs +240 -0
- package/cjs/lib/WABinary/index.cjs +22 -0
- package/cjs/lib/WABinary/jid-utils.cjs +114 -0
- package/cjs/lib/WABinary/types.cjs +37 -0
- package/cjs/lib/WAM/BinaryInfo.cjs +14 -0
- package/cjs/lib/WAM/constants.cjs +22856 -0
- package/cjs/lib/WAM/encode.cjs +154 -0
- package/cjs/lib/WAM/index.cjs +20 -0
- package/cjs/lib/WAUSync/Protocols/USyncContactProtocol.cjs +56 -0
- package/cjs/lib/WAUSync/Protocols/USyncDeviceProtocol.cjs +58 -0
- package/cjs/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.cjs +31 -0
- package/cjs/lib/WAUSync/Protocols/USyncStatusProtocol.cjs +42 -0
- package/cjs/lib/WAUSync/Protocols/USyncUsernameProtocol.cjs +29 -0
- package/cjs/lib/WAUSync/Protocols/UsyncBotProfileProtocol.cjs +55 -0
- package/cjs/lib/WAUSync/Protocols/UsyncLIDProtocol.cjs +33 -0
- package/cjs/lib/WAUSync/Protocols/index.cjs +22 -0
- package/cjs/lib/WAUSync/USyncQuery.cjs +102 -0
- package/cjs/lib/WAUSync/USyncUser.cjs +35 -0
- package/cjs/lib/WAUSync/index.cjs +20 -0
- package/cjs/lib/index.cjs +372 -0
- package/cjs/lib/plugins/loader.cjs +117 -0
- package/lib/Defaults/index.js +1 -1
- package/package.json +11 -6
|
@@ -0,0 +1,82 @@
|
|
|
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 GuildChannel */
|
|
7
|
+
const Channel_1 = __importDefault(require("./Channel"));
|
|
8
|
+
const Errors_1 = require("../util/Errors");
|
|
9
|
+
/** Represents a guild channel. */
|
|
10
|
+
class GuildChannel extends Channel_1.default {
|
|
11
|
+
constructor(data, client) {
|
|
12
|
+
super(data, client);
|
|
13
|
+
this.guildID = data.guild_id;
|
|
14
|
+
this.name = data.name;
|
|
15
|
+
this.parentID = data.parent_id;
|
|
16
|
+
}
|
|
17
|
+
update(data) {
|
|
18
|
+
super.update(data);
|
|
19
|
+
if (data.guild_id !== undefined) {
|
|
20
|
+
this.guildID = data.guild_id;
|
|
21
|
+
}
|
|
22
|
+
if (data.name !== undefined) {
|
|
23
|
+
this.name = data.name;
|
|
24
|
+
}
|
|
25
|
+
if (data.parent_id !== undefined) {
|
|
26
|
+
this.parentID = data.parent_id;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** The guild associated with this channel. This will throw an error if the guild is not cached. */
|
|
30
|
+
get guild() {
|
|
31
|
+
this._cachedGuild ?? (this._cachedGuild = this.client.guilds.get(this.guildID));
|
|
32
|
+
if (!this._cachedGuild) {
|
|
33
|
+
if (this.client.options.restMode) {
|
|
34
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present when rest mode is enabled.`);
|
|
35
|
+
}
|
|
36
|
+
if (!this.client.shards.connected) {
|
|
37
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present without a gateway connection.`);
|
|
38
|
+
}
|
|
39
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present.`);
|
|
40
|
+
}
|
|
41
|
+
return this._cachedGuild;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The parent of this channel, if applicable.
|
|
45
|
+
*
|
|
46
|
+
* If the channel is an {@link AnnouncementThread}, {@link PublicThread}, or {@link PrivateThread}, this will be a {@link TextChannel}, {@link AnnouncementChannel}, {@link ForumChannel}, or {@link MediaChannel}.
|
|
47
|
+
*
|
|
48
|
+
* If the channel is a {@link TextChannel}, {@link VoiceChannel}, {@link AnnouncementChannel}, {@link ForumChannel}, or {@link MediaChannel}, this will be a {@link CategoryChannel}.
|
|
49
|
+
* @returns If undefined, no attempt was made to resolve the parent channel. If null, the parent channel was attempted to be resolved but was not found in the client's cache.
|
|
50
|
+
*/
|
|
51
|
+
get parent() {
|
|
52
|
+
if (this.parentID !== null) {
|
|
53
|
+
if (this._cachedParent !== null) {
|
|
54
|
+
if (this._cachedParent)
|
|
55
|
+
return this._cachedParent;
|
|
56
|
+
this._cachedParent = this.client.getChannel(this.parentID);
|
|
57
|
+
this._cachedParent ?? (this._cachedParent = null);
|
|
58
|
+
return this._cachedParent;
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Edit this channel.
|
|
66
|
+
* @param options The options for editing the channel.
|
|
67
|
+
*/
|
|
68
|
+
async edit(options) {
|
|
69
|
+
// edit is called down the chain
|
|
70
|
+
return this.client.rest.channels.edit(this.id, options);
|
|
71
|
+
}
|
|
72
|
+
toJSON() {
|
|
73
|
+
return {
|
|
74
|
+
...super.toJSON(),
|
|
75
|
+
guildID: this.guildID,
|
|
76
|
+
name: this.name,
|
|
77
|
+
parentID: this.parentID,
|
|
78
|
+
type: this.type
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.default = GuildChannel;
|
|
@@ -0,0 +1,141 @@
|
|
|
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 GuildPreview */
|
|
48
|
+
const Base_1 = __importDefault(require("./Base"));
|
|
49
|
+
const Routes = __importStar(require("../util/Routes"));
|
|
50
|
+
/** Represents a preview of a guild. */
|
|
51
|
+
class GuildPreview extends Base_1.default {
|
|
52
|
+
constructor(data, client) {
|
|
53
|
+
super(data.id, client);
|
|
54
|
+
this.approximateMemberCount = 0;
|
|
55
|
+
this.approximatePresenceCount = 0;
|
|
56
|
+
this.description = null;
|
|
57
|
+
this.discoverySplash = null;
|
|
58
|
+
this.emojis = [];
|
|
59
|
+
this.features = [];
|
|
60
|
+
this.icon = null;
|
|
61
|
+
this.name = data.name;
|
|
62
|
+
this.splash = null;
|
|
63
|
+
this.stickers = [];
|
|
64
|
+
this.update(data);
|
|
65
|
+
}
|
|
66
|
+
update(data) {
|
|
67
|
+
if (data.approximate_member_count !== undefined) {
|
|
68
|
+
this.approximateMemberCount = data.approximate_member_count;
|
|
69
|
+
}
|
|
70
|
+
if (data.approximate_presence_count !== undefined) {
|
|
71
|
+
this.approximatePresenceCount = data.approximate_presence_count;
|
|
72
|
+
}
|
|
73
|
+
if (data.description !== undefined) {
|
|
74
|
+
this.description = data.description;
|
|
75
|
+
}
|
|
76
|
+
if (data.discovery_splash !== undefined) {
|
|
77
|
+
this.discoverySplash = data.discovery_splash;
|
|
78
|
+
}
|
|
79
|
+
if (data.emojis !== undefined) {
|
|
80
|
+
this.emojis = data.emojis.map(emoji => ({
|
|
81
|
+
...emoji,
|
|
82
|
+
user: emoji.user === undefined ? undefined : this.client.users.update(emoji.user)
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
if (data.features !== undefined) {
|
|
86
|
+
this.features = data.features;
|
|
87
|
+
}
|
|
88
|
+
if (data.icon !== undefined) {
|
|
89
|
+
this.icon = data.icon;
|
|
90
|
+
}
|
|
91
|
+
if (data.name !== undefined) {
|
|
92
|
+
this.name = data.name;
|
|
93
|
+
}
|
|
94
|
+
if (data.splash !== undefined) {
|
|
95
|
+
this.splash = data.splash;
|
|
96
|
+
}
|
|
97
|
+
if (data.stickers !== undefined) {
|
|
98
|
+
this.stickers = data.stickers;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The url of this guild's discovery splash.
|
|
103
|
+
* @param format The format the url should be.
|
|
104
|
+
* @param size The dimensions of the image.
|
|
105
|
+
*/
|
|
106
|
+
discoverySplashURL(format, size) {
|
|
107
|
+
return this.discoverySplash === null ? null : this.client.util.formatImage(Routes.GUILD_DISCOVERY_SPLASH(this.id, this.discoverySplash), format, size);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The url of this guild's icon.
|
|
111
|
+
* @param format The format the url should be.
|
|
112
|
+
* @param size The dimensions of the image.
|
|
113
|
+
*/
|
|
114
|
+
iconURL(format, size) {
|
|
115
|
+
return this.icon === null ? null : this.client.util.formatImage(Routes.GUILD_ICON(this.id, this.icon), format, size);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The url of this guild's invite splash.
|
|
119
|
+
* @param format The format the url should be.
|
|
120
|
+
* @param size The dimensions of the image.
|
|
121
|
+
*/
|
|
122
|
+
splashURL(format, size) {
|
|
123
|
+
return this.splash === null ? null : this.client.util.formatImage(Routes.GUILD_SPLASH(this.id, this.splash), format, size);
|
|
124
|
+
}
|
|
125
|
+
toJSON() {
|
|
126
|
+
return {
|
|
127
|
+
...super.toJSON(),
|
|
128
|
+
approximateMemberCount: this.approximateMemberCount,
|
|
129
|
+
approximatePresenceCount: this.approximatePresenceCount,
|
|
130
|
+
description: this.description,
|
|
131
|
+
discoverySplash: this.discoverySplash,
|
|
132
|
+
emojis: this.emojis,
|
|
133
|
+
features: this.features,
|
|
134
|
+
icon: this.icon,
|
|
135
|
+
name: this.name,
|
|
136
|
+
splash: this.splash,
|
|
137
|
+
stickers: this.stickers
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.default = GuildPreview;
|
|
@@ -0,0 +1,166 @@
|
|
|
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 GuildScheduledEvent */
|
|
48
|
+
const Base_1 = __importDefault(require("./Base"));
|
|
49
|
+
const Routes = __importStar(require("../util/Routes"));
|
|
50
|
+
const Errors_1 = require("../util/Errors");
|
|
51
|
+
/** Represents a guild scheduled event. */
|
|
52
|
+
class GuildScheduledEvent extends Base_1.default {
|
|
53
|
+
constructor(data, client) {
|
|
54
|
+
super(data.id, client);
|
|
55
|
+
this.channelID = data.channel_id;
|
|
56
|
+
this.entityID = null;
|
|
57
|
+
this.entityMetadata = null;
|
|
58
|
+
this.entityType = data.entity_type;
|
|
59
|
+
this.guildID = data.guild_id;
|
|
60
|
+
this.image = null;
|
|
61
|
+
this.name = data.name;
|
|
62
|
+
this.privacyLevel = data.privacy_level;
|
|
63
|
+
this.scheduledEndTime = data.scheduled_end_time ? new Date(data.scheduled_end_time) : null;
|
|
64
|
+
this.scheduledStartTime = new Date(data.scheduled_start_time);
|
|
65
|
+
this.status = data.status;
|
|
66
|
+
this.userCount = 0;
|
|
67
|
+
if (data.creator) {
|
|
68
|
+
this.creator = client.users.update(data.creator);
|
|
69
|
+
}
|
|
70
|
+
this.update(data);
|
|
71
|
+
}
|
|
72
|
+
update(data) {
|
|
73
|
+
if (data.channel_id !== undefined) {
|
|
74
|
+
this.channelID = data.channel_id;
|
|
75
|
+
}
|
|
76
|
+
if (data.description !== undefined) {
|
|
77
|
+
this.description = data.description;
|
|
78
|
+
}
|
|
79
|
+
if (data.entity_id !== undefined) {
|
|
80
|
+
this.entityID = data.entity_id;
|
|
81
|
+
}
|
|
82
|
+
if (data.entity_metadata !== undefined) {
|
|
83
|
+
this.entityMetadata = data.entity_metadata;
|
|
84
|
+
}
|
|
85
|
+
if (data.entity_type !== undefined) {
|
|
86
|
+
this.entityType = data.entity_type;
|
|
87
|
+
}
|
|
88
|
+
if (data.image !== undefined) {
|
|
89
|
+
this.image = data.image;
|
|
90
|
+
}
|
|
91
|
+
if (data.name !== undefined) {
|
|
92
|
+
this.name = data.name;
|
|
93
|
+
}
|
|
94
|
+
if (data.privacy_level !== undefined) {
|
|
95
|
+
this.privacyLevel = data.privacy_level;
|
|
96
|
+
}
|
|
97
|
+
if (data.scheduled_end_time !== undefined) {
|
|
98
|
+
this.scheduledEndTime = data.scheduled_end_time ? new Date(data.scheduled_end_time) : null;
|
|
99
|
+
}
|
|
100
|
+
if (data.scheduled_start_time !== undefined) {
|
|
101
|
+
this.scheduledStartTime = new Date(data.scheduled_start_time);
|
|
102
|
+
}
|
|
103
|
+
if (data.status !== undefined) {
|
|
104
|
+
this.status = data.status;
|
|
105
|
+
}
|
|
106
|
+
if (data.user_count !== undefined) {
|
|
107
|
+
this.userCount = data.user_count;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/** The channel in which the event will be hosted. `null` if entityType is `EXTERNAL` */
|
|
111
|
+
get channel() {
|
|
112
|
+
if (this.channelID !== null) {
|
|
113
|
+
return this._cachedChannel ?? (this._cachedChannel = this.client.getChannel(this.channelID));
|
|
114
|
+
}
|
|
115
|
+
return this._cachedChannel === null ? this._cachedChannel : (this._cachedChannel = null);
|
|
116
|
+
}
|
|
117
|
+
/** The guild this scheduled event belongs to. This will throw an error if the guild is not cached. */
|
|
118
|
+
get guild() {
|
|
119
|
+
this._cachedGuild ?? (this._cachedGuild = this.client.guilds.get(this.guildID));
|
|
120
|
+
if (!this._cachedGuild) {
|
|
121
|
+
if (this.client.options.restMode) {
|
|
122
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present when rest mode is enabled.`);
|
|
123
|
+
}
|
|
124
|
+
if (!this.client.shards.connected) {
|
|
125
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present without a gateway connection.`);
|
|
126
|
+
}
|
|
127
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present.`);
|
|
128
|
+
}
|
|
129
|
+
return this._cachedGuild;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Delete this scheduled event.
|
|
133
|
+
* @param reason The reason for deleting the scheduled event. Discord's docs do not explicitly state a reason can be provided, so it may not be used.
|
|
134
|
+
*/
|
|
135
|
+
async deleteScheduledEvent(reason) {
|
|
136
|
+
return this.client.rest.guilds.deleteScheduledEvent(this.guildID, this.id, reason);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The url of this event's cover image.
|
|
140
|
+
* @param format The format of the image.
|
|
141
|
+
* @param size The size of the image.
|
|
142
|
+
*/
|
|
143
|
+
imageURL(format, size) {
|
|
144
|
+
return this.image ? this.client.util.formatImage(Routes.GUILD_SCHEDULED_EVENT_COVER(this.id, this.image), format, size) : null;
|
|
145
|
+
}
|
|
146
|
+
toJSON() {
|
|
147
|
+
return {
|
|
148
|
+
...super.toJSON(),
|
|
149
|
+
channelID: this.channelID,
|
|
150
|
+
creator: this.creator?.toJSON(),
|
|
151
|
+
description: this.description,
|
|
152
|
+
entityID: this.entityID,
|
|
153
|
+
entityMetadata: this.entityMetadata,
|
|
154
|
+
entityType: this.entityType,
|
|
155
|
+
guildID: this.guildID,
|
|
156
|
+
image: this.image,
|
|
157
|
+
name: this.name,
|
|
158
|
+
privacyLevel: this.privacyLevel,
|
|
159
|
+
scheduledEndTime: this.scheduledEndTime?.getTime() ?? null,
|
|
160
|
+
scheduledStartTime: this.scheduledStartTime.getTime(),
|
|
161
|
+
status: this.status,
|
|
162
|
+
userCount: this.userCount
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.default = GuildScheduledEvent;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Errors_1 = require("../util/Errors");
|
|
4
|
+
/** Represents a guild template. */
|
|
5
|
+
class GuildTemplate {
|
|
6
|
+
constructor(data, client) {
|
|
7
|
+
Object.defineProperty(this, "client", {
|
|
8
|
+
value: client,
|
|
9
|
+
enumerable: false,
|
|
10
|
+
writable: false,
|
|
11
|
+
configurable: false
|
|
12
|
+
});
|
|
13
|
+
this.code = data.code;
|
|
14
|
+
this.createdAt = new Date(data.created_at);
|
|
15
|
+
this.creator = this.client.users.update(data.creator);
|
|
16
|
+
this.description = null;
|
|
17
|
+
this.isDirty = null;
|
|
18
|
+
this.name = data.name;
|
|
19
|
+
this.serializedSourceGuild = data.serialized_source_guild;
|
|
20
|
+
this.sourceGuildID = data.source_guild_id;
|
|
21
|
+
this.updatedAt = new Date(data.updated_at);
|
|
22
|
+
this.usageCount = data.usage_count;
|
|
23
|
+
this.update(data);
|
|
24
|
+
}
|
|
25
|
+
update(data) {
|
|
26
|
+
if (data.description !== undefined) {
|
|
27
|
+
this.description = data.description;
|
|
28
|
+
}
|
|
29
|
+
if (data.is_dirty !== undefined) {
|
|
30
|
+
this.isDirty = data.is_dirty;
|
|
31
|
+
}
|
|
32
|
+
if (data.name !== undefined) {
|
|
33
|
+
this.name = data.name;
|
|
34
|
+
}
|
|
35
|
+
if (data.serialized_source_guild !== undefined) {
|
|
36
|
+
this.serializedSourceGuild = data.serialized_source_guild;
|
|
37
|
+
}
|
|
38
|
+
if (data.source_guild_id !== undefined) {
|
|
39
|
+
this.sourceGuildID = data.source_guild_id;
|
|
40
|
+
}
|
|
41
|
+
if (data.updated_at !== undefined) {
|
|
42
|
+
this.updatedAt = new Date(data.updated_at);
|
|
43
|
+
}
|
|
44
|
+
if (data.usage_count !== undefined) {
|
|
45
|
+
this.usageCount = data.usage_count;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** The source guild of this template. This will throw an error if the guild is not cached. */
|
|
49
|
+
get sourceGuild() {
|
|
50
|
+
this._cachedSourceGuild ?? (this._cachedSourceGuild = this.client.guilds.get(this.sourceGuildID));
|
|
51
|
+
if (!this._cachedSourceGuild) {
|
|
52
|
+
if (this.client.options.restMode) {
|
|
53
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#sourceGuild is not present when rest mode is enabled.`);
|
|
54
|
+
}
|
|
55
|
+
if (!this.client.shards.connected) {
|
|
56
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#sourceGuild is not present without a gateway connection.`);
|
|
57
|
+
}
|
|
58
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#sourceGuild is not present.`);
|
|
59
|
+
}
|
|
60
|
+
return this._cachedSourceGuild;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Delete this template.
|
|
64
|
+
*/
|
|
65
|
+
async delete() {
|
|
66
|
+
return this.client.rest.guilds.deleteTemplate(this.sourceGuild.id, this.code);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Edit this template.
|
|
70
|
+
* @param options The options for editing the template.
|
|
71
|
+
*/
|
|
72
|
+
async editTemplate(options) {
|
|
73
|
+
return this.client.rest.guilds.editTemplate(this.sourceGuild.id, this.code, options);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Sync this template.
|
|
77
|
+
*/
|
|
78
|
+
async syncTemplate() {
|
|
79
|
+
return this.client.rest.guilds.syncTemplate(this.sourceGuild.id, this.code);
|
|
80
|
+
}
|
|
81
|
+
toJSON() {
|
|
82
|
+
return {
|
|
83
|
+
code: this.code,
|
|
84
|
+
createdAt: this.createdAt.getTime(),
|
|
85
|
+
creator: this.creator.toJSON(),
|
|
86
|
+
description: this.description,
|
|
87
|
+
isDirty: this.isDirty,
|
|
88
|
+
name: this.name,
|
|
89
|
+
serializedSourceGuild: this.serializedSourceGuild,
|
|
90
|
+
sourceGuildID: this.sourceGuildID,
|
|
91
|
+
updatedAt: this.updatedAt.getTime(),
|
|
92
|
+
usageCount: this.usageCount
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.default = GuildTemplate;
|
|
@@ -0,0 +1,123 @@
|
|
|
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 Integration */
|
|
7
|
+
const Base_1 = __importDefault(require("./Base"));
|
|
8
|
+
const PartialApplication_1 = __importDefault(require("./PartialApplication"));
|
|
9
|
+
const Errors_1 = require("../util/Errors");
|
|
10
|
+
/** Represents a guild integration. */
|
|
11
|
+
class Integration extends Base_1.default {
|
|
12
|
+
constructor(data, client, guildID) {
|
|
13
|
+
super(data.id, client);
|
|
14
|
+
this.account = data.account;
|
|
15
|
+
this.application = null;
|
|
16
|
+
this.enableEmoticons = !!data.enable_emoticons;
|
|
17
|
+
this.enabled = !!data.enabled;
|
|
18
|
+
this.guildID = guildID === undefined ? null : guildID;
|
|
19
|
+
this.name = data.name;
|
|
20
|
+
this.revoked = !!data.revoked;
|
|
21
|
+
this.roleID = data.role_id === undefined ? null : data.role_id;
|
|
22
|
+
this.syncing = !!data.syncing;
|
|
23
|
+
this.type = data.type;
|
|
24
|
+
this.update(data);
|
|
25
|
+
}
|
|
26
|
+
update(data) {
|
|
27
|
+
if (data.account !== undefined) {
|
|
28
|
+
this.account = data.account;
|
|
29
|
+
}
|
|
30
|
+
if (data.application !== undefined) {
|
|
31
|
+
this.application = new PartialApplication_1.default(data.application, this.client);
|
|
32
|
+
}
|
|
33
|
+
if (data.enable_emoticons !== undefined) {
|
|
34
|
+
this.enableEmoticons = data.enable_emoticons;
|
|
35
|
+
}
|
|
36
|
+
if (data.enabled !== undefined) {
|
|
37
|
+
this.enabled = data.enabled;
|
|
38
|
+
}
|
|
39
|
+
if (data.expire_behavior !== undefined) {
|
|
40
|
+
this.expireBehavior = data.expire_behavior;
|
|
41
|
+
}
|
|
42
|
+
if (data.expire_grace_period !== undefined) {
|
|
43
|
+
this.expireGracePeriod = data.expire_grace_period;
|
|
44
|
+
}
|
|
45
|
+
if (data.name !== undefined) {
|
|
46
|
+
this.name = data.name;
|
|
47
|
+
}
|
|
48
|
+
if (data.revoked !== undefined) {
|
|
49
|
+
this.revoked = data.revoked;
|
|
50
|
+
}
|
|
51
|
+
if (data.role_id !== undefined) {
|
|
52
|
+
this.roleID = data.role_id;
|
|
53
|
+
}
|
|
54
|
+
if (data.scopes !== undefined) {
|
|
55
|
+
this.scopes = data.scopes;
|
|
56
|
+
}
|
|
57
|
+
if (data.subscriber_count !== undefined) {
|
|
58
|
+
this.subscriberCount = data.subscriber_count;
|
|
59
|
+
}
|
|
60
|
+
if (data.synced_at !== undefined) {
|
|
61
|
+
this.syncedAt = new Date(data.synced_at);
|
|
62
|
+
}
|
|
63
|
+
if (data.syncing !== undefined) {
|
|
64
|
+
this.syncing = data.syncing;
|
|
65
|
+
}
|
|
66
|
+
if (data.type !== undefined) {
|
|
67
|
+
this.type = data.type;
|
|
68
|
+
}
|
|
69
|
+
if (data.user !== undefined) {
|
|
70
|
+
this.user = this.client.users.update(data.user);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** The guild this integration belongs to, if applicable. This will throw an error if the guild is not cached. */
|
|
74
|
+
get guild() {
|
|
75
|
+
if (this.guildID !== null && this._cachedGuild !== null) {
|
|
76
|
+
this._cachedGuild ?? (this._cachedGuild = this.client.guilds.get(this.guildID));
|
|
77
|
+
if (!this._cachedGuild) {
|
|
78
|
+
if (this.client.options.restMode) {
|
|
79
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present when rest mode is enabled.`);
|
|
80
|
+
}
|
|
81
|
+
if (!this.client.shards.connected) {
|
|
82
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present without a gateway connection.`);
|
|
83
|
+
}
|
|
84
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#guild is not present.`);
|
|
85
|
+
}
|
|
86
|
+
return this._cachedGuild;
|
|
87
|
+
}
|
|
88
|
+
return this._cachedGuild === null ? this._cachedGuild : (this._cachedGuild = null);
|
|
89
|
+
}
|
|
90
|
+
/** The role this integration uses for subscribers, if any. */
|
|
91
|
+
get role() {
|
|
92
|
+
if (this.roleID !== null && this._cachedRole !== null) {
|
|
93
|
+
try {
|
|
94
|
+
return this._cachedRole ?? (this._cachedRole = this.guild?.roles.get(this.roleID));
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return (this._cachedRole = undefined);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return this._cachedRole === null ? this._cachedRole : (this._cachedRole = null);
|
|
101
|
+
}
|
|
102
|
+
toJSON() {
|
|
103
|
+
return {
|
|
104
|
+
...super.toJSON(),
|
|
105
|
+
account: this.account,
|
|
106
|
+
application: this.application?.toJSON(),
|
|
107
|
+
enableEmoticons: this.enableEmoticons,
|
|
108
|
+
enabled: this.enabled,
|
|
109
|
+
expireBehavior: this.expireBehavior,
|
|
110
|
+
expireGracePeriod: this.expireGracePeriod,
|
|
111
|
+
name: this.name,
|
|
112
|
+
revoked: this.revoked,
|
|
113
|
+
roleID: this.roleID,
|
|
114
|
+
scopes: this.scopes,
|
|
115
|
+
subscriberCount: this.subscriberCount,
|
|
116
|
+
syncedAt: this.syncedAt?.getTime(),
|
|
117
|
+
syncing: this.syncing,
|
|
118
|
+
type: this.type,
|
|
119
|
+
user: this.user?.toJSON()
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.default = Integration;
|
|
@@ -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 Interaction */
|
|
7
|
+
const Base_1 = __importDefault(require("./Base"));
|
|
8
|
+
const Constants_1 = require("../Constants");
|
|
9
|
+
/** Represents an interaction. */
|
|
10
|
+
class Interaction extends Base_1.default {
|
|
11
|
+
constructor(data, client) {
|
|
12
|
+
super(data.id, client);
|
|
13
|
+
this.acknowledged = false;
|
|
14
|
+
this.application = client["_application"] && client.application.id === data.application_id ? client.application : undefined;
|
|
15
|
+
this.applicationID = data.application_id;
|
|
16
|
+
Object.defineProperty(this, "token", { value: data.token, enumerable: false });
|
|
17
|
+
this.type = data.type;
|
|
18
|
+
this.version = data.version;
|
|
19
|
+
}
|
|
20
|
+
static from(data, client) {
|
|
21
|
+
switch (data.type) {
|
|
22
|
+
case Constants_1.InteractionTypes.PING: {
|
|
23
|
+
return new PingInteraction(data, client);
|
|
24
|
+
}
|
|
25
|
+
case Constants_1.InteractionTypes.APPLICATION_COMMAND: {
|
|
26
|
+
return new CommandInteraction(data, client);
|
|
27
|
+
}
|
|
28
|
+
case Constants_1.InteractionTypes.MESSAGE_COMPONENT: {
|
|
29
|
+
return new ComponentInteraction(data, client);
|
|
30
|
+
}
|
|
31
|
+
case Constants_1.InteractionTypes.APPLICATION_COMMAND_AUTOCOMPLETE: {
|
|
32
|
+
return new AutocompleteInteraction(data, client);
|
|
33
|
+
}
|
|
34
|
+
case Constants_1.InteractionTypes.MODAL_SUBMIT: {
|
|
35
|
+
return new ModalSubmitInteraction(data, client);
|
|
36
|
+
}
|
|
37
|
+
default: {
|
|
38
|
+
return new Interaction(data, client);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** A type guard, checking if this interaction is an {@link AutocompleteInteraction | Autocomplete Interaction}. */
|
|
43
|
+
isAutocompleteInteraction() {
|
|
44
|
+
return this.type === Constants_1.InteractionTypes.APPLICATION_COMMAND_AUTOCOMPLETE;
|
|
45
|
+
}
|
|
46
|
+
/** A type guard, checking if this interaction is a {@link CommandInteraction | Command Interaction}. */
|
|
47
|
+
isCommandInteraction() {
|
|
48
|
+
return this.type === Constants_1.InteractionTypes.APPLICATION_COMMAND;
|
|
49
|
+
}
|
|
50
|
+
/** A type guard, checking if this interaction is a {@link ComponentInteraction | Component Interaction}. */
|
|
51
|
+
isComponentInteraction() {
|
|
52
|
+
return this.type === Constants_1.InteractionTypes.MESSAGE_COMPONENT;
|
|
53
|
+
}
|
|
54
|
+
/** A type guard, checking if this interaction is a {@link ModalSubmitInteraction | Modal Submit Interaction}. */
|
|
55
|
+
isModalSubmitInteraction() {
|
|
56
|
+
return this.type === Constants_1.InteractionTypes.MODAL_SUBMIT;
|
|
57
|
+
}
|
|
58
|
+
/** A type guard, checking if this interaction is a {@link PingInteraction | Ping Interaction}. */
|
|
59
|
+
isPingInteraction() {
|
|
60
|
+
return this.type === Constants_1.InteractionTypes.PING;
|
|
61
|
+
}
|
|
62
|
+
toJSON() {
|
|
63
|
+
return {
|
|
64
|
+
...super.toJSON(),
|
|
65
|
+
applicationID: this.applicationID,
|
|
66
|
+
type: this.type,
|
|
67
|
+
version: this.version
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.default = Interaction;
|
|
72
|
+
// Yes this sucks, but it works. That's the important part. Circular imports are hell.
|
|
73
|
+
/* eslint-disable @typescript-eslint/no-var-requires, unicorn/prefer-module */
|
|
74
|
+
const AutocompleteInteraction = require("./AutocompleteInteraction").default;
|
|
75
|
+
const CommandInteraction = require("./CommandInteraction").default;
|
|
76
|
+
const ComponentInteraction = require("./ComponentInteraction").default;
|
|
77
|
+
const ModalSubmitInteraction = require("./ModalSubmitInteraction").default;
|
|
78
|
+
const PingInteraction = require("./PingInteraction").default;
|