elynn-baileys 1.0.1
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/LICENSE +22 -0
- package/README.md +2372 -0
- package/WAProto/index.d.ts +15871 -0
- package/WAProto/index.js +115447 -0
- package/elynn/config.js +12 -0
- package/elynn/plugins/README.md +24 -0
- package/elynn/plugins/ai/deepseekr1.js +27 -0
- package/elynn/plugins/ai/gita.js +16 -0
- package/elynn/plugins/ai/glm47flash.js +27 -0
- package/elynn/plugins/ai/gptoss120b.js +27 -0
- package/elynn/plugins/ai/qwq32b.js +27 -0
- package/elynn/plugins/berita/antara.js +18 -0
- package/elynn/plugins/berita/cnbcindonesia.js +18 -0
- package/elynn/plugins/berita/cnn.js +18 -0
- package/elynn/plugins/berita/kompas.js +18 -0
- package/elynn/plugins/berita/liputan6.js +18 -0
- package/elynn/plugins/berita/merdeka.js +18 -0
- package/elynn/plugins/berita/sindonews.js +18 -0
- package/elynn/plugins/berita/tribunnews.js +18 -0
- package/elynn/plugins/downloader/douyin.js +19 -0
- package/elynn/plugins/downloader/facebook.js +19 -0
- package/elynn/plugins/downloader/github.js +25 -0
- package/elynn/plugins/downloader/lahelu.js +19 -0
- package/elynn/plugins/downloader/snackvideo.js +19 -0
- package/elynn/plugins/downloader/soundcloud.js +19 -0
- package/elynn/plugins/downloader/tiktok.js +19 -0
- package/elynn/plugins/downloader/tiktokhd.js +19 -0
- package/elynn/plugins/downloader/twitter.js +19 -0
- package/elynn/plugins/downloader/ummy.js +26 -0
- package/elynn/plugins/index.cjs +26 -0
- package/elynn/plugins/index.js +232 -0
- package/elynn/plugins/info/bmkg.js +25 -0
- package/elynn/plugins/info/cuaca.js +23 -0
- package/elynn/plugins/info/jadwaltv.js +21 -0
- package/elynn/plugins/maker/brat.js +45 -0
- package/elynn/plugins/maker/bratvid.js +52 -0
- package/elynn/plugins/search/8font.js +18 -0
- package/elynn/plugins/search/applemusic.js +18 -0
- package/elynn/plugins/search/bimg.js +19 -0
- package/elynn/plugins/search/brave.js +24 -0
- package/elynn/plugins/search/duckduckgo.js +18 -0
- package/elynn/plugins/search/lahelu.js +18 -0
- package/elynn/plugins/search/mangatoon.js +18 -0
- package/elynn/plugins/search/mcpedl.js +18 -0
- package/elynn/plugins/search/myinstants.js +18 -0
- package/elynn/plugins/search/otakotaku.js +18 -0
- package/elynn/plugins/search/pinterest.js +19 -0
- package/elynn/plugins/search/resep.js +18 -0
- package/elynn/plugins/search/seegore.js +19 -0
- package/elynn/plugins/search/soundcloud.js +18 -0
- package/elynn/plugins/search/youtube.js +18 -0
- package/elynn/plugins/stalk/github.js +28 -0
- package/elynn/plugins/stalk/pinterest.js +27 -0
- package/elynn/plugins/stalk/threads.js +24 -0
- package/elynn/plugins/stalk/tiktok.js +27 -0
- package/elynn/plugins/stalk/twitter.js +27 -0
- package/elynn/plugins/stalk/youtube.js +27 -0
- package/engine-requirements.js +45 -0
- package/lib/Defaults/index.d.ts +145 -0
- package/lib/Defaults/index.d.ts.map +1 -0
- package/lib/Defaults/index.js +152 -0
- package/lib/Defaults/index.js.map +1 -0
- package/lib/Discord/Client.cjs +274 -0
- package/lib/Discord/Client.d.ts +98 -0
- package/lib/Discord/Client.js +274 -0
- package/lib/Discord/Constants.cjs +1842 -0
- package/lib/Discord/Constants.d.ts +1514 -0
- package/lib/Discord/Constants.js +1842 -0
- package/lib/Discord/connect-dc.js +5 -0
- package/lib/Discord/esm-bridge.mjs +128 -0
- package/lib/Discord/gateway/Dispatcher.cjs +86 -0
- package/lib/Discord/gateway/Dispatcher.d.ts +17 -0
- package/lib/Discord/gateway/Dispatcher.js +86 -0
- package/lib/Discord/gateway/Shard.cjs +723 -0
- package/lib/Discord/gateway/Shard.d.ts +87 -0
- package/lib/Discord/gateway/Shard.js +723 -0
- package/lib/Discord/gateway/ShardManager.cjs +350 -0
- package/lib/Discord/gateway/ShardManager.d.ts +31 -0
- package/lib/Discord/gateway/ShardManager.js +350 -0
- package/lib/Discord/gateway/compression/base.cjs +14 -0
- package/lib/Discord/gateway/compression/base.d.ts +6 -0
- package/lib/Discord/gateway/compression/base.js +14 -0
- package/lib/Discord/gateway/compression/config.cjs +47 -0
- package/lib/Discord/gateway/compression/config.d.ts +17 -0
- package/lib/Discord/gateway/compression/config.js +47 -0
- package/lib/Discord/gateway/compression/pako.cjs +45 -0
- package/lib/Discord/gateway/compression/pako.d.ts +16 -0
- package/lib/Discord/gateway/compression/pako.js +45 -0
- package/lib/Discord/gateway/compression/zlib-native.cjs +50 -0
- package/lib/Discord/gateway/compression/zlib-native.d.ts +10 -0
- package/lib/Discord/gateway/compression/zlib-native.js +50 -0
- package/lib/Discord/gateway/compression/zlib-sync.cjs +32 -0
- package/lib/Discord/gateway/compression/zlib-sync.d.ts +8 -0
- package/lib/Discord/gateway/compression/zlib-sync.js +32 -0
- package/lib/Discord/gateway/compression/zstd-napi.cjs +74 -0
- package/lib/Discord/gateway/compression/zstd-napi.d.ts +9 -0
- package/lib/Discord/gateway/compression/zstd-napi.js +74 -0
- package/lib/Discord/gateway/compression/zstd-native.cjs +48 -0
- package/lib/Discord/gateway/compression/zstd-native.d.ts +9 -0
- package/lib/Discord/gateway/compression/zstd-native.js +48 -0
- package/lib/Discord/gateway/events.cjs +956 -0
- package/lib/Discord/gateway/events.d.ts +75 -0
- package/lib/Discord/gateway/events.js +956 -0
- package/lib/Discord/index.cjs +228 -0
- package/lib/Discord/index.d.ts +98 -0
- package/lib/Discord/index.js +228 -0
- package/lib/Discord/rest/Bucket.cjs +77 -0
- package/lib/Discord/rest/Bucket.d.ts +32 -0
- package/lib/Discord/rest/Bucket.js +77 -0
- package/lib/Discord/rest/DiscordHTTPError.cjs +66 -0
- package/lib/Discord/rest/DiscordHTTPError.d.ts +15 -0
- package/lib/Discord/rest/DiscordHTTPError.js +66 -0
- package/lib/Discord/rest/DiscordRESTError.cjs +88 -0
- package/lib/Discord/rest/DiscordRESTError.d.ts +18 -0
- package/lib/Discord/rest/DiscordRESTError.js +88 -0
- package/lib/Discord/rest/OAuthHelper.cjs +220 -0
- package/lib/Discord/rest/OAuthHelper.d.ts +61 -0
- package/lib/Discord/rest/OAuthHelper.js +220 -0
- package/lib/Discord/rest/RESTManager.cjs +119 -0
- package/lib/Discord/rest/RESTManager.d.ts +42 -0
- package/lib/Discord/rest/RESTManager.js +119 -0
- package/lib/Discord/rest/RequestHandler.cjs +323 -0
- package/lib/Discord/rest/RequestHandler.d.ts +27 -0
- package/lib/Discord/rest/RequestHandler.js +323 -0
- package/lib/Discord/rest/SequentialBucket.cjs +74 -0
- package/lib/Discord/rest/SequentialBucket.d.ts +24 -0
- package/lib/Discord/rest/SequentialBucket.js +74 -0
- package/lib/Discord/routes/Applications.cjs +618 -0
- package/lib/Discord/routes/Applications.d.ts +230 -0
- package/lib/Discord/routes/Applications.js +618 -0
- package/lib/Discord/routes/Channels.cjs +1191 -0
- package/lib/Discord/routes/Channels.d.ts +428 -0
- package/lib/Discord/routes/Channels.js +1192 -0
- package/lib/Discord/routes/Guilds.cjs +1785 -0
- package/lib/Discord/routes/Guilds.d.ts +644 -0
- package/lib/Discord/routes/Guilds.js +1785 -0
- package/lib/Discord/routes/Interactions.cjs +205 -0
- package/lib/Discord/routes/Interactions.d.ts +74 -0
- package/lib/Discord/routes/Interactions.js +205 -0
- package/lib/Discord/routes/Lobbies.cjs +190 -0
- package/lib/Discord/routes/Lobbies.d.ts +70 -0
- package/lib/Discord/routes/Lobbies.js +190 -0
- package/lib/Discord/routes/Miscellaneous.cjs +113 -0
- package/lib/Discord/routes/Miscellaneous.d.ts +36 -0
- package/lib/Discord/routes/Miscellaneous.js +113 -0
- package/lib/Discord/routes/OAuth.cjs +343 -0
- package/lib/Discord/routes/OAuth.d.ts +107 -0
- package/lib/Discord/routes/OAuth.js +343 -0
- package/lib/Discord/routes/Users.cjs +100 -0
- package/lib/Discord/routes/Users.d.ts +32 -0
- package/lib/Discord/routes/Users.js +100 -0
- package/lib/Discord/routes/Webhooks.cjs +301 -0
- package/lib/Discord/routes/Webhooks.d.ts +126 -0
- package/lib/Discord/routes/Webhooks.js +301 -0
- package/lib/Discord/structures/AnnouncementChannel.cjs +46 -0
- package/lib/Discord/structures/AnnouncementChannel.d.ts +34 -0
- package/lib/Discord/structures/AnnouncementChannel.js +46 -0
- package/lib/Discord/structures/AnnouncementThreadChannel.cjs +28 -0
- package/lib/Discord/structures/AnnouncementThreadChannel.d.ts +17 -0
- package/lib/Discord/structures/AnnouncementThreadChannel.js +28 -0
- package/lib/Discord/structures/Application.cjs +477 -0
- package/lib/Discord/structures/Application.d.ts +166 -0
- package/lib/Discord/structures/Application.js +477 -0
- package/lib/Discord/structures/ApplicationCommand.cjs +146 -0
- package/lib/Discord/structures/ApplicationCommand.d.ts +75 -0
- package/lib/Discord/structures/ApplicationCommand.js +146 -0
- package/lib/Discord/structures/Attachment.cjs +78 -0
- package/lib/Discord/structures/Attachment.d.ts +43 -0
- package/lib/Discord/structures/Attachment.js +78 -0
- package/lib/Discord/structures/AuditLogEntry.cjs +54 -0
- package/lib/Discord/structures/AuditLogEntry.d.ts +25 -0
- package/lib/Discord/structures/AuditLogEntry.js +54 -0
- package/lib/Discord/structures/AutoModerationRule.cjs +140 -0
- package/lib/Discord/structures/AutoModerationRule.d.ts +48 -0
- package/lib/Discord/structures/AutoModerationRule.js +140 -0
- package/lib/Discord/structures/AutocompleteInteraction.cjs +120 -0
- package/lib/Discord/structures/AutocompleteInteraction.d.ts +61 -0
- package/lib/Discord/structures/AutocompleteInteraction.js +120 -0
- package/lib/Discord/structures/Base.cjs +58 -0
- package/lib/Discord/structures/Base.d.ts +19 -0
- package/lib/Discord/structures/Base.js +58 -0
- package/lib/Discord/structures/BaseEntitlement.cjs +49 -0
- package/lib/Discord/structures/BaseEntitlement.d.ts +20 -0
- package/lib/Discord/structures/BaseEntitlement.js +49 -0
- package/lib/Discord/structures/CategoryChannel.cjs +106 -0
- package/lib/Discord/structures/CategoryChannel.d.ts +40 -0
- package/lib/Discord/structures/CategoryChannel.js +106 -0
- package/lib/Discord/structures/Channel.cjs +92 -0
- package/lib/Discord/structures/Channel.d.ts +19 -0
- package/lib/Discord/structures/Channel.js +92 -0
- package/lib/Discord/structures/ClientApplication.cjs +273 -0
- package/lib/Discord/structures/ClientApplication.d.ts +189 -0
- package/lib/Discord/structures/ClientApplication.js +273 -0
- package/lib/Discord/structures/CommandInteraction.cjs +324 -0
- package/lib/Discord/structures/CommandInteraction.d.ts +166 -0
- package/lib/Discord/structures/CommandInteraction.js +324 -0
- package/lib/Discord/structures/ComponentInteraction.cjs +338 -0
- package/lib/Discord/structures/ComponentInteraction.d.ts +180 -0
- package/lib/Discord/structures/ComponentInteraction.js +338 -0
- package/lib/Discord/structures/Entitlement.cjs +27 -0
- package/lib/Discord/structures/Entitlement.d.ts +11 -0
- package/lib/Discord/structures/Entitlement.js +27 -0
- package/lib/Discord/structures/ExtendedUser.cjs +58 -0
- package/lib/Discord/structures/ExtendedUser.d.ts +25 -0
- package/lib/Discord/structures/ExtendedUser.js +58 -0
- package/lib/Discord/structures/ForumChannel.cjs +20 -0
- package/lib/Discord/structures/ForumChannel.d.ts +11 -0
- package/lib/Discord/structures/ForumChannel.js +20 -0
- package/lib/Discord/structures/GroupChannel.cjs +172 -0
- package/lib/Discord/structures/GroupChannel.d.ts +60 -0
- package/lib/Discord/structures/GroupChannel.js +172 -0
- package/lib/Discord/structures/Guild.cjs +1415 -0
- package/lib/Discord/structures/Guild.d.ts +687 -0
- package/lib/Discord/structures/Guild.js +1415 -0
- package/lib/Discord/structures/GuildChannel.cjs +90 -0
- package/lib/Discord/structures/GuildChannel.d.ts +36 -0
- package/lib/Discord/structures/GuildChannel.js +90 -0
- package/lib/Discord/structures/GuildPreview.cjs +153 -0
- package/lib/Discord/structures/GuildPreview.d.ts +49 -0
- package/lib/Discord/structures/GuildPreview.js +153 -0
- package/lib/Discord/structures/GuildScheduledEvent.cjs +188 -0
- package/lib/Discord/structures/GuildScheduledEvent.d.ts +59 -0
- package/lib/Discord/structures/GuildScheduledEvent.js +188 -0
- package/lib/Discord/structures/GuildTemplate.cjs +118 -0
- package/lib/Discord/structures/GuildTemplate.d.ts +48 -0
- package/lib/Discord/structures/GuildTemplate.js +118 -0
- package/lib/Discord/structures/Integration.cjs +157 -0
- package/lib/Discord/structures/Integration.d.ts +53 -0
- package/lib/Discord/structures/Integration.js +157 -0
- package/lib/Discord/structures/Interaction.cjs +91 -0
- package/lib/Discord/structures/Interaction.d.ts +39 -0
- package/lib/Discord/structures/Interaction.js +91 -0
- package/lib/Discord/structures/InteractionResolvedChannel.cjs +46 -0
- package/lib/Discord/structures/InteractionResolvedChannel.d.ts +27 -0
- package/lib/Discord/structures/InteractionResolvedChannel.js +46 -0
- package/lib/Discord/structures/Invite.cjs +240 -0
- package/lib/Discord/structures/Invite.d.ts +132 -0
- package/lib/Discord/structures/Invite.js +240 -0
- package/lib/Discord/structures/InviteGuild.cjs +130 -0
- package/lib/Discord/structures/InviteGuild.d.ts +54 -0
- package/lib/Discord/structures/InviteGuild.js +130 -0
- package/lib/Discord/structures/InviteRole.cjs +110 -0
- package/lib/Discord/structures/InviteRole.d.ts +53 -0
- package/lib/Discord/structures/InviteRole.js +110 -0
- package/lib/Discord/structures/Lobby.cjs +88 -0
- package/lib/Discord/structures/Lobby.d.ts +54 -0
- package/lib/Discord/structures/Lobby.js +88 -0
- package/lib/Discord/structures/LobbyMember.cjs +33 -0
- package/lib/Discord/structures/LobbyMember.d.ts +15 -0
- package/lib/Discord/structures/LobbyMember.js +33 -0
- package/lib/Discord/structures/MediaChannel.cjs +20 -0
- package/lib/Discord/structures/MediaChannel.d.ts +11 -0
- package/lib/Discord/structures/MediaChannel.js +20 -0
- package/lib/Discord/structures/Member.cjs +325 -0
- package/lib/Discord/structures/Member.d.ts +140 -0
- package/lib/Discord/structures/Member.js +325 -0
- package/lib/Discord/structures/Message.cjs +627 -0
- package/lib/Discord/structures/Message.d.ts +223 -0
- package/lib/Discord/structures/Message.js +627 -0
- package/lib/Discord/structures/ModalSubmitInteraction.cjs +295 -0
- package/lib/Discord/structures/ModalSubmitInteraction.d.ts +138 -0
- package/lib/Discord/structures/ModalSubmitInteraction.js +295 -0
- package/lib/Discord/structures/OAuthApplication.cjs +244 -0
- package/lib/Discord/structures/OAuthApplication.d.ts +77 -0
- package/lib/Discord/structures/OAuthApplication.js +244 -0
- package/lib/Discord/structures/OAuthGuild.cjs +107 -0
- package/lib/Discord/structures/OAuthGuild.d.ts +43 -0
- package/lib/Discord/structures/OAuthGuild.js +107 -0
- package/lib/Discord/structures/PartialApplication.cjs +101 -0
- package/lib/Discord/structures/PartialApplication.d.ts +29 -0
- package/lib/Discord/structures/PartialApplication.js +101 -0
- package/lib/Discord/structures/Permission.cjs +66 -0
- package/lib/Discord/structures/Permission.d.ts +21 -0
- package/lib/Discord/structures/Permission.js +66 -0
- package/lib/Discord/structures/PermissionOverwrite.cjs +50 -0
- package/lib/Discord/structures/PermissionOverwrite.d.ts +25 -0
- package/lib/Discord/structures/PermissionOverwrite.js +50 -0
- package/lib/Discord/structures/PingInteraction.cjs +27 -0
- package/lib/Discord/structures/PingInteraction.d.ts +15 -0
- package/lib/Discord/structures/PingInteraction.js +27 -0
- package/lib/Discord/structures/Poll.cjs +77 -0
- package/lib/Discord/structures/Poll.d.ts +27 -0
- package/lib/Discord/structures/Poll.js +77 -0
- package/lib/Discord/structures/PrimaryGuild.cjs +92 -0
- package/lib/Discord/structures/PrimaryGuild.d.ts +23 -0
- package/lib/Discord/structures/PrimaryGuild.js +92 -0
- package/lib/Discord/structures/PrivateChannel.cjs +139 -0
- package/lib/Discord/structures/PrivateChannel.d.ts +102 -0
- package/lib/Discord/structures/PrivateChannel.js +139 -0
- package/lib/Discord/structures/PrivateThreadChannel.cjs +28 -0
- package/lib/Discord/structures/PrivateThreadChannel.d.ts +17 -0
- package/lib/Discord/structures/PrivateThreadChannel.js +28 -0
- package/lib/Discord/structures/PublicThreadChannel.cjs +38 -0
- package/lib/Discord/structures/PublicThreadChannel.d.ts +20 -0
- package/lib/Discord/structures/PublicThreadChannel.js +38 -0
- package/lib/Discord/structures/Role.cjs +156 -0
- package/lib/Discord/structures/Role.d.ts +56 -0
- package/lib/Discord/structures/Role.js +156 -0
- package/lib/Discord/structures/SKU.cjs +70 -0
- package/lib/Discord/structures/SKU.d.ts +33 -0
- package/lib/Discord/structures/SKU.js +70 -0
- package/lib/Discord/structures/Soundboard.cjs +74 -0
- package/lib/Discord/structures/Soundboard.d.ts +42 -0
- package/lib/Discord/structures/Soundboard.js +74 -0
- package/lib/Discord/structures/StageChannel.cjs +45 -0
- package/lib/Discord/structures/StageChannel.d.ts +31 -0
- package/lib/Discord/structures/StageChannel.js +45 -0
- package/lib/Discord/structures/StageInstance.cjs +95 -0
- package/lib/Discord/structures/StageInstance.d.ts +35 -0
- package/lib/Discord/structures/StageInstance.js +95 -0
- package/lib/Discord/structures/Subscription.cjs +39 -0
- package/lib/Discord/structures/Subscription.d.ts +25 -0
- package/lib/Discord/structures/Subscription.js +39 -0
- package/lib/Discord/structures/Team.cjs +86 -0
- package/lib/Discord/structures/Team.d.ts +28 -0
- package/lib/Discord/structures/Team.js +86 -0
- package/lib/Discord/structures/TestEntitlement.cjs +22 -0
- package/lib/Discord/structures/TestEntitlement.d.ts +10 -0
- package/lib/Discord/structures/TestEntitlement.js +22 -0
- package/lib/Discord/structures/TextChannel.cjs +48 -0
- package/lib/Discord/structures/TextChannel.d.ts +34 -0
- package/lib/Discord/structures/TextChannel.js +48 -0
- package/lib/Discord/structures/TextableChannel.cjs +281 -0
- package/lib/Discord/structures/TextableChannel.d.ts +167 -0
- package/lib/Discord/structures/TextableChannel.js +281 -0
- package/lib/Discord/structures/TextableVoiceChannel.cjs +79 -0
- package/lib/Discord/structures/TextableVoiceChannel.d.ts +34 -0
- package/lib/Discord/structures/TextableVoiceChannel.js +79 -0
- package/lib/Discord/structures/ThreadChannel.cjs +300 -0
- package/lib/Discord/structures/ThreadChannel.d.ts +170 -0
- package/lib/Discord/structures/ThreadChannel.js +300 -0
- package/lib/Discord/structures/ThreadOnlyChannel.cjs +231 -0
- package/lib/Discord/structures/ThreadOnlyChannel.d.ts +95 -0
- package/lib/Discord/structures/ThreadOnlyChannel.js +231 -0
- package/lib/Discord/structures/ThreadableChannel.cjs +59 -0
- package/lib/Discord/structures/ThreadableChannel.d.ts +35 -0
- package/lib/Discord/structures/ThreadableChannel.js +59 -0
- package/lib/Discord/structures/UnavailableGuild.cjs +22 -0
- package/lib/Discord/structures/UnavailableGuild.d.ts +10 -0
- package/lib/Discord/structures/UnavailableGuild.js +22 -0
- package/lib/Discord/structures/User.cjs +240 -0
- package/lib/Discord/structures/User.d.ts +90 -0
- package/lib/Discord/structures/User.js +240 -0
- package/lib/Discord/structures/VoiceChannel.cjs +36 -0
- package/lib/Discord/structures/VoiceChannel.d.ts +19 -0
- package/lib/Discord/structures/VoiceChannel.js +36 -0
- package/lib/Discord/structures/VoiceState.cjs +141 -0
- package/lib/Discord/structures/VoiceState.d.ts +49 -0
- package/lib/Discord/structures/VoiceState.js +141 -0
- package/lib/Discord/structures/Webhook.cjs +240 -0
- package/lib/Discord/structures/Webhook.d.ts +126 -0
- package/lib/Discord/structures/Webhook.js +240 -0
- package/lib/Discord/types/applications.d.ts +695 -0
- package/lib/Discord/types/audit-log.d.ts +116 -0
- package/lib/Discord/types/auto-moderation.d.ts +99 -0
- package/lib/Discord/types/channels.d.ts +1570 -0
- package/lib/Discord/types/client.d.ts +250 -0
- package/lib/Discord/types/events.d.ts +224 -0
- package/lib/Discord/types/gateway-raw.d.ts +585 -0
- package/lib/Discord/types/gateway.d.ts +401 -0
- package/lib/Discord/types/guild-template.d.ts +25 -0
- package/lib/Discord/types/guilds.d.ts +987 -0
- package/lib/Discord/types/index.d.ts +24 -0
- package/lib/Discord/types/interactions.d.ts +524 -0
- package/lib/Discord/types/invites.d.ts +117 -0
- package/lib/Discord/types/json.d.ts +833 -0
- package/lib/Discord/types/lobbies.d.ts +31 -0
- package/lib/Discord/types/misc.d.ts +25 -0
- package/lib/Discord/types/namespaced.d.ts +22 -0
- package/lib/Discord/types/oauth.d.ts +206 -0
- package/lib/Discord/types/request-handler.d.ts +54 -0
- package/lib/Discord/types/scheduled-events.d.ts +87 -0
- package/lib/Discord/types/shared.d.ts +24 -0
- package/lib/Discord/types/users.d.ts +104 -0
- package/lib/Discord/types/voice.d.ts +45 -0
- package/lib/Discord/types/webhooks.d.ts +75 -0
- package/lib/Discord/util/Collection.cjs +77 -0
- package/lib/Discord/util/Collection.d.ts +47 -0
- package/lib/Discord/util/Collection.js +77 -0
- package/lib/Discord/util/Errors.cjs +84 -0
- package/lib/Discord/util/Errors.d.ts +43 -0
- package/lib/Discord/util/Errors.js +84 -0
- package/lib/Discord/util/QueryBuilder.cjs +20 -0
- package/lib/Discord/util/QueryBuilder.d.ts +4 -0
- package/lib/Discord/util/QueryBuilder.js +20 -0
- package/lib/Discord/util/Routes.cjs +293 -0
- package/lib/Discord/util/Routes.d.ts +145 -0
- package/lib/Discord/util/Routes.js +293 -0
- package/lib/Discord/util/SimpleCollection.cjs +82 -0
- package/lib/Discord/util/SimpleCollection.d.ts +12 -0
- package/lib/Discord/util/SimpleCollection.js +82 -0
- package/lib/Discord/util/Time.cjs +93 -0
- package/lib/Discord/util/Time.d.ts +39 -0
- package/lib/Discord/util/Time.js +93 -0
- package/lib/Discord/util/TypedCollection.cjs +81 -0
- package/lib/Discord/util/TypedCollection.d.ts +24 -0
- package/lib/Discord/util/TypedCollection.js +81 -0
- package/lib/Discord/util/TypedEmitter.cjs +20 -0
- package/lib/Discord/util/TypedEmitter.d.ts +18 -0
- package/lib/Discord/util/TypedEmitter.js +20 -0
- package/lib/Discord/util/Util.cjs +906 -0
- package/lib/Discord/util/Util.d.ts +66 -0
- package/lib/Discord/util/Util.js +906 -0
- package/lib/Discord/util/interactions/InteractionOptionsWrapper.cjs +211 -0
- package/lib/Discord/util/interactions/InteractionOptionsWrapper.d.ts +170 -0
- package/lib/Discord/util/interactions/InteractionOptionsWrapper.js +211 -0
- package/lib/Discord/util/interactions/MessageInteractionResponse.cjs +29 -0
- package/lib/Discord/util/interactions/MessageInteractionResponse.d.ts +27 -0
- package/lib/Discord/util/interactions/MessageInteractionResponse.js +29 -0
- package/lib/Discord/util/interactions/ModalSubmitInteractionComponentsWrapper.cjs +101 -0
- package/lib/Discord/util/interactions/ModalSubmitInteractionComponentsWrapper.d.ts +157 -0
- package/lib/Discord/util/interactions/ModalSubmitInteractionComponentsWrapper.js +101 -0
- package/lib/Discord/util/interactions/SelectMenuValuesWrapper.cjs +81 -0
- package/lib/Discord/util/interactions/SelectMenuValuesWrapper.d.ts +59 -0
- package/lib/Discord/util/interactions/SelectMenuValuesWrapper.js +81 -0
- package/lib/Discord/util/interactions/shared.cjs +20 -0
- package/lib/Discord/util/interactions/shared.d.ts +7 -0
- package/lib/Discord/util/interactions/shared.js +20 -0
- package/lib/Discord/util/warning.cjs +34 -0
- package/lib/Discord/util/warning.d.ts +6 -0
- package/lib/Discord/util/warning.js +34 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
- package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -0
- package/lib/Signal/Group/ciphertext-message.js +12 -0
- package/lib/Signal/Group/ciphertext-message.js.map +1 -0
- package/lib/Signal/Group/group-session-builder.d.ts +8 -0
- package/lib/Signal/Group/group-session-builder.d.ts.map +1 -0
- package/lib/Signal/Group/group-session-builder.js +30 -0
- package/lib/Signal/Group/group-session-builder.js.map +1 -0
- package/lib/Signal/Group/group_cipher.d.ts +11 -0
- package/lib/Signal/Group/group_cipher.d.ts.map +1 -0
- package/lib/Signal/Group/group_cipher.js +82 -0
- package/lib/Signal/Group/group_cipher.js.map +1 -0
- package/lib/Signal/Group/index.d.ts +12 -0
- package/lib/Signal/Group/index.d.ts.map +1 -0
- package/lib/Signal/Group/index.js +12 -0
- package/lib/Signal/Group/index.js.map +1 -0
- package/lib/Signal/Group/keyhelper.d.ts +7 -0
- package/lib/Signal/Group/keyhelper.d.ts.map +1 -0
- package/lib/Signal/Group/keyhelper.js +18 -0
- package/lib/Signal/Group/keyhelper.js.map +1 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -0
- package/lib/Signal/Group/sender-chain-key.js +26 -0
- package/lib/Signal/Group/sender-chain-key.js.map +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
- package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -0
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-message.js +66 -0
- package/lib/Signal/Group/sender-key-message.js.map +1 -0
- package/lib/Signal/Group/sender-key-name.d.ts +12 -0
- package/lib/Signal/Group/sender-key-name.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-name.js +48 -0
- package/lib/Signal/Group/sender-key-name.js.map +1 -0
- package/lib/Signal/Group/sender-key-record.d.ts +13 -0
- package/lib/Signal/Group/sender-key-record.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-record.js +41 -0
- package/lib/Signal/Group/sender-key-record.js.map +1 -0
- package/lib/Signal/Group/sender-key-state.d.ts +17 -0
- package/lib/Signal/Group/sender-key-state.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-state.js +84 -0
- package/lib/Signal/Group/sender-key-state.js.map +1 -0
- package/lib/Signal/Group/sender-message-key.d.ts +12 -0
- package/lib/Signal/Group/sender-message-key.d.ts.map +1 -0
- package/lib/Signal/Group/sender-message-key.js +26 -0
- package/lib/Signal/Group/sender-message-key.js.map +1 -0
- package/lib/Signal/libsignal.d.ts +55 -0
- package/lib/Signal/libsignal.d.ts.map +1 -0
- package/lib/Signal/libsignal.js +431 -0
- package/lib/Signal/libsignal.js.map +1 -0
- package/lib/Signal/lid-mapping.d.ts +21 -0
- package/lib/Signal/lid-mapping.d.ts.map +1 -0
- package/lib/Signal/lid-mapping.js +277 -0
- package/lib/Signal/lid-mapping.js.map +1 -0
- package/lib/Socket/Client/index.d.ts +3 -0
- package/lib/Socket/Client/index.d.ts.map +1 -0
- package/lib/Socket/Client/index.js +3 -0
- package/lib/Socket/Client/index.js.map +1 -0
- package/lib/Socket/Client/types.d.ts +6 -0
- package/lib/Socket/Client/types.d.ts.map +1 -0
- package/lib/Socket/Client/types.js +11 -0
- package/lib/Socket/Client/types.js.map +1 -0
- package/lib/Socket/Client/websocket.d.ts +13 -0
- package/lib/Socket/Client/websocket.d.ts.map +1 -0
- package/lib/Socket/Client/websocket.js +54 -0
- package/lib/Socket/Client/websocket.js.map +1 -0
- package/lib/Socket/business.d.ts +395 -0
- package/lib/Socket/business.d.ts.map +1 -0
- package/lib/Socket/business.js +380 -0
- package/lib/Socket/business.js.map +1 -0
- package/lib/Socket/chats.d.ts +137 -0
- package/lib/Socket/chats.d.ts.map +1 -0
- package/lib/Socket/chats.js +1214 -0
- package/lib/Socket/chats.js.map +1 -0
- package/lib/Socket/communities.d.ts +562 -0
- package/lib/Socket/communities.d.ts.map +1 -0
- package/lib/Socket/communities.js +432 -0
- package/lib/Socket/communities.js.map +1 -0
- package/lib/Socket/groups.d.ts +286 -0
- package/lib/Socket/groups.d.ts.map +1 -0
- package/lib/Socket/groups.js +348 -0
- package/lib/Socket/groups.js.map +1 -0
- package/lib/Socket/index.d.ts +530 -0
- package/lib/Socket/index.d.ts.map +1 -0
- package/lib/Socket/index.js +12 -0
- package/lib/Socket/index.js.map +1 -0
- package/lib/Socket/messages-recv.d.ts +334 -0
- package/lib/Socket/messages-recv.d.ts.map +1 -0
- package/lib/Socket/messages-recv.js +1765 -0
- package/lib/Socket/messages-recv.js.map +1 -0
- package/lib/Socket/messages-send.d.ts +330 -0
- package/lib/Socket/messages-send.d.ts.map +1 -0
- package/lib/Socket/messages-send.js +1368 -0
- package/lib/Socket/messages-send.js.map +1 -0
- package/lib/Socket/mex.d.ts +2 -0
- package/lib/Socket/mex.d.ts.map +1 -0
- package/lib/Socket/mex.js +42 -0
- package/lib/Socket/mex.js.map +1 -0
- package/lib/Socket/newsletter.d.ts +283 -0
- package/lib/Socket/newsletter.d.ts.map +1 -0
- package/lib/Socket/newsletter.js +226 -0
- package/lib/Socket/newsletter.js.map +1 -0
- package/lib/Socket/socket.d.ts +61 -0
- package/lib/Socket/socket.d.ts.map +1 -0
- package/lib/Socket/socket.js +972 -0
- package/lib/Socket/socket.js.map +1 -0
- package/lib/Store/index.d.ts +4 -0
- package/lib/Store/index.d.ts.map +1 -0
- package/lib/Store/index.js +4 -0
- package/lib/Store/index.js.map +1 -0
- package/lib/Store/make-in-memory-store.d.ts +63 -0
- package/lib/Store/make-in-memory-store.d.ts.map +1 -0
- package/lib/Store/make-in-memory-store.js +471 -0
- package/lib/Store/make-in-memory-store.js.map +1 -0
- package/lib/Store/make-ordered-dictionary.d.ts +13 -0
- package/lib/Store/make-ordered-dictionary.d.ts.map +1 -0
- package/lib/Store/make-ordered-dictionary.js +79 -0
- package/lib/Store/make-ordered-dictionary.js.map +1 -0
- package/lib/Store/object-repository.d.ts +11 -0
- package/lib/Store/object-repository.d.ts.map +1 -0
- package/lib/Store/object-repository.js +24 -0
- package/lib/Store/object-repository.js.map +1 -0
- package/lib/Telegram/button.js +147 -0
- package/lib/Telegram/cli.mjs +105 -0
- package/lib/Telegram/composer.js +582 -0
- package/lib/Telegram/context.js +855 -0
- package/lib/Telegram/core/helpers/args.js +57 -0
- package/lib/Telegram/core/helpers/check.js +55 -0
- package/lib/Telegram/core/helpers/compact.js +16 -0
- package/lib/Telegram/core/helpers/deunionize.js +12 -0
- package/lib/Telegram/core/helpers/formatting.js +91 -0
- package/lib/Telegram/core/helpers/util.js +50 -0
- package/lib/Telegram/core/network/client.js +330 -0
- package/lib/Telegram/core/network/error.js +21 -0
- package/lib/Telegram/core/network/multipart-stream.js +71 -0
- package/lib/Telegram/core/network/polling.js +87 -0
- package/lib/Telegram/core/network/webhook.js +54 -0
- package/lib/Telegram/core/types/typegram.js +27 -0
- package/lib/Telegram/elynn-telegraf.js +256 -0
- package/lib/Telegram/esm-bridge.mjs +21 -0
- package/lib/Telegram/filters.js +69 -0
- package/lib/Telegram/format.js +58 -0
- package/lib/Telegram/future.js +140 -0
- package/lib/Telegram/index.js +59 -0
- package/lib/Telegram/input.js +61 -0
- package/lib/Telegram/markup.js +121 -0
- package/lib/Telegram/middleware.js +2 -0
- package/lib/Telegram/package.json +3 -0
- package/lib/Telegram/reactions.js +84 -0
- package/lib/Telegram/router.js +46 -0
- package/lib/Telegram/scenes/base.js +39 -0
- package/lib/Telegram/scenes/context.js +104 -0
- package/lib/Telegram/scenes/index.js +21 -0
- package/lib/Telegram/scenes/stage.js +49 -0
- package/lib/Telegram/scenes/wizard/context.js +31 -0
- package/lib/Telegram/scenes/wizard/index.js +45 -0
- package/lib/Telegram/scenes.js +17 -0
- package/lib/Telegram/session.js +166 -0
- package/lib/Telegram/telegram-types.js +6 -0
- package/lib/Telegram/telegram.js +945 -0
- package/lib/Telegram/types.js +2 -0
- package/lib/Telegram/utils.js +5 -0
- package/lib/Types/Auth.d.ts +2 -0
- package/lib/Types/Auth.d.ts.map +1 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Auth.js.map +1 -0
- package/lib/Types/Bussines.d.ts +2 -0
- package/lib/Types/Bussines.d.ts.map +1 -0
- package/lib/Types/Bussines.js +2 -0
- package/lib/Types/Bussines.js.map +1 -0
- package/lib/Types/Call.d.ts +2 -0
- package/lib/Types/Call.d.ts.map +1 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Call.js.map +1 -0
- package/lib/Types/Chat.d.ts +2 -0
- package/lib/Types/Chat.d.ts.map +1 -0
- package/lib/Types/Chat.js +8 -0
- package/lib/Types/Chat.js.map +1 -0
- package/lib/Types/Contact.d.ts +2 -0
- package/lib/Types/Contact.d.ts.map +1 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Contact.js.map +1 -0
- package/lib/Types/Events.d.ts +2 -0
- package/lib/Types/Events.d.ts.map +1 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/Events.js.map +1 -0
- package/lib/Types/GroupMetadata.d.ts +2 -0
- package/lib/Types/GroupMetadata.d.ts.map +1 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/GroupMetadata.js.map +1 -0
- package/lib/Types/Label.d.ts +3 -0
- package/lib/Types/Label.d.ts.map +1 -0
- package/lib/Types/Label.js +25 -0
- package/lib/Types/Label.js.map +1 -0
- package/lib/Types/LabelAssociation.d.ts +3 -0
- package/lib/Types/LabelAssociation.d.ts.map +1 -0
- package/lib/Types/LabelAssociation.js +7 -0
- package/lib/Types/LabelAssociation.js.map +1 -0
- package/lib/Types/Message.d.ts +12 -0
- package/lib/Types/Message.d.ts.map +1 -0
- package/lib/Types/Message.js +18 -0
- package/lib/Types/Message.js.map +1 -0
- package/lib/Types/Mex.d.ts +3 -0
- package/lib/Types/Mex.d.ts.map +1 -0
- package/lib/Types/Mex.js +39 -0
- package/lib/Types/Mex.js.map +1 -0
- package/lib/Types/Product.d.ts +2 -0
- package/lib/Types/Product.d.ts.map +1 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Product.js.map +1 -0
- package/lib/Types/RichType.d.ts +3 -0
- package/lib/Types/RichType.d.ts.map +1 -0
- package/lib/Types/RichType.js +23 -0
- package/lib/Types/RichType.js.map +1 -0
- package/lib/Types/Signal.d.ts +2 -0
- package/lib/Types/Signal.d.ts.map +1 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Signal.js.map +1 -0
- package/lib/Types/Socket.d.ts +2 -0
- package/lib/Types/Socket.d.ts.map +1 -0
- package/lib/Types/Socket.js +2 -0
- package/lib/Types/Socket.js.map +1 -0
- package/lib/Types/State.d.ts +6 -0
- package/lib/Types/State.d.ts.map +1 -0
- package/lib/Types/State.js +56 -0
- package/lib/Types/State.js.map +1 -0
- package/lib/Types/USync.d.ts +2 -0
- package/lib/Types/USync.d.ts.map +1 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/USync.js.map +1 -0
- package/lib/Types/index.d.ts +14 -0
- package/lib/Types/index.d.ts.map +1 -0
- package/lib/Types/index.js +26 -0
- package/lib/Types/index.js.map +1 -0
- package/lib/Utils/auth-utils.d.ts +58 -0
- package/lib/Utils/auth-utils.d.ts.map +1 -0
- package/lib/Utils/auth-utils.js +302 -0
- package/lib/Utils/auth-utils.js.map +1 -0
- package/lib/Utils/browser-utils.d.ts +9 -0
- package/lib/Utils/browser-utils.d.ts.map +1 -0
- package/lib/Utils/browser-utils.js +36 -0
- package/lib/Utils/browser-utils.js.map +1 -0
- package/lib/Utils/business.d.ts +50 -0
- package/lib/Utils/business.d.ts.map +1 -0
- package/lib/Utils/business.js +231 -0
- package/lib/Utils/business.js.map +1 -0
- package/lib/Utils/chat-utils.d.ts +409 -0
- package/lib/Utils/chat-utils.d.ts.map +1 -0
- package/lib/Utils/chat-utils.js +872 -0
- package/lib/Utils/chat-utils.js.map +1 -0
- package/lib/Utils/companion-reg-client-utils.d.ts +5 -0
- package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
- package/lib/Utils/companion-reg-client-utils.js +46 -0
- package/lib/Utils/companion-reg-client-utils.js.map +1 -0
- package/lib/Utils/crypto.d.ts +40 -0
- package/lib/Utils/crypto.d.ts.map +1 -0
- package/lib/Utils/crypto.js +119 -0
- package/lib/Utils/crypto.js.map +1 -0
- package/lib/Utils/decode-wa-message.d.ts +84 -0
- package/lib/Utils/decode-wa-message.d.ts.map +1 -0
- package/lib/Utils/decode-wa-message.js +325 -0
- package/lib/Utils/decode-wa-message.js.map +1 -0
- package/lib/Utils/event-buffer.d.ts +13 -0
- package/lib/Utils/event-buffer.d.ts.map +1 -0
- package/lib/Utils/event-buffer.js +622 -0
- package/lib/Utils/event-buffer.js.map +1 -0
- package/lib/Utils/generics.d.ts +64 -0
- package/lib/Utils/generics.d.ts.map +1 -0
- package/lib/Utils/generics.js +395 -0
- package/lib/Utils/generics.js.map +1 -0
- package/lib/Utils/history.d.ts +76 -0
- package/lib/Utils/history.d.ts.map +1 -0
- package/lib/Utils/history.js +134 -0
- package/lib/Utils/history.js.map +1 -0
- package/lib/Utils/identity-change-handler.d.ts +14 -0
- package/lib/Utils/identity-change-handler.d.ts.map +1 -0
- package/lib/Utils/identity-change-handler.js +50 -0
- package/lib/Utils/identity-change-handler.js.map +1 -0
- package/lib/Utils/index.d.ts +25 -0
- package/lib/Utils/index.d.ts.map +1 -0
- package/lib/Utils/index.js +27 -0
- package/lib/Utils/index.js.map +1 -0
- package/lib/Utils/link-preview.d.ts +13 -0
- package/lib/Utils/link-preview.d.ts.map +1 -0
- package/lib/Utils/link-preview.js +85 -0
- package/lib/Utils/link-preview.js.map +1 -0
- package/lib/Utils/logger.d.ts +3 -0
- package/lib/Utils/logger.d.ts.map +1 -0
- package/lib/Utils/logger.js +3 -0
- package/lib/Utils/logger.js.map +1 -0
- package/lib/Utils/lt-hash.d.ts +7 -0
- package/lib/Utils/lt-hash.d.ts.map +1 -0
- package/lib/Utils/lt-hash.js +8 -0
- package/lib/Utils/lt-hash.js.map +1 -0
- package/lib/Utils/make-mutex.d.ts +7 -0
- package/lib/Utils/make-mutex.d.ts.map +1 -0
- package/lib/Utils/make-mutex.js +33 -0
- package/lib/Utils/make-mutex.js.map +1 -0
- package/lib/Utils/message-retry-manager.d.ts +80 -0
- package/lib/Utils/message-retry-manager.d.ts.map +1 -0
- package/lib/Utils/message-retry-manager.js +265 -0
- package/lib/Utils/message-retry-manager.js.map +1 -0
- package/lib/Utils/messages-media.d.ts +137 -0
- package/lib/Utils/messages-media.d.ts.map +1 -0
- package/lib/Utils/messages-media.js +843 -0
- package/lib/Utils/messages-media.js.map +1 -0
- package/lib/Utils/messages.d.ts +46 -0
- package/lib/Utils/messages.d.ts.map +1 -0
- package/lib/Utils/messages.js +1878 -0
- package/lib/Utils/messages.js.map +1 -0
- package/lib/Utils/noise-handler.d.ts +21 -0
- package/lib/Utils/noise-handler.d.ts.map +1 -0
- package/lib/Utils/noise-handler.js +201 -0
- package/lib/Utils/noise-handler.js.map +1 -0
- package/lib/Utils/offline-node-processor.d.ts +10 -0
- package/lib/Utils/offline-node-processor.d.ts.map +1 -0
- package/lib/Utils/offline-node-processor.js +40 -0
- package/lib/Utils/offline-node-processor.js.map +1 -0
- package/lib/Utils/pre-key-manager.d.ts +26 -0
- package/lib/Utils/pre-key-manager.d.ts.map +1 -0
- package/lib/Utils/pre-key-manager.js +106 -0
- package/lib/Utils/pre-key-manager.js.map +1 -0
- package/lib/Utils/process-message.d.ts +84 -0
- package/lib/Utils/process-message.d.ts.map +1 -0
- package/lib/Utils/process-message.js +745 -0
- package/lib/Utils/process-message.js.map +1 -0
- package/lib/Utils/reporting-utils.d.ts +13 -0
- package/lib/Utils/reporting-utils.d.ts.map +1 -0
- package/lib/Utils/reporting-utils.js +258 -0
- package/lib/Utils/reporting-utils.js.map +1 -0
- package/lib/Utils/rich-message-utils.d.ts +49 -0
- package/lib/Utils/rich-message-utils.d.ts.map +1 -0
- package/lib/Utils/rich-message-utils.js +400 -0
- package/lib/Utils/rich-message-utils.js.map +1 -0
- package/lib/Utils/session-guard.js +148 -0
- package/lib/Utils/signal.d.ts +83 -0
- package/lib/Utils/signal.d.ts.map +1 -0
- package/lib/Utils/signal.js +201 -0
- package/lib/Utils/signal.js.map +1 -0
- package/lib/Utils/stanza-ack.d.ts +17 -0
- package/lib/Utils/stanza-ack.d.ts.map +1 -0
- package/lib/Utils/stanza-ack.js +38 -0
- package/lib/Utils/stanza-ack.js.map +1 -0
- package/lib/Utils/sync-action-utils.d.ts +3 -0
- package/lib/Utils/sync-action-utils.d.ts.map +1 -0
- package/lib/Utils/sync-action-utils.js +49 -0
- package/lib/Utils/sync-action-utils.js.map +1 -0
- package/lib/Utils/tc-token-utils.d.ts +30 -0
- package/lib/Utils/tc-token-utils.d.ts.map +1 -0
- package/lib/Utils/tc-token-utils.js +163 -0
- package/lib/Utils/tc-token-utils.js.map +1 -0
- package/lib/Utils/text-sticker.js +149 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +11 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +121 -0
- package/lib/Utils/use-multi-file-auth-state.js.map +1 -0
- package/lib/Utils/use-single-file-auth-state.d.ts +11 -0
- package/lib/Utils/use-single-file-auth-state.d.ts.map +1 -0
- package/lib/Utils/use-single-file-auth-state.js +109 -0
- package/lib/Utils/use-single-file-auth-state.js.map +1 -0
- package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
- package/lib/Utils/use-sqlite-auth-state.d.ts.map +1 -0
- package/lib/Utils/use-sqlite-auth-state.js +109 -0
- package/lib/Utils/use-sqlite-auth-state.js.map +1 -0
- package/lib/Utils/validate-connection.d.ts +44 -0
- package/lib/Utils/validate-connection.d.ts.map +1 -0
- package/lib/Utils/validate-connection.js +203 -0
- package/lib/Utils/validate-connection.js.map +1 -0
- package/lib/WABinary/constants.d.ts +62 -0
- package/lib/WABinary/constants.d.ts.map +1 -0
- package/lib/WABinary/constants.js +1467 -0
- package/lib/WABinary/constants.js.map +1 -0
- package/lib/WABinary/decode.d.ts +10 -0
- package/lib/WABinary/decode.d.ts.map +1 -0
- package/lib/WABinary/decode.js +262 -0
- package/lib/WABinary/decode.js.map +1 -0
- package/lib/WABinary/encode.d.ts +3 -0
- package/lib/WABinary/encode.d.ts.map +1 -0
- package/lib/WABinary/encode.js +220 -0
- package/lib/WABinary/encode.js.map +1 -0
- package/lib/WABinary/generic-utils.d.ts +77 -0
- package/lib/WABinary/generic-utils.d.ts.map +1 -0
- package/lib/WABinary/generic-utils.js +226 -0
- package/lib/WABinary/generic-utils.js.map +1 -0
- package/lib/WABinary/index.d.ts +6 -0
- package/lib/WABinary/index.d.ts.map +1 -0
- package/lib/WABinary/index.js +6 -0
- package/lib/WABinary/index.js.map +1 -0
- package/lib/WABinary/jid-utils.d.ts +29 -0
- package/lib/WABinary/jid-utils.d.ts.map +1 -0
- package/lib/WABinary/jid-utils.js +96 -0
- package/lib/WABinary/jid-utils.js.map +1 -0
- package/lib/WABinary/types.d.ts +2 -0
- package/lib/WABinary/types.d.ts.map +1 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WABinary/types.js.map +1 -0
- package/lib/WAM/BinaryInfo.d.ts +8 -0
- package/lib/WAM/BinaryInfo.d.ts.map +1 -0
- package/lib/WAM/BinaryInfo.js +10 -0
- package/lib/WAM/BinaryInfo.js.map +1 -0
- package/lib/WAM/constants.d.ts +34927 -0
- package/lib/WAM/constants.d.ts.map +1 -0
- package/lib/WAM/constants.js +22853 -0
- package/lib/WAM/constants.js.map +1 -0
- package/lib/WAM/encode.d.ts +2 -0
- package/lib/WAM/encode.d.ts.map +1 -0
- package/lib/WAM/encode.js +150 -0
- package/lib/WAM/encode.js.map +1 -0
- package/lib/WAM/index.d.ts +4 -0
- package/lib/WAM/index.d.ts.map +1 -0
- package/lib/WAM/index.js +4 -0
- package/lib/WAM/index.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +37 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +52 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +39 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +15 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/index.d.ts +6 -0
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/index.js +6 -0
- package/lib/WAUSync/Protocols/index.js.map +1 -0
- package/lib/WAUSync/USyncQuery.d.ts +21 -0
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
- package/lib/WAUSync/USyncQuery.js +98 -0
- package/lib/WAUSync/USyncQuery.js.map +1 -0
- package/lib/WAUSync/USyncUser.d.ts +17 -0
- package/lib/WAUSync/USyncUser.d.ts.map +1 -0
- package/lib/WAUSync/USyncUser.js +31 -0
- package/lib/WAUSync/USyncUser.js.map +1 -0
- package/lib/WAUSync/index.d.ts +4 -0
- package/lib/WAUSync/index.d.ts.map +1 -0
- package/lib/WAUSync/index.js +4 -0
- package/lib/WAUSync/index.js.map +1 -0
- package/lib/index.d.ts +201 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +314 -0
- package/lib/index.js.map +1 -0
- package/lib/plugins/loader.cjs +26 -0
- package/lib/plugins/loader.js +94 -0
- package/package.json +148 -0
|
@@ -0,0 +1,1191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const Routes = __importStar(require("../util/Routes.cjs"));
|
|
40
|
+
const Invite_1 = __importDefault(require("../structures/Invite.cjs"));
|
|
41
|
+
const StageInstance_1 = __importDefault(require("../structures/StageInstance.cjs"));
|
|
42
|
+
const Constants_1 = require("../Constants.cjs");
|
|
43
|
+
const QueryBuilder_1 = __importDefault(require("../util/QueryBuilder.cjs"));
|
|
44
|
+
/** Various methods for interacting with channels. Located at {@link Client#rest | Client#rest}{@link RESTManager#channels | .channels}. */
|
|
45
|
+
class Channels {
|
|
46
|
+
_manager;
|
|
47
|
+
constructor(manager) {
|
|
48
|
+
this._manager = manager;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Add a user to a group channel.
|
|
52
|
+
* @param groupID The ID of the group to add the user to.
|
|
53
|
+
* @param options The options for adding the recipient.
|
|
54
|
+
* @caching This method **does not** cache its result.
|
|
55
|
+
*/
|
|
56
|
+
async addGroupRecipient(groupID, options) {
|
|
57
|
+
options = this._manager.client.util._freeze(options);
|
|
58
|
+
await this._manager.authRequest({
|
|
59
|
+
method: "PUT",
|
|
60
|
+
path: Routes.GROUP_RECIPIENT(groupID, options.userID),
|
|
61
|
+
json: {
|
|
62
|
+
access_token: options.accessToken,
|
|
63
|
+
nick: options.nick
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Add a member to a thread.
|
|
69
|
+
* @param channelID The ID of the thread to add them to.
|
|
70
|
+
* @param userID The ID of the user to add to the thread.
|
|
71
|
+
* @caching This method **does not** cache its result.
|
|
72
|
+
*/
|
|
73
|
+
async addThreadMember(channelID, userID) {
|
|
74
|
+
await this._manager.authRequest({
|
|
75
|
+
method: "PUT",
|
|
76
|
+
path: Routes.CHANNEL_THREAD_MEMBER(channelID, userID)
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create a direct message. This will not create a new channel if you have already started a dm with the user.
|
|
81
|
+
* @param recipient The ID of the recipient of the direct message.
|
|
82
|
+
* @caching This method **does** cache its result.
|
|
83
|
+
* @caches {@link Client#privateChannels | Client#privateChannels}
|
|
84
|
+
*/
|
|
85
|
+
async createDM(recipient) {
|
|
86
|
+
let cache;
|
|
87
|
+
if ((cache = this._manager.client.privateChannels.find(ch => ch.recipient.id === recipient))) {
|
|
88
|
+
return cache;
|
|
89
|
+
}
|
|
90
|
+
return this._manager.authRequest({
|
|
91
|
+
method: "POST",
|
|
92
|
+
path: Routes.OAUTH_CHANNELS,
|
|
93
|
+
json: { recipient_id: recipient }
|
|
94
|
+
}).then(data => this._manager.client.privateChannels.update(data));
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Create a group dm.
|
|
98
|
+
* @param options The options for creating the group dm.
|
|
99
|
+
* @caching This method **does** cache its result.
|
|
100
|
+
* @caches {@link Client#groupChannels | Client#groupChannels}
|
|
101
|
+
*/
|
|
102
|
+
async createGroupDM(options) {
|
|
103
|
+
options = this._manager.client.util._freeze(options);
|
|
104
|
+
return this._manager.authRequest({
|
|
105
|
+
method: "POST",
|
|
106
|
+
path: Routes.OAUTH_CHANNELS,
|
|
107
|
+
json: {
|
|
108
|
+
access_tokens: options.accessTokens,
|
|
109
|
+
nicks: options.nicks
|
|
110
|
+
}
|
|
111
|
+
}).then(data => this._manager.client.groupChannels.update(data));
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Create an invite for a channel. If the guild is not a `COMMUNITY` server, invites can only be made to last 30 days.
|
|
115
|
+
* @param channelID The ID of the channel to create an invite for.
|
|
116
|
+
* @param options The options for creating the invite.
|
|
117
|
+
* @caching This method **does not** cache its result.
|
|
118
|
+
*/
|
|
119
|
+
async createInvite(channelID, options) {
|
|
120
|
+
options = this._manager.client.util._freeze(options);
|
|
121
|
+
return this._manager.authRequest({
|
|
122
|
+
method: "POST",
|
|
123
|
+
path: Routes.CHANNEL_INVITES(channelID),
|
|
124
|
+
json: {
|
|
125
|
+
max_age: options.maxAge,
|
|
126
|
+
max_uses: options.maxUses,
|
|
127
|
+
target_application_id: options.targetApplicationID,
|
|
128
|
+
target_type: options.targetType,
|
|
129
|
+
target_user_id: options.targetUserID,
|
|
130
|
+
temporary: options.temporary,
|
|
131
|
+
unique: options.unique
|
|
132
|
+
},
|
|
133
|
+
reason: options.reason,
|
|
134
|
+
files: options.targetUsers ? [this._manager.client.util._arrayToCSVFile(options.targetUsers, "target_users_file", "user_id")] : undefined
|
|
135
|
+
}).then(data => Invite_1.default.withMetadata(data, this._manager.client));
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Create a message in a channel.
|
|
139
|
+
* @param channelID The ID of the channel to create the message in.
|
|
140
|
+
* @param options The options for creating the message.
|
|
141
|
+
* @caching This method **may** cache its result. The result will not be cached if the channel is not cached.
|
|
142
|
+
* @caches {@link TextableChannel#messages | TextableChannel#messages}<br>{@link ThreadChannel#messages | ThreadChannel#messages}<br>{@link PrivateChannel#messages | PrivateChannel#messages}
|
|
143
|
+
*/
|
|
144
|
+
async createMessage(channelID, options) {
|
|
145
|
+
options = this._manager.client.util._freeze(options);
|
|
146
|
+
return this._manager.authRequest({
|
|
147
|
+
method: "POST",
|
|
148
|
+
path: Routes.CHANNEL_MESSAGES(channelID),
|
|
149
|
+
json: {
|
|
150
|
+
allowed_mentions: this._manager.client.util.formatAllowedMentions(options.allowedMentions),
|
|
151
|
+
attachments: options.attachments,
|
|
152
|
+
components: options.components ? this._manager.client.util.componentsToRaw(options.components) : undefined,
|
|
153
|
+
content: options.content,
|
|
154
|
+
embeds: options.embeds ? this._manager.client.util.embedsToRaw(options.embeds) : undefined,
|
|
155
|
+
enforce_nonce: options.enforceNonce,
|
|
156
|
+
flags: options.flags,
|
|
157
|
+
sticker_ids: options.stickerIDs,
|
|
158
|
+
message_reference: options.messageReference ? {
|
|
159
|
+
channel_id: options.messageReference.channelID,
|
|
160
|
+
fail_if_not_exists: options.messageReference.failIfNotExists,
|
|
161
|
+
guild_id: options.messageReference.guildID,
|
|
162
|
+
message_id: options.messageReference.messageID,
|
|
163
|
+
type: options.messageReference.type
|
|
164
|
+
} : undefined,
|
|
165
|
+
nonce: options.nonce,
|
|
166
|
+
poll: options.poll ? {
|
|
167
|
+
allow_multiselect: options.poll.allowMultiselect,
|
|
168
|
+
answers: options.poll.answers.map(a => ({
|
|
169
|
+
poll_media: a.pollMedia
|
|
170
|
+
})),
|
|
171
|
+
duration: options.poll.duration,
|
|
172
|
+
layout_type: options.poll.layoutType,
|
|
173
|
+
question: options.poll.question
|
|
174
|
+
} : undefined,
|
|
175
|
+
tts: options.tts
|
|
176
|
+
},
|
|
177
|
+
files: options.files
|
|
178
|
+
}).then(data => this._manager.client.util.updateMessage(data));
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Add a reaction to a message.
|
|
182
|
+
* @param channelID The ID of the channel the message is in.
|
|
183
|
+
* @param messageID The ID of the message to add a reaction to.
|
|
184
|
+
* @param emoji The reaction to add to the message. `name:id` for custom emojis, and the unicode codepoint for default emojis.
|
|
185
|
+
* @caching This method **does not** cache its result.
|
|
186
|
+
*/
|
|
187
|
+
async createReaction(channelID, messageID, emoji) {
|
|
188
|
+
await this._manager.authRequest({
|
|
189
|
+
method: "PUT",
|
|
190
|
+
path: Routes.CHANNEL_REACTION_USER(channelID, messageID, emoji, "@me")
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Create a stage instance.
|
|
195
|
+
* @param channelID The ID of the channel to create the stage instance on.
|
|
196
|
+
* @param options The options for creating the stage instance.
|
|
197
|
+
* @caching This method **does not** cache its result.
|
|
198
|
+
*/
|
|
199
|
+
async createStageInstance(channelID, options) {
|
|
200
|
+
options = this._manager.client.util._freeze(options);
|
|
201
|
+
return this._manager.authRequest({
|
|
202
|
+
method: "POST",
|
|
203
|
+
path: Routes.STAGE_INSTANCES,
|
|
204
|
+
json: {
|
|
205
|
+
channel_id: channelID,
|
|
206
|
+
topic: options.topic,
|
|
207
|
+
privacy_level: options.privacyLevel,
|
|
208
|
+
send_start_notification: options.sendStartNotification
|
|
209
|
+
},
|
|
210
|
+
reason: options.reason
|
|
211
|
+
}).then(data => new StageInstance_1.default(data, this._manager.client));
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Crosspost a message in an announcement channel.
|
|
215
|
+
* @param channelID The ID of the channel to crosspost the message in.
|
|
216
|
+
* @param messageID The ID of the message to crosspost.
|
|
217
|
+
* @caching This method **may** cache its result. The result will not be cached if the channel is not cached.
|
|
218
|
+
* @caches {@link TextableChannel#messages | TextableChannel#messages}<br>{@link ThreadChannel#messages | ThreadChannel#messages}<br>{@link PrivateChannel#messages | PrivateChannel#messages}
|
|
219
|
+
*/
|
|
220
|
+
async crosspostMessage(channelID, messageID) {
|
|
221
|
+
return this._manager.authRequest({
|
|
222
|
+
method: "POST",
|
|
223
|
+
path: Routes.CHANNEL_MESSAGES_CROSSPOST(channelID, messageID)
|
|
224
|
+
}).then(data => this._manager.client.util.updateMessage(data));
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Delete or close a channel.
|
|
228
|
+
* @param channelID The ID of the channel to delete or close.
|
|
229
|
+
* @param reason The reason to be displayed in the audit log.
|
|
230
|
+
* @caching This method **does not** cache its result.
|
|
231
|
+
*/
|
|
232
|
+
async delete(channelID, reason) {
|
|
233
|
+
await this._manager.authRequest({
|
|
234
|
+
method: "DELETE",
|
|
235
|
+
path: Routes.CHANNEL(channelID),
|
|
236
|
+
reason
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Delete an invite.
|
|
241
|
+
* @param code The code of the invite to delete.
|
|
242
|
+
* @param reason The reason for deleting the invite.
|
|
243
|
+
* @caching This method **does not** cache its result.
|
|
244
|
+
*/
|
|
245
|
+
async deleteInvite(code, reason) {
|
|
246
|
+
return this._manager.authRequest({
|
|
247
|
+
method: "DELETE",
|
|
248
|
+
path: Routes.INVITE(code),
|
|
249
|
+
reason
|
|
250
|
+
}).then(data => new Invite_1.default(data, this._manager.client));
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Delete a message.
|
|
254
|
+
* @param channelID The ID of the channel to delete the message in.
|
|
255
|
+
* @param messageID The ID of the message to delete.
|
|
256
|
+
* @param reason The reason for deleting the message.
|
|
257
|
+
* @caching This method **does not** cache its result.
|
|
258
|
+
*/
|
|
259
|
+
async deleteMessage(channelID, messageID, reason) {
|
|
260
|
+
await this._manager.authRequest({
|
|
261
|
+
method: "DELETE",
|
|
262
|
+
path: Routes.CHANNEL_MESSAGE(channelID, messageID),
|
|
263
|
+
reason
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Bulk delete messages.
|
|
268
|
+
* @param channelID The ID of the channel to delete the messages in.
|
|
269
|
+
* @param messageIDs The IDs of the messages to delete. Any duplicates or messages older than two weeks will cause an error.
|
|
270
|
+
* @param reason The reason for deleting the messages.
|
|
271
|
+
* @caching This method **does not** cache its result.
|
|
272
|
+
*/
|
|
273
|
+
async deleteMessages(channelID, messageIDs, reason) {
|
|
274
|
+
const chunks = [];
|
|
275
|
+
messageIDs = Array.from(messageIDs);
|
|
276
|
+
const amountOfMessages = messageIDs.length;
|
|
277
|
+
while (messageIDs.length !== 0) {
|
|
278
|
+
chunks.push(messageIDs.splice(0, 100));
|
|
279
|
+
}
|
|
280
|
+
let done = 0;
|
|
281
|
+
for (const chunk of chunks.values()) {
|
|
282
|
+
if (chunks.length > 1) {
|
|
283
|
+
const left = amountOfMessages - done;
|
|
284
|
+
this._manager.client.emit("debug", `Deleting ${left} messages in ${channelID}`);
|
|
285
|
+
}
|
|
286
|
+
if (chunk.length === 1) {
|
|
287
|
+
this._manager.client.emit("debug", "deleteMessages created a chunk with only 1 element, using deleteMessage instead.");
|
|
288
|
+
await this.deleteMessage(channelID, chunk[0], reason);
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
await this._manager.authRequest({
|
|
292
|
+
method: "POST",
|
|
293
|
+
path: Routes.CHANNEL_BULK_DELETE_MESSAGES(channelID),
|
|
294
|
+
json: { messages: chunk },
|
|
295
|
+
reason
|
|
296
|
+
});
|
|
297
|
+
done += chunk.length;
|
|
298
|
+
}
|
|
299
|
+
return amountOfMessages;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Delete a permission overwrite.
|
|
303
|
+
* @param channelID The ID of the channel to delete the permission overwrite in.
|
|
304
|
+
* @param overwriteID The ID of the permission overwrite to delete.
|
|
305
|
+
* @param reason The reason for deleting the permission overwrite.
|
|
306
|
+
* @caching This method **does not** cache its result.
|
|
307
|
+
*/
|
|
308
|
+
async deletePermission(channelID, overwriteID, reason) {
|
|
309
|
+
await this._manager.authRequest({
|
|
310
|
+
method: "DELETE",
|
|
311
|
+
path: Routes.CHANNEL_PERMISSION(channelID, overwriteID),
|
|
312
|
+
reason
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Remove a reaction from a message.
|
|
317
|
+
* @param channelID The ID of the channel the message is in.
|
|
318
|
+
* @param messageID The ID of the message to remove a reaction from.
|
|
319
|
+
* @param emoji The reaction to remove from the message. `name:id` for custom emojis, and the unicode codepoint for default emojis.
|
|
320
|
+
* @param user The user to remove the reaction from, `@me` for the current user (default).
|
|
321
|
+
* @caching This method **does not** cache its result.
|
|
322
|
+
*/
|
|
323
|
+
async deleteReaction(channelID, messageID, emoji, user = "@me") {
|
|
324
|
+
await this._manager.authRequest({
|
|
325
|
+
method: "DELETE",
|
|
326
|
+
path: Routes.CHANNEL_REACTION_USER(channelID, messageID, emoji, user)
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Remove all, or a specific emoji's reactions from a message.
|
|
331
|
+
* @param channelID The ID of the channel the message is in.
|
|
332
|
+
* @param messageID The ID of the message to remove reactions from.
|
|
333
|
+
* @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.
|
|
334
|
+
* @caching This method **does not** cache its result.
|
|
335
|
+
*/
|
|
336
|
+
async deleteReactions(channelID, messageID, emoji) {
|
|
337
|
+
await this._manager.authRequest({
|
|
338
|
+
method: "DELETE",
|
|
339
|
+
path: emoji ? Routes.CHANNEL_REACTION(channelID, messageID, emoji) : Routes.CHANNEL_REACTIONS(channelID, messageID)
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Delete a stage instance.
|
|
344
|
+
* @param channelID The ID of the channel to delete the stage instance on.
|
|
345
|
+
* @param reason The reason for deleting the stage instance.
|
|
346
|
+
* @caching This method **does not** cache its result.
|
|
347
|
+
*/
|
|
348
|
+
async deleteStageInstance(channelID, reason) {
|
|
349
|
+
await this._manager.authRequest({
|
|
350
|
+
method: "DELETE",
|
|
351
|
+
path: Routes.STAGE_INSTANCE(channelID),
|
|
352
|
+
reason
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Edit a channel.
|
|
357
|
+
* @param channelID The ID of the channel to edit.
|
|
358
|
+
* @param options The options for editing the channel.
|
|
359
|
+
* @caching This method **may** cache its result. If a guild channel, the result will not be cached if the guild is not cached.
|
|
360
|
+
* @caches {@link Guild#channels | Guild#channels}<br>{@link Guild#threads | Guild#threads}<br>{@link Client#groupChannels | Client#groupChannels}
|
|
361
|
+
*/
|
|
362
|
+
async edit(channelID, options) {
|
|
363
|
+
options = this._manager.client.util._freeze(options);
|
|
364
|
+
let icon;
|
|
365
|
+
if (options.icon) {
|
|
366
|
+
try {
|
|
367
|
+
icon = this._manager.client.util.convertImage(options.icon);
|
|
368
|
+
}
|
|
369
|
+
catch (err) {
|
|
370
|
+
throw new TypeError("Invalid icon provided. Ensure you are providing a valid, fully-qualified base64 url.", { cause: err });
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return this._manager.authRequest({
|
|
374
|
+
method: "PATCH",
|
|
375
|
+
path: Routes.CHANNEL(channelID),
|
|
376
|
+
json: {
|
|
377
|
+
applied_tags: options.appliedTags,
|
|
378
|
+
archived: options.archived,
|
|
379
|
+
auto_archive_duration: options.autoArchiveDuration,
|
|
380
|
+
available_tags: options.availableTags?.map(tag => ({
|
|
381
|
+
emoji_id: tag.emoji?.id,
|
|
382
|
+
emoji_name: tag.emoji?.name,
|
|
383
|
+
moderated: tag.moderated,
|
|
384
|
+
name: tag.name,
|
|
385
|
+
id: tag.id
|
|
386
|
+
})),
|
|
387
|
+
bitrate: options.bitrate,
|
|
388
|
+
default_auto_archive_duration: options.defaultAutoArchiveDuration,
|
|
389
|
+
default_forum_layout: options.defaultForumLayout,
|
|
390
|
+
default_reaction_emoji: options.defaultReactionEmoji ? { emoji_id: options.defaultReactionEmoji.id, emoji_name: options.defaultReactionEmoji.name } : options.defaultReactionEmoji,
|
|
391
|
+
default_sort_order: options.defaultSortOrder,
|
|
392
|
+
default_thread_rate_limit_per_user: options.defaultThreadRateLimitPerUser,
|
|
393
|
+
flags: options.flags,
|
|
394
|
+
icon,
|
|
395
|
+
invitable: options.invitable,
|
|
396
|
+
locked: options.locked,
|
|
397
|
+
name: options.name,
|
|
398
|
+
nsfw: options.nsfw,
|
|
399
|
+
parent_id: options.parentID,
|
|
400
|
+
permission_overwrites: options.permissionOverwrites,
|
|
401
|
+
position: options.position,
|
|
402
|
+
rate_limit_per_user: options.rateLimitPerUser,
|
|
403
|
+
rtc_region: options.rtcRegion,
|
|
404
|
+
topic: options.topic,
|
|
405
|
+
type: options.type,
|
|
406
|
+
user_limit: options.userLimit,
|
|
407
|
+
video_quality_mode: options.videoQualityMode
|
|
408
|
+
},
|
|
409
|
+
reason: options.reason
|
|
410
|
+
}).then(data => this._manager.client.util.updateChannel(data));
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Edit a message.
|
|
414
|
+
* @param channelID The ID of the channel the message is in.
|
|
415
|
+
* @param messageID The ID of the message to edit.
|
|
416
|
+
* @param options The options for editing the message.
|
|
417
|
+
* @caching This method **may** cache its result. The result will not be cached if the channel is not cached.
|
|
418
|
+
* @caches {@link TextableChannel#messages | TextableChannel#messages}<br>{@link ThreadChannel#messages | ThreadChannel#messages}<br>{@link PrivateChannel#messages | PrivateChannel#messages}
|
|
419
|
+
*/
|
|
420
|
+
async editMessage(channelID, messageID, options) {
|
|
421
|
+
options = this._manager.client.util._freeze(options);
|
|
422
|
+
return this._manager.authRequest({
|
|
423
|
+
method: "PATCH",
|
|
424
|
+
path: Routes.CHANNEL_MESSAGE(channelID, messageID),
|
|
425
|
+
json: {
|
|
426
|
+
allowed_mentions: options.content !== undefined || options.allowedMentions || ((options.flags ?? 0) & Constants_1.MessageFlags.IS_COMPONENTS_V2) !== 0
|
|
427
|
+
? this._manager.client.util.formatAllowedMentions(options.allowedMentions)
|
|
428
|
+
: undefined,
|
|
429
|
+
attachments: options.attachments,
|
|
430
|
+
components: options.components ? this._manager.client.util.componentsToRaw(options.components) : undefined,
|
|
431
|
+
content: options.content,
|
|
432
|
+
embeds: options.embeds ? this._manager.client.util.embedsToRaw(options.embeds) : undefined,
|
|
433
|
+
flags: options.flags
|
|
434
|
+
},
|
|
435
|
+
files: options.files ?? undefined
|
|
436
|
+
}).then(data => this._manager.client.util.updateMessage(data));
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Edit a permission overwrite.
|
|
440
|
+
* @param channelID The ID of the channel to edit the permission overwrite for.
|
|
441
|
+
* @param overwriteID The ID of the permission overwrite to edit.
|
|
442
|
+
* @param options The options for editing the permission overwrite.
|
|
443
|
+
* @caching This method **does not** cache its result.
|
|
444
|
+
*/
|
|
445
|
+
async editPermission(channelID, overwriteID, options) {
|
|
446
|
+
options = this._manager.client.util._freeze(options);
|
|
447
|
+
await this._manager.authRequest({
|
|
448
|
+
method: "PUT",
|
|
449
|
+
path: Routes.CHANNEL_PERMISSION(channelID, overwriteID),
|
|
450
|
+
json: {
|
|
451
|
+
allow: options.allow,
|
|
452
|
+
deny: options.deny,
|
|
453
|
+
type: options.type
|
|
454
|
+
},
|
|
455
|
+
reason: options.reason
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Edit a stage instance.
|
|
460
|
+
* @param channelID The ID of the channel to edit the stage instance on.
|
|
461
|
+
* @param options The options for editing the stage instance.
|
|
462
|
+
* @caching This method **does not** cache its result.
|
|
463
|
+
*/
|
|
464
|
+
async editStageInstance(channelID, options) {
|
|
465
|
+
options = this._manager.client.util._freeze(options);
|
|
466
|
+
return this._manager.authRequest({
|
|
467
|
+
method: "PATCH",
|
|
468
|
+
path: Routes.STAGE_INSTANCE(channelID),
|
|
469
|
+
json: {
|
|
470
|
+
channel_id: channelID,
|
|
471
|
+
topic: options.topic,
|
|
472
|
+
privacy_level: options.privacyLevel
|
|
473
|
+
},
|
|
474
|
+
reason: options.reason
|
|
475
|
+
}).then(data => new StageInstance_1.default(data, this._manager.client));
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* End a poll now.
|
|
479
|
+
* @param channelID The ID of the channel the poll is in.
|
|
480
|
+
* @param messageID The ID of the message the poll is on.
|
|
481
|
+
* @caching This method **does not** cache its result.
|
|
482
|
+
*/
|
|
483
|
+
async expirePoll(channelID, messageID) {
|
|
484
|
+
await this._manager.authRequest({
|
|
485
|
+
method: "POST",
|
|
486
|
+
path: Routes.POLL_EXPIRE(channelID, messageID)
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Follow an announcement channel.
|
|
491
|
+
* @param channelID The ID of the channel to follow announcements from.
|
|
492
|
+
* @param webhookChannelID The ID of the channel crossposted messages should be sent to. The client must have the `MANAGE_WEBHOOKS` permission in this channel.
|
|
493
|
+
* @param reason The reason for following the announcement channel.
|
|
494
|
+
* @caching This method **does not** cache its result.
|
|
495
|
+
*/
|
|
496
|
+
async followAnnouncement(channelID, webhookChannelID, reason) {
|
|
497
|
+
return this._manager.authRequest({
|
|
498
|
+
method: "POST",
|
|
499
|
+
reason,
|
|
500
|
+
path: Routes.CHANNEL_FOLLOWERS(channelID),
|
|
501
|
+
json: { webhook_channel_id: webhookChannelID }
|
|
502
|
+
}).then(data => ({
|
|
503
|
+
channelID: data.channel_id,
|
|
504
|
+
webhookID: data.webhook_id
|
|
505
|
+
}));
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Get a channel.
|
|
509
|
+
* @param channelID The ID of the channel to get.
|
|
510
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
511
|
+
* @caches {@link Guild#channels | Guild#channels}<br>{@link Guild#threads | Guild#threads}<br>{@link Client#privateChannels | Client#privateChannels}<br>{@link Client#groupChannels | Client#groupChannels}
|
|
512
|
+
*/
|
|
513
|
+
async get(channelID) {
|
|
514
|
+
return this._manager.authRequest({
|
|
515
|
+
method: "GET",
|
|
516
|
+
path: Routes.CHANNEL(channelID)
|
|
517
|
+
}).then(data => this._manager.client.util.updateChannel(data));
|
|
518
|
+
}
|
|
519
|
+
async getInvite(code, options) {
|
|
520
|
+
options = this._manager.client.util._freeze(options);
|
|
521
|
+
const query = new QueryBuilder_1.default();
|
|
522
|
+
query.setIfPresent("guild_scheduled_event_id", options?.guildScheduledEventID);
|
|
523
|
+
query.setIfPresent("with_counts", options?.withCounts);
|
|
524
|
+
return this._manager.authRequest({
|
|
525
|
+
method: "GET",
|
|
526
|
+
path: Routes.INVITE(code),
|
|
527
|
+
query
|
|
528
|
+
}).then(data => new Invite_1.default(data, this._manager.client));
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Get the target users for an invite. Requires being the inviter or having the `MANAGE_GUILD` or `VIEW_AUDIT_LOG` permission.
|
|
532
|
+
* @param code The code of the invite.
|
|
533
|
+
*/
|
|
534
|
+
async getInviteTargetUsers(code) {
|
|
535
|
+
return this._manager.authRequest({
|
|
536
|
+
method: "GET",
|
|
537
|
+
path: Routes.INVITE_TARGET_USERS(code)
|
|
538
|
+
}).then(data => data.toString().split(/\r?\n/).filter(line => /^\d{15,}$/.test(line)));
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Get the target users job status for an invite. Requires being the inviter or having the `MANAGE_GUILD` or `VIEW_AUDIT_LOG` permission.
|
|
542
|
+
* @param code The code of the invite.
|
|
543
|
+
*/
|
|
544
|
+
async getInviteTargetUsersJobStatus(code) {
|
|
545
|
+
return this._manager.authRequest({
|
|
546
|
+
method: "GET",
|
|
547
|
+
path: Routes.INVITE_TARGET_USERS_JOB_STATUS(code)
|
|
548
|
+
}).then(data => ({
|
|
549
|
+
completedAt: data.completed_at ? new Date(data.completed_at) : null,
|
|
550
|
+
createdAt: new Date(data.created_at),
|
|
551
|
+
errorMessage: data.error_message,
|
|
552
|
+
processedUsers: data.processed_users,
|
|
553
|
+
status: data.status,
|
|
554
|
+
totalUsers: data.total_users
|
|
555
|
+
}));
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Get the invites of a channel.
|
|
559
|
+
* @param channelID The ID of the channel to get the invites of.
|
|
560
|
+
* @caching This method **does not** cache its result.
|
|
561
|
+
*/
|
|
562
|
+
async getInvites(channelID) {
|
|
563
|
+
return this._manager.authRequest({
|
|
564
|
+
method: "GET",
|
|
565
|
+
path: Routes.CHANNEL_INVITES(channelID)
|
|
566
|
+
}).then(data => data.map(invite => Invite_1.default.withMetadata(invite, this._manager.client)));
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Get the private archived threads the current user has joined in a channel.
|
|
570
|
+
* @param channelID The ID of the channel to get the archived threads from.
|
|
571
|
+
* @param options The options for getting the archived threads.
|
|
572
|
+
* @caching This method **does not** cache its result.
|
|
573
|
+
*/
|
|
574
|
+
async getJoinedPrivateArchivedThreads(channelID, options) {
|
|
575
|
+
options = this._manager.client.util._freeze(options);
|
|
576
|
+
return this._manager.authRequest({
|
|
577
|
+
method: "GET",
|
|
578
|
+
path: Routes.CHANNEL_PRIVATE_ARCHIVED_THREADS(channelID),
|
|
579
|
+
json: {
|
|
580
|
+
before: options?.before,
|
|
581
|
+
limit: options?.limit
|
|
582
|
+
}
|
|
583
|
+
}).then(data => ({
|
|
584
|
+
hasMore: data.has_more,
|
|
585
|
+
members: data.members.map(m => ({
|
|
586
|
+
flags: m.flags,
|
|
587
|
+
id: m.id,
|
|
588
|
+
joinTimestamp: new Date(m.join_timestamp),
|
|
589
|
+
userID: m.user_id
|
|
590
|
+
})),
|
|
591
|
+
threads: data.threads.map(d => this._manager.client.util.updateThread(d))
|
|
592
|
+
}));
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Get a message in a channel.
|
|
596
|
+
* @param channelID The ID of the channel the message is in
|
|
597
|
+
* @param messageID The ID of the message to get.
|
|
598
|
+
* @caching This method **may** cache its result. The result will not be cached if the channel is not cached.
|
|
599
|
+
* @caches {@link TextableChannel#messages | TextableChannel#messages}<br>{@link ThreadChannel#messages | ThreadChannel#messages}<br>{@link PrivateChannel#messages | PrivateChannel#messages}
|
|
600
|
+
*/
|
|
601
|
+
async getMessage(channelID, messageID) {
|
|
602
|
+
return this._manager.authRequest({
|
|
603
|
+
method: "GET",
|
|
604
|
+
path: Routes.CHANNEL_MESSAGE(channelID, messageID)
|
|
605
|
+
}).then(data => this._manager.client.util.updateMessage(data));
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Get messages in a channel.
|
|
609
|
+
* @param channelID The ID of the channel to get messages from.
|
|
610
|
+
* @param options The options for getting messages. `before`, `after`, and `around `All are mutually exclusive.
|
|
611
|
+
* @caching This method **may** cache its result. The result will not be cached if the channel is not cached.
|
|
612
|
+
* @caches {@link TextableChannel#messages | TextableChannel#messages}<br>{@link ThreadChannel#messages | ThreadChannel#messages}<br>{@link PrivateChannel#messages | PrivateChannel#messages}
|
|
613
|
+
*/
|
|
614
|
+
async getMessages(channelID, options) {
|
|
615
|
+
options = this._manager.client.util._freeze(options);
|
|
616
|
+
const query = new QueryBuilder_1.default();
|
|
617
|
+
let chosenOption;
|
|
618
|
+
if (options?.around !== undefined) {
|
|
619
|
+
query.set("around", options.around);
|
|
620
|
+
chosenOption = "around";
|
|
621
|
+
// eslint-disable-next-line unicorn/no-negated-condition
|
|
622
|
+
}
|
|
623
|
+
else if (options?.after !== undefined) {
|
|
624
|
+
query.set("after", options.after);
|
|
625
|
+
chosenOption = "after";
|
|
626
|
+
}
|
|
627
|
+
else {
|
|
628
|
+
query.setIfPresent("before", options?.before);
|
|
629
|
+
chosenOption = "before";
|
|
630
|
+
}
|
|
631
|
+
if (chosenOption === "around" || (options?.limit && options.limit <= 100)) {
|
|
632
|
+
const filter = options?.filter?.bind(this) ?? (() => true);
|
|
633
|
+
if (options?.limit !== undefined) {
|
|
634
|
+
query.set("limit", Math.min(options.limit, 100));
|
|
635
|
+
}
|
|
636
|
+
const messages = await this._manager.authRequest({
|
|
637
|
+
method: "GET",
|
|
638
|
+
path: Routes.CHANNEL_MESSAGES(channelID),
|
|
639
|
+
query
|
|
640
|
+
}).then(data => data.map(d => this._manager.client.util.updateMessage(d)));
|
|
641
|
+
for (const message of Array.from(messages)) {
|
|
642
|
+
const f = filter(message);
|
|
643
|
+
if (f === false) {
|
|
644
|
+
messages.splice(messages.indexOf(message), 1);
|
|
645
|
+
}
|
|
646
|
+
if (f === "break") {
|
|
647
|
+
messages.splice(messages.indexOf(message));
|
|
648
|
+
break;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
return messages;
|
|
652
|
+
}
|
|
653
|
+
const results = [];
|
|
654
|
+
const it = this.getMessagesIterator(channelID, options);
|
|
655
|
+
for await (const messages of it) {
|
|
656
|
+
const limit = messages.length < 100 ? messages.length : it.limit + 100;
|
|
657
|
+
this._manager.client.emit("debug", `Getting ${limit} more message${limit === 1 ? "" : "s"} for ${channelID}: ${it.lastMessage ?? ""}`);
|
|
658
|
+
results.push(...messages);
|
|
659
|
+
}
|
|
660
|
+
return results;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Get an async iterator for getting messages in a channel.
|
|
664
|
+
* @param channelID The ID of the channel to get messages from.
|
|
665
|
+
* @param options The options for getting messages. `before`, `after`, and `around `All are mutually exclusive.
|
|
666
|
+
* @caching This method **may** cache its result. The result will not be cached if the channel is not cached.
|
|
667
|
+
* @caches {@link TextableChannel#messages | TextableChannel#messages}<br>{@link ThreadChannel#messages | ThreadChannel#messages}<br>{@link PrivateChannel#messages | PrivateChannel#messages}
|
|
668
|
+
*/
|
|
669
|
+
getMessagesIterator(channelID, options) {
|
|
670
|
+
options = this._manager.client.util._freeze(options);
|
|
671
|
+
const filter = options?.filter?.bind(this) ?? (() => true);
|
|
672
|
+
const chosenOption = options?.after === undefined ? "before" : "after";
|
|
673
|
+
// arrow functions cannot be generator functions
|
|
674
|
+
// eslint-disable-next-line unicorn/no-this-assignment
|
|
675
|
+
const self = this;
|
|
676
|
+
const it = {
|
|
677
|
+
lastMessage: chosenOption === "after" ? options?.after : options?.before,
|
|
678
|
+
limit: options?.limit ?? 100,
|
|
679
|
+
async *[Symbol.asyncIterator]() {
|
|
680
|
+
loop: while (it.limit > 0) {
|
|
681
|
+
const messages = await self.getMessages(channelID, {
|
|
682
|
+
limit: Math.min(it.limit, 100),
|
|
683
|
+
[chosenOption]: it.lastMessage
|
|
684
|
+
});
|
|
685
|
+
const originalCount = messages.length;
|
|
686
|
+
it.limit -= messages.length;
|
|
687
|
+
for (const message of Array.from(messages)) {
|
|
688
|
+
const f = filter(message);
|
|
689
|
+
if (f === false) {
|
|
690
|
+
messages.splice(messages.indexOf(message), 1);
|
|
691
|
+
}
|
|
692
|
+
if (f === "break") {
|
|
693
|
+
messages.splice(messages.indexOf(message));
|
|
694
|
+
yield messages;
|
|
695
|
+
break loop;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
it.lastMessage = messages.at(-1)?.id;
|
|
699
|
+
yield messages;
|
|
700
|
+
if (originalCount < 100 || it.limit <= 0) {
|
|
701
|
+
break loop;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
return it;
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Get the pinned messages in a channel.
|
|
710
|
+
* @param channelID The ID of the channel to get the pinned messages from.
|
|
711
|
+
* @caching This method **may** cache its result. The result will not be cached if the channel is not cached.
|
|
712
|
+
* @caches {@link TextableChannel#messages | TextableChannel#messages}<br>{@link ThreadChannel#messages | ThreadChannel#messages}<br>{@link PrivateChannel#messages | PrivateChannel#messages}
|
|
713
|
+
*/
|
|
714
|
+
async getPinnedMessages(channelID) {
|
|
715
|
+
return this._manager.authRequest({
|
|
716
|
+
method: "GET",
|
|
717
|
+
path: Routes.CHANNEL_PINS(channelID)
|
|
718
|
+
}).then(data => data.map(d => this._manager.client.util.updateMessage(d)));
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Get the users that voted on a poll answer.
|
|
722
|
+
* @param channelID The ID of the channel the poll is in.
|
|
723
|
+
* @param messageID The ID of the message the poll is on.
|
|
724
|
+
* @param answerID The ID of the poll answer to get voters for.
|
|
725
|
+
* @param options The options for getting the voters.
|
|
726
|
+
* @caching This method **does** cache its result.
|
|
727
|
+
* @caches {@link Client#users | Client#users}
|
|
728
|
+
*/
|
|
729
|
+
async getPollAnswerUsers(channelID, messageID, answerID, options) {
|
|
730
|
+
options = this._manager.client.util._freeze(options);
|
|
731
|
+
const query = new QueryBuilder_1.default();
|
|
732
|
+
query.setIfPresent("after", options?.after);
|
|
733
|
+
query.setIfPresent("limit", options?.limit);
|
|
734
|
+
return this._manager.authRequest({
|
|
735
|
+
method: "GET",
|
|
736
|
+
path: Routes.POLL_ANSWER_USERS(channelID, messageID, answerID),
|
|
737
|
+
query
|
|
738
|
+
}).then(data => {
|
|
739
|
+
const users = data.users.map(user => this._manager.client.users.update(user));
|
|
740
|
+
const message = this._manager.client.getChannel(channelID)?.messages.get(messageID);
|
|
741
|
+
if (message?.poll) {
|
|
742
|
+
this._manager.client.util.replacePollAnswer(message.poll, answerID, users.length, users.map(u => u.id));
|
|
743
|
+
}
|
|
744
|
+
return users;
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* Get the private archived threads in a channel.
|
|
749
|
+
* @param channelID The ID of the channel to get the archived threads from.
|
|
750
|
+
* @param options The options for getting the archived threads.
|
|
751
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
752
|
+
* @caches {@link Guild#threads | Guild#threads}
|
|
753
|
+
*/
|
|
754
|
+
async getPrivateArchivedThreads(channelID, options) {
|
|
755
|
+
options = this._manager.client.util._freeze(options);
|
|
756
|
+
const query = new QueryBuilder_1.default();
|
|
757
|
+
query.setIfPresent("before", options?.before);
|
|
758
|
+
query.setIfPresent("limit", options?.limit);
|
|
759
|
+
return this._manager.authRequest({
|
|
760
|
+
method: "GET",
|
|
761
|
+
path: Routes.CHANNEL_PRIVATE_ARCHIVED_THREADS(channelID),
|
|
762
|
+
query
|
|
763
|
+
}).then(data => ({
|
|
764
|
+
hasMore: data.has_more,
|
|
765
|
+
members: data.members.map(m => ({
|
|
766
|
+
flags: m.flags,
|
|
767
|
+
id: m.id,
|
|
768
|
+
joinTimestamp: new Date(m.join_timestamp),
|
|
769
|
+
userID: m.user_id
|
|
770
|
+
})),
|
|
771
|
+
threads: data.threads.map(d => this._manager.client.util.updateThread(d))
|
|
772
|
+
}));
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Get the private joined archived threads in a channel.
|
|
776
|
+
* @param channelID The ID of the channel to get the archived threads from.
|
|
777
|
+
* @param options The options for getting the archived threads.
|
|
778
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
779
|
+
* @caches {@link Guild#threads | Guild#threads}
|
|
780
|
+
*/
|
|
781
|
+
async getPrivateJoinedArchivedThreads(channelID, options) {
|
|
782
|
+
options = this._manager.client.util._freeze(options);
|
|
783
|
+
const query = new QueryBuilder_1.default();
|
|
784
|
+
query.setIfPresent("before", options?.before);
|
|
785
|
+
query.setIfPresent("limit", options?.limit);
|
|
786
|
+
return this._manager.authRequest({
|
|
787
|
+
method: "GET",
|
|
788
|
+
path: Routes.CHANNEL_JOINED_PRIVATE_ARCHIVED_THREADS(channelID),
|
|
789
|
+
query
|
|
790
|
+
}).then(data => ({
|
|
791
|
+
hasMore: data.has_more,
|
|
792
|
+
members: data.members.map(m => ({
|
|
793
|
+
flags: m.flags,
|
|
794
|
+
id: m.id,
|
|
795
|
+
joinTimestamp: new Date(m.join_timestamp),
|
|
796
|
+
userID: m.user_id
|
|
797
|
+
})),
|
|
798
|
+
threads: data.threads.map(d => this._manager.client.util.updateThread(d))
|
|
799
|
+
}));
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Get the public archived threads in a channel.
|
|
803
|
+
* @param channelID The ID of the channel to get the archived threads from.
|
|
804
|
+
* @param options The options for getting the archived threads.
|
|
805
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
806
|
+
* @caches {@link Guild#threads | Guild#threads}
|
|
807
|
+
*/
|
|
808
|
+
async getPublicArchivedThreads(channelID, options) {
|
|
809
|
+
options = this._manager.client.util._freeze(options);
|
|
810
|
+
const query = new QueryBuilder_1.default();
|
|
811
|
+
query.setIfPresent("before", options?.before);
|
|
812
|
+
query.setIfPresent("limit", options?.limit);
|
|
813
|
+
return this._manager.authRequest({
|
|
814
|
+
method: "GET",
|
|
815
|
+
path: Routes.CHANNEL_PUBLIC_ARCHIVED_THREADS(channelID),
|
|
816
|
+
query
|
|
817
|
+
}).then(data => ({
|
|
818
|
+
hasMore: data.has_more,
|
|
819
|
+
members: data.members.map(m => ({
|
|
820
|
+
flags: m.flags,
|
|
821
|
+
id: m.id,
|
|
822
|
+
joinTimestamp: new Date(m.join_timestamp),
|
|
823
|
+
userID: m.user_id
|
|
824
|
+
})),
|
|
825
|
+
threads: data.threads.map(d => this._manager.client.util.updateThread(d))
|
|
826
|
+
}));
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Get the users who reacted with a specific emoji on a message.
|
|
830
|
+
* @param channelID The ID of the channel the message is in.
|
|
831
|
+
* @param messageID The ID of the message to get reactions from.
|
|
832
|
+
* @param emoji The reaction to remove from the message. `name:id` for custom emojis, and the unicode codepoint for default emojis.
|
|
833
|
+
* @param options The options for getting the reactions.
|
|
834
|
+
* @caching This method **does not** cache its result.
|
|
835
|
+
*/
|
|
836
|
+
async getReactions(channelID, messageID, emoji, options) {
|
|
837
|
+
options = this._manager.client.util._freeze(options);
|
|
838
|
+
const _getReactions = async (_options) => {
|
|
839
|
+
const query = new QueryBuilder_1.default();
|
|
840
|
+
query.setIfPresent("after", _options?.after);
|
|
841
|
+
query.setIfPresent("limit", _options?.limit);
|
|
842
|
+
query.setIfPresent("type", options?.type);
|
|
843
|
+
return this._manager.authRequest({
|
|
844
|
+
method: "GET",
|
|
845
|
+
path: Routes.CHANNEL_REACTION(channelID, messageID, emoji),
|
|
846
|
+
query
|
|
847
|
+
}).then(data => data.map(d => this._manager.client.users.update(d)));
|
|
848
|
+
};
|
|
849
|
+
const limit = options?.limit ?? 100;
|
|
850
|
+
let after = options?.after;
|
|
851
|
+
let reactions = [];
|
|
852
|
+
while (reactions.length < limit) {
|
|
853
|
+
const limitLeft = limit - reactions.length;
|
|
854
|
+
const limitToFetch = Math.min(limitLeft, 100);
|
|
855
|
+
this._manager.client.emit("debug", `Getting ${limitLeft} more ${emoji} reactions for message ${messageID} on ${channelID}: ${after ?? ""}`);
|
|
856
|
+
const reactionsChunk = await _getReactions({
|
|
857
|
+
after,
|
|
858
|
+
limit: limitToFetch
|
|
859
|
+
});
|
|
860
|
+
if (reactionsChunk.length === 0) {
|
|
861
|
+
break;
|
|
862
|
+
}
|
|
863
|
+
reactions = reactions.concat(reactionsChunk);
|
|
864
|
+
after = reactionsChunk.at(-1).id;
|
|
865
|
+
if (reactionsChunk.length < 100) {
|
|
866
|
+
break;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
return reactions;
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Get the stage instance associated with a channel.
|
|
873
|
+
* @param channelID The ID of the channel to get the stage instance on.
|
|
874
|
+
* @caching This method **does not** cache its result.
|
|
875
|
+
*/
|
|
876
|
+
async getStageInstance(channelID) {
|
|
877
|
+
return this._manager.authRequest({
|
|
878
|
+
method: "GET",
|
|
879
|
+
path: Routes.STAGE_INSTANCE(channelID)
|
|
880
|
+
}).then(data => new StageInstance_1.default(data, this._manager.client));
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* Get a thread member.
|
|
884
|
+
* @param channelID The ID of the thread.
|
|
885
|
+
* @param userID The ID of the user to get the thread member of.
|
|
886
|
+
* @caching This method **does not** cache its result.
|
|
887
|
+
*/
|
|
888
|
+
async getThreadMember(channelID, userID) {
|
|
889
|
+
return this._manager.authRequest({
|
|
890
|
+
method: "GET",
|
|
891
|
+
path: Routes.CHANNEL_THREAD_MEMBER(channelID, userID)
|
|
892
|
+
}).then(data => ({
|
|
893
|
+
flags: data.flags,
|
|
894
|
+
id: data.id,
|
|
895
|
+
joinTimestamp: new Date(data.join_timestamp),
|
|
896
|
+
userID: data.user_id
|
|
897
|
+
}));
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* Get the members of a thread.
|
|
901
|
+
* @param channelID The ID of the thread.
|
|
902
|
+
* @param options The options for getting the thread members.
|
|
903
|
+
* @caching This method **does not** cache its result.
|
|
904
|
+
*/
|
|
905
|
+
async getThreadMembers(channelID, options) {
|
|
906
|
+
options = this._manager.client.util._freeze(options);
|
|
907
|
+
const query = new QueryBuilder_1.default();
|
|
908
|
+
query.setIfPresent("after", options?.after);
|
|
909
|
+
query.setIfPresent("limit", options?.limit);
|
|
910
|
+
query.setIfPresent("with_member", options?.withMember);
|
|
911
|
+
return this._manager.authRequest({
|
|
912
|
+
method: "GET",
|
|
913
|
+
path: Routes.CHANNEL_THREAD_MEMBERS(channelID),
|
|
914
|
+
query
|
|
915
|
+
}).then(data => data.map(d => {
|
|
916
|
+
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
917
|
+
const guild = this._manager.client.getChannel(channelID)?.["_cachedGuild"];
|
|
918
|
+
const member = guild && options?.withMember ? guild.members.update(d.member, guild.id) : undefined;
|
|
919
|
+
return {
|
|
920
|
+
flags: d.flags,
|
|
921
|
+
id: d.id,
|
|
922
|
+
joinTimestamp: new Date(d.join_timestamp),
|
|
923
|
+
member,
|
|
924
|
+
userID: d.user_id
|
|
925
|
+
};
|
|
926
|
+
}));
|
|
927
|
+
}
|
|
928
|
+
/** @deprecated Get the list of usable voice regions. Moved to `misc`. */
|
|
929
|
+
async getVoiceRegions() {
|
|
930
|
+
return this._manager.authRequest({
|
|
931
|
+
method: "GET",
|
|
932
|
+
path: Routes.VOICE_REGIONS
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* Join a thread.
|
|
937
|
+
* @param channelID The ID of the thread to join.
|
|
938
|
+
* @caching This method **does not** cache its result.
|
|
939
|
+
*/
|
|
940
|
+
async joinThread(channelID) {
|
|
941
|
+
await this._manager.authRequest({
|
|
942
|
+
method: "PUT",
|
|
943
|
+
path: Routes.CHANNEL_THREAD_MEMBER(channelID, "@me")
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* Leave a thread.
|
|
948
|
+
* @param channelID The ID of the thread to leave.
|
|
949
|
+
* @caching This method **does not** cache its result.
|
|
950
|
+
*/
|
|
951
|
+
async leaveThread(channelID) {
|
|
952
|
+
await this._manager.authRequest({
|
|
953
|
+
method: "DELETE",
|
|
954
|
+
path: Routes.CHANNEL_THREAD_MEMBER(channelID, "@me")
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Pin a message in a channel.
|
|
959
|
+
* @param channelID The ID of the channel to pin the message in.
|
|
960
|
+
* @param messageID The ID of the message to pin.
|
|
961
|
+
* @param reason The reason for pinning the message.
|
|
962
|
+
* @caching This method **does not** cache its result.
|
|
963
|
+
*/
|
|
964
|
+
async pinMessage(channelID, messageID, reason) {
|
|
965
|
+
await this._manager.authRequest({
|
|
966
|
+
method: "PUT",
|
|
967
|
+
path: Routes.CHANNEL_PINNED_MESSAGE(channelID, messageID),
|
|
968
|
+
reason
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* Purge an amount of messages from a channel.
|
|
973
|
+
* @param channelID The ID of the channel to purge.
|
|
974
|
+
* @param options The options to purge. `before`, `after`, and `around `All are mutually exclusive.
|
|
975
|
+
* @caching This method **does not** cache its result.
|
|
976
|
+
*/
|
|
977
|
+
async purgeMessages(channelID, options) {
|
|
978
|
+
options = this._manager.client.util._freeze(options);
|
|
979
|
+
if (options.limit === 0) {
|
|
980
|
+
return 0;
|
|
981
|
+
}
|
|
982
|
+
const filter = (message) => {
|
|
983
|
+
if (message.timestamp.getTime() < Date.now() - 1209600000) {
|
|
984
|
+
return "break";
|
|
985
|
+
}
|
|
986
|
+
return options?.filter?.(message) ?? true;
|
|
987
|
+
};
|
|
988
|
+
let chosenOption;
|
|
989
|
+
if (options.after) {
|
|
990
|
+
chosenOption = "after";
|
|
991
|
+
}
|
|
992
|
+
else if (options.around) {
|
|
993
|
+
chosenOption = "around";
|
|
994
|
+
}
|
|
995
|
+
else {
|
|
996
|
+
chosenOption = "before";
|
|
997
|
+
}
|
|
998
|
+
if (chosenOption === "around" || options.limit <= 100) {
|
|
999
|
+
const messages = await this.getMessages(channelID, {
|
|
1000
|
+
limit: options.limit,
|
|
1001
|
+
[chosenOption]: options[chosenOption]
|
|
1002
|
+
});
|
|
1003
|
+
for (const message of Array.from(messages)) {
|
|
1004
|
+
const f = filter(message);
|
|
1005
|
+
if (f === false) {
|
|
1006
|
+
messages.splice(messages.indexOf(message), 1);
|
|
1007
|
+
}
|
|
1008
|
+
if (f === "break") {
|
|
1009
|
+
messages.splice(messages.indexOf(message));
|
|
1010
|
+
break;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
return this.deleteMessages(channelID, messages.map(message => message.id), options.reason);
|
|
1014
|
+
}
|
|
1015
|
+
const it = this.getMessagesIterator(channelID, {
|
|
1016
|
+
after: options.after,
|
|
1017
|
+
before: options.before,
|
|
1018
|
+
limit: options.limit,
|
|
1019
|
+
filter
|
|
1020
|
+
});
|
|
1021
|
+
let deleted = 0;
|
|
1022
|
+
for await (const messages of it) {
|
|
1023
|
+
deleted += await this.deleteMessages(channelID, messages.map(message => message.id), options.reason);
|
|
1024
|
+
}
|
|
1025
|
+
return deleted;
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Remove a user from the group channel.
|
|
1029
|
+
* @param groupID The ID of the group to remove the user from.
|
|
1030
|
+
* @param userID The ID of the user to remove.
|
|
1031
|
+
* @caching This method **does not** cache its result.
|
|
1032
|
+
*/
|
|
1033
|
+
async removeGroupRecipient(groupID, userID) {
|
|
1034
|
+
await this._manager.authRequest({
|
|
1035
|
+
method: "DELETE",
|
|
1036
|
+
path: Routes.GROUP_RECIPIENT(groupID, userID)
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Remove a member from a thread.
|
|
1041
|
+
* @param channelID The ID of the thread to remove them from.
|
|
1042
|
+
* @param userID The ID of the user to remove from the thread.
|
|
1043
|
+
* @caching This method **does not** cache its result.
|
|
1044
|
+
*/
|
|
1045
|
+
async removeThreadMember(channelID, userID) {
|
|
1046
|
+
await this._manager.authRequest({
|
|
1047
|
+
method: "DELETE",
|
|
1048
|
+
path: Routes.CHANNEL_THREAD_MEMBER(channelID, userID)
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Send a sound from the soundboard to the channel where the user is connected.
|
|
1053
|
+
* @param channelID The ID of the channel to send the soundboard sound to.
|
|
1054
|
+
* @param options The options for sending the soundboard sound.
|
|
1055
|
+
* @caching This method **does not** cache its result.
|
|
1056
|
+
*/
|
|
1057
|
+
async sendSoundboardSound(channelID, options) {
|
|
1058
|
+
options = this._manager.client.util._freeze(options);
|
|
1059
|
+
await this._manager.authRequest({
|
|
1060
|
+
method: "POST",
|
|
1061
|
+
path: Routes.SEND_SOUNDBOARD_SOUND(channelID),
|
|
1062
|
+
json: { sound_id: options.soundID, source_guild_id: options.sourceGuildID }
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Show a typing indicator in a channel. How long users see this varies from client to client.
|
|
1067
|
+
* @param channelID The ID of the channel to show the typing indicator in.
|
|
1068
|
+
* @caching This method **does not** cache its result.
|
|
1069
|
+
*/
|
|
1070
|
+
async sendTyping(channelID) {
|
|
1071
|
+
await this._manager.authRequest({
|
|
1072
|
+
method: "POST",
|
|
1073
|
+
path: Routes.CHANNEL_TYPING(channelID)
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* Set a voice status in a channel.
|
|
1078
|
+
* @param channelID The ID of the channel to set the voice status in.
|
|
1079
|
+
* @param status The voice status to set.
|
|
1080
|
+
*/
|
|
1081
|
+
async setVoiceStatus(channelID, status) {
|
|
1082
|
+
await this._manager.authRequest({
|
|
1083
|
+
method: "PUT",
|
|
1084
|
+
path: Routes.VOICE_STATUS(channelID),
|
|
1085
|
+
json: { status }
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Create a thread from an existing message.
|
|
1090
|
+
* @param channelID The ID of the channel to create the thread in.
|
|
1091
|
+
* @param messageID The ID of the message to create the thread from.
|
|
1092
|
+
* @param options The options for starting the thread.
|
|
1093
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1094
|
+
* @caches {@link Guild#threads | Guild#threads}
|
|
1095
|
+
*/
|
|
1096
|
+
async startThreadFromMessage(channelID, messageID, options) {
|
|
1097
|
+
options = this._manager.client.util._freeze(options);
|
|
1098
|
+
return this._manager.authRequest({
|
|
1099
|
+
method: "POST",
|
|
1100
|
+
path: Routes.CHANNEL_MESSAGE_THREADS(channelID, messageID),
|
|
1101
|
+
json: {
|
|
1102
|
+
auto_archive_duration: options.autoArchiveDuration,
|
|
1103
|
+
name: options.name,
|
|
1104
|
+
rate_limit_per_user: options.rateLimitPerUser
|
|
1105
|
+
},
|
|
1106
|
+
reason: options.reason
|
|
1107
|
+
}).then(data => this._manager.client.util.updateThread(data));
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* Create a thread in a thread only channel (forum & media).
|
|
1111
|
+
* @param channelID The ID of the channel to start the thread in.
|
|
1112
|
+
* @param options The options for starting the thread.
|
|
1113
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1114
|
+
* @caches {@link Guild#threads | Guild#threads}
|
|
1115
|
+
*/
|
|
1116
|
+
async startThreadInThreadOnlyChannel(channelID, options) {
|
|
1117
|
+
options = this._manager.client.util._freeze(options);
|
|
1118
|
+
return this._manager.authRequest({
|
|
1119
|
+
method: "POST",
|
|
1120
|
+
path: Routes.CHANNEL_THREADS(channelID),
|
|
1121
|
+
json: {
|
|
1122
|
+
auto_archive_duration: options.autoArchiveDuration,
|
|
1123
|
+
message: {
|
|
1124
|
+
allowed_mentions: this._manager.client.util.formatAllowedMentions(options.message.allowedMentions),
|
|
1125
|
+
attachments: options.message.attachments,
|
|
1126
|
+
components: options.message.components ? this._manager.client.util.componentsToRaw(options.message.components) : undefined,
|
|
1127
|
+
content: options.message.content,
|
|
1128
|
+
embeds: options.message.embeds ? this._manager.client.util.embedsToRaw(options.message.embeds) : undefined,
|
|
1129
|
+
flags: options.message.flags,
|
|
1130
|
+
sticker_ids: options.message.stickerIDs
|
|
1131
|
+
},
|
|
1132
|
+
name: options.name,
|
|
1133
|
+
rate_limit_per_user: options.rateLimitPerUser,
|
|
1134
|
+
applied_tags: options.appliedTags
|
|
1135
|
+
},
|
|
1136
|
+
reason: options.reason,
|
|
1137
|
+
files: options.message.files
|
|
1138
|
+
}).then(data => this._manager.client.util.updateThread(data));
|
|
1139
|
+
}
|
|
1140
|
+
/**
|
|
1141
|
+
* Create a thread without an existing message.
|
|
1142
|
+
* @param channelID The ID of the channel to start the thread in.
|
|
1143
|
+
* @param options The options for starting the thread.
|
|
1144
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1145
|
+
* @caches {@link Guild#threads | Guild#threads}
|
|
1146
|
+
*/
|
|
1147
|
+
async startThreadWithoutMessage(channelID, options) {
|
|
1148
|
+
options = this._manager.client.util._freeze(options);
|
|
1149
|
+
return this._manager.authRequest({
|
|
1150
|
+
method: "POST",
|
|
1151
|
+
path: Routes.CHANNEL_THREADS(channelID),
|
|
1152
|
+
json: {
|
|
1153
|
+
auto_archive_duration: options.autoArchiveDuration,
|
|
1154
|
+
invitable: options.invitable,
|
|
1155
|
+
name: options.name,
|
|
1156
|
+
rate_limit_per_user: options.rateLimitPerUser,
|
|
1157
|
+
type: options.type
|
|
1158
|
+
},
|
|
1159
|
+
reason: options.reason
|
|
1160
|
+
}).then(data => this._manager.client.util.updateThread(data));
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Unpin a message in a channel.
|
|
1164
|
+
* @param channelID The ID of the channel to unpin the message in.
|
|
1165
|
+
* @param messageID The ID of the message to unpin.
|
|
1166
|
+
* @param reason The reason for unpinning the message.
|
|
1167
|
+
* @caching This method **does not** cache its result.
|
|
1168
|
+
*/
|
|
1169
|
+
async unpinMessage(channelID, messageID, reason) {
|
|
1170
|
+
await this._manager.authRequest({
|
|
1171
|
+
method: "DELETE",
|
|
1172
|
+
path: Routes.CHANNEL_PINNED_MESSAGE(channelID, messageID),
|
|
1173
|
+
reason
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* Update the target users for an invite. Requires being the inviter or having the `MANAGE_GUILD` permission.
|
|
1178
|
+
* @param code The code of the invite.
|
|
1179
|
+
* @param users The IDs of the users to allow accepting the invite.
|
|
1180
|
+
*/
|
|
1181
|
+
async updateInviteTargetUsers(code, users) {
|
|
1182
|
+
return this._manager.authRequest({
|
|
1183
|
+
method: "PUT",
|
|
1184
|
+
path: Routes.INVITE_TARGET_USERS(code),
|
|
1185
|
+
files: [
|
|
1186
|
+
this._manager.client.util._arrayToCSVFile(users, "target_users_file", "user_id")
|
|
1187
|
+
]
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
exports.default = Channels;
|