@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,276 @@
|
|
|
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 ThreadChannel */
|
|
7
|
+
const GuildChannel_1 = __importDefault(require("./GuildChannel.cjs"));
|
|
8
|
+
const Message_1 = __importDefault(require("./Message.cjs"));
|
|
9
|
+
const Constants_1 = require("../Constants.cjs");
|
|
10
|
+
const TypedCollection_1 = __importDefault(require("../util/TypedCollection.cjs"));
|
|
11
|
+
const Errors_1 = require("../util/Errors.cjs");
|
|
12
|
+
/** Represents a guild thread channel. */
|
|
13
|
+
class ThreadChannel extends GuildChannel_1.default {
|
|
14
|
+
constructor(data, client) {
|
|
15
|
+
super(data, client);
|
|
16
|
+
this.flags = data.flags;
|
|
17
|
+
this.lastMessageID = data.last_message_id;
|
|
18
|
+
this.memberCount = 0;
|
|
19
|
+
this.members = [];
|
|
20
|
+
this.messageCount = 0;
|
|
21
|
+
this.messages = new TypedCollection_1.default((Message_1.default), client, this.client.util._getLimit("messages", this.id));
|
|
22
|
+
this.ownerID = data.owner_id;
|
|
23
|
+
this.rateLimitPerUser = data.rate_limit_per_user;
|
|
24
|
+
this.threadMetadata = {
|
|
25
|
+
archiveTimestamp: new Date(data.thread_metadata.archive_timestamp),
|
|
26
|
+
archived: !!data.thread_metadata.archived,
|
|
27
|
+
autoArchiveDuration: data.thread_metadata.auto_archive_duration,
|
|
28
|
+
createTimestamp: data.thread_metadata.create_timestamp ? new Date(data.thread_metadata.create_timestamp) : null,
|
|
29
|
+
locked: !!data.thread_metadata.locked,
|
|
30
|
+
invitable: data.thread_metadata.invitable
|
|
31
|
+
};
|
|
32
|
+
this.totalMessageSent = 0;
|
|
33
|
+
if (data.type === Constants_1.ChannelTypes.PRIVATE_THREAD && data.thread_metadata.invitable !== undefined) {
|
|
34
|
+
this.threadMetadata.invitable = !!data.thread_metadata.invitable;
|
|
35
|
+
}
|
|
36
|
+
this.update(data);
|
|
37
|
+
}
|
|
38
|
+
update(data) {
|
|
39
|
+
if (data.flags !== undefined) {
|
|
40
|
+
this.flags = data.flags;
|
|
41
|
+
}
|
|
42
|
+
if (data.last_message_id !== undefined) {
|
|
43
|
+
this.lastMessage = data.last_message_id === null ? null : this.messages.get(data.last_message_id);
|
|
44
|
+
this.lastMessageID = data.last_message_id;
|
|
45
|
+
}
|
|
46
|
+
// @TODO look over this to see if we can make it "safer" (accessing Client#user)
|
|
47
|
+
if (data.member) {
|
|
48
|
+
const index = this.members.findIndex(m => m.userID === this.client.user.id);
|
|
49
|
+
if (index === -1) {
|
|
50
|
+
this.members.push({ flags: data.member.flags, id: this.id, joinTimestamp: new Date(data.member.join_timestamp), userID: this.client.user.id });
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.members[index] = {
|
|
54
|
+
...this.members[index],
|
|
55
|
+
flags: data.member.flags,
|
|
56
|
+
joinTimestamp: new Date(data.member.join_timestamp)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (data.member_count !== undefined) {
|
|
61
|
+
this.memberCount = data.member_count;
|
|
62
|
+
}
|
|
63
|
+
if (data.message_count !== undefined) {
|
|
64
|
+
this.messageCount = data.message_count;
|
|
65
|
+
}
|
|
66
|
+
if (data.owner_id !== undefined) {
|
|
67
|
+
this.owner = this.client.users.get(data.owner_id);
|
|
68
|
+
this.ownerID = data.owner_id;
|
|
69
|
+
}
|
|
70
|
+
if (data.rate_limit_per_user !== undefined) {
|
|
71
|
+
this.rateLimitPerUser = data.rate_limit_per_user;
|
|
72
|
+
}
|
|
73
|
+
if (data.thread_metadata !== undefined) {
|
|
74
|
+
this.threadMetadata = {
|
|
75
|
+
archiveTimestamp: new Date(data.thread_metadata.archive_timestamp),
|
|
76
|
+
archived: !!data.thread_metadata.archived,
|
|
77
|
+
autoArchiveDuration: data.thread_metadata.auto_archive_duration,
|
|
78
|
+
createTimestamp: data.thread_metadata.create_timestamp ? new Date(data.thread_metadata.create_timestamp) : null,
|
|
79
|
+
locked: !!data.thread_metadata.locked,
|
|
80
|
+
invitable: data.thread_metadata.invitable
|
|
81
|
+
};
|
|
82
|
+
if (data.type === Constants_1.ChannelTypes.PRIVATE_THREAD && data.thread_metadata.invitable !== undefined) {
|
|
83
|
+
this.threadMetadata.invitable = !!data.thread_metadata.invitable;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (data.total_message_sent !== undefined) {
|
|
87
|
+
this.totalMessageSent = data.total_message_sent;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Add a member to this thread.
|
|
92
|
+
* @param userID The ID of the user to add to the thread.
|
|
93
|
+
*/
|
|
94
|
+
async addMember(userID) {
|
|
95
|
+
return this.client.rest.channels.addThreadMember(this.id, userID);
|
|
96
|
+
}
|
|
97
|
+
async createMessage(content, options) {
|
|
98
|
+
if (typeof content === "string") {
|
|
99
|
+
options = {
|
|
100
|
+
...options,
|
|
101
|
+
content
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
else
|
|
105
|
+
options = content;
|
|
106
|
+
return this.client.rest.channels.createMessage(this.id, options);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Add a reaction to a message in this thread.
|
|
110
|
+
* @param messageID The ID of the message to add a reaction to.
|
|
111
|
+
* @param emoji The reaction to add to the message. `name:id` for custom emojis, and the unicode codepoint for default emojis.
|
|
112
|
+
*/
|
|
113
|
+
async createReaction(messageID, emoji) {
|
|
114
|
+
return this.client.rest.channels.createReaction(this.id, messageID, emoji);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Delete a message in this thread.
|
|
118
|
+
* @param messageID The ID of the message to delete.
|
|
119
|
+
* @param reason The reason for deleting the message.
|
|
120
|
+
*/
|
|
121
|
+
async deleteMessage(messageID, reason) {
|
|
122
|
+
return this.client.rest.channels.deleteMessage(this.id, messageID, reason);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Bulk delete messages in this thread.
|
|
126
|
+
* @param messageIDs The IDs of the messages to delete. Any duplicates or messages older than two weeks will cause an error.
|
|
127
|
+
* @param reason The reason for deleting the messages.
|
|
128
|
+
*/
|
|
129
|
+
async deleteMessages(messageIDs, reason) {
|
|
130
|
+
return this.client.rest.channels.deleteMessages(this.id, messageIDs, reason);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Remove a reaction from a message in this thread.
|
|
134
|
+
* @param messageID The ID of the message to remove a reaction from.
|
|
135
|
+
* @param emoji The reaction to remove from the message. `name:id` for custom emojis, and the unicode codepoint for default emojis.
|
|
136
|
+
* @param user The user to remove the reaction from, `@me` for the current user (default).
|
|
137
|
+
*/
|
|
138
|
+
async deleteReaction(messageID, emoji, user = "@me") {
|
|
139
|
+
return this.client.rest.channels.deleteReaction(this.id, messageID, emoji, user);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Remove all, or a specific emoji's reactions from a message.
|
|
143
|
+
* @param messageID The ID of the message to remove reactions from.
|
|
144
|
+
* @param emoji The reaction to remove from the message. `name:id` for custom emojis, and the unicode codepoint for default emojis. Omit to remove all reactions.
|
|
145
|
+
*/
|
|
146
|
+
async deleteReactions(messageID, emoji) {
|
|
147
|
+
return this.client.rest.channels.deleteReactions(this.id, messageID, emoji);
|
|
148
|
+
}
|
|
149
|
+
async editMessage(messageID, content, options) {
|
|
150
|
+
if (typeof content === "string") {
|
|
151
|
+
options = {
|
|
152
|
+
...options,
|
|
153
|
+
content
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
else
|
|
157
|
+
options = content;
|
|
158
|
+
return this.client.rest.channels.editMessage(this.id, messageID, options);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Get a thread member in this thread.
|
|
162
|
+
* @param userID The ID of the user to get the thread member of.
|
|
163
|
+
*/
|
|
164
|
+
async getMember(userID) {
|
|
165
|
+
return this.client.rest.channels.getThreadMember(this.id, userID);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Get the members of this thread.
|
|
169
|
+
*/
|
|
170
|
+
async getMembers() {
|
|
171
|
+
return this.client.rest.channels.getThreadMembers(this.id);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Get a message in this thread.
|
|
175
|
+
* @param messageID The ID of the message to get.
|
|
176
|
+
*/
|
|
177
|
+
async getMessage(messageID) {
|
|
178
|
+
return this.client.rest.channels.getMessage(this.id, messageID);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Get messages in this thread.
|
|
182
|
+
* @param options The options for getting the messages. `before`, `after`, and `around `All are mutually exclusive.
|
|
183
|
+
*/
|
|
184
|
+
async getMessages(options) {
|
|
185
|
+
return this.client.rest.channels.getMessages(this.id, options);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get the pinned messages in this thread.
|
|
189
|
+
*/
|
|
190
|
+
async getPinnedMessages() {
|
|
191
|
+
return this.client.rest.channels.getPinnedMessages(this.id);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get the users who reacted with a specific emoji on a message.
|
|
195
|
+
* @param messageID The ID of the message to get reactions from.
|
|
196
|
+
* @param emoji The reaction to remove from the message. `name:id` for custom emojis, and the unicode codepoint for default emojis.
|
|
197
|
+
* @param options The options for getting the reactions.
|
|
198
|
+
*/
|
|
199
|
+
async getReactions(messageID, emoji, options) {
|
|
200
|
+
return this.client.rest.channels.getReactions(this.id, messageID, emoji, options);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Join this thread.
|
|
204
|
+
*/
|
|
205
|
+
async join() {
|
|
206
|
+
return this.client.rest.channels.joinThread(this.id);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Leave this thread.
|
|
210
|
+
*/
|
|
211
|
+
async leave() {
|
|
212
|
+
return this.client.rest.channels.leaveThread(this.id);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Get the permissions of a member. If providing an id, the member must be cached. The parent channel must be cached as threads themselves do not have permissions.
|
|
216
|
+
* @param member The member to get the permissions of.
|
|
217
|
+
*/
|
|
218
|
+
permissionsOf(member) {
|
|
219
|
+
if (!this.parent) {
|
|
220
|
+
throw new Errors_1.UncachedError(`${this.constructor.name}#permisionsOf cannot be used if the parent channel is not cached.`);
|
|
221
|
+
}
|
|
222
|
+
return this.parent.permissionsOf(member);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Pin a message in this thread.
|
|
226
|
+
* @param messageID The ID of the message to pin.
|
|
227
|
+
* @param reason The reason for pinning the message.
|
|
228
|
+
*/
|
|
229
|
+
async pinMessage(messageID, reason) {
|
|
230
|
+
return this.client.rest.channels.pinMessage(this.id, messageID, reason);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Purge an amount of messages from this channel.
|
|
234
|
+
* @param options The options to purge. `before`, `after`, and `around `All are mutually exclusive.
|
|
235
|
+
*/
|
|
236
|
+
async purge(options) {
|
|
237
|
+
return this.client.rest.channels.purgeMessages(this.id, options);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Remove a member from this thread.
|
|
241
|
+
* @param userID The ID of the user to remove from the thread.
|
|
242
|
+
*/
|
|
243
|
+
async removeMember(userID) {
|
|
244
|
+
return this.client.rest.channels.removeThreadMember(this.id, userID);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Show a typing indicator in this thread.
|
|
248
|
+
*/
|
|
249
|
+
async sendTyping() {
|
|
250
|
+
return this.client.rest.channels.sendTyping(this.id);
|
|
251
|
+
}
|
|
252
|
+
toJSON() {
|
|
253
|
+
return {
|
|
254
|
+
...super.toJSON(),
|
|
255
|
+
flags: this.flags,
|
|
256
|
+
lastMessageID: this.lastMessageID,
|
|
257
|
+
memberCount: this.memberCount,
|
|
258
|
+
messageCount: this.messageCount,
|
|
259
|
+
messages: this.messages.map(m => m.id),
|
|
260
|
+
ownerID: this.ownerID,
|
|
261
|
+
rateLimitPerUser: this.rateLimitPerUser,
|
|
262
|
+
threadMetadata: this.threadMetadata,
|
|
263
|
+
totalMessageSent: this.totalMessageSent,
|
|
264
|
+
type: this.type
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Unpin a message in this thread.
|
|
269
|
+
* @param messageID The ID of the message to unpin.
|
|
270
|
+
* @param reason The reason for unpinning the message.
|
|
271
|
+
*/
|
|
272
|
+
async unpinMessage(messageID, reason) {
|
|
273
|
+
return this.client.rest.channels.unpinMessage(this.id, messageID, reason);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
exports.default = ThreadChannel;
|
|
@@ -0,0 +1,205 @@
|
|
|
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 ThreadOnlyChannel */
|
|
7
|
+
const GuildChannel_1 = __importDefault(require("./GuildChannel.cjs"));
|
|
8
|
+
const PermissionOverwrite_1 = __importDefault(require("./PermissionOverwrite.cjs"));
|
|
9
|
+
const Permission_1 = __importDefault(require("./Permission.cjs"));
|
|
10
|
+
const TypedCollection_1 = __importDefault(require("../util/TypedCollection.cjs"));
|
|
11
|
+
const Constants_1 = require("../Constants.cjs");
|
|
12
|
+
const Errors_1 = require("../util/Errors.cjs");
|
|
13
|
+
const Collection_1 = __importDefault(require("../util/Collection.cjs"));
|
|
14
|
+
/** Represents a thread only channel. */
|
|
15
|
+
class ThreadOnlyChannel extends GuildChannel_1.default {
|
|
16
|
+
constructor(data, client) {
|
|
17
|
+
super(data, client);
|
|
18
|
+
this.availableTags = [];
|
|
19
|
+
this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
|
|
20
|
+
this.defaultForumLayout = data.default_forum_layout;
|
|
21
|
+
this.defaultReactionEmoji = null;
|
|
22
|
+
this.defaultSortOrder = null;
|
|
23
|
+
this.defaultThreadRateLimitPerUser = data.default_thread_rate_limit_per_user;
|
|
24
|
+
this.flags = data.flags;
|
|
25
|
+
this.lastThreadID = data.last_message_id;
|
|
26
|
+
this.nsfw = data.nsfw;
|
|
27
|
+
this.permissionOverwrites = new TypedCollection_1.default(PermissionOverwrite_1.default, client);
|
|
28
|
+
this.position = data.position;
|
|
29
|
+
this.rateLimitPerUser = data.rate_limit_per_user;
|
|
30
|
+
this.topic = data.topic;
|
|
31
|
+
this.update(data);
|
|
32
|
+
}
|
|
33
|
+
update(data) {
|
|
34
|
+
super.update(data);
|
|
35
|
+
if (data.available_tags !== undefined) {
|
|
36
|
+
this.availableTags = data.available_tags.map(tag => ({
|
|
37
|
+
emoji: tag.emoji_id === null && tag.emoji_name === null ? null : { id: tag.emoji_id, name: tag.emoji_name },
|
|
38
|
+
id: tag.id,
|
|
39
|
+
moderated: tag.moderated,
|
|
40
|
+
name: tag.name
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
if (data.default_auto_archive_duration !== undefined) {
|
|
44
|
+
this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
|
|
45
|
+
}
|
|
46
|
+
if (data.default_forum_layout !== undefined) {
|
|
47
|
+
this.defaultForumLayout = data.default_forum_layout;
|
|
48
|
+
}
|
|
49
|
+
if (data.default_reaction_emoji !== undefined) {
|
|
50
|
+
this.defaultReactionEmoji = data.default_reaction_emoji === null || (data.default_reaction_emoji.emoji_id === null && data.default_reaction_emoji.emoji_name === null) ? null : { id: data.default_reaction_emoji.emoji_id, name: data.default_reaction_emoji.emoji_name };
|
|
51
|
+
}
|
|
52
|
+
if (data.default_sort_order !== undefined) {
|
|
53
|
+
this.defaultSortOrder = data.default_sort_order;
|
|
54
|
+
}
|
|
55
|
+
if (data.default_thread_rate_limit_per_user !== undefined) {
|
|
56
|
+
this.defaultThreadRateLimitPerUser = data.default_thread_rate_limit_per_user;
|
|
57
|
+
}
|
|
58
|
+
if (data.flags !== undefined) {
|
|
59
|
+
this.flags = data.flags;
|
|
60
|
+
}
|
|
61
|
+
if (data.last_message_id !== undefined) {
|
|
62
|
+
this.lastThreadID = data.last_message_id;
|
|
63
|
+
}
|
|
64
|
+
if (data.nsfw !== undefined) {
|
|
65
|
+
this.nsfw = data.nsfw;
|
|
66
|
+
}
|
|
67
|
+
if (data.permission_overwrites !== undefined) {
|
|
68
|
+
for (const id of this.permissionOverwrites.keys()) {
|
|
69
|
+
if (!data.permission_overwrites.some(overwrite => overwrite.id === id)) {
|
|
70
|
+
this.permissionOverwrites.delete(id);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
for (const overwrite of data.permission_overwrites) {
|
|
74
|
+
this.permissionOverwrites.update(overwrite);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (data.position !== undefined) {
|
|
78
|
+
this.position = data.position;
|
|
79
|
+
}
|
|
80
|
+
if (data.rate_limit_per_user !== undefined) {
|
|
81
|
+
this.rateLimitPerUser = data.rate_limit_per_user;
|
|
82
|
+
}
|
|
83
|
+
if (data.topic !== undefined && data.topic !== null) {
|
|
84
|
+
this.topic = data.topic;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** The most recently created thread. */
|
|
88
|
+
get lastThread() {
|
|
89
|
+
return this.lastThreadID === null ? null : this.guild.threads.get(this.lastThreadID);
|
|
90
|
+
}
|
|
91
|
+
/** The threads in this channel. The returned collection is disposable. */
|
|
92
|
+
get threads() {
|
|
93
|
+
return new Collection_1.default(this.guild.threads.filter(thread => thread.parentID === this.id).map(thread => [thread.id, thread]));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Create an invite for this channel. If the guild is not a `COMMUNITY` server, invites can only be made to last 30 days.
|
|
97
|
+
* @param options The options for the invite.
|
|
98
|
+
*/
|
|
99
|
+
async createInvite(options) {
|
|
100
|
+
return this.client.rest.channels.createInvite(this.id, options);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Create a webhook in this channel.
|
|
104
|
+
* @param options The options to create the webhook with.
|
|
105
|
+
*/
|
|
106
|
+
async createWebhook(options) {
|
|
107
|
+
return this.client.rest.webhooks.create(this.id, options);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Delete a permission overwrite on this channel.
|
|
111
|
+
* @param overwriteID The ID of the permission overwrite to delete.
|
|
112
|
+
* @param reason The reason for deleting the permission overwrite.
|
|
113
|
+
*/
|
|
114
|
+
async deletePermission(overwriteID, reason) {
|
|
115
|
+
return this.client.rest.channels.deletePermission(this.id, overwriteID, reason);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Edit a permission overwrite on this channel.
|
|
119
|
+
* @param overwriteID The ID of the permission overwrite to edit.
|
|
120
|
+
* @param options The options for editing the permission overwrite.
|
|
121
|
+
*/
|
|
122
|
+
async editPermission(overwriteID, options) {
|
|
123
|
+
return this.client.rest.channels.editPermission(this.id, overwriteID, options);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get the invites of this channel.
|
|
127
|
+
*/
|
|
128
|
+
async getInvites() {
|
|
129
|
+
return this.client.rest.channels.getInvites(this.id);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Get the public archived threads in this channel.
|
|
133
|
+
* @param options The options for getting the public archived threads.
|
|
134
|
+
*/
|
|
135
|
+
async getPublicArchivedThreads(options) {
|
|
136
|
+
return this.client.rest.channels.getPublicArchivedThreads(this.id, options);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Get the webhooks in this channel.
|
|
140
|
+
*/
|
|
141
|
+
async getWebhooks() {
|
|
142
|
+
return this.client.rest.webhooks.getForChannel(this.id);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get the permissions of a member. If providing an id, the member must be cached.
|
|
146
|
+
* @param member The member to get the permissions of.
|
|
147
|
+
*/
|
|
148
|
+
permissionsOf(member) {
|
|
149
|
+
if (typeof member === "string") {
|
|
150
|
+
member = this.guild.members.get(member);
|
|
151
|
+
}
|
|
152
|
+
if (!member) {
|
|
153
|
+
throw new Errors_1.UncachedError(`Cannot use ${this.constructor.name}#permissionsOf with an ID when the member is not cached.`);
|
|
154
|
+
}
|
|
155
|
+
let permission = this.guild.permissionsOf(member).allow;
|
|
156
|
+
if (permission & Constants_1.Permissions.ADMINISTRATOR) {
|
|
157
|
+
return new Permission_1.default(Constants_1.AllPermissions);
|
|
158
|
+
}
|
|
159
|
+
let overwrite = this.permissionOverwrites.get(this.guildID);
|
|
160
|
+
if (overwrite) {
|
|
161
|
+
permission = (permission & ~overwrite.deny) | overwrite.allow;
|
|
162
|
+
}
|
|
163
|
+
let deny = 0n;
|
|
164
|
+
let allow = 0n;
|
|
165
|
+
for (const id of member.roles) {
|
|
166
|
+
if ((overwrite = this.permissionOverwrites.get(id))) {
|
|
167
|
+
deny |= overwrite.deny;
|
|
168
|
+
allow |= overwrite.allow;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
permission = (permission & ~deny) | allow;
|
|
172
|
+
overwrite = this.permissionOverwrites.get(member.id);
|
|
173
|
+
if (overwrite) {
|
|
174
|
+
permission = (permission & ~overwrite.deny) | overwrite.allow;
|
|
175
|
+
}
|
|
176
|
+
return new Permission_1.default(permission);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Create a thread in this forum channel.
|
|
180
|
+
* @param options The options for starting the thread.
|
|
181
|
+
*/
|
|
182
|
+
async startThread(options) {
|
|
183
|
+
return this.client.rest.channels.startThreadInThreadOnlyChannel(this.id, options);
|
|
184
|
+
}
|
|
185
|
+
toJSON() {
|
|
186
|
+
return {
|
|
187
|
+
...super.toJSON(),
|
|
188
|
+
availableTags: this.availableTags,
|
|
189
|
+
defaultAutoArchiveDuration: this.defaultAutoArchiveDuration,
|
|
190
|
+
defaultForumLayout: this.defaultForumLayout,
|
|
191
|
+
defaultReactionEmoji: this.defaultReactionEmoji,
|
|
192
|
+
defaultSortOrder: this.defaultSortOrder,
|
|
193
|
+
defaultThreadRateLimitPerUser: this.defaultThreadRateLimitPerUser,
|
|
194
|
+
flags: this.flags,
|
|
195
|
+
lastThreadID: this.lastThreadID,
|
|
196
|
+
permissionOverwrites: this.permissionOverwrites.map(overwrite => overwrite.toJSON()),
|
|
197
|
+
position: this.position,
|
|
198
|
+
rateLimitPerUser: this.rateLimitPerUser,
|
|
199
|
+
threads: this.threads.map(thread => thread.id),
|
|
200
|
+
topic: this.topic,
|
|
201
|
+
type: this.type
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.default = ThreadOnlyChannel;
|
|
@@ -0,0 +1,57 @@
|
|
|
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 TextableChannel */
|
|
7
|
+
const TextableChannel_1 = __importDefault(require("./TextableChannel.cjs"));
|
|
8
|
+
const Collection_1 = __importDefault(require("../util/Collection.cjs"));
|
|
9
|
+
/** Represents a guild textable channel. */
|
|
10
|
+
class ThreadableChannel extends TextableChannel_1.default {
|
|
11
|
+
constructor(data, client) {
|
|
12
|
+
super(data, client);
|
|
13
|
+
this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
|
|
14
|
+
this.update(data);
|
|
15
|
+
}
|
|
16
|
+
update(data) {
|
|
17
|
+
super.update(data);
|
|
18
|
+
if (data.default_auto_archive_duration !== undefined) {
|
|
19
|
+
this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** The threads in this channel. The returned collection is disposable. */
|
|
23
|
+
get threads() {
|
|
24
|
+
return new Collection_1.default(this.guild.threads.filter(thread => thread.parentID === this.id).map(thread => [thread.id, thread]));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the public archived threads in this channel.
|
|
28
|
+
* @param options The options for getting the public archived threads.
|
|
29
|
+
*/
|
|
30
|
+
async getPublicArchivedThreads(options) {
|
|
31
|
+
return this.client.rest.channels.getPublicArchivedThreads(this.id, options);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create a thread from an existing message in this channel.
|
|
35
|
+
* @param messageID The ID of the message to create a thread from.
|
|
36
|
+
* @param options The options for creating the thread.
|
|
37
|
+
*/
|
|
38
|
+
async startThreadFromMessage(messageID, options) {
|
|
39
|
+
return this.client.rest.channels.startThreadFromMessage(this.id, messageID, options);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create a thread without an existing message in this channel.
|
|
43
|
+
* @param options The options for creating the thread.
|
|
44
|
+
*/
|
|
45
|
+
async startThreadWithoutMessage(options) {
|
|
46
|
+
return this.client.rest.channels.startThreadWithoutMessage(this.id, options);
|
|
47
|
+
}
|
|
48
|
+
toJSON() {
|
|
49
|
+
return {
|
|
50
|
+
...super.toJSON(),
|
|
51
|
+
defaultAutoArchiveDuration: this.defaultAutoArchiveDuration,
|
|
52
|
+
threads: this.threads.map(thread => thread.id),
|
|
53
|
+
type: this.type
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.default = ThreadableChannel;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 UnavailableGuild */
|
|
7
|
+
const Base_1 = __importDefault(require("./Base.cjs"));
|
|
8
|
+
/** Represents a guild that is unavailable. */
|
|
9
|
+
class UnavailableGuild extends Base_1.default {
|
|
10
|
+
constructor(data, client) {
|
|
11
|
+
super(data.id, client);
|
|
12
|
+
this.unavailable = data.unavailable;
|
|
13
|
+
}
|
|
14
|
+
toJSON() {
|
|
15
|
+
return {
|
|
16
|
+
...super.toJSON(),
|
|
17
|
+
unavailable: this.unavailable
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.default = UnavailableGuild;
|