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,1785 @@
|
|
|
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 ApplicationCommand_1 = __importDefault(require("../structures/ApplicationCommand"));
|
|
40
|
+
const AuditLogEntry_1 = __importDefault(require("../structures/AuditLogEntry"));
|
|
41
|
+
const AutoModerationRule_1 = __importDefault(require("../structures/AutoModerationRule"));
|
|
42
|
+
const Guild_1 = __importDefault(require("../structures/Guild"));
|
|
43
|
+
const GuildPreview_1 = __importDefault(require("../structures/GuildPreview"));
|
|
44
|
+
const GuildScheduledEvent_1 = __importDefault(require("../structures/GuildScheduledEvent"));
|
|
45
|
+
const GuildTemplate_1 = __importDefault(require("../structures/GuildTemplate"));
|
|
46
|
+
const Integration_1 = __importDefault(require("../structures/Integration"));
|
|
47
|
+
const Invite_1 = __importDefault(require("../structures/Invite"));
|
|
48
|
+
const Role_1 = __importDefault(require("../structures/Role"));
|
|
49
|
+
const Soundboard_1 = __importDefault(require("../structures/Soundboard"));
|
|
50
|
+
const VoiceState_1 = __importDefault(require("../structures/VoiceState"));
|
|
51
|
+
const Webhook_1 = __importDefault(require("../structures/Webhook"));
|
|
52
|
+
const QueryBuilder_1 = __importDefault(require("../util/QueryBuilder"));
|
|
53
|
+
const Routes = __importStar(require("../util/Routes"));
|
|
54
|
+
const promises_1 = require("node:timers/promises");
|
|
55
|
+
/** Various methods for interacting with guilds. Located at {@link Client#rest | Client#rest}{@link RESTManager#guilds | .guilds}. */
|
|
56
|
+
class Guilds {
|
|
57
|
+
_manager;
|
|
58
|
+
constructor(manager) {
|
|
59
|
+
this._manager = manager;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Add a member to a guild. Requires an access token with the `guilds.join` scope.
|
|
63
|
+
*
|
|
64
|
+
* Returns the newly added member upon success, or void if the member is already in the guild.
|
|
65
|
+
* @param guildID The ID of the guild.
|
|
66
|
+
* @param userID The ID of the user to add.
|
|
67
|
+
* @param options The options for adding the member.
|
|
68
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
69
|
+
* @caches {@link Guild#members | Guild#members}
|
|
70
|
+
*/
|
|
71
|
+
async addMember(guildID, userID, options) {
|
|
72
|
+
options = this._manager.client.util._freeze(options);
|
|
73
|
+
return this._manager.authRequest({
|
|
74
|
+
method: "PUT",
|
|
75
|
+
path: Routes.GUILD_MEMBER(guildID, userID),
|
|
76
|
+
json: {
|
|
77
|
+
access_token: options.accessToken,
|
|
78
|
+
deaf: options.deaf,
|
|
79
|
+
mute: options.mute,
|
|
80
|
+
nick: options.nick,
|
|
81
|
+
roles: options.roles
|
|
82
|
+
}
|
|
83
|
+
}).then(data => data === null ? undefined : this._manager.client.util.updateMember(guildID, userID, data));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Add a role to a member.
|
|
87
|
+
* @param guildID The ID of the guild.
|
|
88
|
+
* @param memberID The ID of the member.
|
|
89
|
+
* @param roleID The ID of the role to add.
|
|
90
|
+
* @param reason The reason for adding the role.
|
|
91
|
+
* @caching This method **does not** cache its result.
|
|
92
|
+
*/
|
|
93
|
+
async addMemberRole(guildID, memberID, roleID, reason) {
|
|
94
|
+
await this._manager.authRequest({
|
|
95
|
+
method: "PUT",
|
|
96
|
+
path: Routes.GUILD_MEMBER_ROLE(guildID, memberID, roleID),
|
|
97
|
+
reason
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Begin a prune.
|
|
102
|
+
* @param guildID The ID of the guild.
|
|
103
|
+
* @param options The options for the prune.
|
|
104
|
+
* @caching This method **does not** cache its result.
|
|
105
|
+
*/
|
|
106
|
+
async beginPrune(guildID, options) {
|
|
107
|
+
options = this._manager.client.util._freeze(options);
|
|
108
|
+
return this._manager.authRequest({
|
|
109
|
+
method: "POST",
|
|
110
|
+
path: Routes.GUILD_PRUNE(guildID),
|
|
111
|
+
json: {
|
|
112
|
+
days: options?.days,
|
|
113
|
+
compute_prune_count: options?.computePruneCount,
|
|
114
|
+
include_roles: options?.includeRoles
|
|
115
|
+
},
|
|
116
|
+
reason: options?.reason
|
|
117
|
+
}).then(data => data.pruned);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Ban up to 200 members from a guild. This requires both the `BAN_MEMBERS` and `MANAGE_GUILD` permissions.
|
|
121
|
+
* If no members were banned, a {@link Constants~JSONErrorCodes.FAILED_TO_BAN_USERS | FAILED_TO_BAN_USERS } will be returned.
|
|
122
|
+
* The bot user is ignored.
|
|
123
|
+
* @param guildID The ID of the guild.
|
|
124
|
+
* @param options The options for banning.
|
|
125
|
+
*/
|
|
126
|
+
async bulkBan(guildID, options) {
|
|
127
|
+
options = this._manager.client.util._freeze(options);
|
|
128
|
+
return this._manager.authRequest({
|
|
129
|
+
method: "POST",
|
|
130
|
+
path: Routes.GUILD_BULK_BAN(guildID),
|
|
131
|
+
json: {
|
|
132
|
+
delete_message_seconds: options.deleteMessageSeconds,
|
|
133
|
+
user_ids: options.userIDs
|
|
134
|
+
},
|
|
135
|
+
reason: options.reason
|
|
136
|
+
}).then(data => ({
|
|
137
|
+
bannedUsers: data.banned_users,
|
|
138
|
+
failedUsers: data.failed_users
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Create an auto moderation rule for a guild.
|
|
143
|
+
* @param guildID The ID of the guild.
|
|
144
|
+
* @param options The options for creating the rule.
|
|
145
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
146
|
+
* @caches {@link Guild#autoModerationRules | Guild#autoModerationRules}
|
|
147
|
+
*/
|
|
148
|
+
async createAutoModerationRule(guildID, options) {
|
|
149
|
+
options = this._manager.client.util._freeze(options);
|
|
150
|
+
return this._manager.authRequest({
|
|
151
|
+
method: "POST",
|
|
152
|
+
path: Routes.GUILD_AUTOMOD_RULES(guildID),
|
|
153
|
+
json: {
|
|
154
|
+
actions: options.actions.map(a => ({
|
|
155
|
+
metadata: {
|
|
156
|
+
channel_id: a.metadata.channelID,
|
|
157
|
+
custom_message: a.metadata.customMessage,
|
|
158
|
+
duration_seconds: a.metadata.durationSeconds
|
|
159
|
+
},
|
|
160
|
+
type: a.type
|
|
161
|
+
})),
|
|
162
|
+
enabled: options.enabled,
|
|
163
|
+
event_type: options.eventType,
|
|
164
|
+
exempt_channels: options.exemptChannels,
|
|
165
|
+
exempt_roles: options.exemptRoles,
|
|
166
|
+
name: options.name,
|
|
167
|
+
trigger_metadata: options.triggerMetadata ? {
|
|
168
|
+
allow_list: options.triggerMetadata.allowList,
|
|
169
|
+
keyword_filter: options.triggerMetadata.keywordFilter,
|
|
170
|
+
mention_raid_protection_enabled: options.triggerMetadata.mentionRaidProtectionEnabled,
|
|
171
|
+
mention_total_limit: options.triggerMetadata.mentionTotalLimit,
|
|
172
|
+
presets: options.triggerMetadata.presets,
|
|
173
|
+
regex_patterns: options.triggerMetadata.regexPatterns
|
|
174
|
+
} : undefined,
|
|
175
|
+
trigger_type: options.triggerType
|
|
176
|
+
},
|
|
177
|
+
reason: options.reason
|
|
178
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.autoModerationRules.update(data) ?? new AutoModerationRule_1.default(data, this._manager.client));
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Create a ban for a user.
|
|
182
|
+
* @param guildID The ID of the guild.
|
|
183
|
+
* @param userID The ID of the user to ban.
|
|
184
|
+
* @param options The options for creating the ban.
|
|
185
|
+
* @caching This method **does not** cache its result.
|
|
186
|
+
*/
|
|
187
|
+
async createBan(guildID, userID, options) {
|
|
188
|
+
options = this._manager.client.util._freeze(options);
|
|
189
|
+
let deleteMessageSeconds = options?.deleteMessageSeconds;
|
|
190
|
+
if (options?.deleteMessageDays !== undefined && !Object.hasOwn(options, "deleteMessageSeconds")) {
|
|
191
|
+
deleteMessageSeconds = options.deleteMessageDays * 86400;
|
|
192
|
+
}
|
|
193
|
+
await this._manager.authRequest({
|
|
194
|
+
method: "PUT",
|
|
195
|
+
path: Routes.GUILD_BAN(guildID, userID),
|
|
196
|
+
json: { delete_message_seconds: deleteMessageSeconds },
|
|
197
|
+
reason: options?.reason
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Create a channel in a guild.
|
|
202
|
+
* @param guildID The ID of the guild.
|
|
203
|
+
* @param options The options for creating the channel.
|
|
204
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
205
|
+
* @caches {@link Guild#channels | Guild#channels}
|
|
206
|
+
*/
|
|
207
|
+
async createChannel(guildID, type, options) {
|
|
208
|
+
options = this._manager.client.util._freeze(options);
|
|
209
|
+
return this._manager.authRequest({
|
|
210
|
+
method: "POST",
|
|
211
|
+
path: Routes.GUILD_CHANNELS(guildID),
|
|
212
|
+
json: {
|
|
213
|
+
available_tags: options.availableTags ? options.availableTags.map(tag => ({
|
|
214
|
+
emoji_id: tag.emoji?.id,
|
|
215
|
+
emoji_name: tag.emoji?.name,
|
|
216
|
+
moderated: tag.moderated,
|
|
217
|
+
name: tag.name
|
|
218
|
+
})) : options.availableTags,
|
|
219
|
+
bitrate: options.bitrate,
|
|
220
|
+
default_auto_archive_duration: options.defaultAutoArchiveDuration,
|
|
221
|
+
default_forum_layout: options.defaultForumLayout,
|
|
222
|
+
default_reaction_emoji: options.defaultReactionEmoji ? { emoji_id: options.defaultReactionEmoji.id, emoji_name: options.defaultReactionEmoji.name } : options.defaultReactionEmoji,
|
|
223
|
+
default_sort_order: options.defaultSortOrder,
|
|
224
|
+
name: options.name,
|
|
225
|
+
nsfw: options.nsfw,
|
|
226
|
+
parent_id: options.parentID,
|
|
227
|
+
permission_overwrites: options.permissionOverwrites,
|
|
228
|
+
position: options.position,
|
|
229
|
+
rate_limit_per_user: options.rateLimitPerUser,
|
|
230
|
+
rtc_region: options.rtcRegion,
|
|
231
|
+
topic: options.topic,
|
|
232
|
+
type,
|
|
233
|
+
user_limit: options.userLimit,
|
|
234
|
+
video_quality_mode: options.videoQualityMode
|
|
235
|
+
},
|
|
236
|
+
reason: options.reason
|
|
237
|
+
}).then(data => this._manager.client.util.updateChannel(data));
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Create an emoji in a guild.
|
|
241
|
+
* @param guildID The ID of the guild.
|
|
242
|
+
* @param options The options for creating the emoji.
|
|
243
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
244
|
+
* @caches {@link Guild#emojis | Guild#emojis}<br>{@link Client#users | Client#users} (creator, if applicable)
|
|
245
|
+
*/
|
|
246
|
+
async createEmoji(guildID, options) {
|
|
247
|
+
options = this._manager.client.util._freeze(options);
|
|
248
|
+
let image;
|
|
249
|
+
if (options.image) {
|
|
250
|
+
image = this._manager.client.util._convertImage(options.image, "image");
|
|
251
|
+
}
|
|
252
|
+
return this._manager.authRequest({
|
|
253
|
+
method: "POST",
|
|
254
|
+
path: Routes.GUILD_EMOJIS(guildID),
|
|
255
|
+
json: {
|
|
256
|
+
image,
|
|
257
|
+
name: options.name,
|
|
258
|
+
roles: options.roles
|
|
259
|
+
},
|
|
260
|
+
reason: options.reason
|
|
261
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.emojis.update(data) ?? this._manager.client.util.convertGuildEmoji(data));
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Create a role.
|
|
265
|
+
* @param guildID The ID of the guild.
|
|
266
|
+
* @param options The options for creating the role.
|
|
267
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
268
|
+
* @caches {@link Guild#roles | Guild#roles}
|
|
269
|
+
*/
|
|
270
|
+
async createRole(guildID, options) {
|
|
271
|
+
options = this._manager.client.util._freeze(options);
|
|
272
|
+
let icon;
|
|
273
|
+
if (options?.icon) {
|
|
274
|
+
icon = this._manager.client.util._convertImage(options.icon, "icon");
|
|
275
|
+
}
|
|
276
|
+
return this._manager.authRequest({
|
|
277
|
+
method: "POST",
|
|
278
|
+
path: Routes.GUILD_ROLES(guildID),
|
|
279
|
+
json: {
|
|
280
|
+
colors: options?.colors || options?.color ? {
|
|
281
|
+
primary_color: options.colors?.primaryColor ?? options.color,
|
|
282
|
+
secondary_color: options.colors?.secondaryColor,
|
|
283
|
+
tertiary_color: options.colors?.tertiaryColor
|
|
284
|
+
} : undefined,
|
|
285
|
+
hoist: options?.hoist,
|
|
286
|
+
icon,
|
|
287
|
+
mentionable: options?.mentionable,
|
|
288
|
+
name: options?.name,
|
|
289
|
+
permissions: options?.permissions,
|
|
290
|
+
unicode_emoji: options?.unicodeEmoji
|
|
291
|
+
},
|
|
292
|
+
reason: options?.reason
|
|
293
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.roles.update(data, guildID) ?? new Role_1.default(data, this._manager.client, guildID));
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Create a scheduled event in a guild.
|
|
297
|
+
* @param guildID The ID of the guild.
|
|
298
|
+
* @param options The options for creating the scheduled event.
|
|
299
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
300
|
+
* @caches {@link Guild#scheduledEvents | Guild#scheduledEvents}
|
|
301
|
+
*/
|
|
302
|
+
async createScheduledEvent(guildID, options) {
|
|
303
|
+
options = this._manager.client.util._freeze(options);
|
|
304
|
+
let image;
|
|
305
|
+
if (options.image) {
|
|
306
|
+
image = this._manager.client.util._convertImage(options.image, "image");
|
|
307
|
+
}
|
|
308
|
+
return this._manager.authRequest({
|
|
309
|
+
method: "POST",
|
|
310
|
+
path: Routes.GUILD_SCHEDULED_EVENTS(guildID),
|
|
311
|
+
json: {
|
|
312
|
+
channel_id: options.channelID,
|
|
313
|
+
description: options.description,
|
|
314
|
+
entity_metadata: options.entityMetadata ? { location: options.entityMetadata.location } : undefined,
|
|
315
|
+
entity_type: options.entityType,
|
|
316
|
+
image,
|
|
317
|
+
name: options.name,
|
|
318
|
+
privacy_level: options.privacyLevel,
|
|
319
|
+
scheduled_end_time: options.scheduledEndTime,
|
|
320
|
+
scheduled_start_time: options.scheduledStartTime
|
|
321
|
+
},
|
|
322
|
+
reason: options.reason
|
|
323
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.scheduledEvents.update(data) ?? new GuildScheduledEvent_1.default(data, this._manager.client));
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Create a soundboard sound
|
|
327
|
+
* @param guildID The ID of the guild
|
|
328
|
+
* @param options The options for creating the soundboard sound
|
|
329
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
330
|
+
* @caches {@link Guild#soundboardSounds | Guild#soundboardSounds}
|
|
331
|
+
*/
|
|
332
|
+
async createSoundboardSound(guildID, options) {
|
|
333
|
+
options = this._manager.client.util._freeze(options);
|
|
334
|
+
let sound;
|
|
335
|
+
if (options.sound) {
|
|
336
|
+
sound = this._manager.client.util._convertSound(options.sound, "sound");
|
|
337
|
+
}
|
|
338
|
+
return this._manager.authRequest({
|
|
339
|
+
method: "POST",
|
|
340
|
+
path: Routes.SOUNDBOARD_SOUNDS(guildID),
|
|
341
|
+
json: {
|
|
342
|
+
emoji_id: options.emojiID,
|
|
343
|
+
emoji_name: options.emojiName,
|
|
344
|
+
name: options.name,
|
|
345
|
+
sound,
|
|
346
|
+
volume: options.volume
|
|
347
|
+
},
|
|
348
|
+
reason: options.reason
|
|
349
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.soundboardSounds.update(data) ?? new Soundboard_1.default(data, this._manager.client));
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Create a sticker.
|
|
353
|
+
* @param guildID The ID of the guild.
|
|
354
|
+
* @param options The options for creating the sticker.
|
|
355
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
356
|
+
* @caches {@link Guild#stickers | Guild#stickers}<br>{@link Client#users | Client#users} (creator, if applicable)
|
|
357
|
+
*/
|
|
358
|
+
async createSticker(guildID, options) {
|
|
359
|
+
options = this._manager.client.util._freeze(options);
|
|
360
|
+
const magic = this._manager.client.util.getMagic(options.file.contents);
|
|
361
|
+
let mime;
|
|
362
|
+
switch (magic) {
|
|
363
|
+
// png & apng have the same magic
|
|
364
|
+
case "89504E47": {
|
|
365
|
+
mime = "image/png";
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
// lottie
|
|
369
|
+
case "7B227622": {
|
|
370
|
+
mime = "application/json";
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
const form = new FormData();
|
|
375
|
+
form.append("description", options.description);
|
|
376
|
+
form.append("name", options.name);
|
|
377
|
+
form.append("tags", options.tags);
|
|
378
|
+
form.append("file", new Blob([options.file.contents], { type: mime }), options.file.name);
|
|
379
|
+
return this._manager.authRequest({
|
|
380
|
+
method: "POST",
|
|
381
|
+
path: Routes.GUILD_STICKERS(guildID),
|
|
382
|
+
form,
|
|
383
|
+
reason: options.reason
|
|
384
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.stickers.update(data) ?? this._manager.client.util.convertSticker(data));
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Create a guild template.
|
|
388
|
+
* @param guildID The ID of the guild to create a template from.
|
|
389
|
+
* @param options The options for creating the template.
|
|
390
|
+
*/
|
|
391
|
+
async createTemplate(guildID, options) {
|
|
392
|
+
options = this._manager.client.util._freeze(options);
|
|
393
|
+
return this._manager.authRequest({
|
|
394
|
+
method: "POST",
|
|
395
|
+
path: Routes.GUILD_TEMPLATES(guildID),
|
|
396
|
+
json: {
|
|
397
|
+
description: options.description,
|
|
398
|
+
name: options.name
|
|
399
|
+
}
|
|
400
|
+
}).then(data => new GuildTemplate_1.default(data, this._manager.client));
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Delete an auto moderation rule.
|
|
404
|
+
* @param guildID The ID of the guild.
|
|
405
|
+
* @param ruleID The ID of the rule to delete.
|
|
406
|
+
* @param reason The reason for deleting the rule.
|
|
407
|
+
* @caching This method **does not** cache its result.
|
|
408
|
+
*/
|
|
409
|
+
async deleteAutoModerationRule(guildID, ruleID, reason) {
|
|
410
|
+
await this._manager.authRequest({
|
|
411
|
+
method: "DELETE",
|
|
412
|
+
path: Routes.GUILD_AUTOMOD_RULE(guildID, ruleID),
|
|
413
|
+
reason
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Delete an emoji.
|
|
418
|
+
* @param guildID The ID of the guild.
|
|
419
|
+
* @param emojiID The ID of the emoji.
|
|
420
|
+
* @param reason The reason for deleting the emoji.
|
|
421
|
+
* @caching This method **does not** cache its result.
|
|
422
|
+
*/
|
|
423
|
+
async deleteEmoji(guildID, emojiID, reason) {
|
|
424
|
+
await this._manager.authRequest({
|
|
425
|
+
method: "DELETE",
|
|
426
|
+
path: Routes.GUILD_EMOJI(guildID, emojiID),
|
|
427
|
+
reason
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Delete an integration.
|
|
432
|
+
* @param guildID The ID of the guild.
|
|
433
|
+
* @param integrationID The ID of the integration.
|
|
434
|
+
* @param reason The reason for deleting the integration.
|
|
435
|
+
* @caching This method **does not** cache its result.
|
|
436
|
+
*/
|
|
437
|
+
async deleteIntegration(guildID, integrationID, reason) {
|
|
438
|
+
await this._manager.authRequest({
|
|
439
|
+
method: "DELETE",
|
|
440
|
+
path: Routes.GUILD_INTEGRATION(guildID, integrationID),
|
|
441
|
+
reason
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Delete a role.
|
|
446
|
+
* @param guildID The ID of the guild.
|
|
447
|
+
* @param roleID The ID of the role to delete.
|
|
448
|
+
* @param reason The reason for deleting the role.
|
|
449
|
+
* @caching This method **does not** cache its result.
|
|
450
|
+
*/
|
|
451
|
+
async deleteRole(guildID, roleID, reason) {
|
|
452
|
+
await this._manager.authRequest({
|
|
453
|
+
method: "DELETE",
|
|
454
|
+
path: Routes.GUILD_ROLE(guildID, roleID),
|
|
455
|
+
reason
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Delete a scheduled event.
|
|
460
|
+
* @param guildID The ID of the guild.
|
|
461
|
+
* @param eventID The ID of the scheduled event.
|
|
462
|
+
* @param reason The reason for deleting the scheduled event. Discord's docs do not explicitly state a reason can be provided, so it may not be used.
|
|
463
|
+
* @caching This method **does not** cache its result.
|
|
464
|
+
*/
|
|
465
|
+
async deleteScheduledEvent(guildID, eventID, reason) {
|
|
466
|
+
await this._manager.authRequest({
|
|
467
|
+
method: "DELETE",
|
|
468
|
+
path: Routes.GUILD_SCHEDULED_EVENT(guildID, eventID),
|
|
469
|
+
reason
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
*
|
|
474
|
+
* @param guildID The ID of the guild.
|
|
475
|
+
* @param soundID The ID of the soundboard sound to delete.
|
|
476
|
+
* @param reason The reason for deleting the soundboard sound.
|
|
477
|
+
* @caching This method **does not** cache its result.
|
|
478
|
+
*/
|
|
479
|
+
async deleteSoundboardSound(guildID, soundID, reason) {
|
|
480
|
+
await this._manager.authRequest({
|
|
481
|
+
method: "DELETE",
|
|
482
|
+
path: Routes.SOUNDBOARD_SOUND(guildID, soundID),
|
|
483
|
+
reason
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Delete a sticker.
|
|
488
|
+
* @param guildID The ID of the guild.
|
|
489
|
+
* @param stickerID The ID of the sticker to delete.
|
|
490
|
+
* @param reason The reason for deleting the sticker.
|
|
491
|
+
* @caching This method **does not** cache its result.
|
|
492
|
+
*/
|
|
493
|
+
async deleteSticker(guildID, stickerID, reason) {
|
|
494
|
+
await this._manager.authRequest({
|
|
495
|
+
method: "DELETE",
|
|
496
|
+
path: Routes.GUILD_STICKER(guildID, stickerID),
|
|
497
|
+
reason
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Delete a template.
|
|
502
|
+
* @param guildID The ID of the guild.
|
|
503
|
+
* @param code The code of the template.
|
|
504
|
+
* @caching This method **does not** cache its result.
|
|
505
|
+
*/
|
|
506
|
+
async deleteTemplate(guildID, code) {
|
|
507
|
+
await this._manager.authRequest({
|
|
508
|
+
method: "DELETE",
|
|
509
|
+
path: Routes.GUILD_TEMPLATE(guildID, code)
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Edit a guild.
|
|
514
|
+
* @param guildID The ID of the guild.
|
|
515
|
+
* @param options The options for editing the guild.
|
|
516
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not already cached.
|
|
517
|
+
* @caches {@link Client#guilds | Client#guilds}
|
|
518
|
+
*/
|
|
519
|
+
async edit(guildID, options) {
|
|
520
|
+
options = this._manager.client.util._freeze(options);
|
|
521
|
+
let banner, discoverySplash, icon, splash;
|
|
522
|
+
if (options.banner) {
|
|
523
|
+
banner = this._manager.client.util._convertImage(options.banner, "banner");
|
|
524
|
+
}
|
|
525
|
+
if (options.discoverySplash) {
|
|
526
|
+
discoverySplash = this._manager.client.util._convertImage(options.discoverySplash, "discovery splash");
|
|
527
|
+
}
|
|
528
|
+
if (options.icon) {
|
|
529
|
+
icon = this._manager.client.util._convertImage(options.icon, "icon");
|
|
530
|
+
}
|
|
531
|
+
if (options.splash) {
|
|
532
|
+
splash = this._manager.client.util._convertImage(options.splash, "splash");
|
|
533
|
+
}
|
|
534
|
+
return this._manager.authRequest({
|
|
535
|
+
method: "PATCH",
|
|
536
|
+
path: Routes.GUILD(guildID),
|
|
537
|
+
json: {
|
|
538
|
+
afk_channel_id: options.afkChannelID,
|
|
539
|
+
afk_timeout: options.afkTimeout,
|
|
540
|
+
banner,
|
|
541
|
+
default_message_notifications: options.defaultMessageNotifications,
|
|
542
|
+
description: options.description,
|
|
543
|
+
discovery_splash: discoverySplash,
|
|
544
|
+
explicit_content_filter: options.explicitContentFilter,
|
|
545
|
+
features: options.features,
|
|
546
|
+
icon,
|
|
547
|
+
name: options.name,
|
|
548
|
+
preferred_locale: options.preferredLocale,
|
|
549
|
+
premium_progress_bar_enabled: options.premiumProgressBarEnabled,
|
|
550
|
+
public_updates_channel_id: options.publicUpdatesChannelID,
|
|
551
|
+
region: options.region,
|
|
552
|
+
rules_channel_id: options.rulesChannelID,
|
|
553
|
+
safety_alerts_channel_id: options.safetyAlertsChannelID,
|
|
554
|
+
splash,
|
|
555
|
+
system_channel_flags: options.systemChannelFlags,
|
|
556
|
+
system_channel_id: options.systemChannelID,
|
|
557
|
+
verification_level: options.verificationLevel
|
|
558
|
+
},
|
|
559
|
+
reason: options.reason
|
|
560
|
+
}).then(data => this._manager.client.guilds.has(guildID) ? this._manager.client.guilds.update(data, true) : new Guild_1.default(data, this._manager.client, true));
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Edit an existing auto moderation rule.
|
|
564
|
+
* @param guildID The ID of the guild.
|
|
565
|
+
* @param ruleID The ID of the rule to edit.
|
|
566
|
+
* @param options The options for editing the rule.
|
|
567
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
568
|
+
* @caches {@link Guild#autoModerationRules | Guild#autoModerationRules}
|
|
569
|
+
*/
|
|
570
|
+
async editAutoModerationRule(guildID, ruleID, options) {
|
|
571
|
+
options = this._manager.client.util._freeze(options);
|
|
572
|
+
return this._manager.authRequest({
|
|
573
|
+
method: "PATCH",
|
|
574
|
+
path: Routes.GUILD_AUTOMOD_RULE(guildID, ruleID),
|
|
575
|
+
json: {
|
|
576
|
+
actions: options.actions?.map(a => ({
|
|
577
|
+
metadata: {
|
|
578
|
+
channel_id: a.metadata.channelID,
|
|
579
|
+
custom_message: a.metadata.customMessage,
|
|
580
|
+
duration_seconds: a.metadata.durationSeconds
|
|
581
|
+
},
|
|
582
|
+
type: a.type
|
|
583
|
+
})),
|
|
584
|
+
enabled: options.enabled,
|
|
585
|
+
event_type: options.eventType,
|
|
586
|
+
exempt_channels: options.exemptChannels,
|
|
587
|
+
exempt_roles: options.exemptRoles,
|
|
588
|
+
name: options.name,
|
|
589
|
+
trigger_metadata: options.triggerMetadata ? {
|
|
590
|
+
allow_list: options.triggerMetadata.allowList,
|
|
591
|
+
keyword_filter: options.triggerMetadata.keywordFilter,
|
|
592
|
+
mention_raid_protection_enabled: options.triggerMetadata.mentionRaidProtectionEnabled,
|
|
593
|
+
mention_total_limit: options.triggerMetadata.mentionTotalLimit,
|
|
594
|
+
presets: options.triggerMetadata.presets,
|
|
595
|
+
regex_patterns: options.triggerMetadata.regexPatterns
|
|
596
|
+
} : undefined
|
|
597
|
+
},
|
|
598
|
+
reason: options.reason
|
|
599
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.autoModerationRules.update(data) ?? new AutoModerationRule_1.default(data, this._manager.client));
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Edit the positions of channels in a guild.
|
|
603
|
+
* @param guildID The ID of the guild.
|
|
604
|
+
* @param options The channels to move. Unedited channels do not need to be specified.
|
|
605
|
+
* @caching This method **does not** cache its result.
|
|
606
|
+
*/
|
|
607
|
+
async editChannelPositions(guildID, options) {
|
|
608
|
+
options = this._manager.client.util._freeze(options);
|
|
609
|
+
await this._manager.authRequest({
|
|
610
|
+
method: "PATCH",
|
|
611
|
+
path: Routes.GUILD_CHANNELS(guildID),
|
|
612
|
+
json: options.map(o => ({
|
|
613
|
+
id: o.id,
|
|
614
|
+
// lock_permissions: o.lockPermissions ?? null,
|
|
615
|
+
// parent_id: o.parentID ?? null,
|
|
616
|
+
position: o.position ?? null
|
|
617
|
+
}))
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Modify the current member in a guild.
|
|
622
|
+
* @param guildID The ID of the guild.
|
|
623
|
+
* @param options The options for editing the member.
|
|
624
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
625
|
+
* @caches {@link Guild#members | Guild#members}<br>{@link Guild#clientMember | Guild#clientMember}
|
|
626
|
+
*/
|
|
627
|
+
async editCurrentMember(guildID, options) {
|
|
628
|
+
options = this._manager.client.util._freeze(options);
|
|
629
|
+
let avatar = options.avatar;
|
|
630
|
+
let banner = options.banner;
|
|
631
|
+
if (avatar) {
|
|
632
|
+
avatar = this._manager.client.util._convertImage(avatar, "avatar");
|
|
633
|
+
}
|
|
634
|
+
if (banner) {
|
|
635
|
+
banner = this._manager.client.util._convertImage(banner, "banner");
|
|
636
|
+
}
|
|
637
|
+
return this._manager.authRequest({
|
|
638
|
+
method: "PATCH",
|
|
639
|
+
path: Routes.GUILD_MEMBER(guildID, "@me"),
|
|
640
|
+
json: { nick: options.nick, banner, avatar, bio: options.bio },
|
|
641
|
+
reason: options.reason
|
|
642
|
+
}).then(data => this._manager.client.util.updateMember(guildID, data.user.id, data));
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Edit the current member's voice state in a guild. `channelID` is required, and the current member must already be in that channel. See [Discord's docs](https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state-caveats) for more information.
|
|
646
|
+
* @param guildID The ID of the guild.
|
|
647
|
+
* @param options The options for editing the voice state.
|
|
648
|
+
* @caching This method **does not** cache its result.
|
|
649
|
+
*/
|
|
650
|
+
async editCurrentUserVoiceState(guildID, options) {
|
|
651
|
+
options = this._manager.client.util._freeze(options);
|
|
652
|
+
await this._manager.authRequest({
|
|
653
|
+
method: "PATCH",
|
|
654
|
+
path: Routes.GUILD_VOICE_STATE(guildID, "@me"),
|
|
655
|
+
json: {
|
|
656
|
+
channel_id: options.channelID,
|
|
657
|
+
suppress: options.suppress,
|
|
658
|
+
request_to_speak_timestamp: options.requestToSpeakTimestamp
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Edit an existing emoji.
|
|
664
|
+
* @param guildID The ID of the guild the emoji is in.
|
|
665
|
+
* @param options The options for editing the emoji.
|
|
666
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
667
|
+
* @caches {@link Guild#emojis | Guild#emojis}
|
|
668
|
+
*/
|
|
669
|
+
async editEmoji(guildID, emojiID, options) {
|
|
670
|
+
options = this._manager.client.util._freeze(options);
|
|
671
|
+
return this._manager.authRequest({
|
|
672
|
+
method: "PATCH",
|
|
673
|
+
path: Routes.GUILD_EMOJI(guildID, emojiID),
|
|
674
|
+
json: {
|
|
675
|
+
name: options.name,
|
|
676
|
+
roles: options.roles
|
|
677
|
+
},
|
|
678
|
+
reason: options.reason
|
|
679
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.emojis.update(data) ?? this._manager.client.util.convertGuildEmoji(data));
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Edit the incident actions for a guild.
|
|
683
|
+
* @param guildID The ID of the guild.
|
|
684
|
+
* @param options The options for editing the incident actions.
|
|
685
|
+
* @caching This method **does not** cache its result.
|
|
686
|
+
*/
|
|
687
|
+
async editIncidentActions(guildID, options) {
|
|
688
|
+
options = this._manager.client.util._freeze(options);
|
|
689
|
+
return this._manager.authRequest({
|
|
690
|
+
method: "PUT",
|
|
691
|
+
path: Routes.GUILD_INCIDENT_ACTIONS(guildID),
|
|
692
|
+
json: {
|
|
693
|
+
dms_disabled_until: options.dmsDisabledUntil,
|
|
694
|
+
invites_disabled_until: options.invitesDisabledUntil
|
|
695
|
+
},
|
|
696
|
+
reason: options.reason
|
|
697
|
+
}).then(data => ({
|
|
698
|
+
dmsDisabledUntil: data.dms_disabled_until,
|
|
699
|
+
invitesDisabledUntil: data.invites_disabled_until
|
|
700
|
+
}));
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Edit a guild member. Use editCurrentMember if you wish to update the nick of this client using the `CHANGE_NICKNAME` permission.
|
|
704
|
+
* @param guildID The ID of the guild.
|
|
705
|
+
* @param memberID The ID of the member.
|
|
706
|
+
* @param options The options for editing the member.
|
|
707
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
708
|
+
* @caches {@link Guild#members | Guild#members}
|
|
709
|
+
*/
|
|
710
|
+
async editMember(guildID, memberID, options) {
|
|
711
|
+
options = this._manager.client.util._freeze(options);
|
|
712
|
+
return this._manager.authRequest({
|
|
713
|
+
method: "PATCH",
|
|
714
|
+
path: Routes.GUILD_MEMBER(guildID, memberID),
|
|
715
|
+
json: {
|
|
716
|
+
channel_id: options.channelID,
|
|
717
|
+
communication_disabled_until: options.communicationDisabledUntil,
|
|
718
|
+
deaf: options.deaf,
|
|
719
|
+
flags: options.flags,
|
|
720
|
+
mute: options.mute,
|
|
721
|
+
nick: options.nick,
|
|
722
|
+
roles: options.roles
|
|
723
|
+
},
|
|
724
|
+
reason: options.reason
|
|
725
|
+
}).then(data => this._manager.client.util.updateMember(guildID, memberID, data));
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Edit a guild's onboarding configuration.
|
|
729
|
+
* @param guildID The ID of the guild.
|
|
730
|
+
* @param options The options for editing the onboarding configuration.
|
|
731
|
+
* @caching This method **does not** cache its result.
|
|
732
|
+
*/
|
|
733
|
+
async editOnboarding(guildID, options) {
|
|
734
|
+
options = this._manager.client.util._freeze(options);
|
|
735
|
+
return this._manager.authRequest({
|
|
736
|
+
method: "PATCH",
|
|
737
|
+
path: Routes.GUILD_ONBOARDING(guildID),
|
|
738
|
+
json: {
|
|
739
|
+
enabled: options.enabled,
|
|
740
|
+
default_channel_ids: options.defaultChannelIDs,
|
|
741
|
+
prompts: options.prompts?.map(p => ({
|
|
742
|
+
id: p.id,
|
|
743
|
+
in_oboarding: p.inOnboarding,
|
|
744
|
+
options: p.options.map(o => ({
|
|
745
|
+
channel_ids: o.channelIDs,
|
|
746
|
+
description: o.description,
|
|
747
|
+
emoji: o.emoji,
|
|
748
|
+
id: o.id,
|
|
749
|
+
role_ids: o.roleIDs,
|
|
750
|
+
title: o.title
|
|
751
|
+
})),
|
|
752
|
+
required: p.required,
|
|
753
|
+
single_select: p.singleSelect,
|
|
754
|
+
title: p.title
|
|
755
|
+
})),
|
|
756
|
+
mode: options.mode
|
|
757
|
+
},
|
|
758
|
+
reason: options.reason
|
|
759
|
+
}).then(data => ({
|
|
760
|
+
defaultChannelIDs: data.default_channel_ids,
|
|
761
|
+
enabled: data.enabled,
|
|
762
|
+
guildID: data.guild_id,
|
|
763
|
+
mode: data.mode,
|
|
764
|
+
prompts: data.prompts.map(p => ({
|
|
765
|
+
id: p.id,
|
|
766
|
+
inOnboarding: p.in_onboarding,
|
|
767
|
+
options: p.options.map(o => ({
|
|
768
|
+
channelIDs: o.channel_ids,
|
|
769
|
+
description: o.description,
|
|
770
|
+
emoji: o.emoji,
|
|
771
|
+
id: o.id,
|
|
772
|
+
roleIDs: o.role_ids,
|
|
773
|
+
title: o.title
|
|
774
|
+
})),
|
|
775
|
+
required: p.required,
|
|
776
|
+
singleSelect: p.single_select,
|
|
777
|
+
title: p.title
|
|
778
|
+
}))
|
|
779
|
+
}));
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Edit an existing role.
|
|
783
|
+
* @param guildID The ID of the guild.
|
|
784
|
+
* @param options The options for editing the role.
|
|
785
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
786
|
+
* @caches {@link Guild#roles | Guild#roles}
|
|
787
|
+
*/
|
|
788
|
+
async editRole(guildID, roleID, options) {
|
|
789
|
+
options = this._manager.client.util._freeze(options);
|
|
790
|
+
let icon;
|
|
791
|
+
if (options.icon) {
|
|
792
|
+
icon = this._manager.client.util._convertImage(options.icon, "icon");
|
|
793
|
+
}
|
|
794
|
+
return this._manager.authRequest({
|
|
795
|
+
method: "PATCH",
|
|
796
|
+
path: Routes.GUILD_ROLE(guildID, roleID),
|
|
797
|
+
json: {
|
|
798
|
+
colors: options?.colors || options?.color ? {
|
|
799
|
+
primary_color: options.colors?.primaryColor ?? options.color,
|
|
800
|
+
secondary_color: options.colors?.secondaryColor,
|
|
801
|
+
tertiary_color: options.colors?.tertiaryColor
|
|
802
|
+
} : undefined,
|
|
803
|
+
hoist: options.hoist,
|
|
804
|
+
icon,
|
|
805
|
+
mentionable: options.mentionable,
|
|
806
|
+
name: options.name,
|
|
807
|
+
permissions: options.permissions,
|
|
808
|
+
unicode_emoji: options.unicodeEmoji
|
|
809
|
+
},
|
|
810
|
+
reason: options.reason
|
|
811
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.roles.update(data, guildID) ?? new Role_1.default(data, this._manager.client, guildID));
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Edit the position of roles in a guild.
|
|
815
|
+
* @param guildID The ID of the guild.
|
|
816
|
+
* @param options The roles to move.
|
|
817
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
818
|
+
* @caches {@link Guild#roles | Guild#roles}
|
|
819
|
+
*/
|
|
820
|
+
async editRolePositions(guildID, options, reason) {
|
|
821
|
+
options = this._manager.client.util._freeze(options);
|
|
822
|
+
const guild = this._manager.client.guilds.get(guildID);
|
|
823
|
+
return this._manager.authRequest({
|
|
824
|
+
method: "PATCH",
|
|
825
|
+
path: Routes.GUILD_ROLES(guildID),
|
|
826
|
+
json: options.map(o => ({
|
|
827
|
+
id: o.id,
|
|
828
|
+
position: o.position
|
|
829
|
+
})),
|
|
830
|
+
reason
|
|
831
|
+
}).then(data => data.map(role => guild?.roles.update(role, guildID) ?? new Role_1.default(role, this._manager.client, guildID)));
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Edit an existing scheduled event in a guild.
|
|
835
|
+
* @param guildID The ID of the guild.
|
|
836
|
+
* @param scheduledEventID The ID of the scheduled event.
|
|
837
|
+
* @param options The options for editing the scheduled event.
|
|
838
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
839
|
+
* @caches {@link Guild#scheduledEvents | Guild#scheduledEvents}
|
|
840
|
+
*/
|
|
841
|
+
async editScheduledEvent(guildID, scheduledEventID, options) {
|
|
842
|
+
options = this._manager.client.util._freeze(options);
|
|
843
|
+
let image;
|
|
844
|
+
if (options.image) {
|
|
845
|
+
image = this._manager.client.util._convertImage(options.image, "image");
|
|
846
|
+
}
|
|
847
|
+
return this._manager.authRequest({
|
|
848
|
+
method: "PATCH",
|
|
849
|
+
path: Routes.GUILD_SCHEDULED_EVENT(guildID, scheduledEventID),
|
|
850
|
+
json: {
|
|
851
|
+
channel_id: options.channelID,
|
|
852
|
+
description: options.description,
|
|
853
|
+
entity_metadata: options.entityMetadata ? { location: options.entityMetadata.location } : undefined,
|
|
854
|
+
entity_type: options.entityType,
|
|
855
|
+
image,
|
|
856
|
+
name: options.name,
|
|
857
|
+
privacy_level: options.privacyLevel,
|
|
858
|
+
status: options.status,
|
|
859
|
+
scheduled_end_time: options.scheduledEndTime,
|
|
860
|
+
scheduled_start_time: options.scheduledStartTime
|
|
861
|
+
},
|
|
862
|
+
reason: options.reason
|
|
863
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.scheduledEvents.update(data) ?? new GuildScheduledEvent_1.default(data, this._manager.client));
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Edit a soundboard sound.
|
|
867
|
+
* @param guildID The ID of the guild.
|
|
868
|
+
* @param soundID The ID of the soundboard sound to edit.
|
|
869
|
+
* @param options The options for editing the soundboard sound.
|
|
870
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
871
|
+
* @caches {@link Guild#soundboardSounds | Guild#soundboardSounds}
|
|
872
|
+
*/
|
|
873
|
+
async editSoundboardSound(guildID, soundID, options) {
|
|
874
|
+
options = this._manager.client.util._freeze(options);
|
|
875
|
+
return this._manager.authRequest({
|
|
876
|
+
method: "PATCH",
|
|
877
|
+
path: Routes.SOUNDBOARD_SOUND(guildID, soundID),
|
|
878
|
+
json: {
|
|
879
|
+
emoji_id: options.emojiID,
|
|
880
|
+
emoji_name: options.emojiName,
|
|
881
|
+
name: options.name,
|
|
882
|
+
volume: options.volume
|
|
883
|
+
},
|
|
884
|
+
reason: options.reason
|
|
885
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.soundboardSounds.update(data) ?? new Soundboard_1.default(data, this._manager.client));
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Edit a sticker.
|
|
889
|
+
* @param guildID The ID of the guild.
|
|
890
|
+
* @param options The options for editing the sticker.
|
|
891
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
892
|
+
* @caches {@link Guild#stickers | Guild#stickers}
|
|
893
|
+
*/
|
|
894
|
+
async editSticker(guildID, stickerID, options) {
|
|
895
|
+
options = this._manager.client.util._freeze(options);
|
|
896
|
+
return this._manager.authRequest({
|
|
897
|
+
method: "PATCH",
|
|
898
|
+
path: Routes.GUILD_STICKER(guildID, stickerID),
|
|
899
|
+
json: {
|
|
900
|
+
description: options.description,
|
|
901
|
+
name: options.name,
|
|
902
|
+
tags: options.tags
|
|
903
|
+
},
|
|
904
|
+
reason: options.reason
|
|
905
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.stickers.update(data) ?? this._manager.client.util.convertSticker(data));
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Edit a guild template.
|
|
909
|
+
* @param guildID The ID of the guild.
|
|
910
|
+
* @param code The code of the template.
|
|
911
|
+
* @param options The options for editing the template.
|
|
912
|
+
* @caching This method **does not** cache its result.
|
|
913
|
+
*/
|
|
914
|
+
async editTemplate(guildID, code, options) {
|
|
915
|
+
options = this._manager.client.util._freeze(options);
|
|
916
|
+
return this._manager.authRequest({
|
|
917
|
+
method: "POST",
|
|
918
|
+
path: Routes.GUILD_TEMPLATE(guildID, code),
|
|
919
|
+
json: {
|
|
920
|
+
code,
|
|
921
|
+
description: options.description,
|
|
922
|
+
name: options.name
|
|
923
|
+
}
|
|
924
|
+
}).then(data => new GuildTemplate_1.default(data, this._manager.client));
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Edit a guild member's voice state. `channelID` is required, and the user must already be in that channel. See [Discord's docs](https://discord.com/developers/docs/resources/guild#modify-user-voice-state) for more information.
|
|
928
|
+
* @param guildID The ID of the guild.
|
|
929
|
+
* @param memberID The ID of the member.
|
|
930
|
+
* @param options The options for editing the voice state.
|
|
931
|
+
* @caching This method **does not** cache its result.
|
|
932
|
+
*/
|
|
933
|
+
async editUserVoiceState(guildID, memberID, options) {
|
|
934
|
+
options = this._manager.client.util._freeze(options);
|
|
935
|
+
await this._manager.authRequest({
|
|
936
|
+
method: "PATCH",
|
|
937
|
+
path: Routes.GUILD_VOICE_STATE(guildID, memberID),
|
|
938
|
+
json: {
|
|
939
|
+
channel_id: options.channelID,
|
|
940
|
+
suppress: options.suppress
|
|
941
|
+
}
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Edit the welcome screen in a guild.
|
|
946
|
+
* @param guildID The ID of the guild.
|
|
947
|
+
* @param options The options for editing the welcome screen.
|
|
948
|
+
* @caching This method **does not** cache its result.
|
|
949
|
+
*/
|
|
950
|
+
async editWelcomeScreen(guildID, options) {
|
|
951
|
+
options = this._manager.client.util._freeze(options);
|
|
952
|
+
return this._manager.authRequest({
|
|
953
|
+
method: "PATCH",
|
|
954
|
+
path: Routes.GUILD_WELCOME_SCREEN(guildID),
|
|
955
|
+
json: {
|
|
956
|
+
description: options.description,
|
|
957
|
+
enabled: options.enabled,
|
|
958
|
+
welcome_channels: options.welcomeChannels.map(ch => ({
|
|
959
|
+
channel_id: ch.channelID,
|
|
960
|
+
description: ch.description,
|
|
961
|
+
emoji_id: ch.emojiID,
|
|
962
|
+
emoji_name: ch.emojiName
|
|
963
|
+
}))
|
|
964
|
+
},
|
|
965
|
+
reason: options.reason
|
|
966
|
+
}).then(data => ({
|
|
967
|
+
description: data.description,
|
|
968
|
+
welcomeChannels: data.welcome_channels.map(channel => ({
|
|
969
|
+
channelID: channel.channel_id,
|
|
970
|
+
description: channel.description,
|
|
971
|
+
emojiID: channel.emoji_id,
|
|
972
|
+
emojiName: channel.emoji_name
|
|
973
|
+
}))
|
|
974
|
+
}));
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* Edit the widget of a guild.
|
|
978
|
+
* @param guildID The ID of the guild.
|
|
979
|
+
* @param options The options for editing the widget.
|
|
980
|
+
* @caching This method **does not** cache its result.
|
|
981
|
+
*/
|
|
982
|
+
async editWidget(guildID, options) {
|
|
983
|
+
options = this._manager.client.util._freeze(options);
|
|
984
|
+
return this._manager.authRequest({
|
|
985
|
+
method: "POST",
|
|
986
|
+
path: Routes.GUILD_WIDGET(guildID),
|
|
987
|
+
json: {
|
|
988
|
+
channel_id: options.channelID,
|
|
989
|
+
enabled: options.enabled
|
|
990
|
+
}
|
|
991
|
+
}).then(data => ({
|
|
992
|
+
channels: data.channels,
|
|
993
|
+
id: data.id,
|
|
994
|
+
instantInvite: data.instant_invite,
|
|
995
|
+
members: data.members.map(m => ({
|
|
996
|
+
activity: m.activity,
|
|
997
|
+
avatar: m.avatar,
|
|
998
|
+
avatarURL: m.avatar_url,
|
|
999
|
+
discriminator: m.discriminator,
|
|
1000
|
+
id: m.id,
|
|
1001
|
+
status: m.status,
|
|
1002
|
+
tag: m.username,
|
|
1003
|
+
username: m.username
|
|
1004
|
+
})),
|
|
1005
|
+
name: data.name,
|
|
1006
|
+
presenceCount: data.presence_count
|
|
1007
|
+
}));
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Get a guild.
|
|
1011
|
+
* @param guildID The ID of the guild.
|
|
1012
|
+
* @param withCounts If the approximate number of members and online members should be included.
|
|
1013
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not already cached.
|
|
1014
|
+
* @caches {@link Client#guilds | Client#guilds}
|
|
1015
|
+
*/
|
|
1016
|
+
async get(guildID, withCounts) {
|
|
1017
|
+
const query = new QueryBuilder_1.default();
|
|
1018
|
+
query.setIfPresent("with_counts", withCounts);
|
|
1019
|
+
return this._manager.authRequest({
|
|
1020
|
+
method: "GET",
|
|
1021
|
+
path: Routes.GUILD(guildID),
|
|
1022
|
+
query
|
|
1023
|
+
}).then(data => this._manager.client.guilds.has(guildID) ? this._manager.client.guilds.update(data, true) : new Guild_1.default(data, this._manager.client, true));
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* Get the active threads in a guild.
|
|
1027
|
+
* @param guildID The ID of the guild.
|
|
1028
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1029
|
+
* @caches {@link Guild#threads | Guild#threads}
|
|
1030
|
+
*/
|
|
1031
|
+
async getActiveThreads(guildID) {
|
|
1032
|
+
return this._manager.authRequest({
|
|
1033
|
+
method: "GET",
|
|
1034
|
+
path: Routes.GUILD_ACTIVE_THREADS(guildID)
|
|
1035
|
+
}).then(data => ({
|
|
1036
|
+
members: data.members.map(member => ({
|
|
1037
|
+
flags: member.flags,
|
|
1038
|
+
id: member.id,
|
|
1039
|
+
joinTimestamp: new Date(member.join_timestamp),
|
|
1040
|
+
userID: member.user_id
|
|
1041
|
+
})),
|
|
1042
|
+
threads: data.threads.map(rawThread => this._manager.client.util.updateThread(rawThread))
|
|
1043
|
+
}));
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Get a guild's audit log.
|
|
1047
|
+
* @param guildID The ID of the guild.
|
|
1048
|
+
* @param options The options for getting the audit logs.
|
|
1049
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1050
|
+
* @caches {@link Guild#autoModerationRules | Guild#autoModerationRules}<br>{@link Guild#scheduledEvents | Guild#scheduledEvents}<br>{@link Guild#integrations | Guild#integrations}<br>{@link Guild#threads | Guild#threads}<br>{@link Client#users | Client#users}
|
|
1051
|
+
*/
|
|
1052
|
+
async getAuditLog(guildID, options) {
|
|
1053
|
+
const guild = this._manager.client.guilds.get(guildID);
|
|
1054
|
+
const query = new QueryBuilder_1.default();
|
|
1055
|
+
query.setIfPresent("action_type", options?.actionType);
|
|
1056
|
+
query.setIfPresent("before", options?.before);
|
|
1057
|
+
query.setIfPresent("limit", options?.limit);
|
|
1058
|
+
query.setIfPresent("user_id", options?.userID);
|
|
1059
|
+
return this._manager.authRequest({
|
|
1060
|
+
method: "GET",
|
|
1061
|
+
path: Routes.GUILD_AUDIT_LOG(guildID),
|
|
1062
|
+
query
|
|
1063
|
+
}).then(data => ({
|
|
1064
|
+
applicationCommands: data.application_commands.map(command => new ApplicationCommand_1.default(command, this._manager.client)),
|
|
1065
|
+
autoModerationRules: data.auto_moderation_rules.map(rule => guild?.autoModerationRules.update(rule) ?? new AutoModerationRule_1.default(rule, this._manager.client)),
|
|
1066
|
+
entries: data.audit_log_entries.map(entry => new AuditLogEntry_1.default(entry, this._manager.client)),
|
|
1067
|
+
guildScheduledEvents: data.guild_scheduled_events.map(event => guild?.scheduledEvents.update(event) ?? new GuildScheduledEvent_1.default(event, this._manager.client)),
|
|
1068
|
+
integrations: data.integrations.map(integration => guild?.integrations.update(integration, guildID) ?? new Integration_1.default(integration, this._manager.client, guildID)),
|
|
1069
|
+
threads: data.threads.map(rawThread => this._manager.client.util.updateThread(rawThread)),
|
|
1070
|
+
users: data.users.map(user => this._manager.client.users.update(user)),
|
|
1071
|
+
webhooks: data.webhooks.map(webhook => new Webhook_1.default(webhook, this._manager.client))
|
|
1072
|
+
}));
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Get an auto moderation rule for a guild.
|
|
1076
|
+
* @param guildID The ID of the guild.
|
|
1077
|
+
* @param ruleID The ID of the rule to get.
|
|
1078
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1079
|
+
* @caches {@link Guild#autoModerationRules | Guild#autoModerationRules}
|
|
1080
|
+
*/
|
|
1081
|
+
async getAutoModerationRule(guildID, ruleID) {
|
|
1082
|
+
return this._manager.authRequest({
|
|
1083
|
+
method: "GET",
|
|
1084
|
+
path: Routes.GUILD_AUTOMOD_RULE(guildID, ruleID)
|
|
1085
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.autoModerationRules.update(data) ?? new AutoModerationRule_1.default(data, this._manager.client));
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* Get the auto moderation rules for a guild.
|
|
1089
|
+
* @param guildID The ID of the guild.
|
|
1090
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1091
|
+
* @caches {@link Guild#autoModerationRules | Guild#autoModerationRules}
|
|
1092
|
+
*/
|
|
1093
|
+
async getAutoModerationRules(guildID) {
|
|
1094
|
+
const guild = this._manager.client.guilds.get(guildID);
|
|
1095
|
+
return this._manager.authRequest({
|
|
1096
|
+
method: "GET",
|
|
1097
|
+
path: Routes.GUILD_AUTOMOD_RULES(guildID)
|
|
1098
|
+
}).then(data => data.map(rule => guild?.autoModerationRules.update(rule) ?? new AutoModerationRule_1.default(rule, this._manager.client)));
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* Get a ban.
|
|
1102
|
+
* @param guildID The ID of the guild.
|
|
1103
|
+
* @param userID The ID of the user to get the ban of.
|
|
1104
|
+
* @caching This method **does** cache part of its result.
|
|
1105
|
+
* @caches {@link Client#users | Client#users}
|
|
1106
|
+
*/
|
|
1107
|
+
async getBan(guildID, userID) {
|
|
1108
|
+
return this._manager.authRequest({
|
|
1109
|
+
method: "GET",
|
|
1110
|
+
path: Routes.GUILD_BAN(guildID, userID)
|
|
1111
|
+
}).then(data => ({
|
|
1112
|
+
reason: data.reason,
|
|
1113
|
+
user: this._manager.client.users.update(data.user)
|
|
1114
|
+
}));
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Get the bans in a guild.
|
|
1118
|
+
* @param guildID The ID of the guild.
|
|
1119
|
+
* @param options The options for getting the bans.
|
|
1120
|
+
* @caching This method **does** cache part of its result.
|
|
1121
|
+
* @caches {@link Client#users | Client#users}
|
|
1122
|
+
*/
|
|
1123
|
+
async getBans(guildID, options) {
|
|
1124
|
+
const _getBans = async (_options) => {
|
|
1125
|
+
const query = new QueryBuilder_1.default();
|
|
1126
|
+
query.setIfPresent("after", _options?.after);
|
|
1127
|
+
query.setIfPresent("before", _options?.before);
|
|
1128
|
+
query.setIfPresent("limit", _options?.limit);
|
|
1129
|
+
return this._manager.authRequest({
|
|
1130
|
+
method: "GET",
|
|
1131
|
+
path: Routes.GUILD_BANS(guildID),
|
|
1132
|
+
query
|
|
1133
|
+
}).then(data => data.map(ban => ({
|
|
1134
|
+
reason: ban.reason,
|
|
1135
|
+
user: this._manager.client.users.update(ban.user)
|
|
1136
|
+
})));
|
|
1137
|
+
};
|
|
1138
|
+
const limit = options?.limit ?? 1000;
|
|
1139
|
+
let chosenOption;
|
|
1140
|
+
if (options?.after) {
|
|
1141
|
+
chosenOption = "after";
|
|
1142
|
+
}
|
|
1143
|
+
else if (options?.before) {
|
|
1144
|
+
chosenOption = "before";
|
|
1145
|
+
}
|
|
1146
|
+
else {
|
|
1147
|
+
chosenOption = "after";
|
|
1148
|
+
}
|
|
1149
|
+
let optionValue = options?.[chosenOption] ?? undefined;
|
|
1150
|
+
let bans = [];
|
|
1151
|
+
while (bans.length < limit) {
|
|
1152
|
+
const limitLeft = limit - bans.length;
|
|
1153
|
+
const limitToFetch = Math.min(limitLeft, 1000);
|
|
1154
|
+
this._manager.client.emit("debug", `Getting ${limitLeft} more ban${limitLeft === 1 ? "" : "s"} for ${guildID}: ${optionValue ?? ""}`);
|
|
1155
|
+
const bansChunk = await _getBans({
|
|
1156
|
+
limit: limitToFetch,
|
|
1157
|
+
[chosenOption]: optionValue
|
|
1158
|
+
});
|
|
1159
|
+
if (bansChunk.length === 0) {
|
|
1160
|
+
break;
|
|
1161
|
+
}
|
|
1162
|
+
bans = bans.concat(bansChunk);
|
|
1163
|
+
optionValue = bansChunk.at(-1).user.id;
|
|
1164
|
+
if (bansChunk.length < 1000) {
|
|
1165
|
+
break;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
return bans;
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Get the channels in a guild. Does not include threads.
|
|
1172
|
+
* @param guildID The ID of the guild.
|
|
1173
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1174
|
+
* @caches {@link Guild#channels | Guild#channels}
|
|
1175
|
+
*/
|
|
1176
|
+
async getChannels(guildID) {
|
|
1177
|
+
return this._manager.authRequest({
|
|
1178
|
+
method: "GET",
|
|
1179
|
+
path: Routes.GUILD_CHANNELS(guildID)
|
|
1180
|
+
}).then(data => data.map(d => this._manager.client.util.updateChannel(d)));
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Get an emoji in a guild.
|
|
1184
|
+
* @param guildID The ID of the guild.
|
|
1185
|
+
* @param emojiID The ID of the emoji to get.
|
|
1186
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1187
|
+
* @caches {@link Guild#emojis | Guild#emojis}
|
|
1188
|
+
*/
|
|
1189
|
+
async getEmoji(guildID, emojiID) {
|
|
1190
|
+
return this._manager.authRequest({
|
|
1191
|
+
method: "GET",
|
|
1192
|
+
path: Routes.GUILD_EMOJI(guildID, emojiID)
|
|
1193
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.emojis.update(data) ?? this._manager.client.util.convertGuildEmoji(data));
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Get the emojis in a guild.
|
|
1197
|
+
* @param guildID The ID of the guild.
|
|
1198
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1199
|
+
* @caches {@link Guild#emojis | Guild#emojis} (will be completely cleared and refilled)
|
|
1200
|
+
*/
|
|
1201
|
+
async getEmojis(guildID) {
|
|
1202
|
+
return this._manager.authRequest({
|
|
1203
|
+
method: "GET",
|
|
1204
|
+
path: Routes.GUILD_EMOJIS(guildID)
|
|
1205
|
+
}).then(data => {
|
|
1206
|
+
const guild = this._manager.client.guilds.get(guildID);
|
|
1207
|
+
guild?.emojis.clear();
|
|
1208
|
+
return data.map(emoji => guild?.emojis.update(emoji) ?? this._manager.client.util.convertGuildEmoji(emoji));
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* Get the integrations in a guild.
|
|
1213
|
+
* @param guildID The ID of the guild.
|
|
1214
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1215
|
+
* @caches {@link Guild#integrations | Guild#integrations}
|
|
1216
|
+
*/
|
|
1217
|
+
async getIntegrations(guildID) {
|
|
1218
|
+
const guild = this._manager.client.guilds.get(guildID);
|
|
1219
|
+
return this._manager.authRequest({
|
|
1220
|
+
method: "GET",
|
|
1221
|
+
path: Routes.GUILD_INTEGRATIONS(guildID)
|
|
1222
|
+
}).then(data => data.map(integration => guild?.integrations.update(integration, guildID) ?? new Integration_1.default(integration, this._manager.client, guildID)));
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* Get the invites of a guild.
|
|
1226
|
+
* @param guildID The ID of the guild to get the invites of.
|
|
1227
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1228
|
+
* @caches {@link Guild#invites | Guild#invites}
|
|
1229
|
+
*/
|
|
1230
|
+
async getInvites(guildID) {
|
|
1231
|
+
const guild = this._manager.client.guilds.get(guildID);
|
|
1232
|
+
return this._manager.authRequest({
|
|
1233
|
+
method: "GET",
|
|
1234
|
+
path: Routes.GUILD_INVITES(guildID)
|
|
1235
|
+
}).then(data => data.map(invite => guild?.invites.update(invite) ?? Invite_1.default.withMetadata(invite, this._manager.client)));
|
|
1236
|
+
}
|
|
1237
|
+
/**
|
|
1238
|
+
* Get a guild member.
|
|
1239
|
+
* @param guildID The ID of the guild.
|
|
1240
|
+
* @param memberID The ID of the member.
|
|
1241
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1242
|
+
* @caches {@link Guild#members | Guild#members}
|
|
1243
|
+
*/
|
|
1244
|
+
async getMember(guildID, memberID) {
|
|
1245
|
+
return this._manager.authRequest({
|
|
1246
|
+
method: "GET",
|
|
1247
|
+
path: Routes.GUILD_MEMBER(guildID, memberID)
|
|
1248
|
+
}).then(data => this._manager.client.util.updateMember(guildID, memberID, data));
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Get a guild's members. This requires the `GUILD_MEMBERS` intent.
|
|
1252
|
+
* @param guildID The ID of the guild.
|
|
1253
|
+
* @param options The options for getting the members.
|
|
1254
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1255
|
+
* @caches {@link Guild#members | Guild#members}}
|
|
1256
|
+
*/
|
|
1257
|
+
async getMembers(guildID, options) {
|
|
1258
|
+
const query = new QueryBuilder_1.default();
|
|
1259
|
+
query.setIfPresent("after", options?.after);
|
|
1260
|
+
query.setIfPresent("limit", options?.limit);
|
|
1261
|
+
return this._manager.authRequest({
|
|
1262
|
+
method: "GET",
|
|
1263
|
+
path: Routes.GUILD_MEMBERS(guildID),
|
|
1264
|
+
query
|
|
1265
|
+
}).then(data => data.map(d => this._manager.client.util.updateMember(guildID, d.user.id, d)));
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Get a guild's onboarding info.
|
|
1269
|
+
* @param guildID The ID of the guild.
|
|
1270
|
+
* @caching This method **does not** cache its result.
|
|
1271
|
+
*/
|
|
1272
|
+
async getOnboarding(guildID) {
|
|
1273
|
+
return this._manager.authRequest({
|
|
1274
|
+
method: "GET",
|
|
1275
|
+
path: Routes.GUILD_ONBOARDING(guildID)
|
|
1276
|
+
}).then(data => ({
|
|
1277
|
+
defaultChannelIDs: data.default_channel_ids,
|
|
1278
|
+
enabled: data.enabled,
|
|
1279
|
+
guildID: data.guild_id,
|
|
1280
|
+
mode: data.mode,
|
|
1281
|
+
prompts: data.prompts.map(p => ({
|
|
1282
|
+
id: p.id,
|
|
1283
|
+
inOnboarding: p.in_onboarding,
|
|
1284
|
+
options: p.options.map(o => ({
|
|
1285
|
+
channelIDs: o.channel_ids,
|
|
1286
|
+
description: o.description,
|
|
1287
|
+
emoji: o.emoji,
|
|
1288
|
+
id: o.id,
|
|
1289
|
+
roleIDs: o.role_ids,
|
|
1290
|
+
title: o.title
|
|
1291
|
+
})),
|
|
1292
|
+
required: p.required,
|
|
1293
|
+
singleSelect: p.single_select,
|
|
1294
|
+
title: p.title
|
|
1295
|
+
}))
|
|
1296
|
+
}));
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* Get a preview of a guild. If the client is not already in this guild, the guild must be lurkable.
|
|
1300
|
+
* @param guildID The ID of the guild.
|
|
1301
|
+
* @caching This method **does not** cache its result.
|
|
1302
|
+
*/
|
|
1303
|
+
async getPreview(guildID) {
|
|
1304
|
+
return this._manager.authRequest({
|
|
1305
|
+
method: "GET",
|
|
1306
|
+
path: Routes.GUILD_PREVIEW(guildID)
|
|
1307
|
+
}).then(data => new GuildPreview_1.default(data, this._manager.client));
|
|
1308
|
+
}
|
|
1309
|
+
/**
|
|
1310
|
+
* Get the prune count of a guild.
|
|
1311
|
+
* @param guildID The ID of the guild.
|
|
1312
|
+
* @param options The options for getting the prune count.
|
|
1313
|
+
* @caching This method **does not** cache its result.
|
|
1314
|
+
*/
|
|
1315
|
+
async getPruneCount(guildID, options) {
|
|
1316
|
+
const query = new QueryBuilder_1.default();
|
|
1317
|
+
query.setIfPresent("days", options?.days);
|
|
1318
|
+
query.setIfPresent("include_roles", options?.includeRoles?.join(","));
|
|
1319
|
+
return this._manager.authRequest({
|
|
1320
|
+
method: "GET",
|
|
1321
|
+
path: Routes.GUILD_PRUNE(guildID),
|
|
1322
|
+
query
|
|
1323
|
+
}).then(data => data.pruned);
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* Get a role in a guild.
|
|
1327
|
+
* @param guildID The ID of the guild.
|
|
1328
|
+
* @param roleID The ID of the role to get.
|
|
1329
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1330
|
+
* @caches {@link Guild#roles | Guild#roles}
|
|
1331
|
+
*/
|
|
1332
|
+
async getRole(guildID, roleID) {
|
|
1333
|
+
const guild = this._manager.client.guilds.get(guildID);
|
|
1334
|
+
return this._manager.authRequest({
|
|
1335
|
+
method: "GET",
|
|
1336
|
+
path: Routes.GUILD_ROLE(guildID, roleID)
|
|
1337
|
+
}).then(data => guild?.roles.update(data, guildID) ?? new Role_1.default(data, this._manager.client, guildID));
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* Get the member count of the roles in a guild. The result is a key-value map of role id to member count.
|
|
1341
|
+
* @param guildID The ID of the guild.
|
|
1342
|
+
* @caching This method **does not** cache its result.
|
|
1343
|
+
*/
|
|
1344
|
+
async getRoleMemberCounts(guildID) {
|
|
1345
|
+
return this._manager.authRequest({
|
|
1346
|
+
method: "GET",
|
|
1347
|
+
path: Routes.GUILD_ROLE_MEMBER_COUNTS(guildID)
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Get the roles in a guild.
|
|
1352
|
+
* @param guildID The ID of the guild.
|
|
1353
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1354
|
+
* @caches {@link Guild#roles | Guild#roles}
|
|
1355
|
+
*/
|
|
1356
|
+
async getRoles(guildID) {
|
|
1357
|
+
const guild = this._manager.client.guilds.get(guildID);
|
|
1358
|
+
return this._manager.authRequest({
|
|
1359
|
+
method: "GET",
|
|
1360
|
+
path: Routes.GUILD_ROLES(guildID)
|
|
1361
|
+
}).then(data => data.map(role => guild?.roles.update(role, guildID) ?? new Role_1.default(role, this._manager.client, guildID)));
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* Get a scheduled event.
|
|
1365
|
+
* @param guildID The ID of the guild.
|
|
1366
|
+
* @param eventID The ID of the scheduled event to get.
|
|
1367
|
+
* @param withUserCount If the number of users subscribed to the event should be included.
|
|
1368
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1369
|
+
* @caches {@link Guild#scheduledEvents | Guild#scheduledEvents}
|
|
1370
|
+
*/
|
|
1371
|
+
async getScheduledEvent(guildID, eventID, withUserCount) {
|
|
1372
|
+
const guild = this._manager.client.guilds.get(guildID);
|
|
1373
|
+
const query = new QueryBuilder_1.default();
|
|
1374
|
+
query.setIfPresent("with_user_count", withUserCount);
|
|
1375
|
+
return this._manager.authRequest({
|
|
1376
|
+
method: "GET",
|
|
1377
|
+
path: Routes.GUILD_SCHEDULED_EVENT(guildID, eventID),
|
|
1378
|
+
query
|
|
1379
|
+
}).then(data => guild?.scheduledEvents.update(data) ?? new GuildScheduledEvent_1.default(data, this._manager.client));
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* Get the users subscribed to a scheduled event.
|
|
1383
|
+
* @param guildID The ID of the guild.
|
|
1384
|
+
* @param eventID The ID of the scheduled event.
|
|
1385
|
+
* @param options The options for getting the users.
|
|
1386
|
+
* @caching This method **does** cache part its result. Members will not be cached if the guild is not cached.
|
|
1387
|
+
* @caches {@link Client#users | Client#users}<br>{@link Guild#members | Guild#members}
|
|
1388
|
+
*/
|
|
1389
|
+
async getScheduledEventUsers(guildID, eventID, options) {
|
|
1390
|
+
const guild = this._manager.client.guilds.get(guildID);
|
|
1391
|
+
const query = new QueryBuilder_1.default();
|
|
1392
|
+
query.setIfPresent("after", options?.after);
|
|
1393
|
+
query.setIfPresent("before", options?.before);
|
|
1394
|
+
query.setIfPresent("limit", options?.limit);
|
|
1395
|
+
query.setIfPresent("with_member", options?.withMember);
|
|
1396
|
+
return this._manager.authRequest({
|
|
1397
|
+
method: "GET",
|
|
1398
|
+
path: Routes.GUILD_SCHEDULED_EVENT_USERS(guildID, eventID)
|
|
1399
|
+
}).then(data => data.map(d => ({
|
|
1400
|
+
guildScheduledEvent: guild?.scheduledEvents.get(d.guild_scheduled_event_id),
|
|
1401
|
+
guildScheduledEventID: d.guild_scheduled_event_id,
|
|
1402
|
+
user: this._manager.client.users.update(d.user),
|
|
1403
|
+
member: d.member ? this._manager.client.util.updateMember(guildID, d.member.user.id, d.member) : undefined
|
|
1404
|
+
})));
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Get a guild's scheduled events.
|
|
1408
|
+
* @param guildID The ID of the guild.
|
|
1409
|
+
* @param withUserCount If the number of users subscribed to the event should be included.
|
|
1410
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1411
|
+
* @caches {@link Guild#scheduledEvents | Guild#scheduledEvents}
|
|
1412
|
+
*/
|
|
1413
|
+
async getScheduledEvents(guildID, withUserCount) {
|
|
1414
|
+
const guild = this._manager.client.guilds.get(guildID);
|
|
1415
|
+
const query = new QueryBuilder_1.default();
|
|
1416
|
+
query.setIfPresent("with_user_count", withUserCount);
|
|
1417
|
+
return this._manager.authRequest({
|
|
1418
|
+
method: "GET",
|
|
1419
|
+
path: Routes.GUILD_SCHEDULED_EVENTS(guildID),
|
|
1420
|
+
query
|
|
1421
|
+
}).then(data => data.map(d => guild?.scheduledEvents.update(d) ?? new GuildScheduledEvent_1.default(d, this._manager.client)));
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* Get a soundboard sound.
|
|
1425
|
+
* @param guildID The ID of the guild.
|
|
1426
|
+
* @param soundID The ID of the soundboard sound to get.
|
|
1427
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1428
|
+
* @caches {@link Guild#soundboardSounds | Guild#soundboardSounds}
|
|
1429
|
+
*/
|
|
1430
|
+
async getSoundboardSound(guildID, soundID) {
|
|
1431
|
+
const guild = this._manager.client.guilds.get(guildID);
|
|
1432
|
+
return this._manager.authRequest({
|
|
1433
|
+
method: "GET",
|
|
1434
|
+
path: Routes.SOUNDBOARD_SOUND(guildID, soundID)
|
|
1435
|
+
}).then(data => guild?.soundboardSounds.update(data) ?? new Soundboard_1.default(data, this._manager.client));
|
|
1436
|
+
}
|
|
1437
|
+
/**
|
|
1438
|
+
* Get a guild's soundboard sounds.
|
|
1439
|
+
* @param guildID The ID of the guild.
|
|
1440
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1441
|
+
* @caches {@link Guild#soundboardSounds | Guild#soundboardSounds}
|
|
1442
|
+
*/
|
|
1443
|
+
async getSoundboardSounds(guildID) {
|
|
1444
|
+
const guild = this._manager.client.guilds.get(guildID);
|
|
1445
|
+
return this._manager.authRequest({
|
|
1446
|
+
method: "GET",
|
|
1447
|
+
path: Routes.SOUNDBOARD_SOUNDS(guildID)
|
|
1448
|
+
}).then(data => data.items.map(d => guild?.soundboardSounds.update(d) ?? new Soundboard_1.default(d, this._manager.client)));
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* Get a sticker. Response will include a user if the client has the `MANAGE_EMOJIS_AND_STICKERS` permissions.
|
|
1452
|
+
* @param guildID The ID of the guild.
|
|
1453
|
+
* @param stickerID The ID of the sticker to get.
|
|
1454
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1455
|
+
* @caches {@link Guild#stickers | Guild#stickers}
|
|
1456
|
+
*/
|
|
1457
|
+
async getSticker(guildID, stickerID) {
|
|
1458
|
+
return this._manager.authRequest({
|
|
1459
|
+
method: "GET",
|
|
1460
|
+
path: Routes.GUILD_STICKER(guildID, stickerID)
|
|
1461
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.stickers.update(data) ?? this._manager.client.util.convertSticker(data));
|
|
1462
|
+
}
|
|
1463
|
+
/**
|
|
1464
|
+
* Get a guild's stickers. Stickers will include a user if the client has the `MANAGE_EMOJIS_AND_STICKERS` permissions.
|
|
1465
|
+
* @param guildID The ID of the guild.
|
|
1466
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1467
|
+
* @caches {@link Guild#stickers | Guild#stickers} (will be completely cleared and refilled)
|
|
1468
|
+
*/
|
|
1469
|
+
async getStickers(guildID) {
|
|
1470
|
+
return this._manager.authRequest({
|
|
1471
|
+
method: "GET",
|
|
1472
|
+
path: Routes.GUILD_STICKERS(guildID)
|
|
1473
|
+
}).then(data => {
|
|
1474
|
+
const guild = this._manager.client.guilds.get(guildID);
|
|
1475
|
+
guild?.stickers.clear();
|
|
1476
|
+
return data.map(sticker => guild?.stickers.update(sticker) ?? this._manager.client.util.convertSticker(sticker));
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* Get a guild template.
|
|
1481
|
+
* @param code The code of the template to get.
|
|
1482
|
+
* @caching This method **does not** cache its result.
|
|
1483
|
+
*/
|
|
1484
|
+
async getTemplate(code) {
|
|
1485
|
+
return this._manager.authRequest({
|
|
1486
|
+
method: "GET",
|
|
1487
|
+
path: Routes.GUILD_TEMPLATE_CODE(code)
|
|
1488
|
+
}).then(data => new GuildTemplate_1.default(data, this._manager.client));
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* Get a guild's templates.
|
|
1492
|
+
* @param guildID The ID of the guild.
|
|
1493
|
+
* @caching This method **does not** cache its result.
|
|
1494
|
+
*/
|
|
1495
|
+
async getTemplates(guildID) {
|
|
1496
|
+
return this._manager.authRequest({
|
|
1497
|
+
method: "GET",
|
|
1498
|
+
path: Routes.GUILD_TEMPLATES(guildID)
|
|
1499
|
+
}).then(data => data.map(d => new GuildTemplate_1.default(d, this._manager.client)));
|
|
1500
|
+
}
|
|
1501
|
+
/**
|
|
1502
|
+
* Get the vanity url of a guild.
|
|
1503
|
+
* @param guildID The ID of the guild.
|
|
1504
|
+
* @caching This method **does not** cache its result.
|
|
1505
|
+
*/
|
|
1506
|
+
async getVanityURL(guildID) {
|
|
1507
|
+
return this._manager.authRequest({
|
|
1508
|
+
method: "GET",
|
|
1509
|
+
path: Routes.GUILD_VANITY_URL(guildID)
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
/**
|
|
1513
|
+
* Get the list of usable voice regions for a guild. This will return VIP servers when the guild is VIP-enabled.
|
|
1514
|
+
* @param guildID The ID of the guild.
|
|
1515
|
+
* @caching This method **does not** cache its result.
|
|
1516
|
+
*/
|
|
1517
|
+
async getVoiceRegions(guildID) {
|
|
1518
|
+
return this._manager.authRequest({
|
|
1519
|
+
method: "GET",
|
|
1520
|
+
path: Routes.GUILD_VOICE_REGIONS(guildID)
|
|
1521
|
+
});
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Get the voice state of a member.
|
|
1525
|
+
* @param guildID The ID of the guild.
|
|
1526
|
+
* @param memberID The ID of the member. Use `@me` for the bot user.
|
|
1527
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1528
|
+
* @caches {@link Guild#voiceStates | Guild#voiceStates}
|
|
1529
|
+
*/
|
|
1530
|
+
async getVoiceState(guildID, memberID) {
|
|
1531
|
+
return this._manager.authRequest({
|
|
1532
|
+
method: "GET",
|
|
1533
|
+
path: Routes.GUILD_VOICE_STATE(guildID, memberID)
|
|
1534
|
+
}).then(data => this._manager.client.guilds.get(guildID)?.voiceStates.update(data) ?? new VoiceState_1.default(data, this._manager.client));
|
|
1535
|
+
}
|
|
1536
|
+
/**
|
|
1537
|
+
* Get the welcome screen for a guild.
|
|
1538
|
+
* @param guildID The ID of the guild.
|
|
1539
|
+
* @caching This method **does not** cache its result.
|
|
1540
|
+
*/
|
|
1541
|
+
async getWelcomeScreen(guildID) {
|
|
1542
|
+
return this._manager.authRequest({
|
|
1543
|
+
method: "GET",
|
|
1544
|
+
path: Routes.GUILD_WELCOME_SCREEN(guildID)
|
|
1545
|
+
}).then(data => ({
|
|
1546
|
+
description: data.description,
|
|
1547
|
+
welcomeChannels: data.welcome_channels.map(channel => ({
|
|
1548
|
+
channelID: channel.channel_id,
|
|
1549
|
+
description: channel.description,
|
|
1550
|
+
emojiID: channel.emoji_id,
|
|
1551
|
+
emojiName: channel.emoji_name
|
|
1552
|
+
}))
|
|
1553
|
+
}));
|
|
1554
|
+
}
|
|
1555
|
+
/**
|
|
1556
|
+
* Get the widget of a guild.
|
|
1557
|
+
* @param guildID The ID of the guild.
|
|
1558
|
+
* @caching This method **does not** cache its result.
|
|
1559
|
+
*/
|
|
1560
|
+
async getWidget(guildID) {
|
|
1561
|
+
return this._manager.authRequest({
|
|
1562
|
+
method: "GET",
|
|
1563
|
+
path: Routes.GUILD_WIDGET(guildID)
|
|
1564
|
+
}).then(data => ({
|
|
1565
|
+
channels: data.channels,
|
|
1566
|
+
id: data.id,
|
|
1567
|
+
instantInvite: data.instant_invite,
|
|
1568
|
+
members: data.members.map(m => ({
|
|
1569
|
+
activity: m.activity,
|
|
1570
|
+
avatar: m.avatar,
|
|
1571
|
+
avatarURL: m.avatar_url,
|
|
1572
|
+
discriminator: m.discriminator,
|
|
1573
|
+
id: m.id,
|
|
1574
|
+
status: m.status,
|
|
1575
|
+
tag: m.username,
|
|
1576
|
+
username: m.username
|
|
1577
|
+
})),
|
|
1578
|
+
name: data.name,
|
|
1579
|
+
presenceCount: data.presence_count
|
|
1580
|
+
}));
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* Get the widget image of a guild.
|
|
1584
|
+
* @param guildID The ID of the guild.
|
|
1585
|
+
* @param style The style of the image.
|
|
1586
|
+
* @caching This method **does not** cache its result.
|
|
1587
|
+
*/
|
|
1588
|
+
async getWidgetImage(guildID, style) {
|
|
1589
|
+
const query = new QueryBuilder_1.default();
|
|
1590
|
+
query.setIfPresent("style", style);
|
|
1591
|
+
return this._manager.request({
|
|
1592
|
+
method: "GET",
|
|
1593
|
+
path: Routes.GUILD_WIDGET_IMAGE(guildID),
|
|
1594
|
+
query
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1597
|
+
/**
|
|
1598
|
+
* Get the raw JSON widget of a guild.
|
|
1599
|
+
* @param guildID The ID of the guild.
|
|
1600
|
+
* @caching This method **does not** cache its result.
|
|
1601
|
+
*/
|
|
1602
|
+
async getWidgetJSON(guildID) {
|
|
1603
|
+
return this._manager.request({
|
|
1604
|
+
method: "GET",
|
|
1605
|
+
path: Routes.GUILD_WIDGET_JSON(guildID)
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Get a guild's widget settings.
|
|
1610
|
+
* @param guildID The ID of the guild.
|
|
1611
|
+
* @caching This method **does not** cache its result.
|
|
1612
|
+
*/
|
|
1613
|
+
async getWidgetSettings(guildID) {
|
|
1614
|
+
return this._manager.authRequest({
|
|
1615
|
+
method: "GET",
|
|
1616
|
+
path: Routes.GUILD_WIDGET(guildID)
|
|
1617
|
+
}).then(data => ({
|
|
1618
|
+
channelID: data.channel_id,
|
|
1619
|
+
enabled: data.enabled
|
|
1620
|
+
}));
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Search a guild's members.
|
|
1624
|
+
* @param guildID The ID of the guild.
|
|
1625
|
+
* @param options The options to search with.
|
|
1626
|
+
* @param retryOnIndexNotAvailable If the search should be retried if Discord replies with an index unavailable response. This will retry at most one time, waiting for `retry_after` or 15-45 seconds.
|
|
1627
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1628
|
+
* @caches {@link Guild#members | Guild#members}
|
|
1629
|
+
*/
|
|
1630
|
+
async memberSearch(guildID, options, retryOnIndexNotAvailable = true) {
|
|
1631
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type, unicorn/consistent-function-scoping */
|
|
1632
|
+
const formatRange = (data) => ({
|
|
1633
|
+
range: data.range === undefined ? undefined : {
|
|
1634
|
+
gte: data.range.gte,
|
|
1635
|
+
lte: data.range.lte
|
|
1636
|
+
}
|
|
1637
|
+
});
|
|
1638
|
+
const formatOrQuery = (data) => ({
|
|
1639
|
+
or_query: data.orQuery
|
|
1640
|
+
});
|
|
1641
|
+
const formatOrQueryRange = (data) => ({
|
|
1642
|
+
or_query: data.orQuery,
|
|
1643
|
+
range: data.range === undefined ? undefined : {
|
|
1644
|
+
gte: data.range.gte,
|
|
1645
|
+
lte: data.range.lte
|
|
1646
|
+
}
|
|
1647
|
+
});
|
|
1648
|
+
const formatAndOrQuery = (data) => ({
|
|
1649
|
+
and_query: data.andQuery,
|
|
1650
|
+
or_query: data.orQuery
|
|
1651
|
+
});
|
|
1652
|
+
const formatSearchFilter = (data) => ({
|
|
1653
|
+
did_rejoin: data.didRejoin,
|
|
1654
|
+
guild_joined_at: data.guildJoinedAt === undefined ? undefined : formatRange(data.guildJoinedAt),
|
|
1655
|
+
is_pending: data.isPending,
|
|
1656
|
+
join_source_type: data.joinSourceType === undefined ? undefined : formatOrQuery(data.joinSourceType),
|
|
1657
|
+
role_ids: data.roleIDs === undefined ? undefined : formatAndOrQuery(data.roleIDs),
|
|
1658
|
+
safety_signals: data.safetySignals === undefined ? undefined : {
|
|
1659
|
+
automod_quarantined_username: data.safetySignals.automodQuarantinedUsername,
|
|
1660
|
+
communication_disabled_until: data.safetySignals.communicationDisabledUntil === undefined ? undefined : formatRange(data.safetySignals.communicationDisabledUntil),
|
|
1661
|
+
unusual_account_activity: data.safetySignals.unusualAccountActivity,
|
|
1662
|
+
unusual_dm_activity_until: data.safetySignals.unusualDmActivityUntil === undefined ? undefined : formatRange(data.safetySignals.unusualDmActivityUntil)
|
|
1663
|
+
},
|
|
1664
|
+
source_invite_code: data.sourceInviteCode === undefined ? undefined : formatOrQuery(data.sourceInviteCode),
|
|
1665
|
+
user_id: data.userID === undefined ? undefined : formatOrQueryRange(data.userID),
|
|
1666
|
+
usernames: data.usernames === undefined ? undefined : formatOrQuery(data.usernames)
|
|
1667
|
+
});
|
|
1668
|
+
const formatPaginationFilter = (data) => ({
|
|
1669
|
+
guild_joined_at: data.guildJoinedAt,
|
|
1670
|
+
user_id: data.userID
|
|
1671
|
+
});
|
|
1672
|
+
/* eslint-enable @typescript-eslint/explicit-function-return-type, unicorn/consistent-function-scoping */
|
|
1673
|
+
return this._manager.authRequest({
|
|
1674
|
+
method: "POST",
|
|
1675
|
+
path: Routes.GUILD_MEMBERS_SEARCH(guildID),
|
|
1676
|
+
json: {
|
|
1677
|
+
after: options?.after === undefined ? undefined : formatPaginationFilter(options.after),
|
|
1678
|
+
and_query: options?.andQuery === undefined ? undefined : formatSearchFilter(options.andQuery),
|
|
1679
|
+
before: options?.before === undefined ? undefined : formatPaginationFilter(options.before),
|
|
1680
|
+
limit: options?.limit,
|
|
1681
|
+
or_query: options?.orQuery === undefined ? undefined : formatSearchFilter(options.orQuery),
|
|
1682
|
+
sort: options?.sort
|
|
1683
|
+
}
|
|
1684
|
+
}).then(async (data) => {
|
|
1685
|
+
if ("retry_after" in data) {
|
|
1686
|
+
if (!retryOnIndexNotAvailable) {
|
|
1687
|
+
throw new Error(`Member search for guild ${guildID} failed due to the index not being available.`);
|
|
1688
|
+
}
|
|
1689
|
+
let retryAfter = data.retry_after;
|
|
1690
|
+
if (retryAfter === 0) {
|
|
1691
|
+
retryAfter = Math.floor(Math.random() * 30) + 15;
|
|
1692
|
+
}
|
|
1693
|
+
this._manager.client.emit("debug", `Retrying member search for ${guildID} in ${retryAfter} seconds...`);
|
|
1694
|
+
await (0, promises_1.setTimeout)(retryAfter * 1000);
|
|
1695
|
+
return this.memberSearch(guildID, options, false);
|
|
1696
|
+
}
|
|
1697
|
+
return {
|
|
1698
|
+
guildID: data.guild_id,
|
|
1699
|
+
members: data.members.map(m => ({
|
|
1700
|
+
integrationType: m.integration_type,
|
|
1701
|
+
inviterID: m.inviter_id,
|
|
1702
|
+
joinSourceType: m.join_source_type,
|
|
1703
|
+
member: this._manager.client.util.updateMember(guildID, m.member.user.id, m.member),
|
|
1704
|
+
sourceInviteCode: m.source_invite_code
|
|
1705
|
+
})),
|
|
1706
|
+
pageResultCount: data.page_result_count,
|
|
1707
|
+
totalResultCount: data.total_result_count
|
|
1708
|
+
};
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1711
|
+
/**
|
|
1712
|
+
* Remove a ban.
|
|
1713
|
+
* @param guildID The ID of the guild.
|
|
1714
|
+
* @param userID The ID of the user to remove the ban from.
|
|
1715
|
+
* @param reason The reason for removing the ban.
|
|
1716
|
+
* @caching This method **does not** cache its result.
|
|
1717
|
+
*/
|
|
1718
|
+
async removeBan(guildID, userID, reason) {
|
|
1719
|
+
await this._manager.authRequest({
|
|
1720
|
+
method: "DELETE",
|
|
1721
|
+
path: Routes.GUILD_BAN(guildID, userID),
|
|
1722
|
+
reason
|
|
1723
|
+
});
|
|
1724
|
+
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Remove a member from a guild.
|
|
1727
|
+
* @param guildID The ID of the guild.
|
|
1728
|
+
* @param memberID The ID of the user to remove.
|
|
1729
|
+
* @param reason The reason for the removal.
|
|
1730
|
+
* @caching This method **does not** cache its result.
|
|
1731
|
+
*/
|
|
1732
|
+
async removeMember(guildID, memberID, reason) {
|
|
1733
|
+
await this._manager.authRequest({
|
|
1734
|
+
method: "DELETE",
|
|
1735
|
+
path: Routes.GUILD_MEMBER(guildID, memberID),
|
|
1736
|
+
reason
|
|
1737
|
+
});
|
|
1738
|
+
}
|
|
1739
|
+
/**
|
|
1740
|
+
* Remove a role from a member.
|
|
1741
|
+
* @param guildID The ID of the guild.
|
|
1742
|
+
* @param memberID The ID of the member.
|
|
1743
|
+
* @param roleID The ID of the role to remove.
|
|
1744
|
+
* @param reason The reason for removing the role.
|
|
1745
|
+
* @caching This method **does not** cache its result.
|
|
1746
|
+
*/
|
|
1747
|
+
async removeMemberRole(guildID, memberID, roleID, reason) {
|
|
1748
|
+
await this._manager.authRequest({
|
|
1749
|
+
method: "DELETE",
|
|
1750
|
+
path: Routes.GUILD_MEMBER_ROLE(guildID, memberID, roleID),
|
|
1751
|
+
reason
|
|
1752
|
+
});
|
|
1753
|
+
}
|
|
1754
|
+
/**
|
|
1755
|
+
* Search the username & nicknames of members in a guild. See {@link REST/Guilds#memberSearch | memberSearch} for a more detailed search.
|
|
1756
|
+
* @param guildID The ID of the guild.
|
|
1757
|
+
* @param options The options to search with.
|
|
1758
|
+
* @caching This method **may** cache its result. The result will not be cached if the guild is not cached.
|
|
1759
|
+
* @caches {@link Guild#members | Guild#members}
|
|
1760
|
+
*/
|
|
1761
|
+
async searchMembers(guildID, options) {
|
|
1762
|
+
options = this._manager.client.util._freeze(options);
|
|
1763
|
+
const query = new QueryBuilder_1.default();
|
|
1764
|
+
query.set("query", options.query);
|
|
1765
|
+
query.setIfPresent("limit", options.limit);
|
|
1766
|
+
return this._manager.authRequest({
|
|
1767
|
+
method: "GET",
|
|
1768
|
+
path: Routes.GUILD_SEARCH_MEMBERS(guildID),
|
|
1769
|
+
query
|
|
1770
|
+
}).then(data => data.map(d => this._manager.client.util.updateMember(guildID, d.user.id, d)));
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Sync a guild template.
|
|
1774
|
+
* @param guildID The ID of the guild.
|
|
1775
|
+
* @param code The code of the template to sync.
|
|
1776
|
+
* @caching This method **does not** cache its result.
|
|
1777
|
+
*/
|
|
1778
|
+
async syncTemplate(guildID, code) {
|
|
1779
|
+
return this._manager.authRequest({
|
|
1780
|
+
method: "POST",
|
|
1781
|
+
path: Routes.GUILD_TEMPLATE(guildID, code)
|
|
1782
|
+
}).then(data => new GuildTemplate_1.default(data, this._manager.client));
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
exports.default = Guilds;
|