lolka.js 0.1.4 → 0.2.0
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/README.md +6 -6
- package/package.json +21 -52
- package/src/client/BaseClient.js +120 -0
- package/src/client/Client.js +147 -446
- package/src/client/WebhookClient.js +103 -0
- package/src/client/actions/Action.js +3 -4
- package/src/client/actions/ActionsManager.js +65 -55
- package/src/client/actions/ApplicationCommandPermissionsUpdate.js +34 -0
- package/src/client/actions/AutoModerationActionExecution.js +26 -0
- package/src/client/actions/AutoModerationRuleCreate.js +27 -0
- package/src/client/actions/AutoModerationRuleDelete.js +31 -0
- package/src/client/actions/AutoModerationRuleUpdate.js +29 -0
- package/src/client/actions/ChannelCreate.js +3 -5
- package/src/client/actions/ChannelDelete.js +3 -4
- package/src/client/actions/ChannelUpdate.js +3 -3
- package/src/client/actions/EntitlementCreate.js +23 -0
- package/src/client/actions/EntitlementDelete.js +27 -0
- package/src/client/actions/EntitlementUpdate.js +25 -0
- package/src/client/actions/GuildAuditLogEntryCreate.js +29 -0
- package/src/client/actions/GuildBanAdd.js +20 -0
- package/src/client/actions/GuildBanRemove.js +25 -0
- package/src/client/actions/GuildChannelsPositionUpdate.js +3 -3
- package/src/client/actions/GuildDelete.js +44 -0
- package/src/client/actions/GuildEmojiCreate.js +3 -4
- package/src/client/actions/GuildEmojiDelete.js +3 -4
- package/src/client/actions/GuildEmojiUpdate.js +3 -4
- package/src/client/actions/GuildEmojisUpdate.js +2 -2
- package/src/client/actions/GuildIntegrationsUpdate.js +19 -0
- package/src/client/actions/GuildMemberRemove.js +6 -8
- package/src/client/actions/GuildMemberUpdate.js +6 -7
- package/src/client/actions/GuildRoleCreate.js +4 -6
- package/src/client/actions/GuildRoleDelete.js +3 -4
- package/src/client/actions/GuildRoleUpdate.js +39 -0
- package/src/client/actions/GuildRolesPositionUpdate.js +3 -3
- package/src/client/actions/GuildScheduledEventCreate.js +27 -0
- package/src/client/actions/GuildScheduledEventDelete.js +3 -4
- package/src/client/actions/GuildScheduledEventUpdate.js +30 -0
- package/src/client/actions/GuildScheduledEventUserAdd.js +3 -4
- package/src/client/actions/GuildScheduledEventUserRemove.js +3 -4
- package/src/client/actions/GuildSoundboardSoundDelete.js +3 -4
- package/src/client/actions/GuildStickerCreate.js +3 -4
- package/src/client/actions/GuildStickerDelete.js +3 -4
- package/src/client/actions/GuildStickerUpdate.js +3 -4
- package/src/client/actions/GuildStickersUpdate.js +2 -2
- package/src/client/actions/GuildUpdate.js +3 -4
- package/src/client/actions/InteractionCreate.js +15 -18
- package/src/client/actions/InviteCreate.js +27 -0
- package/src/client/actions/InviteDelete.js +29 -0
- package/src/client/actions/MessageCreate.js +3 -4
- package/src/client/actions/MessageDelete.js +3 -4
- package/src/client/actions/MessageDeleteBulk.js +3 -5
- package/src/client/actions/MessagePollVoteAdd.js +3 -4
- package/src/client/actions/MessagePollVoteRemove.js +3 -4
- package/src/client/actions/MessageReactionAdd.js +5 -7
- package/src/client/actions/MessageReactionRemove.js +4 -5
- package/src/client/actions/MessageReactionRemoveAll.js +4 -5
- package/src/client/actions/MessageReactionRemoveEmoji.js +4 -5
- package/src/client/actions/MessageUpdate.js +2 -2
- package/src/client/actions/PresenceUpdate.js +45 -0
- package/src/client/actions/StageInstanceCreate.js +3 -4
- package/src/client/actions/StageInstanceDelete.js +3 -4
- package/src/client/actions/StageInstanceUpdate.js +3 -4
- package/src/client/actions/ThreadCreate.js +3 -5
- package/src/client/actions/ThreadDelete.js +26 -0
- package/src/client/actions/ThreadListSync.js +60 -0
- package/src/client/actions/ThreadMemberUpdate.js +30 -0
- package/src/client/actions/ThreadMembersUpdate.js +3 -5
- package/src/client/actions/TypingStart.js +5 -6
- package/src/client/actions/UserUpdate.js +3 -4
- package/src/client/actions/VoiceStateUpdate.js +43 -0
- package/src/client/actions/WebhooksUpdate.js +37 -0
- package/src/client/voice/ClientVoiceManager.js +6 -10
- package/src/client/websocket/WebSocketManager.js +407 -0
- package/src/client/websocket/WebSocketShard.js +234 -0
- package/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.js +2 -27
- package/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.js +2 -15
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.js +2 -16
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.js +2 -19
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.js +2 -18
- package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js +1 -2
- package/src/client/websocket/handlers/CHANNEL_UPDATE.js +1 -2
- package/src/client/websocket/handlers/ENTITLEMENT_CREATE.js +2 -12
- package/src/client/websocket/handlers/ENTITLEMENT_DELETE.js +2 -16
- package/src/client/websocket/handlers/ENTITLEMENT_UPDATE.js +2 -14
- package/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.js +2 -17
- package/src/client/websocket/handlers/GUILD_BAN_ADD.js +2 -13
- package/src/client/websocket/handlers/GUILD_BAN_REMOVE.js +2 -18
- package/src/client/websocket/handlers/GUILD_CREATE.js +5 -7
- package/src/client/websocket/handlers/GUILD_DELETE.js +2 -34
- package/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.js +2 -13
- package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js +1 -3
- package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +11 -9
- package/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.js +2 -2
- package/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.js +2 -2
- package/src/client/websocket/handlers/GUILD_ROLE_UPDATE.js +2 -19
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.js +2 -15
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.js +2 -17
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.js +1 -2
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.js +1 -2
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.js +1 -2
- package/src/client/websocket/handlers/INVITE_CREATE.js +2 -18
- package/src/client/websocket/handlers/INVITE_DELETE.js +2 -21
- package/src/client/websocket/handlers/MESSAGE_UPDATE.js +1 -2
- package/src/client/websocket/handlers/PRESENCE_UPDATE.js +2 -40
- package/src/client/websocket/handlers/RATE_LIMITED.js +2 -1
- package/src/client/websocket/handlers/READY.js +5 -8
- package/src/client/websocket/handlers/RESUMED.js +14 -0
- package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.js +1 -2
- package/src/client/websocket/handlers/SUBSCRIPTION_CREATE.js +1 -2
- package/src/client/websocket/handlers/SUBSCRIPTION_DELETE.js +1 -2
- package/src/client/websocket/handlers/SUBSCRIPTION_UPDATE.js +1 -2
- package/src/client/websocket/handlers/THREAD_DELETE.js +2 -15
- package/src/client/websocket/handlers/THREAD_LIST_SYNC.js +2 -49
- package/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.js +2 -23
- package/src/client/websocket/handlers/THREAD_UPDATE.js +1 -2
- package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js +2 -3
- package/src/client/websocket/handlers/VOICE_SERVER_UPDATE.js +3 -30
- package/src/client/websocket/handlers/VOICE_STATE_UPDATE.js +2 -35
- package/src/client/websocket/handlers/WEBHOOKS_UPDATE.js +2 -14
- package/src/client/websocket/handlers/index.js +75 -74
- package/src/errors/DJSError.js +7 -7
- package/src/errors/ErrorCodes.js +134 -58
- package/src/errors/Messages.js +143 -115
- package/src/errors/index.js +3 -5
- package/src/index.js +226 -234
- package/src/managers/ApplicationCommandManager.js +24 -60
- package/src/managers/ApplicationCommandPermissionsManager.js +33 -57
- package/src/managers/ApplicationEmojiManager.js +8 -18
- package/src/managers/AutoModerationRuleManager.js +6 -24
- package/src/managers/BaseGuildEmojiManager.js +85 -0
- package/src/managers/BaseManager.js +1 -3
- package/src/managers/CachedManager.js +8 -12
- package/src/managers/CategoryChannelChildManager.js +4 -10
- package/src/managers/ChannelManager.js +8 -70
- package/src/managers/DMMessageManager.js +2 -4
- package/src/managers/DataManager.js +5 -10
- package/src/managers/EntitlementManager.js +8 -19
- package/src/managers/GuildApplicationCommandManager.js +3 -6
- package/src/managers/GuildBanManager.js +52 -27
- package/src/managers/GuildChannelManager.js +54 -91
- package/src/managers/GuildEmojiManager.js +18 -108
- package/src/managers/GuildEmojiRoleManager.js +14 -24
- package/src/managers/GuildForumThreadManager.js +5 -10
- package/src/managers/GuildInviteManager.js +27 -51
- package/src/managers/GuildManager.js +185 -45
- package/src/managers/GuildMemberManager.js +105 -89
- package/src/managers/GuildMemberRoleManager.js +14 -29
- package/src/managers/GuildMessageManager.js +2 -20
- package/src/managers/GuildScheduledEventManager.js +13 -31
- package/src/managers/GuildSoundboardSoundManager.js +5 -17
- package/src/managers/GuildStickerManager.js +21 -34
- package/src/managers/GuildTextThreadManager.js +5 -9
- package/src/managers/MessageManager.js +77 -64
- package/src/managers/PartialGroupDMMessageManager.js +2 -4
- package/src/managers/PermissionOverwriteManager.js +15 -26
- package/src/managers/PollAnswerVoterManager.js +2 -14
- package/src/managers/PresenceManager.js +6 -11
- package/src/managers/ReactionManager.js +6 -13
- package/src/managers/ReactionUserManager.js +4 -11
- package/src/managers/RoleManager.js +74 -76
- package/src/managers/StageInstanceManager.js +8 -18
- package/src/managers/SubscriptionManager.js +4 -9
- package/src/managers/ThreadManager.js +13 -33
- package/src/managers/ThreadMemberManager.js +34 -27
- package/src/managers/UserManager.js +34 -32
- package/src/managers/VoiceStateManager.js +4 -9
- package/src/sharding/Shard.js +40 -64
- package/src/sharding/ShardClientUtil.js +60 -60
- package/src/sharding/ShardingManager.js +30 -89
- package/src/structures/ActionRow.js +18 -6
- package/src/structures/ActionRowBuilder.js +35 -0
- package/src/structures/AnonymousGuild.js +10 -14
- package/src/structures/ApplicationCommand.js +49 -67
- package/src/structures/ApplicationEmoji.js +5 -22
- package/src/structures/ApplicationRoleConnectionMetadata.js +0 -6
- package/src/structures/Attachment.js +7 -25
- package/src/structures/AttachmentBuilder.js +111 -0
- package/src/structures/AutoModerationActionExecution.js +2 -17
- package/src/structures/AutoModerationRule.js +17 -46
- package/src/structures/AutocompleteInteraction.js +4 -14
- package/src/structures/Base.js +2 -4
- package/src/structures/BaseChannel.js +4 -21
- package/src/structures/BaseGuild.js +7 -19
- package/src/structures/BaseGuildEmoji.js +13 -13
- package/src/structures/BaseGuildTextChannel.js +16 -45
- package/src/structures/BaseGuildVoiceChannel.js +12 -43
- package/src/structures/BaseInteraction.js +25 -54
- package/src/structures/BaseSelectMenuComponent.js +2 -8
- package/src/structures/ButtonBuilder.js +44 -0
- package/src/structures/ButtonComponent.js +2 -9
- package/src/structures/ButtonInteraction.js +2 -3
- package/src/structures/CategoryChannel.js +3 -8
- package/src/structures/ChannelSelectMenuBuilder.js +31 -0
- package/src/structures/ChannelSelectMenuComponent.js +2 -4
- package/src/structures/ChannelSelectMenuInteraction.js +2 -5
- package/src/structures/ChatInputCommandInteraction.js +4 -7
- package/src/structures/ClientApplication.js +12 -60
- package/src/structures/ClientPresence.js +10 -15
- package/src/structures/ClientUser.js +19 -36
- package/src/structures/CommandInteraction.js +7 -27
- package/src/structures/CommandInteractionOptionResolver.js +8 -36
- package/src/structures/Component.js +1 -7
- package/src/structures/ContainerComponent.js +3 -9
- package/src/structures/ContextMenuCommandInteraction.js +5 -9
- package/src/structures/DMChannel.js +15 -34
- package/src/structures/DirectoryChannel.js +2 -6
- package/src/structures/Embed.js +2 -19
- package/src/structures/EmbedBuilder.js +50 -0
- package/src/structures/Emoji.js +19 -19
- package/src/structures/Entitlement.js +2 -22
- package/src/structures/FileComponent.js +3 -7
- package/src/structures/ForumChannel.js +3 -6
- package/src/structures/Guild.js +131 -187
- package/src/structures/GuildAuditLogs.js +6 -12
- package/src/structures/GuildAuditLogsEntry.js +63 -88
- package/src/structures/GuildBan.js +3 -9
- package/src/structures/GuildChannel.js +33 -68
- package/src/structures/GuildEmoji.js +7 -19
- package/src/structures/GuildMember.js +58 -107
- package/src/structures/GuildOnboarding.js +2 -9
- package/src/structures/GuildOnboardingPrompt.js +2 -12
- package/src/structures/GuildOnboardingPromptOption.js +2 -12
- package/src/structures/GuildPreview.js +21 -30
- package/src/structures/GuildPreviewEmoji.js +2 -5
- package/src/structures/GuildScheduledEvent.js +19 -59
- package/src/structures/GuildTemplate.js +45 -24
- package/src/structures/Integration.js +7 -30
- package/src/structures/IntegrationApplication.js +12 -9
- package/src/structures/InteractionCallback.js +1 -10
- package/src/structures/InteractionCallbackResource.js +2 -7
- package/src/structures/InteractionCallbackResponse.js +3 -6
- package/src/structures/InteractionCollector.js +36 -23
- package/src/structures/InteractionResponse.js +102 -0
- package/src/structures/InteractionWebhook.js +6 -14
- package/src/structures/Invite.js +341 -0
- package/src/structures/InviteGuild.js +4 -6
- package/src/structures/InviteStageInstance.js +87 -0
- package/src/structures/LabelComponent.js +3 -3
- package/src/structures/MediaChannel.js +2 -3
- package/src/structures/MediaGalleryComponent.js +3 -6
- package/src/structures/MediaGalleryItem.js +2 -7
- package/src/structures/MentionableSelectMenuBuilder.js +32 -0
- package/src/structures/MentionableSelectMenuComponent.js +2 -3
- package/src/structures/MentionableSelectMenuInteraction.js +3 -8
- package/src/structures/Message.js +100 -169
- package/src/structures/MessageCollector.js +5 -16
- package/src/structures/MessageComponentInteraction.js +14 -34
- package/src/structures/MessageContextMenuCommandInteraction.js +2 -4
- package/src/structures/MessageMentions.js +4 -30
- package/src/structures/MessagePayload.js +90 -92
- package/src/structures/MessageReaction.js +17 -31
- package/src/structures/ModalBuilder.js +36 -0
- package/src/structures/{ModalComponentResolver.js → ModalSubmitFields.js} +31 -37
- package/src/structures/ModalSubmitInteraction.js +55 -54
- package/src/structures/NewsChannel.js +32 -0
- package/src/structures/OAuth2Guild.js +3 -6
- package/src/structures/PartialGroupDMChannel.js +11 -23
- package/src/structures/PermissionOverwrites.js +25 -47
- package/src/structures/Poll.js +4 -19
- package/src/structures/PollAnswer.js +29 -13
- package/src/structures/Presence.js +13 -57
- package/src/structures/PrimaryEntryPointCommandInteraction.js +2 -3
- package/src/structures/ReactionCollector.js +4 -21
- package/src/structures/ReactionEmoji.js +3 -5
- package/src/structures/Role.js +48 -65
- package/src/structures/RoleSelectMenuBuilder.js +31 -0
- package/src/structures/RoleSelectMenuComponent.js +2 -3
- package/src/structures/RoleSelectMenuInteraction.js +2 -5
- package/src/structures/SKU.js +2 -9
- package/src/structures/SectionComponent.js +3 -7
- package/src/structures/SelectMenuBuilder.js +26 -0
- package/src/structures/SelectMenuComponent.js +26 -0
- package/src/structures/SelectMenuInteraction.js +26 -0
- package/src/structures/SelectMenuOptionBuilder.js +26 -0
- package/src/structures/SeparatorComponent.js +2 -5
- package/src/structures/SoundboardSound.js +2 -18
- package/src/structures/StageChannel.js +4 -13
- package/src/structures/StageInstance.js +16 -19
- package/src/structures/Sticker.js +4 -28
- package/src/structures/StickerPack.js +4 -16
- package/src/structures/StringSelectMenuBuilder.js +79 -0
- package/src/structures/StringSelectMenuComponent.js +2 -4
- package/src/structures/StringSelectMenuInteraction.js +2 -4
- package/src/structures/StringSelectMenuOptionBuilder.js +49 -0
- package/src/structures/Subscription.js +1 -15
- package/src/structures/Team.js +7 -16
- package/src/structures/TeamMember.js +15 -9
- package/src/structures/TextChannel.js +3 -6
- package/src/structures/TextDisplayComponent.js +2 -4
- package/src/structures/TextInputBuilder.js +31 -0
- package/src/structures/TextInputComponent.js +2 -5
- package/src/structures/ThreadChannel.js +35 -85
- package/src/structures/ThreadMember.js +12 -17
- package/src/structures/ThreadOnlyChannel.js +15 -36
- package/src/structures/ThumbnailComponent.js +3 -8
- package/src/structures/Typing.js +2 -10
- package/src/structures/UnfurledMediaItem.js +2 -5
- package/src/structures/User.js +68 -60
- package/src/structures/UserContextMenuCommandInteraction.js +2 -5
- package/src/structures/UserSelectMenuBuilder.js +31 -0
- package/src/structures/UserSelectMenuComponent.js +2 -3
- package/src/structures/UserSelectMenuInteraction.js +3 -7
- package/src/structures/VoiceChannel.js +4 -11
- package/src/structures/VoiceChannelEffect.js +2 -12
- package/src/structures/VoiceRegion.js +2 -7
- package/src/structures/VoiceState.js +10 -36
- package/src/structures/Webhook.js +37 -65
- package/src/structures/WelcomeChannel.js +5 -12
- package/src/structures/WelcomeScreen.js +3 -8
- package/src/structures/Widget.js +3 -13
- package/src/structures/WidgetMember.js +2 -17
- package/src/structures/interfaces/Application.js +10 -19
- package/src/structures/interfaces/Collector.js +12 -45
- package/src/structures/interfaces/InteractionResponses.js +152 -43
- package/src/structures/interfaces/TextBasedChannel.js +99 -83
- package/src/util/APITypes.js +16 -30
- package/src/util/ActivityFlagsBitField.js +2 -5
- package/src/util/ApplicationFlagsBitField.js +6 -11
- package/src/util/AttachmentFlagsBitField.js +2 -5
- package/src/util/BitField.js +8 -27
- package/src/util/ChannelFlagsBitField.js +6 -11
- package/src/util/Channels.js +61 -73
- package/src/util/Colors.js +43 -43
- package/src/util/Components.js +82 -61
- package/src/util/Constants.js +124 -94
- package/src/util/DataResolver.js +17 -36
- package/src/util/Enums.js +1 -2
- package/src/util/Events.js +14 -3
- package/src/util/Formatters.js +413 -0
- package/src/util/GuildMemberFlagsBitField.js +5 -9
- package/src/util/IntentsBitField.js +6 -10
- package/src/util/InviteFlagsBitField.js +1 -2
- package/src/util/LimitedCollection.js +6 -13
- package/src/util/LolkaSnowflake.js +14 -1
- package/src/util/MessageFlagsBitField.js +6 -11
- package/src/util/Options.js +57 -35
- package/src/util/Partials.js +4 -5
- package/src/util/PermissionsBitField.js +8 -21
- package/src/util/RoleFlagsBitField.js +2 -5
- package/src/util/SKUFlagsBitField.js +1 -4
- package/src/util/ShardEvents.js +3 -1
- package/src/util/Status.js +21 -5
- package/src/util/Sweepers.js +13 -59
- package/src/util/SystemChannelFlagsBitField.js +6 -11
- package/src/util/ThreadMemberFlagsBitField.js +2 -6
- package/src/util/Transformers.js +18 -17
- package/src/util/UserFlagsBitField.js +2 -6
- package/src/util/Util.js +97 -148
- package/src/util/WebSocketShardEvents.js +25 -0
- package/typings/index.d.mts +2394 -1771
- package/typings/index.d.ts +2394 -1771
- package/typings/rawDataTypes.d.ts +211 -0
- package/src/structures/ActivityInstance.js +0 -52
- package/src/structures/ActivityLocation.js +0 -65
- package/src/structures/AnnouncementChannel.js +0 -29
- package/src/structures/AuthorizingIntegrationOwners.js +0 -64
- package/src/structures/BaseInvite.js +0 -187
- package/src/structures/GroupDMInvite.js +0 -37
- package/src/structures/GuildInvite.js +0 -223
- package/src/util/Invites.js +0 -31
package/src/structures/Guild.js
CHANGED
|
@@ -4,39 +4,39 @@ const { Collection } = require('@discordjs/collection');
|
|
|
4
4
|
const { makeURLSearchParams } = require('@discordjs/rest');
|
|
5
5
|
const { DiscordSnowflake } = require('../util/LolkaSnowflake');
|
|
6
6
|
const { ChannelType, GuildPremiumTier, Routes, GuildFeature } = require('discord-api-types/v10');
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const {
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
7
|
+
const AnonymousGuild = require('./AnonymousGuild');
|
|
8
|
+
const GuildAuditLogs = require('./GuildAuditLogs');
|
|
9
|
+
const { GuildOnboarding } = require('./GuildOnboarding');
|
|
10
|
+
const GuildPreview = require('./GuildPreview');
|
|
11
|
+
const GuildTemplate = require('./GuildTemplate');
|
|
12
|
+
const Integration = require('./Integration');
|
|
13
|
+
const Webhook = require('./Webhook');
|
|
14
|
+
const WelcomeScreen = require('./WelcomeScreen');
|
|
15
|
+
const { DiscordjsError, DiscordjsTypeError, ErrorCodes } = require('../errors');
|
|
16
|
+
const AutoModerationRuleManager = require('../managers/AutoModerationRuleManager');
|
|
17
|
+
const GuildApplicationCommandManager = require('../managers/GuildApplicationCommandManager');
|
|
18
|
+
const GuildBanManager = require('../managers/GuildBanManager');
|
|
19
|
+
const GuildChannelManager = require('../managers/GuildChannelManager');
|
|
20
|
+
const GuildEmojiManager = require('../managers/GuildEmojiManager');
|
|
21
|
+
const GuildInviteManager = require('../managers/GuildInviteManager');
|
|
22
|
+
const GuildMemberManager = require('../managers/GuildMemberManager');
|
|
23
|
+
const GuildScheduledEventManager = require('../managers/GuildScheduledEventManager');
|
|
24
|
+
const { GuildSoundboardSoundManager } = require('../managers/GuildSoundboardSoundManager');
|
|
25
|
+
const GuildStickerManager = require('../managers/GuildStickerManager');
|
|
26
|
+
const PresenceManager = require('../managers/PresenceManager');
|
|
27
|
+
const RoleManager = require('../managers/RoleManager');
|
|
28
|
+
const StageInstanceManager = require('../managers/StageInstanceManager');
|
|
29
|
+
const VoiceStateManager = require('../managers/VoiceStateManager');
|
|
30
|
+
const { resolveImage } = require('../util/DataResolver');
|
|
31
|
+
const Status = require('../util/Status');
|
|
32
|
+
const SystemChannelFlagsBitField = require('../util/SystemChannelFlagsBitField');
|
|
24
33
|
const { _transformAPIIncidentsData } = require('../util/Transformers.js');
|
|
25
|
-
const { discordSort, getSortableGroupTypes, resolvePartialEmoji } = require('../util/Util
|
|
26
|
-
const { AnonymousGuild } = require('./AnonymousGuild.js');
|
|
27
|
-
const { GuildAuditLogs } = require('./GuildAuditLogs.js');
|
|
28
|
-
const { GuildOnboarding } = require('./GuildOnboarding.js');
|
|
29
|
-
const { GuildPreview } = require('./GuildPreview.js');
|
|
30
|
-
const { GuildTemplate } = require('./GuildTemplate.js');
|
|
31
|
-
const { Integration } = require('./Integration.js');
|
|
32
|
-
const { Webhook } = require('./Webhook.js');
|
|
33
|
-
const { WelcomeScreen } = require('./WelcomeScreen.js');
|
|
34
|
+
const { discordSort, getSortableGroupTypes, resolvePartialEmoji } = require('../util/Util');
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* Represents a guild (or a server) on Discord.
|
|
37
38
|
* <info>It's recommended to see if a guild is available before performing operations or reading data from it. You can
|
|
38
39
|
* check this with {@link Guild#available}.</info>
|
|
39
|
-
*
|
|
40
40
|
* @extends {AnonymousGuild}
|
|
41
41
|
*/
|
|
42
42
|
class Guild extends AnonymousGuild {
|
|
@@ -45,84 +45,72 @@ class Guild extends AnonymousGuild {
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* A manager of the application commands belonging to this guild
|
|
48
|
-
*
|
|
49
48
|
* @type {GuildApplicationCommandManager}
|
|
50
49
|
*/
|
|
51
50
|
this.commands = new GuildApplicationCommandManager(this);
|
|
52
51
|
|
|
53
52
|
/**
|
|
54
53
|
* A manager of the members belonging to this guild
|
|
55
|
-
*
|
|
56
54
|
* @type {GuildMemberManager}
|
|
57
55
|
*/
|
|
58
56
|
this.members = new GuildMemberManager(this);
|
|
59
57
|
|
|
60
58
|
/**
|
|
61
59
|
* A manager of the channels belonging to this guild
|
|
62
|
-
*
|
|
63
60
|
* @type {GuildChannelManager}
|
|
64
61
|
*/
|
|
65
62
|
this.channels = new GuildChannelManager(this);
|
|
66
63
|
|
|
67
64
|
/**
|
|
68
65
|
* A manager of the bans belonging to this guild
|
|
69
|
-
*
|
|
70
66
|
* @type {GuildBanManager}
|
|
71
67
|
*/
|
|
72
68
|
this.bans = new GuildBanManager(this);
|
|
73
69
|
|
|
74
70
|
/**
|
|
75
71
|
* A manager of the roles belonging to this guild
|
|
76
|
-
*
|
|
77
72
|
* @type {RoleManager}
|
|
78
73
|
*/
|
|
79
74
|
this.roles = new RoleManager(this);
|
|
80
75
|
|
|
81
76
|
/**
|
|
82
77
|
* A manager of the presences belonging to this guild
|
|
83
|
-
*
|
|
84
78
|
* @type {PresenceManager}
|
|
85
79
|
*/
|
|
86
80
|
this.presences = new PresenceManager(this.client);
|
|
87
81
|
|
|
88
82
|
/**
|
|
89
83
|
* A manager of the voice states of this guild
|
|
90
|
-
*
|
|
91
84
|
* @type {VoiceStateManager}
|
|
92
85
|
*/
|
|
93
86
|
this.voiceStates = new VoiceStateManager(this);
|
|
94
87
|
|
|
95
88
|
/**
|
|
96
89
|
* A manager of the stage instances of this guild
|
|
97
|
-
*
|
|
98
90
|
* @type {StageInstanceManager}
|
|
99
91
|
*/
|
|
100
92
|
this.stageInstances = new StageInstanceManager(this);
|
|
101
93
|
|
|
102
94
|
/**
|
|
103
95
|
* A manager of the invites of this guild
|
|
104
|
-
*
|
|
105
96
|
* @type {GuildInviteManager}
|
|
106
97
|
*/
|
|
107
98
|
this.invites = new GuildInviteManager(this);
|
|
108
99
|
|
|
109
100
|
/**
|
|
110
101
|
* A manager of the scheduled events of this guild
|
|
111
|
-
*
|
|
112
102
|
* @type {GuildScheduledEventManager}
|
|
113
103
|
*/
|
|
114
104
|
this.scheduledEvents = new GuildScheduledEventManager(this);
|
|
115
105
|
|
|
116
106
|
/**
|
|
117
107
|
* A manager of the auto moderation rules of this guild.
|
|
118
|
-
*
|
|
119
108
|
* @type {AutoModerationRuleManager}
|
|
120
109
|
*/
|
|
121
110
|
this.autoModerationRules = new AutoModerationRuleManager(this);
|
|
122
111
|
|
|
123
112
|
/**
|
|
124
113
|
* A manager of the soundboard sounds of this guild.
|
|
125
|
-
*
|
|
126
114
|
* @type {GuildSoundboardSoundManager}
|
|
127
115
|
*/
|
|
128
116
|
this.soundboardSounds = new GuildSoundboardSoundManager(this);
|
|
@@ -131,7 +119,6 @@ class Guild extends AnonymousGuild {
|
|
|
131
119
|
if (data.unavailable) {
|
|
132
120
|
/**
|
|
133
121
|
* Whether the guild is available to access. If it is not available, it indicates a server outage
|
|
134
|
-
*
|
|
135
122
|
* @type {boolean}
|
|
136
123
|
*/
|
|
137
124
|
this.available = false;
|
|
@@ -142,12 +129,20 @@ class Guild extends AnonymousGuild {
|
|
|
142
129
|
|
|
143
130
|
/**
|
|
144
131
|
* The id of the shard this Guild belongs to.
|
|
145
|
-
*
|
|
146
132
|
* @type {number}
|
|
147
133
|
*/
|
|
148
134
|
this.shardId = data.shardId;
|
|
149
135
|
}
|
|
150
136
|
|
|
137
|
+
/**
|
|
138
|
+
* The Shard this Guild belongs to.
|
|
139
|
+
* @type {WebSocketShard}
|
|
140
|
+
* @readonly
|
|
141
|
+
*/
|
|
142
|
+
get shard() {
|
|
143
|
+
return this.client.ws.shards.get(this.shardId);
|
|
144
|
+
}
|
|
145
|
+
|
|
151
146
|
_patch(data) {
|
|
152
147
|
super._patch(data);
|
|
153
148
|
this.id = data.id;
|
|
@@ -162,7 +157,6 @@ class Guild extends AnonymousGuild {
|
|
|
162
157
|
if ('discovery_splash' in data) {
|
|
163
158
|
/**
|
|
164
159
|
* The hash of the guild discovery splash image
|
|
165
|
-
*
|
|
166
160
|
* @type {?string}
|
|
167
161
|
*/
|
|
168
162
|
this.discoverySplash = data.discovery_splash;
|
|
@@ -171,7 +165,6 @@ class Guild extends AnonymousGuild {
|
|
|
171
165
|
if ('member_count' in data) {
|
|
172
166
|
/**
|
|
173
167
|
* The full amount of members in this guild
|
|
174
|
-
*
|
|
175
168
|
* @type {number}
|
|
176
169
|
*/
|
|
177
170
|
this.memberCount = data.member_count;
|
|
@@ -180,7 +173,6 @@ class Guild extends AnonymousGuild {
|
|
|
180
173
|
if ('large' in data) {
|
|
181
174
|
/**
|
|
182
175
|
* Whether the guild is "large" (has more than {@link WebSocketOptions large_threshold} members, 50 by default)
|
|
183
|
-
*
|
|
184
176
|
* @type {boolean}
|
|
185
177
|
*/
|
|
186
178
|
this.large = Boolean(data.large);
|
|
@@ -189,7 +181,6 @@ class Guild extends AnonymousGuild {
|
|
|
189
181
|
if ('premium_progress_bar_enabled' in data) {
|
|
190
182
|
/**
|
|
191
183
|
* Whether this guild has its premium (boost) progress bar enabled
|
|
192
|
-
*
|
|
193
184
|
* @type {boolean}
|
|
194
185
|
*/
|
|
195
186
|
this.premiumProgressBarEnabled = data.premium_progress_bar_enabled;
|
|
@@ -198,7 +189,6 @@ class Guild extends AnonymousGuild {
|
|
|
198
189
|
if ('application_id' in data) {
|
|
199
190
|
/**
|
|
200
191
|
* The id of the application that created this guild (if applicable)
|
|
201
|
-
*
|
|
202
192
|
* @type {?Snowflake}
|
|
203
193
|
*/
|
|
204
194
|
this.applicationId = data.application_id;
|
|
@@ -207,7 +197,6 @@ class Guild extends AnonymousGuild {
|
|
|
207
197
|
if ('afk_timeout' in data) {
|
|
208
198
|
/**
|
|
209
199
|
* The time in seconds before a user is counted as "away from keyboard"
|
|
210
|
-
*
|
|
211
200
|
* @type {?number}
|
|
212
201
|
*/
|
|
213
202
|
this.afkTimeout = data.afk_timeout;
|
|
@@ -216,7 +205,6 @@ class Guild extends AnonymousGuild {
|
|
|
216
205
|
if ('afk_channel_id' in data) {
|
|
217
206
|
/**
|
|
218
207
|
* The id of the voice channel where AFK members are moved
|
|
219
|
-
*
|
|
220
208
|
* @type {?Snowflake}
|
|
221
209
|
*/
|
|
222
210
|
this.afkChannelId = data.afk_channel_id;
|
|
@@ -225,7 +213,6 @@ class Guild extends AnonymousGuild {
|
|
|
225
213
|
if ('system_channel_id' in data) {
|
|
226
214
|
/**
|
|
227
215
|
* The system channel's id
|
|
228
|
-
*
|
|
229
216
|
* @type {?Snowflake}
|
|
230
217
|
*/
|
|
231
218
|
this.systemChannelId = data.system_channel_id;
|
|
@@ -234,7 +221,6 @@ class Guild extends AnonymousGuild {
|
|
|
234
221
|
if ('premium_tier' in data) {
|
|
235
222
|
/**
|
|
236
223
|
* The premium tier of this guild
|
|
237
|
-
*
|
|
238
224
|
* @type {GuildPremiumTier}
|
|
239
225
|
*/
|
|
240
226
|
this.premiumTier = data.premium_tier;
|
|
@@ -243,7 +229,6 @@ class Guild extends AnonymousGuild {
|
|
|
243
229
|
if ('widget_enabled' in data) {
|
|
244
230
|
/**
|
|
245
231
|
* Whether widget images are enabled on this guild
|
|
246
|
-
*
|
|
247
232
|
* @type {?boolean}
|
|
248
233
|
*/
|
|
249
234
|
this.widgetEnabled = data.widget_enabled;
|
|
@@ -254,7 +239,6 @@ class Guild extends AnonymousGuild {
|
|
|
254
239
|
if ('widget_channel_id' in data) {
|
|
255
240
|
/**
|
|
256
241
|
* The widget channel's id, if enabled
|
|
257
|
-
*
|
|
258
242
|
* @type {?string}
|
|
259
243
|
*/
|
|
260
244
|
this.widgetChannelId = data.widget_channel_id;
|
|
@@ -265,7 +249,6 @@ class Guild extends AnonymousGuild {
|
|
|
265
249
|
if ('explicit_content_filter' in data) {
|
|
266
250
|
/**
|
|
267
251
|
* The explicit content filter level of the guild
|
|
268
|
-
*
|
|
269
252
|
* @type {GuildExplicitContentFilter}
|
|
270
253
|
*/
|
|
271
254
|
this.explicitContentFilter = data.explicit_content_filter;
|
|
@@ -274,7 +257,6 @@ class Guild extends AnonymousGuild {
|
|
|
274
257
|
if ('mfa_level' in data) {
|
|
275
258
|
/**
|
|
276
259
|
* The required MFA level for this guild
|
|
277
|
-
*
|
|
278
260
|
* @type {GuildMFALevel}
|
|
279
261
|
*/
|
|
280
262
|
this.mfaLevel = data.mfa_level;
|
|
@@ -283,7 +265,6 @@ class Guild extends AnonymousGuild {
|
|
|
283
265
|
if ('joined_at' in data) {
|
|
284
266
|
/**
|
|
285
267
|
* The timestamp the client user joined the guild at
|
|
286
|
-
*
|
|
287
268
|
* @type {number}
|
|
288
269
|
*/
|
|
289
270
|
this.joinedTimestamp = Date.parse(data.joined_at);
|
|
@@ -292,7 +273,6 @@ class Guild extends AnonymousGuild {
|
|
|
292
273
|
if ('default_message_notifications' in data) {
|
|
293
274
|
/**
|
|
294
275
|
* The default message notification level of the guild
|
|
295
|
-
*
|
|
296
276
|
* @type {GuildDefaultMessageNotifications}
|
|
297
277
|
*/
|
|
298
278
|
this.defaultMessageNotifications = data.default_message_notifications;
|
|
@@ -301,7 +281,6 @@ class Guild extends AnonymousGuild {
|
|
|
301
281
|
if ('system_channel_flags' in data) {
|
|
302
282
|
/**
|
|
303
283
|
* The value set for the guild's system channel flags
|
|
304
|
-
*
|
|
305
284
|
* @type {Readonly<SystemChannelFlagsBitField>}
|
|
306
285
|
*/
|
|
307
286
|
this.systemChannelFlags = new SystemChannelFlagsBitField(data.system_channel_flags).freeze();
|
|
@@ -310,7 +289,6 @@ class Guild extends AnonymousGuild {
|
|
|
310
289
|
if ('max_members' in data) {
|
|
311
290
|
/**
|
|
312
291
|
* The maximum amount of members the guild can have
|
|
313
|
-
*
|
|
314
292
|
* @type {?number}
|
|
315
293
|
*/
|
|
316
294
|
this.maximumMembers = data.max_members;
|
|
@@ -323,7 +301,6 @@ class Guild extends AnonymousGuild {
|
|
|
323
301
|
* The maximum amount of presences the guild can have (this is `null` for all but the largest of guilds)
|
|
324
302
|
* <info>You will need to fetch the guild using {@link BaseGuild#fetch} if you want to receive
|
|
325
303
|
* this parameter</info>
|
|
326
|
-
*
|
|
327
304
|
* @type {?number}
|
|
328
305
|
*/
|
|
329
306
|
this.maximumPresences = data.max_presences;
|
|
@@ -334,7 +311,6 @@ class Guild extends AnonymousGuild {
|
|
|
334
311
|
if ('max_video_channel_users' in data) {
|
|
335
312
|
/**
|
|
336
313
|
* The maximum amount of users allowed in a video channel.
|
|
337
|
-
*
|
|
338
314
|
* @type {?number}
|
|
339
315
|
*/
|
|
340
316
|
this.maxVideoChannelUsers = data.max_video_channel_users;
|
|
@@ -345,7 +321,6 @@ class Guild extends AnonymousGuild {
|
|
|
345
321
|
if ('max_stage_video_channel_users' in data) {
|
|
346
322
|
/**
|
|
347
323
|
* The maximum amount of users allowed in a stage video channel.
|
|
348
|
-
*
|
|
349
324
|
* @type {?number}
|
|
350
325
|
*/
|
|
351
326
|
this.maxStageVideoChannelUsers = data.max_stage_video_channel_users;
|
|
@@ -358,7 +333,6 @@ class Guild extends AnonymousGuild {
|
|
|
358
333
|
* The approximate amount of members the guild has
|
|
359
334
|
* <info>You will need to fetch the guild using {@link BaseGuild#fetch} if you want to receive
|
|
360
335
|
* this parameter</info>
|
|
361
|
-
*
|
|
362
336
|
* @type {?number}
|
|
363
337
|
*/
|
|
364
338
|
this.approximateMemberCount = data.approximate_member_count;
|
|
@@ -371,7 +345,6 @@ class Guild extends AnonymousGuild {
|
|
|
371
345
|
* The approximate amount of presences the guild has
|
|
372
346
|
* <info>You will need to fetch the guild using {@link BaseGuild#fetch} if you want to receive
|
|
373
347
|
* this parameter</info>
|
|
374
|
-
*
|
|
375
348
|
* @type {?number}
|
|
376
349
|
*/
|
|
377
350
|
this.approximatePresenceCount = data.approximate_presence_count;
|
|
@@ -382,7 +355,6 @@ class Guild extends AnonymousGuild {
|
|
|
382
355
|
/**
|
|
383
356
|
* The use count of the vanity URL code of the guild, if any
|
|
384
357
|
* <info>You will need to fetch this parameter using {@link Guild#fetchVanityData} if you want to receive it</info>
|
|
385
|
-
*
|
|
386
358
|
* @type {?number}
|
|
387
359
|
*/
|
|
388
360
|
this.vanityURLUses ??= null;
|
|
@@ -390,7 +362,6 @@ class Guild extends AnonymousGuild {
|
|
|
390
362
|
if ('rules_channel_id' in data) {
|
|
391
363
|
/**
|
|
392
364
|
* The rules channel's id for the guild
|
|
393
|
-
*
|
|
394
365
|
* @type {?Snowflake}
|
|
395
366
|
*/
|
|
396
367
|
this.rulesChannelId = data.rules_channel_id;
|
|
@@ -399,7 +370,6 @@ class Guild extends AnonymousGuild {
|
|
|
399
370
|
if ('public_updates_channel_id' in data) {
|
|
400
371
|
/**
|
|
401
372
|
* The community updates channel's id for the guild
|
|
402
|
-
*
|
|
403
373
|
* @type {?Snowflake}
|
|
404
374
|
*/
|
|
405
375
|
this.publicUpdatesChannelId = data.public_updates_channel_id;
|
|
@@ -408,7 +378,6 @@ class Guild extends AnonymousGuild {
|
|
|
408
378
|
if ('preferred_locale' in data) {
|
|
409
379
|
/**
|
|
410
380
|
* The preferred locale of the guild, defaults to `en-US`
|
|
411
|
-
*
|
|
412
381
|
* @type {Locale}
|
|
413
382
|
*/
|
|
414
383
|
this.preferredLocale = data.preferred_locale;
|
|
@@ -417,7 +386,6 @@ class Guild extends AnonymousGuild {
|
|
|
417
386
|
if ('safety_alerts_channel_id' in data) {
|
|
418
387
|
/**
|
|
419
388
|
* The safety alerts channel's id for the guild
|
|
420
|
-
*
|
|
421
389
|
* @type {?Snowflake}
|
|
422
390
|
*/
|
|
423
391
|
this.safetyAlertsChannelId = data.safety_alerts_channel_id;
|
|
@@ -451,7 +419,6 @@ class Guild extends AnonymousGuild {
|
|
|
451
419
|
if ('owner_id' in data) {
|
|
452
420
|
/**
|
|
453
421
|
* The user id of this guild's owner
|
|
454
|
-
*
|
|
455
422
|
* @type {Snowflake}
|
|
456
423
|
*/
|
|
457
424
|
this.ownerId = data.owner_id;
|
|
@@ -487,7 +454,6 @@ class Guild extends AnonymousGuild {
|
|
|
487
454
|
if (!this.emojis) {
|
|
488
455
|
/**
|
|
489
456
|
* A manager of the emojis belonging to this guild
|
|
490
|
-
*
|
|
491
457
|
* @type {GuildEmojiManager}
|
|
492
458
|
*/
|
|
493
459
|
this.emojis = new GuildEmojiManager(this);
|
|
@@ -502,7 +468,6 @@ class Guild extends AnonymousGuild {
|
|
|
502
468
|
if (!this.stickers) {
|
|
503
469
|
/**
|
|
504
470
|
* A manager of the stickers belonging to this guild
|
|
505
|
-
*
|
|
506
471
|
* @type {GuildStickerManager}
|
|
507
472
|
*/
|
|
508
473
|
this.stickers = new GuildStickerManager(this);
|
|
@@ -517,7 +482,6 @@ class Guild extends AnonymousGuild {
|
|
|
517
482
|
if ('incidents_data' in data) {
|
|
518
483
|
/**
|
|
519
484
|
* Incident actions of a guild.
|
|
520
|
-
*
|
|
521
485
|
* @typedef {Object} IncidentActions
|
|
522
486
|
* @property {?Date} invitesDisabledUntil When invites would be enabled again
|
|
523
487
|
* @property {?Date} dmsDisabledUntil When direct messages would be enabled again
|
|
@@ -529,7 +493,6 @@ class Guild extends AnonymousGuild {
|
|
|
529
493
|
* The incidents data of this guild.
|
|
530
494
|
* <info>You will need to fetch the guild using {@link BaseGuild#fetch} if you want to receive
|
|
531
495
|
* this property.</info>
|
|
532
|
-
*
|
|
533
496
|
* @type {?IncidentActions}
|
|
534
497
|
*/
|
|
535
498
|
this.incidentsData = data.incidents_data && _transformAPIIncidentsData(data.incidents_data);
|
|
@@ -547,7 +510,6 @@ class Guild extends AnonymousGuild {
|
|
|
547
510
|
|
|
548
511
|
/**
|
|
549
512
|
* The time the client user joined the guild
|
|
550
|
-
*
|
|
551
513
|
* @type {Date}
|
|
552
514
|
* @readonly
|
|
553
515
|
*/
|
|
@@ -557,18 +519,21 @@ class Guild extends AnonymousGuild {
|
|
|
557
519
|
|
|
558
520
|
/**
|
|
559
521
|
* The URL to this guild's discovery splash image.
|
|
560
|
-
*
|
|
561
522
|
* @param {ImageURLOptions} [options={}] Options for the image URL
|
|
562
523
|
* @returns {?string}
|
|
563
524
|
*/
|
|
564
525
|
discoverySplashURL(options = {}) {
|
|
565
|
-
return
|
|
526
|
+
return (
|
|
527
|
+
this.discoverySplash &&
|
|
528
|
+
(/^https?:\/\//.test(this.discoverySplash)
|
|
529
|
+
? this.discoverySplash
|
|
530
|
+
: this.client.rest.cdn.discoverySplash(this.id, this.discoverySplash, options))
|
|
531
|
+
);
|
|
566
532
|
}
|
|
567
533
|
|
|
568
534
|
/**
|
|
569
535
|
* Fetches the owner of the guild.
|
|
570
536
|
* If the member object isn't needed, use {@link Guild#ownerId} instead.
|
|
571
|
-
*
|
|
572
537
|
* @param {BaseFetchOptions} [options] The options for fetching the member
|
|
573
538
|
* @returns {Promise<GuildMember>}
|
|
574
539
|
*/
|
|
@@ -576,13 +541,12 @@ class Guild extends AnonymousGuild {
|
|
|
576
541
|
if (!this.ownerId) {
|
|
577
542
|
throw new DiscordjsError(ErrorCodes.FetchOwnerId, 'guild');
|
|
578
543
|
}
|
|
579
|
-
|
|
580
|
-
return
|
|
544
|
+
const member = await this.members.fetch({ ...options, user: this.ownerId });
|
|
545
|
+
return member;
|
|
581
546
|
}
|
|
582
547
|
|
|
583
548
|
/**
|
|
584
549
|
* AFK voice channel for this guild
|
|
585
|
-
*
|
|
586
550
|
* @type {?VoiceChannel}
|
|
587
551
|
* @readonly
|
|
588
552
|
*/
|
|
@@ -592,7 +556,6 @@ class Guild extends AnonymousGuild {
|
|
|
592
556
|
|
|
593
557
|
/**
|
|
594
558
|
* System channel for this guild
|
|
595
|
-
*
|
|
596
559
|
* @type {?TextChannel}
|
|
597
560
|
* @readonly
|
|
598
561
|
*/
|
|
@@ -602,8 +565,7 @@ class Guild extends AnonymousGuild {
|
|
|
602
565
|
|
|
603
566
|
/**
|
|
604
567
|
* Widget channel for this guild
|
|
605
|
-
*
|
|
606
|
-
* @type {?(TextChannel|AnnouncementChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel)}
|
|
568
|
+
* @type {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel)}
|
|
607
569
|
* @readonly
|
|
608
570
|
*/
|
|
609
571
|
get widgetChannel() {
|
|
@@ -612,7 +574,6 @@ class Guild extends AnonymousGuild {
|
|
|
612
574
|
|
|
613
575
|
/**
|
|
614
576
|
* Rules channel for this guild
|
|
615
|
-
*
|
|
616
577
|
* @type {?TextChannel}
|
|
617
578
|
* @readonly
|
|
618
579
|
*/
|
|
@@ -622,7 +583,6 @@ class Guild extends AnonymousGuild {
|
|
|
622
583
|
|
|
623
584
|
/**
|
|
624
585
|
* Public updates channel for this guild
|
|
625
|
-
*
|
|
626
586
|
* @type {?TextChannel}
|
|
627
587
|
* @readonly
|
|
628
588
|
*/
|
|
@@ -632,7 +592,6 @@ class Guild extends AnonymousGuild {
|
|
|
632
592
|
|
|
633
593
|
/**
|
|
634
594
|
* Safety alerts channel for this guild
|
|
635
|
-
*
|
|
636
595
|
* @type {?TextChannel}
|
|
637
596
|
* @readonly
|
|
638
597
|
*/
|
|
@@ -641,8 +600,7 @@ class Guild extends AnonymousGuild {
|
|
|
641
600
|
}
|
|
642
601
|
|
|
643
602
|
/**
|
|
644
|
-
* The maximum bitrate available for
|
|
645
|
-
*
|
|
603
|
+
* The maximum bitrate available for this guild
|
|
646
604
|
* @type {number}
|
|
647
605
|
* @readonly
|
|
648
606
|
*/
|
|
@@ -663,20 +621,9 @@ class Guild extends AnonymousGuild {
|
|
|
663
621
|
}
|
|
664
622
|
}
|
|
665
623
|
|
|
666
|
-
/**
|
|
667
|
-
* The maximum bitrate available for a stage channel in this guild
|
|
668
|
-
*
|
|
669
|
-
* @type {number}
|
|
670
|
-
* @readonly
|
|
671
|
-
*/
|
|
672
|
-
get maximumStageBitrate() {
|
|
673
|
-
return 64_000;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
624
|
/**
|
|
677
625
|
* Fetches a collection of integrations to this guild.
|
|
678
626
|
* Resolves with a collection mapping integrations by their ids.
|
|
679
|
-
*
|
|
680
627
|
* @returns {Promise<Collection<Snowflake|string, Integration>>}
|
|
681
628
|
* @example
|
|
682
629
|
* // Fetch integrations
|
|
@@ -695,7 +642,6 @@ class Guild extends AnonymousGuild {
|
|
|
695
642
|
/**
|
|
696
643
|
* Fetches a collection of templates from this guild.
|
|
697
644
|
* Resolves with a collection mapping templates by their codes.
|
|
698
|
-
*
|
|
699
645
|
* @returns {Promise<Collection<string, GuildTemplate>>}
|
|
700
646
|
*/
|
|
701
647
|
async fetchTemplates() {
|
|
@@ -705,7 +651,6 @@ class Guild extends AnonymousGuild {
|
|
|
705
651
|
|
|
706
652
|
/**
|
|
707
653
|
* Fetches the welcome screen for this guild.
|
|
708
|
-
*
|
|
709
654
|
* @returns {Promise<WelcomeScreen>}
|
|
710
655
|
*/
|
|
711
656
|
async fetchWelcomeScreen() {
|
|
@@ -715,7 +660,6 @@ class Guild extends AnonymousGuild {
|
|
|
715
660
|
|
|
716
661
|
/**
|
|
717
662
|
* Creates a template for the guild.
|
|
718
|
-
*
|
|
719
663
|
* @param {string} name The name for the template
|
|
720
664
|
* @param {string} [description] The description for the template
|
|
721
665
|
* @returns {Promise<GuildTemplate>}
|
|
@@ -727,7 +671,6 @@ class Guild extends AnonymousGuild {
|
|
|
727
671
|
|
|
728
672
|
/**
|
|
729
673
|
* Obtains a guild preview for this guild from Discord.
|
|
730
|
-
*
|
|
731
674
|
* @returns {Promise<GuildPreview>}
|
|
732
675
|
*/
|
|
733
676
|
async fetchPreview() {
|
|
@@ -737,7 +680,6 @@ class Guild extends AnonymousGuild {
|
|
|
737
680
|
|
|
738
681
|
/**
|
|
739
682
|
* An object containing information about a guild's vanity invite.
|
|
740
|
-
*
|
|
741
683
|
* @typedef {Object} Vanity
|
|
742
684
|
* @property {?string} code Vanity invite code
|
|
743
685
|
* @property {number} uses How many times this invite has been used
|
|
@@ -746,7 +688,6 @@ class Guild extends AnonymousGuild {
|
|
|
746
688
|
/**
|
|
747
689
|
* Fetches the vanity URL invite object to this guild.
|
|
748
690
|
* Resolves with an object containing the vanity URL invite code and the use count
|
|
749
|
-
*
|
|
750
691
|
* @returns {Promise<Vanity>}
|
|
751
692
|
* @example
|
|
752
693
|
* // Fetch invite data
|
|
@@ -766,7 +707,6 @@ class Guild extends AnonymousGuild {
|
|
|
766
707
|
|
|
767
708
|
/**
|
|
768
709
|
* Fetches all webhooks for the guild.
|
|
769
|
-
*
|
|
770
710
|
* @returns {Promise<Collection<Snowflake, Webhook>>}
|
|
771
711
|
* @example
|
|
772
712
|
* // Fetch webhooks
|
|
@@ -783,7 +723,6 @@ class Guild extends AnonymousGuild {
|
|
|
783
723
|
|
|
784
724
|
/**
|
|
785
725
|
* Fetches the guild widget data, requires the widget to be enabled.
|
|
786
|
-
*
|
|
787
726
|
* @returns {Promise<Widget>}
|
|
788
727
|
* @example
|
|
789
728
|
* // Fetches the guild widget data
|
|
@@ -791,31 +730,28 @@ class Guild extends AnonymousGuild {
|
|
|
791
730
|
* .then(widget => console.log(`The widget shows ${widget.channels.size} channels`))
|
|
792
731
|
* .catch(console.error);
|
|
793
732
|
*/
|
|
794
|
-
|
|
733
|
+
fetchWidget() {
|
|
795
734
|
return this.client.fetchGuildWidget(this.id);
|
|
796
735
|
}
|
|
797
736
|
|
|
798
737
|
/**
|
|
799
738
|
* Data for the Guild Widget Settings object
|
|
800
|
-
*
|
|
801
739
|
* @typedef {Object} GuildWidgetSettings
|
|
802
740
|
* @property {boolean} enabled Whether the widget is enabled
|
|
803
|
-
* @property {?(TextChannel|
|
|
741
|
+
* @property {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel)} channel
|
|
804
742
|
* The widget invite channel
|
|
805
743
|
*/
|
|
806
744
|
|
|
807
745
|
/**
|
|
808
746
|
* The Guild Widget Settings object
|
|
809
|
-
*
|
|
810
747
|
* @typedef {Object} GuildWidgetSettingsData
|
|
811
748
|
* @property {boolean} enabled Whether the widget is enabled
|
|
812
|
-
* @property {?(TextChannel|
|
|
813
|
-
*
|
|
749
|
+
* @property {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel|Snowflake)} channel
|
|
750
|
+
* The widget invite channel
|
|
814
751
|
*/
|
|
815
752
|
|
|
816
753
|
/**
|
|
817
754
|
* Fetches the guild widget settings.
|
|
818
|
-
*
|
|
819
755
|
* @returns {Promise<GuildWidgetSettings>}
|
|
820
756
|
* @example
|
|
821
757
|
* // Fetches the guild widget settings
|
|
@@ -835,7 +771,6 @@ class Guild extends AnonymousGuild {
|
|
|
835
771
|
|
|
836
772
|
/**
|
|
837
773
|
* Returns a URL for the PNG widget of the guild.
|
|
838
|
-
*
|
|
839
774
|
* @param {GuildWidgetStyle} [style] The style for the widget image
|
|
840
775
|
* @returns {string}
|
|
841
776
|
*/
|
|
@@ -845,7 +780,6 @@ class Guild extends AnonymousGuild {
|
|
|
845
780
|
|
|
846
781
|
/**
|
|
847
782
|
* Options used to fetch audit logs.
|
|
848
|
-
*
|
|
849
783
|
* @typedef {Object} GuildAuditLogsFetchOptions
|
|
850
784
|
* @property {Snowflake|GuildAuditLogsEntry} [before] Consider only entries before this entry
|
|
851
785
|
* @property {Snowflake|GuildAuditLogsEntry} [after] Consider only entries after this entry
|
|
@@ -856,7 +790,6 @@ class Guild extends AnonymousGuild {
|
|
|
856
790
|
|
|
857
791
|
/**
|
|
858
792
|
* Fetches audit logs for this guild.
|
|
859
|
-
*
|
|
860
793
|
* @param {GuildAuditLogsFetchOptions} [options={}] Options for fetching audit logs
|
|
861
794
|
* @returns {Promise<GuildAuditLogs>}
|
|
862
795
|
* @example
|
|
@@ -885,7 +818,6 @@ class Guild extends AnonymousGuild {
|
|
|
885
818
|
|
|
886
819
|
/**
|
|
887
820
|
* Fetches the guild onboarding data for this guild.
|
|
888
|
-
*
|
|
889
821
|
* @returns {Promise<GuildOnboarding>}
|
|
890
822
|
*/
|
|
891
823
|
async fetchOnboarding() {
|
|
@@ -895,7 +827,6 @@ class Guild extends AnonymousGuild {
|
|
|
895
827
|
|
|
896
828
|
/**
|
|
897
829
|
* The data for editing a guild.
|
|
898
|
-
*
|
|
899
830
|
* @typedef {Object} GuildEditOptions
|
|
900
831
|
* @property {string} [name] The name of the guild
|
|
901
832
|
* @property {?GuildVerificationLevel} [verificationLevel] The verification level of the guild
|
|
@@ -905,6 +836,8 @@ class Guild extends AnonymousGuild {
|
|
|
905
836
|
* @property {?VoiceChannelResolvable} [afkChannel] The AFK channel of the guild
|
|
906
837
|
* @property {number} [afkTimeout] The AFK timeout of the guild
|
|
907
838
|
* @property {?(BufferResolvable|Base64Resolvable)} [icon] The icon of the guild
|
|
839
|
+
* @property {GuildMemberResolvable} [owner] The owner of the guild
|
|
840
|
+
* <warn>This property is **deprecated** as API related to guild ownership may no longer be used.</warn>
|
|
908
841
|
* @property {?(BufferResolvable|Base64Resolvable)} [splash] The invite splash image of the guild
|
|
909
842
|
* @property {?(BufferResolvable|Base64Resolvable)} [discoverySplash] The discovery splash image of the guild
|
|
910
843
|
* @property {?(BufferResolvable|Base64Resolvable)} [banner] The banner of the guild
|
|
@@ -922,23 +855,20 @@ class Guild extends AnonymousGuild {
|
|
|
922
855
|
|
|
923
856
|
/**
|
|
924
857
|
* Data that can be resolved to a Text Channel object. This can be:
|
|
925
|
-
*
|
|
926
|
-
*
|
|
927
|
-
*
|
|
858
|
+
* * A TextChannel
|
|
859
|
+
* * A Snowflake
|
|
928
860
|
* @typedef {TextChannel|Snowflake} TextChannelResolvable
|
|
929
861
|
*/
|
|
930
862
|
|
|
931
863
|
/**
|
|
932
864
|
* Data that can be resolved to a Voice Channel object. This can be:
|
|
933
|
-
*
|
|
934
|
-
*
|
|
935
|
-
*
|
|
865
|
+
* * A VoiceChannel
|
|
866
|
+
* * A Snowflake
|
|
936
867
|
* @typedef {VoiceChannel|Snowflake} VoiceChannelResolvable
|
|
937
868
|
*/
|
|
938
869
|
|
|
939
870
|
/**
|
|
940
871
|
* Updates the guild with new information - e.g. a new name.
|
|
941
|
-
*
|
|
942
872
|
* @param {GuildEditOptions} options The options to provide
|
|
943
873
|
* @returns {Promise<Guild>}
|
|
944
874
|
* @example
|
|
@@ -956,6 +886,7 @@ class Guild extends AnonymousGuild {
|
|
|
956
886
|
afkChannel,
|
|
957
887
|
afkTimeout,
|
|
958
888
|
icon,
|
|
889
|
+
owner,
|
|
959
890
|
splash,
|
|
960
891
|
discoverySplash,
|
|
961
892
|
banner,
|
|
@@ -977,6 +908,7 @@ class Guild extends AnonymousGuild {
|
|
|
977
908
|
afk_channel_id: afkChannel && this.client.channels.resolveId(afkChannel),
|
|
978
909
|
afk_timeout: afkTimeout,
|
|
979
910
|
icon: icon && (await resolveImage(icon)),
|
|
911
|
+
owner_id: owner && this.client.users.resolveId(owner),
|
|
980
912
|
splash: splash && (await resolveImage(splash)),
|
|
981
913
|
discovery_splash: discoverySplash && (await resolveImage(discoverySplash)),
|
|
982
914
|
banner: banner && (await resolveImage(banner)),
|
|
@@ -997,7 +929,6 @@ class Guild extends AnonymousGuild {
|
|
|
997
929
|
|
|
998
930
|
/**
|
|
999
931
|
* Options used to edit the guild onboarding.
|
|
1000
|
-
*
|
|
1001
932
|
* @typedef {Object} GuildOnboardingEditOptions
|
|
1002
933
|
* @property {GuildOnboardingPromptData[]|Collection<Snowflake, GuildOnboardingPrompt>} [prompts]
|
|
1003
934
|
* The prompts shown during onboarding and in customize community
|
|
@@ -1010,7 +941,6 @@ class Guild extends AnonymousGuild {
|
|
|
1010
941
|
|
|
1011
942
|
/**
|
|
1012
943
|
* Data for editing a guild onboarding prompt.
|
|
1013
|
-
*
|
|
1014
944
|
* @typedef {Object} GuildOnboardingPromptData
|
|
1015
945
|
* @property {Snowflake} [id] The id of the prompt
|
|
1016
946
|
* @property {string} title The title for the prompt
|
|
@@ -1024,7 +954,6 @@ class Guild extends AnonymousGuild {
|
|
|
1024
954
|
|
|
1025
955
|
/**
|
|
1026
956
|
* Data for editing a guild onboarding prompt option.
|
|
1027
|
-
*
|
|
1028
957
|
* @typedef {Object} GuildOnboardingPromptOptionData
|
|
1029
958
|
* @property {?Snowflake} [id] The id of the option
|
|
1030
959
|
* @property {ChannelResolvable[]|Collection<Snowflake, GuildChannel>} [channels]
|
|
@@ -1038,7 +967,6 @@ class Guild extends AnonymousGuild {
|
|
|
1038
967
|
|
|
1039
968
|
/**
|
|
1040
969
|
* Edits the guild onboarding data for this guild.
|
|
1041
|
-
*
|
|
1042
970
|
* @param {GuildOnboardingEditOptions} options The options to provide
|
|
1043
971
|
* @returns {Promise<GuildOnboarding>}
|
|
1044
972
|
*/
|
|
@@ -1080,17 +1008,15 @@ class Guild extends AnonymousGuild {
|
|
|
1080
1008
|
|
|
1081
1009
|
/**
|
|
1082
1010
|
* Welcome channel data
|
|
1083
|
-
*
|
|
1084
1011
|
* @typedef {Object} WelcomeChannelData
|
|
1085
1012
|
* @property {string} description The description to show for this welcome channel
|
|
1086
|
-
* @property {TextChannel|
|
|
1013
|
+
* @property {TextChannel|NewsChannel|ForumChannel|MediaChannel|Snowflake} channel
|
|
1087
1014
|
* The channel to link for this welcome channel
|
|
1088
1015
|
* @property {EmojiIdentifierResolvable} [emoji] The emoji to display for this welcome channel
|
|
1089
1016
|
*/
|
|
1090
1017
|
|
|
1091
1018
|
/**
|
|
1092
1019
|
* Welcome screen edit data
|
|
1093
|
-
*
|
|
1094
1020
|
* @typedef {Object} WelcomeScreenEditOptions
|
|
1095
1021
|
* @property {boolean} [enabled] Whether the welcome screen is enabled
|
|
1096
1022
|
* @property {string} [description] The description for the welcome screen
|
|
@@ -1099,25 +1025,22 @@ class Guild extends AnonymousGuild {
|
|
|
1099
1025
|
|
|
1100
1026
|
/**
|
|
1101
1027
|
* Data that can be resolved to a GuildTextChannel object. This can be:
|
|
1102
|
-
*
|
|
1103
|
-
*
|
|
1104
|
-
*
|
|
1105
|
-
*
|
|
1106
|
-
* @typedef {TextChannel|AnnouncementChannel|Snowflake} GuildTextChannelResolvable
|
|
1028
|
+
* * A TextChannel
|
|
1029
|
+
* * A NewsChannel
|
|
1030
|
+
* * A Snowflake
|
|
1031
|
+
* @typedef {TextChannel|NewsChannel|Snowflake} GuildTextChannelResolvable
|
|
1107
1032
|
*/
|
|
1108
1033
|
|
|
1109
1034
|
/**
|
|
1110
1035
|
* Data that can be resolved to a GuildVoiceChannel object. This can be:
|
|
1111
|
-
*
|
|
1112
|
-
*
|
|
1113
|
-
*
|
|
1114
|
-
*
|
|
1036
|
+
* * A VoiceChannel
|
|
1037
|
+
* * A StageChannel
|
|
1038
|
+
* * A Snowflake
|
|
1115
1039
|
* @typedef {VoiceChannel|StageChannel|Snowflake} GuildVoiceChannelResolvable
|
|
1116
1040
|
*/
|
|
1117
1041
|
|
|
1118
1042
|
/**
|
|
1119
1043
|
* Updates the guild's welcome screen
|
|
1120
|
-
*
|
|
1121
1044
|
* @param {WelcomeScreenEditOptions} options The options to provide
|
|
1122
1045
|
* @returns {Promise<WelcomeScreen>}
|
|
1123
1046
|
* @example
|
|
@@ -1156,41 +1079,37 @@ class Guild extends AnonymousGuild {
|
|
|
1156
1079
|
|
|
1157
1080
|
/**
|
|
1158
1081
|
* Edits the level of the explicit content filter.
|
|
1159
|
-
*
|
|
1160
1082
|
* @param {?GuildExplicitContentFilter} explicitContentFilter The new level of the explicit content filter
|
|
1161
1083
|
* @param {string} [reason] Reason for changing the level of the guild's explicit content filter
|
|
1162
1084
|
* @returns {Promise<Guild>}
|
|
1163
1085
|
*/
|
|
1164
|
-
|
|
1086
|
+
setExplicitContentFilter(explicitContentFilter, reason) {
|
|
1165
1087
|
return this.edit({ explicitContentFilter, reason });
|
|
1166
1088
|
}
|
|
1167
1089
|
|
|
1168
1090
|
/**
|
|
1169
1091
|
* Edits the setting of the default message notifications of the guild.
|
|
1170
|
-
*
|
|
1171
1092
|
* @param {?GuildDefaultMessageNotifications} defaultMessageNotifications
|
|
1172
1093
|
* The new default message notification level of the guild
|
|
1173
1094
|
* @param {string} [reason] Reason for changing the setting of the default message notifications
|
|
1174
1095
|
* @returns {Promise<Guild>}
|
|
1175
1096
|
*/
|
|
1176
|
-
|
|
1097
|
+
setDefaultMessageNotifications(defaultMessageNotifications, reason) {
|
|
1177
1098
|
return this.edit({ defaultMessageNotifications, reason });
|
|
1178
1099
|
}
|
|
1179
1100
|
|
|
1180
1101
|
/**
|
|
1181
1102
|
* Edits the flags of the default message notifications of the guild.
|
|
1182
|
-
*
|
|
1183
1103
|
* @param {SystemChannelFlagsResolvable} systemChannelFlags The new flags for the default message notifications
|
|
1184
1104
|
* @param {string} [reason] Reason for changing the flags of the default message notifications
|
|
1185
1105
|
* @returns {Promise<Guild>}
|
|
1186
1106
|
*/
|
|
1187
|
-
|
|
1107
|
+
setSystemChannelFlags(systemChannelFlags, reason) {
|
|
1188
1108
|
return this.edit({ systemChannelFlags, reason });
|
|
1189
1109
|
}
|
|
1190
1110
|
|
|
1191
1111
|
/**
|
|
1192
1112
|
* Edits the name of the guild.
|
|
1193
|
-
*
|
|
1194
1113
|
* @param {string} name The new name of the guild
|
|
1195
1114
|
* @param {string} [reason] Reason for changing the guild's name
|
|
1196
1115
|
* @returns {Promise<Guild>}
|
|
@@ -1200,13 +1119,12 @@ class Guild extends AnonymousGuild {
|
|
|
1200
1119
|
* .then(updated => console.log(`Updated guild name to ${updated.name}`))
|
|
1201
1120
|
* .catch(console.error);
|
|
1202
1121
|
*/
|
|
1203
|
-
|
|
1122
|
+
setName(name, reason) {
|
|
1204
1123
|
return this.edit({ name, reason });
|
|
1205
1124
|
}
|
|
1206
1125
|
|
|
1207
1126
|
/**
|
|
1208
1127
|
* Edits the verification level of the guild.
|
|
1209
|
-
*
|
|
1210
1128
|
* @param {?GuildVerificationLevel} verificationLevel The new verification level of the guild
|
|
1211
1129
|
* @param {string} [reason] Reason for changing the guild's verification level
|
|
1212
1130
|
* @returns {Promise<Guild>}
|
|
@@ -1216,13 +1134,12 @@ class Guild extends AnonymousGuild {
|
|
|
1216
1134
|
* .then(updated => console.log(`Updated guild verification level to ${guild.verificationLevel}`))
|
|
1217
1135
|
* .catch(console.error);
|
|
1218
1136
|
*/
|
|
1219
|
-
|
|
1137
|
+
setVerificationLevel(verificationLevel, reason) {
|
|
1220
1138
|
return this.edit({ verificationLevel, reason });
|
|
1221
1139
|
}
|
|
1222
1140
|
|
|
1223
1141
|
/**
|
|
1224
1142
|
* Edits the AFK channel of the guild.
|
|
1225
|
-
*
|
|
1226
1143
|
* @param {?VoiceChannelResolvable} afkChannel The new AFK channel
|
|
1227
1144
|
* @param {string} [reason] Reason for changing the guild's AFK channel
|
|
1228
1145
|
* @returns {Promise<Guild>}
|
|
@@ -1232,13 +1149,12 @@ class Guild extends AnonymousGuild {
|
|
|
1232
1149
|
* .then(updated => console.log(`Updated guild AFK channel to ${guild.afkChannel.name}`))
|
|
1233
1150
|
* .catch(console.error);
|
|
1234
1151
|
*/
|
|
1235
|
-
|
|
1152
|
+
setAFKChannel(afkChannel, reason) {
|
|
1236
1153
|
return this.edit({ afkChannel, reason });
|
|
1237
1154
|
}
|
|
1238
1155
|
|
|
1239
1156
|
/**
|
|
1240
1157
|
* Edits the system channel of the guild.
|
|
1241
|
-
*
|
|
1242
1158
|
* @param {?TextChannelResolvable} systemChannel The new system channel
|
|
1243
1159
|
* @param {string} [reason] Reason for changing the guild's system channel
|
|
1244
1160
|
* @returns {Promise<Guild>}
|
|
@@ -1248,13 +1164,12 @@ class Guild extends AnonymousGuild {
|
|
|
1248
1164
|
* .then(updated => console.log(`Updated guild system channel to ${guild.systemChannel.name}`))
|
|
1249
1165
|
* .catch(console.error);
|
|
1250
1166
|
*/
|
|
1251
|
-
|
|
1167
|
+
setSystemChannel(systemChannel, reason) {
|
|
1252
1168
|
return this.edit({ systemChannel, reason });
|
|
1253
1169
|
}
|
|
1254
1170
|
|
|
1255
1171
|
/**
|
|
1256
1172
|
* Edits the AFK timeout of the guild.
|
|
1257
|
-
*
|
|
1258
1173
|
* @param {number} afkTimeout The time in seconds that a user must be idle to be considered AFK
|
|
1259
1174
|
* @param {string} [reason] Reason for changing the guild's AFK timeout
|
|
1260
1175
|
* @returns {Promise<Guild>}
|
|
@@ -1264,13 +1179,12 @@ class Guild extends AnonymousGuild {
|
|
|
1264
1179
|
* .then(updated => console.log(`Updated guild AFK timeout to ${guild.afkTimeout}`))
|
|
1265
1180
|
* .catch(console.error);
|
|
1266
1181
|
*/
|
|
1267
|
-
|
|
1182
|
+
setAFKTimeout(afkTimeout, reason) {
|
|
1268
1183
|
return this.edit({ afkTimeout, reason });
|
|
1269
1184
|
}
|
|
1270
1185
|
|
|
1271
1186
|
/**
|
|
1272
1187
|
* Sets a new guild icon.
|
|
1273
|
-
*
|
|
1274
1188
|
* @param {?(Base64Resolvable|BufferResolvable)} icon The new icon of the guild
|
|
1275
1189
|
* @param {string} [reason] Reason for changing the guild's icon
|
|
1276
1190
|
* @returns {Promise<Guild>}
|
|
@@ -1280,13 +1194,23 @@ class Guild extends AnonymousGuild {
|
|
|
1280
1194
|
* .then(updated => console.log('Updated the guild icon'))
|
|
1281
1195
|
* .catch(console.error);
|
|
1282
1196
|
*/
|
|
1283
|
-
|
|
1197
|
+
setIcon(icon, reason) {
|
|
1284
1198
|
return this.edit({ icon, reason });
|
|
1285
1199
|
}
|
|
1286
1200
|
|
|
1201
|
+
/**
|
|
1202
|
+
* Sets a new owner of the guild.
|
|
1203
|
+
* @param {GuildMemberResolvable} owner The new owner of the guild
|
|
1204
|
+
* @param {string} [reason] Reason for setting the new owner
|
|
1205
|
+
* @returns {Promise<Guild>}
|
|
1206
|
+
* @deprecated API related to guild ownership may no longer be used.
|
|
1207
|
+
*/
|
|
1208
|
+
setOwner(owner, reason) {
|
|
1209
|
+
return this.edit({ owner, reason });
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1287
1212
|
/**
|
|
1288
1213
|
* Sets a new guild invite splash image.
|
|
1289
|
-
*
|
|
1290
1214
|
* @param {?(Base64Resolvable|BufferResolvable)} splash The new invite splash image of the guild
|
|
1291
1215
|
* @param {string} [reason] Reason for changing the guild's invite splash image
|
|
1292
1216
|
* @returns {Promise<Guild>}
|
|
@@ -1296,13 +1220,12 @@ class Guild extends AnonymousGuild {
|
|
|
1296
1220
|
* .then(updated => console.log('Updated the guild splash'))
|
|
1297
1221
|
* .catch(console.error);
|
|
1298
1222
|
*/
|
|
1299
|
-
|
|
1223
|
+
setSplash(splash, reason) {
|
|
1300
1224
|
return this.edit({ splash, reason });
|
|
1301
1225
|
}
|
|
1302
1226
|
|
|
1303
1227
|
/**
|
|
1304
1228
|
* Sets a new guild discovery splash image.
|
|
1305
|
-
*
|
|
1306
1229
|
* @param {?(Base64Resolvable|BufferResolvable)} discoverySplash The new discovery splash image of the guild
|
|
1307
1230
|
* @param {string} [reason] Reason for changing the guild's discovery splash image
|
|
1308
1231
|
* @returns {Promise<Guild>}
|
|
@@ -1312,13 +1235,12 @@ class Guild extends AnonymousGuild {
|
|
|
1312
1235
|
* .then(updated => console.log('Updated the guild discovery splash'))
|
|
1313
1236
|
* .catch(console.error);
|
|
1314
1237
|
*/
|
|
1315
|
-
|
|
1238
|
+
setDiscoverySplash(discoverySplash, reason) {
|
|
1316
1239
|
return this.edit({ discoverySplash, reason });
|
|
1317
1240
|
}
|
|
1318
1241
|
|
|
1319
1242
|
/**
|
|
1320
1243
|
* Sets a new guild banner.
|
|
1321
|
-
*
|
|
1322
1244
|
* @param {?(Base64Resolvable|BufferResolvable)} banner The new banner of the guild
|
|
1323
1245
|
* @param {string} [reason] Reason for changing the guild's banner
|
|
1324
1246
|
* @returns {Promise<Guild>}
|
|
@@ -1327,13 +1249,12 @@ class Guild extends AnonymousGuild {
|
|
|
1327
1249
|
* .then(updated => console.log('Updated the guild banner'))
|
|
1328
1250
|
* .catch(console.error);
|
|
1329
1251
|
*/
|
|
1330
|
-
|
|
1252
|
+
setBanner(banner, reason) {
|
|
1331
1253
|
return this.edit({ banner, reason });
|
|
1332
1254
|
}
|
|
1333
1255
|
|
|
1334
1256
|
/**
|
|
1335
1257
|
* Edits the rules channel of the guild.
|
|
1336
|
-
*
|
|
1337
1258
|
* @param {?TextChannelResolvable} rulesChannel The new rules channel
|
|
1338
1259
|
* @param {string} [reason] Reason for changing the guild's rules channel
|
|
1339
1260
|
* @returns {Promise<Guild>}
|
|
@@ -1343,13 +1264,12 @@ class Guild extends AnonymousGuild {
|
|
|
1343
1264
|
* .then(updated => console.log(`Updated guild rules channel to ${guild.rulesChannel.name}`))
|
|
1344
1265
|
* .catch(console.error);
|
|
1345
1266
|
*/
|
|
1346
|
-
|
|
1267
|
+
setRulesChannel(rulesChannel, reason) {
|
|
1347
1268
|
return this.edit({ rulesChannel, reason });
|
|
1348
1269
|
}
|
|
1349
1270
|
|
|
1350
1271
|
/**
|
|
1351
1272
|
* Edits the community updates channel of the guild.
|
|
1352
|
-
*
|
|
1353
1273
|
* @param {?TextChannelResolvable} publicUpdatesChannel The new community updates channel
|
|
1354
1274
|
* @param {string} [reason] Reason for changing the guild's community updates channel
|
|
1355
1275
|
* @returns {Promise<Guild>}
|
|
@@ -1359,13 +1279,12 @@ class Guild extends AnonymousGuild {
|
|
|
1359
1279
|
* .then(updated => console.log(`Updated guild community updates channel to ${guild.publicUpdatesChannel.name}`))
|
|
1360
1280
|
* .catch(console.error);
|
|
1361
1281
|
*/
|
|
1362
|
-
|
|
1282
|
+
setPublicUpdatesChannel(publicUpdatesChannel, reason) {
|
|
1363
1283
|
return this.edit({ publicUpdatesChannel, reason });
|
|
1364
1284
|
}
|
|
1365
1285
|
|
|
1366
1286
|
/**
|
|
1367
1287
|
* Edits the preferred locale of the guild.
|
|
1368
|
-
*
|
|
1369
1288
|
* @param {?Locale} preferredLocale The new preferred locale of the guild
|
|
1370
1289
|
* @param {string} [reason] Reason for changing the guild's preferred locale
|
|
1371
1290
|
* @returns {Promise<Guild>}
|
|
@@ -1375,24 +1294,22 @@ class Guild extends AnonymousGuild {
|
|
|
1375
1294
|
* .then(updated => console.log(`Updated guild preferred locale to ${guild.preferredLocale}`))
|
|
1376
1295
|
* .catch(console.error);
|
|
1377
1296
|
*/
|
|
1378
|
-
|
|
1297
|
+
setPreferredLocale(preferredLocale, reason) {
|
|
1379
1298
|
return this.edit({ preferredLocale, reason });
|
|
1380
1299
|
}
|
|
1381
1300
|
|
|
1382
1301
|
/**
|
|
1383
1302
|
* Edits the enabled state of the guild's premium progress bar
|
|
1384
|
-
*
|
|
1385
1303
|
* @param {boolean} [enabled=true] The new enabled state of the guild's premium progress bar
|
|
1386
1304
|
* @param {string} [reason] Reason for changing the state of the guild's premium progress bar
|
|
1387
1305
|
* @returns {Promise<Guild>}
|
|
1388
1306
|
*/
|
|
1389
|
-
|
|
1307
|
+
setPremiumProgressBarEnabled(enabled = true, reason) {
|
|
1390
1308
|
return this.edit({ premiumProgressBarEnabled: enabled, reason });
|
|
1391
1309
|
}
|
|
1392
1310
|
|
|
1393
1311
|
/**
|
|
1394
1312
|
* Edits the safety alerts channel of the guild.
|
|
1395
|
-
*
|
|
1396
1313
|
* @param {?TextChannelResolvable} safetyAlertsChannel The new safety alerts channel
|
|
1397
1314
|
* @param {string} [reason] Reason for changing the guild's safety alerts channel
|
|
1398
1315
|
* @returns {Promise<Guild>}
|
|
@@ -1402,13 +1319,12 @@ class Guild extends AnonymousGuild {
|
|
|
1402
1319
|
* .then(updated => console.log(`Updated guild safety alerts channel to ${updated.safetyAlertsChannel.name}`))
|
|
1403
1320
|
* .catch(console.error);
|
|
1404
1321
|
*/
|
|
1405
|
-
|
|
1322
|
+
setSafetyAlertsChannel(safetyAlertsChannel, reason) {
|
|
1406
1323
|
return this.edit({ safetyAlertsChannel, reason });
|
|
1407
1324
|
}
|
|
1408
1325
|
|
|
1409
1326
|
/**
|
|
1410
1327
|
* Edits the guild's widget settings.
|
|
1411
|
-
*
|
|
1412
1328
|
* @param {GuildWidgetSettingsData} settings The widget settings for the guild
|
|
1413
1329
|
* @param {string} [reason] Reason for changing the guild's widget settings
|
|
1414
1330
|
* @returns {Promise<Guild>}
|
|
@@ -1424,9 +1340,26 @@ class Guild extends AnonymousGuild {
|
|
|
1424
1340
|
return this;
|
|
1425
1341
|
}
|
|
1426
1342
|
|
|
1343
|
+
/**
|
|
1344
|
+
* Sets the guild's MFA level
|
|
1345
|
+
* <info>An elevated MFA level requires guild moderators to have 2FA enabled.</info>
|
|
1346
|
+
* @param {GuildMFALevel} level The MFA level
|
|
1347
|
+
* @param {string} [reason] Reason for changing the guild's MFA level
|
|
1348
|
+
* @returns {Promise<Guild>}
|
|
1349
|
+
* @deprecated API related to guild ownership may no longer be used.
|
|
1350
|
+
*/
|
|
1351
|
+
async setMFALevel(level, reason) {
|
|
1352
|
+
await this.client.rest.post(Routes.guildMFA(this.id), {
|
|
1353
|
+
body: {
|
|
1354
|
+
level,
|
|
1355
|
+
},
|
|
1356
|
+
reason,
|
|
1357
|
+
});
|
|
1358
|
+
return this;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1427
1361
|
/**
|
|
1428
1362
|
* Leaves the guild.
|
|
1429
|
-
*
|
|
1430
1363
|
* @returns {Promise<Guild>}
|
|
1431
1364
|
* @example
|
|
1432
1365
|
* // Leave a guild
|
|
@@ -1435,13 +1368,28 @@ class Guild extends AnonymousGuild {
|
|
|
1435
1368
|
* .catch(console.error);
|
|
1436
1369
|
*/
|
|
1437
1370
|
async leave() {
|
|
1371
|
+
if (this.ownerId === this.client.user.id) throw new DiscordjsError(ErrorCodes.GuildOwned);
|
|
1438
1372
|
await this.client.rest.delete(Routes.userGuild(this.id));
|
|
1439
1373
|
return this;
|
|
1440
1374
|
}
|
|
1441
1375
|
|
|
1376
|
+
/**
|
|
1377
|
+
* Deletes the guild.
|
|
1378
|
+
* @returns {Promise<Guild>}
|
|
1379
|
+
* @deprecated API related to guild ownership may no longer be used.
|
|
1380
|
+
* @example
|
|
1381
|
+
* // Delete a guild
|
|
1382
|
+
* guild.delete()
|
|
1383
|
+
* .then(guild => console.log(`Deleted the guild ${guild}`))
|
|
1384
|
+
* .catch(console.error);
|
|
1385
|
+
*/
|
|
1386
|
+
async delete() {
|
|
1387
|
+
await this.client.rest.delete(Routes.guild(this.id));
|
|
1388
|
+
return this;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1442
1391
|
/**
|
|
1443
1392
|
* Sets whether this guild's invites are disabled.
|
|
1444
|
-
*
|
|
1445
1393
|
* @param {boolean} [disabled=true] Whether the invites are disabled
|
|
1446
1394
|
* @returns {Promise<Guild>}
|
|
1447
1395
|
*/
|
|
@@ -1453,7 +1401,6 @@ class Guild extends AnonymousGuild {
|
|
|
1453
1401
|
|
|
1454
1402
|
/**
|
|
1455
1403
|
* Sets the incident actions for a guild.
|
|
1456
|
-
*
|
|
1457
1404
|
* @param {IncidentActionsEditOptions} incidentActions The incident actions to set
|
|
1458
1405
|
* @returns {Promise<IncidentActions>}
|
|
1459
1406
|
*/
|
|
@@ -1465,7 +1412,6 @@ class Guild extends AnonymousGuild {
|
|
|
1465
1412
|
* Whether this guild equals another guild. It compares all properties, so for most operations
|
|
1466
1413
|
* it is advisable to just compare `guild.id === guild2.id` as it is much faster and is often
|
|
1467
1414
|
* what most users need.
|
|
1468
|
-
*
|
|
1469
1415
|
* @param {Guild} guild The guild to compare with
|
|
1470
1416
|
* @returns {boolean}
|
|
1471
1417
|
*/
|
|
@@ -1485,7 +1431,7 @@ class Guild extends AnonymousGuild {
|
|
|
1485
1431
|
this.verificationLevel === guild.verificationLevel &&
|
|
1486
1432
|
(this.features === guild.features ||
|
|
1487
1433
|
(this.features.length === guild.features.length &&
|
|
1488
|
-
this.features.every((feat,
|
|
1434
|
+
this.features.every((feat, i) => feat === guild.features[i])))
|
|
1489
1435
|
);
|
|
1490
1436
|
}
|
|
1491
1437
|
|
|
@@ -1507,7 +1453,6 @@ class Guild extends AnonymousGuild {
|
|
|
1507
1453
|
/**
|
|
1508
1454
|
* The voice state adapter for this guild that can be used with `@discordjs/voice` to play audio in voice
|
|
1509
1455
|
* and stage channels.
|
|
1510
|
-
*
|
|
1511
1456
|
* @type {Function}
|
|
1512
1457
|
* @readonly
|
|
1513
1458
|
*/
|
|
@@ -1516,7 +1461,8 @@ class Guild extends AnonymousGuild {
|
|
|
1516
1461
|
this.client.voice.adapters.set(this.id, methods);
|
|
1517
1462
|
return {
|
|
1518
1463
|
sendPayload: data => {
|
|
1519
|
-
this.
|
|
1464
|
+
if (this.shard.status !== Status.Ready) return false;
|
|
1465
|
+
this.shard.send(data);
|
|
1520
1466
|
return true;
|
|
1521
1467
|
},
|
|
1522
1468
|
destroy: () => {
|
|
@@ -1528,7 +1474,6 @@ class Guild extends AnonymousGuild {
|
|
|
1528
1474
|
|
|
1529
1475
|
/**
|
|
1530
1476
|
* Creates a collection of this guild's roles, sorted by their position and ids.
|
|
1531
|
-
*
|
|
1532
1477
|
* @returns {Collection<Snowflake, Role>}
|
|
1533
1478
|
* @private
|
|
1534
1479
|
*/
|
|
@@ -1538,7 +1483,6 @@ class Guild extends AnonymousGuild {
|
|
|
1538
1483
|
|
|
1539
1484
|
/**
|
|
1540
1485
|
* Creates a collection of this guild's or a specific category's channels, sorted by their position and ids.
|
|
1541
|
-
*
|
|
1542
1486
|
* @param {GuildChannel} [channel] Category to get the channels of
|
|
1543
1487
|
* @returns {Collection<Snowflake, GuildChannel>}
|
|
1544
1488
|
* @private
|