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
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { PermissionFlagsBits } = require('discord-api-types/v10');
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const {
|
|
8
|
-
const
|
|
9
|
-
const {
|
|
10
|
-
const
|
|
4
|
+
const Base = require('./Base');
|
|
5
|
+
const VoiceState = require('./VoiceState');
|
|
6
|
+
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
|
7
|
+
const { DiscordjsError, ErrorCodes } = require('../errors');
|
|
8
|
+
const GuildMemberRoleManager = require('../managers/GuildMemberRoleManager');
|
|
9
|
+
const { GuildMemberFlagsBitField } = require('../util/GuildMemberFlagsBitField');
|
|
10
|
+
const PermissionsBitField = require('../util/PermissionsBitField');
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Represents a member of a guild on Discord.
|
|
14
|
-
*
|
|
14
|
+
* @implements {TextBasedChannel}
|
|
15
15
|
* @extends {Base}
|
|
16
16
|
*/
|
|
17
17
|
class GuildMember extends Base {
|
|
@@ -20,42 +20,36 @@ class GuildMember extends Base {
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* The guild that this member is part of
|
|
23
|
-
*
|
|
24
23
|
* @type {Guild}
|
|
25
24
|
*/
|
|
26
25
|
this.guild = guild;
|
|
27
26
|
|
|
28
27
|
/**
|
|
29
28
|
* The last timestamp this member started boosting the guild
|
|
30
|
-
*
|
|
31
29
|
* @type {?number}
|
|
32
30
|
*/
|
|
33
31
|
this.premiumSinceTimestamp = null;
|
|
34
32
|
|
|
35
33
|
/**
|
|
36
34
|
* The nickname of this member, if they have one
|
|
37
|
-
*
|
|
38
35
|
* @type {?string}
|
|
39
36
|
*/
|
|
40
37
|
this.nickname = null;
|
|
41
38
|
|
|
42
39
|
/**
|
|
43
40
|
* Whether this member has yet to pass the guild's membership gate
|
|
44
|
-
*
|
|
45
41
|
* @type {?boolean}
|
|
46
42
|
*/
|
|
47
43
|
this.pending = null;
|
|
48
44
|
|
|
49
45
|
/**
|
|
50
46
|
* The timestamp this member's timeout will be removed
|
|
51
|
-
*
|
|
52
47
|
* @type {?number}
|
|
53
48
|
*/
|
|
54
49
|
this.communicationDisabledUntilTimestamp = null;
|
|
55
50
|
|
|
56
51
|
/**
|
|
57
52
|
* The role ids of the member
|
|
58
|
-
*
|
|
59
53
|
* @name GuildMember#_roles
|
|
60
54
|
* @type {Snowflake[]}
|
|
61
55
|
* @private
|
|
@@ -69,7 +63,6 @@ class GuildMember extends Base {
|
|
|
69
63
|
if ('user' in data) {
|
|
70
64
|
/**
|
|
71
65
|
* The user that this guild member instance represents
|
|
72
|
-
*
|
|
73
66
|
* @type {?User}
|
|
74
67
|
*/
|
|
75
68
|
this.user = this.client.users._add(data.user, true);
|
|
@@ -79,7 +72,6 @@ class GuildMember extends Base {
|
|
|
79
72
|
if ('avatar' in data) {
|
|
80
73
|
/**
|
|
81
74
|
* The guild member's avatar hash
|
|
82
|
-
*
|
|
83
75
|
* @type {?string}
|
|
84
76
|
*/
|
|
85
77
|
this.avatar = data.avatar;
|
|
@@ -90,7 +82,6 @@ class GuildMember extends Base {
|
|
|
90
82
|
if ('banner' in data) {
|
|
91
83
|
/**
|
|
92
84
|
* The guild member's banner hash.
|
|
93
|
-
*
|
|
94
85
|
* @type {?string}
|
|
95
86
|
*/
|
|
96
87
|
this.banner = data.banner;
|
|
@@ -112,7 +103,6 @@ class GuildMember extends Base {
|
|
|
112
103
|
if ('premium_since' in data) {
|
|
113
104
|
this.premiumSinceTimestamp = data.premium_since ? Date.parse(data.premium_since) : null;
|
|
114
105
|
}
|
|
115
|
-
|
|
116
106
|
if ('roles' in data) this._roles = data.roles;
|
|
117
107
|
|
|
118
108
|
if ('pending' in data) {
|
|
@@ -130,7 +120,6 @@ class GuildMember extends Base {
|
|
|
130
120
|
if ('flags' in data) {
|
|
131
121
|
/**
|
|
132
122
|
* The flags of this member
|
|
133
|
-
*
|
|
134
123
|
* @type {Readonly<GuildMemberFlagsBitField>}
|
|
135
124
|
*/
|
|
136
125
|
this.flags = new GuildMemberFlagsBitField(data.flags).freeze();
|
|
@@ -151,17 +140,6 @@ class GuildMember extends Base {
|
|
|
151
140
|
} else {
|
|
152
141
|
this.avatarDecorationData = null;
|
|
153
142
|
}
|
|
154
|
-
|
|
155
|
-
if ('collectibles' in data) {
|
|
156
|
-
/**
|
|
157
|
-
* The member's collectibles
|
|
158
|
-
*
|
|
159
|
-
* @type {?Collectibles}
|
|
160
|
-
*/
|
|
161
|
-
this.collectibles = data.collectibles ? _transformCollectibles(data.collectibles) : null;
|
|
162
|
-
} else {
|
|
163
|
-
this.collectibles ??= null;
|
|
164
|
-
}
|
|
165
143
|
}
|
|
166
144
|
|
|
167
145
|
_clone() {
|
|
@@ -172,7 +150,6 @@ class GuildMember extends Base {
|
|
|
172
150
|
|
|
173
151
|
/**
|
|
174
152
|
* Whether this GuildMember is a partial
|
|
175
|
-
*
|
|
176
153
|
* @type {boolean}
|
|
177
154
|
* @readonly
|
|
178
155
|
*/
|
|
@@ -182,7 +159,6 @@ class GuildMember extends Base {
|
|
|
182
159
|
|
|
183
160
|
/**
|
|
184
161
|
* A manager for the roles belonging to this member
|
|
185
|
-
*
|
|
186
162
|
* @type {GuildMemberRoleManager}
|
|
187
163
|
* @readonly
|
|
188
164
|
*/
|
|
@@ -192,7 +168,6 @@ class GuildMember extends Base {
|
|
|
192
168
|
|
|
193
169
|
/**
|
|
194
170
|
* The voice state of this member
|
|
195
|
-
*
|
|
196
171
|
* @type {VoiceState}
|
|
197
172
|
* @readonly
|
|
198
173
|
*/
|
|
@@ -202,12 +177,16 @@ class GuildMember extends Base {
|
|
|
202
177
|
|
|
203
178
|
/**
|
|
204
179
|
* A link to the member's guild avatar.
|
|
205
|
-
*
|
|
206
180
|
* @param {ImageURLOptions} [options={}] Options for the image URL
|
|
207
181
|
* @returns {?string}
|
|
208
182
|
*/
|
|
209
183
|
avatarURL(options = {}) {
|
|
210
|
-
return
|
|
184
|
+
return (
|
|
185
|
+
this.avatar &&
|
|
186
|
+
(/^https?:\/\//.test(this.avatar)
|
|
187
|
+
? this.avatar
|
|
188
|
+
: this.client.rest.cdn.guildMemberAvatar(this.guild.id, this.id, this.avatar, options))
|
|
189
|
+
);
|
|
211
190
|
}
|
|
212
191
|
|
|
213
192
|
/**
|
|
@@ -221,18 +200,21 @@ class GuildMember extends Base {
|
|
|
221
200
|
|
|
222
201
|
/**
|
|
223
202
|
* A link to the member's banner.
|
|
224
|
-
*
|
|
225
203
|
* @param {ImageURLOptions} [options={}] Options for the banner URL
|
|
226
204
|
* @returns {?string}
|
|
227
205
|
*/
|
|
228
206
|
bannerURL(options = {}) {
|
|
229
|
-
return
|
|
207
|
+
return (
|
|
208
|
+
this.banner &&
|
|
209
|
+
(/^https?:\/\//.test(this.banner)
|
|
210
|
+
? this.banner
|
|
211
|
+
: this.client.rest.cdn.guildMemberBanner(this.guild.id, this.id, this.banner, options))
|
|
212
|
+
);
|
|
230
213
|
}
|
|
231
214
|
|
|
232
215
|
/**
|
|
233
216
|
* A link to the member's guild avatar if they have one.
|
|
234
217
|
* Otherwise, a link to their {@link User#displayAvatarURL} will be returned.
|
|
235
|
-
*
|
|
236
218
|
* @param {ImageURLOptions} [options={}] Options for the image URL
|
|
237
219
|
* @returns {string}
|
|
238
220
|
*/
|
|
@@ -243,7 +225,6 @@ class GuildMember extends Base {
|
|
|
243
225
|
/**
|
|
244
226
|
* A link to the member's guild banner if they have one.
|
|
245
227
|
* Otherwise, a link to their {@link User#bannerURL} will be returned.
|
|
246
|
-
*
|
|
247
228
|
* @param {ImageURLOptions} [options={}] Options for the image URL
|
|
248
229
|
* @returns {?string}
|
|
249
230
|
*/
|
|
@@ -263,7 +244,6 @@ class GuildMember extends Base {
|
|
|
263
244
|
|
|
264
245
|
/**
|
|
265
246
|
* The time this member joined the guild
|
|
266
|
-
*
|
|
267
247
|
* @type {?Date}
|
|
268
248
|
* @readonly
|
|
269
249
|
*/
|
|
@@ -273,7 +253,6 @@ class GuildMember extends Base {
|
|
|
273
253
|
|
|
274
254
|
/**
|
|
275
255
|
* The time this member's timeout will be removed
|
|
276
|
-
*
|
|
277
256
|
* @type {?Date}
|
|
278
257
|
* @readonly
|
|
279
258
|
*/
|
|
@@ -283,7 +262,6 @@ class GuildMember extends Base {
|
|
|
283
262
|
|
|
284
263
|
/**
|
|
285
264
|
* The last time this member started boosting the guild
|
|
286
|
-
*
|
|
287
265
|
* @type {?Date}
|
|
288
266
|
* @readonly
|
|
289
267
|
*/
|
|
@@ -293,7 +271,6 @@ class GuildMember extends Base {
|
|
|
293
271
|
|
|
294
272
|
/**
|
|
295
273
|
* The presence of this guild member
|
|
296
|
-
*
|
|
297
274
|
* @type {?Presence}
|
|
298
275
|
* @readonly
|
|
299
276
|
*/
|
|
@@ -303,7 +280,6 @@ class GuildMember extends Base {
|
|
|
303
280
|
|
|
304
281
|
/**
|
|
305
282
|
* The displayed role color of this member in base 10
|
|
306
|
-
*
|
|
307
283
|
* @type {number}
|
|
308
284
|
* @readonly
|
|
309
285
|
*/
|
|
@@ -313,7 +289,6 @@ class GuildMember extends Base {
|
|
|
313
289
|
|
|
314
290
|
/**
|
|
315
291
|
* The displayed role color of this member in hexadecimal
|
|
316
|
-
*
|
|
317
292
|
* @type {string}
|
|
318
293
|
* @readonly
|
|
319
294
|
*/
|
|
@@ -323,7 +298,6 @@ class GuildMember extends Base {
|
|
|
323
298
|
|
|
324
299
|
/**
|
|
325
300
|
* The member's id
|
|
326
|
-
*
|
|
327
301
|
* @type {Snowflake}
|
|
328
302
|
* @readonly
|
|
329
303
|
*/
|
|
@@ -333,7 +307,6 @@ class GuildMember extends Base {
|
|
|
333
307
|
|
|
334
308
|
/**
|
|
335
309
|
* The DM between the client's user and this member
|
|
336
|
-
*
|
|
337
310
|
* @type {?DMChannel}
|
|
338
311
|
* @readonly
|
|
339
312
|
*/
|
|
@@ -343,7 +316,6 @@ class GuildMember extends Base {
|
|
|
343
316
|
|
|
344
317
|
/**
|
|
345
318
|
* The nickname of this member, or their user display name if they don't have one
|
|
346
|
-
*
|
|
347
319
|
* @type {?string}
|
|
348
320
|
* @readonly
|
|
349
321
|
*/
|
|
@@ -353,7 +325,6 @@ class GuildMember extends Base {
|
|
|
353
325
|
|
|
354
326
|
/**
|
|
355
327
|
* The overall set of permissions for this member, taking only roles and owner status into account
|
|
356
|
-
*
|
|
357
328
|
* @type {Readonly<PermissionsBitField>}
|
|
358
329
|
* @readonly
|
|
359
330
|
*/
|
|
@@ -365,20 +336,19 @@ class GuildMember extends Base {
|
|
|
365
336
|
/**
|
|
366
337
|
* Whether the client user is above this user in the hierarchy, according to role position and guild ownership.
|
|
367
338
|
* This is a prerequisite for many moderative actions.
|
|
368
|
-
*
|
|
369
339
|
* @type {boolean}
|
|
370
340
|
* @readonly
|
|
371
341
|
*/
|
|
372
342
|
get manageable() {
|
|
373
343
|
if (this.user.id === this.guild.ownerId) return false;
|
|
374
344
|
if (this.user.id === this.client.user.id) return false;
|
|
345
|
+
if (this.client.user.id === this.guild.ownerId) return true;
|
|
375
346
|
if (!this.guild.members.me) throw new DiscordjsError(ErrorCodes.GuildUncachedMe);
|
|
376
347
|
return this.guild.members.me.roles.highest.comparePositionTo(this.roles.highest) > 0;
|
|
377
348
|
}
|
|
378
349
|
|
|
379
350
|
/**
|
|
380
351
|
* Whether this member is kickable by the client user
|
|
381
|
-
*
|
|
382
352
|
* @type {boolean}
|
|
383
353
|
* @readonly
|
|
384
354
|
*/
|
|
@@ -389,7 +359,6 @@ class GuildMember extends Base {
|
|
|
389
359
|
|
|
390
360
|
/**
|
|
391
361
|
* Whether this member is bannable by the client user
|
|
392
|
-
*
|
|
393
362
|
* @type {boolean}
|
|
394
363
|
* @readonly
|
|
395
364
|
*/
|
|
@@ -400,7 +369,6 @@ class GuildMember extends Base {
|
|
|
400
369
|
|
|
401
370
|
/**
|
|
402
371
|
* Whether this member is moderatable by the client user
|
|
403
|
-
*
|
|
404
372
|
* @type {boolean}
|
|
405
373
|
* @readonly
|
|
406
374
|
*/
|
|
@@ -414,7 +382,6 @@ class GuildMember extends Base {
|
|
|
414
382
|
|
|
415
383
|
/**
|
|
416
384
|
* Whether this member is currently timed out
|
|
417
|
-
*
|
|
418
385
|
* @returns {boolean}
|
|
419
386
|
*/
|
|
420
387
|
isCommunicationDisabled() {
|
|
@@ -424,40 +391,36 @@ class GuildMember extends Base {
|
|
|
424
391
|
/**
|
|
425
392
|
* Returns `channel.permissionsFor(guildMember)`. Returns permissions for a member in a guild channel,
|
|
426
393
|
* taking into account roles and permission overwrites.
|
|
427
|
-
*
|
|
428
394
|
* @param {GuildChannelResolvable} channel The guild channel to use as context
|
|
429
395
|
* @returns {Readonly<PermissionsBitField>}
|
|
430
396
|
*/
|
|
431
397
|
permissionsIn(channel) {
|
|
432
|
-
|
|
433
|
-
if (!
|
|
434
|
-
return
|
|
398
|
+
channel = this.guild.channels.resolve(channel);
|
|
399
|
+
if (!channel) throw new DiscordjsError(ErrorCodes.GuildChannelResolve);
|
|
400
|
+
return channel.permissionsFor(this);
|
|
435
401
|
}
|
|
436
402
|
|
|
437
403
|
/**
|
|
438
404
|
* Edits this member.
|
|
439
|
-
*
|
|
440
405
|
* @param {GuildMemberEditOptions} options The options to provide
|
|
441
406
|
* @returns {Promise<GuildMember>}
|
|
442
407
|
*/
|
|
443
|
-
|
|
408
|
+
edit(options) {
|
|
444
409
|
return this.guild.members.edit(this, options);
|
|
445
410
|
}
|
|
446
411
|
|
|
447
412
|
/**
|
|
448
413
|
* Sets the flags for this member.
|
|
449
|
-
*
|
|
450
414
|
* @param {GuildMemberFlagsResolvable} flags The flags to set
|
|
451
415
|
* @param {string} [reason] Reason for setting the flags
|
|
452
416
|
* @returns {Promise<GuildMember>}
|
|
453
417
|
*/
|
|
454
|
-
|
|
418
|
+
setFlags(flags, reason) {
|
|
455
419
|
return this.edit({ flags, reason });
|
|
456
420
|
}
|
|
457
421
|
|
|
458
422
|
/**
|
|
459
423
|
* Sets the nickname for this member.
|
|
460
|
-
*
|
|
461
424
|
* @param {?string} nick The nickname for the guild member, or `null` if you want to reset their nickname
|
|
462
425
|
* @param {string} [reason] Reason for setting the nickname
|
|
463
426
|
* @returns {Promise<GuildMember>}
|
|
@@ -472,7 +435,7 @@ class GuildMember extends Base {
|
|
|
472
435
|
* .then(member => console.log(`Removed nickname for ${member.user.username}`))
|
|
473
436
|
* .catch(console.error);
|
|
474
437
|
*/
|
|
475
|
-
|
|
438
|
+
setNickname(nick, reason) {
|
|
476
439
|
return this.user.id === this.client.user.id
|
|
477
440
|
? this.guild.members.editMe({ nick, reason })
|
|
478
441
|
: this.edit({ nick, reason });
|
|
@@ -480,49 +443,46 @@ class GuildMember extends Base {
|
|
|
480
443
|
|
|
481
444
|
/**
|
|
482
445
|
* Creates a DM channel between the client and this member.
|
|
483
|
-
*
|
|
484
446
|
* @param {boolean} [force=false] Whether to skip the cache check and request the API
|
|
485
447
|
* @returns {Promise<DMChannel>}
|
|
486
448
|
*/
|
|
487
|
-
|
|
449
|
+
createDM(force = false) {
|
|
488
450
|
return this.user.createDM(force);
|
|
489
451
|
}
|
|
490
452
|
|
|
491
453
|
/**
|
|
492
454
|
* Deletes any DMs with this member.
|
|
493
|
-
*
|
|
494
455
|
* @returns {Promise<DMChannel>}
|
|
495
456
|
*/
|
|
496
|
-
|
|
457
|
+
deleteDM() {
|
|
497
458
|
return this.user.deleteDM();
|
|
498
459
|
}
|
|
499
460
|
|
|
500
461
|
/**
|
|
501
462
|
* Kicks this member from the guild.
|
|
502
|
-
*
|
|
503
463
|
* @param {string} [reason] Reason for kicking user
|
|
504
|
-
* @returns {Promise<
|
|
464
|
+
* @returns {Promise<GuildMember>}
|
|
505
465
|
*/
|
|
506
|
-
|
|
507
|
-
|
|
466
|
+
kick(reason) {
|
|
467
|
+
return this.guild.members.kick(this, reason);
|
|
508
468
|
}
|
|
509
469
|
|
|
510
470
|
/**
|
|
511
471
|
* Bans this guild member.
|
|
512
|
-
*
|
|
513
472
|
* @param {BanOptions} [options] Options for the ban
|
|
514
|
-
* @returns {Promise<
|
|
473
|
+
* @returns {Promise<GuildMember>}
|
|
515
474
|
* @example
|
|
516
475
|
* // Ban a guild member, deleting a week's worth of messages
|
|
517
|
-
*
|
|
476
|
+
* guildMember.ban({ deleteMessageSeconds: 60 * 60 * 24 * 7, reason: 'They deserved it' })
|
|
477
|
+
* .then(console.log)
|
|
478
|
+
* .catch(console.error);
|
|
518
479
|
*/
|
|
519
|
-
|
|
520
|
-
|
|
480
|
+
ban(options) {
|
|
481
|
+
return this.guild.bans.create(this, options);
|
|
521
482
|
}
|
|
522
483
|
|
|
523
484
|
/**
|
|
524
485
|
* Times this guild member out.
|
|
525
|
-
*
|
|
526
486
|
* @param {?DateResolvable} communicationDisabledUntil The date or timestamp
|
|
527
487
|
* for the member's communication to be disabled until. Provide `null` to remove the timeout.
|
|
528
488
|
* @param {string} [reason] The reason for this timeout.
|
|
@@ -538,13 +498,12 @@ class GuildMember extends Base {
|
|
|
538
498
|
* .then(member => console.log(`Removed timeout for ${member.displayName}`))
|
|
539
499
|
* .catch(console.error);
|
|
540
500
|
*/
|
|
541
|
-
|
|
501
|
+
disableCommunicationUntil(communicationDisabledUntil, reason) {
|
|
542
502
|
return this.edit({ communicationDisabledUntil, reason });
|
|
543
503
|
}
|
|
544
504
|
|
|
545
505
|
/**
|
|
546
506
|
* Times this guild member out.
|
|
547
|
-
*
|
|
548
507
|
* @param {?number} timeout The duration in milliseconds
|
|
549
508
|
* for the member's communication to be disabled. Provide `null` to remove the timeout.
|
|
550
509
|
* @param {string} [reason] The reason for this timeout.
|
|
@@ -555,42 +514,23 @@ class GuildMember extends Base {
|
|
|
555
514
|
* .then(console.log)
|
|
556
515
|
* .catch(console.error);
|
|
557
516
|
*/
|
|
558
|
-
|
|
517
|
+
timeout(timeout, reason) {
|
|
559
518
|
return this.disableCommunicationUntil(timeout && Date.now() + timeout, reason);
|
|
560
519
|
}
|
|
561
520
|
|
|
562
521
|
/**
|
|
563
522
|
* Fetches this GuildMember.
|
|
564
|
-
*
|
|
565
523
|
* @param {boolean} [force=true] Whether to skip the cache check and request the API
|
|
566
524
|
* @returns {Promise<GuildMember>}
|
|
567
525
|
*/
|
|
568
|
-
|
|
526
|
+
fetch(force = true) {
|
|
569
527
|
return this.guild.members.fetch({ user: this.id, cache: true, force });
|
|
570
528
|
}
|
|
571
529
|
|
|
572
|
-
/**
|
|
573
|
-
* Sends a message to this user.
|
|
574
|
-
*
|
|
575
|
-
* @param {string|MessagePayload|MessageCreateOptions} options The options to provide
|
|
576
|
-
* @returns {Promise<Message>}
|
|
577
|
-
* @example
|
|
578
|
-
* // Send a direct message
|
|
579
|
-
* guildMember.send('Hello!')
|
|
580
|
-
* .then(message => console.log(`Sent message: ${message.content} to ${guildMember.displayName}`))
|
|
581
|
-
* .catch(console.error);
|
|
582
|
-
*/
|
|
583
|
-
async send(options) {
|
|
584
|
-
const dmChannel = await this.createDM();
|
|
585
|
-
|
|
586
|
-
return this.client.channels.createMessage(dmChannel, options);
|
|
587
|
-
}
|
|
588
|
-
|
|
589
530
|
/**
|
|
590
531
|
* Whether this guild member equals another guild member. It compares all properties, so for most
|
|
591
532
|
* comparison it is advisable to just compare `member.id === member2.id` as it is significantly faster
|
|
592
533
|
* and is often what most users need.
|
|
593
|
-
*
|
|
594
534
|
* @param {GuildMember} member The member to compare with
|
|
595
535
|
* @returns {boolean}
|
|
596
536
|
*/
|
|
@@ -611,17 +551,12 @@ class GuildMember extends Base {
|
|
|
611
551
|
(this._roles.length === member._roles.length &&
|
|
612
552
|
this._roles.every((role, index) => role === member._roles[index]))) &&
|
|
613
553
|
this.avatarDecorationData?.asset === member.avatarDecorationData?.asset &&
|
|
614
|
-
this.avatarDecorationData?.skuId === member.avatarDecorationData?.skuId
|
|
615
|
-
this.collectibles?.nameplate?.skuId === member.collectibles?.nameplate?.skuId &&
|
|
616
|
-
this.collectibles?.nameplate?.asset === member.collectibles?.nameplate?.asset &&
|
|
617
|
-
this.collectibles?.nameplate?.label === member.collectibles?.nameplate?.label &&
|
|
618
|
-
this.collectibles?.nameplate?.palette === member.collectibles?.nameplate?.palette
|
|
554
|
+
this.avatarDecorationData?.skuId === member.avatarDecorationData?.skuId
|
|
619
555
|
);
|
|
620
556
|
}
|
|
621
557
|
|
|
622
558
|
/**
|
|
623
559
|
* When concatenated with a string, this automatically returns the user's mention instead of the GuildMember object.
|
|
624
|
-
*
|
|
625
560
|
* @returns {string}
|
|
626
561
|
* @example
|
|
627
562
|
* // Logs: Hello from <@123456789012345678>!
|
|
@@ -647,4 +582,20 @@ class GuildMember extends Base {
|
|
|
647
582
|
}
|
|
648
583
|
}
|
|
649
584
|
|
|
585
|
+
/**
|
|
586
|
+
* Sends a message to this user.
|
|
587
|
+
* @method send
|
|
588
|
+
* @memberof GuildMember
|
|
589
|
+
* @instance
|
|
590
|
+
* @param {string|MessagePayload|MessageCreateOptions} options The options to provide
|
|
591
|
+
* @returns {Promise<Message>}
|
|
592
|
+
* @example
|
|
593
|
+
* // Send a direct message
|
|
594
|
+
* guildMember.send('Hello!')
|
|
595
|
+
* .then(message => console.log(`Sent message: ${message.content} to ${guildMember.displayName}`))
|
|
596
|
+
* .catch(console.error);
|
|
597
|
+
*/
|
|
598
|
+
|
|
599
|
+
TextBasedChannel.applyToClass(GuildMember);
|
|
600
|
+
|
|
650
601
|
exports.GuildMember = GuildMember;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { Collection } = require('@discordjs/collection');
|
|
4
|
-
const
|
|
5
|
-
const { GuildOnboardingPrompt } = require('./GuildOnboardingPrompt
|
|
4
|
+
const Base = require('./Base');
|
|
5
|
+
const { GuildOnboardingPrompt } = require('./GuildOnboardingPrompt');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Represents the onboarding data of a guild.
|
|
9
|
-
*
|
|
10
9
|
* @extends {Base}
|
|
11
10
|
*/
|
|
12
11
|
class GuildOnboarding extends Base {
|
|
@@ -15,7 +14,6 @@ class GuildOnboarding extends Base {
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* The id of the guild this onboarding data is for
|
|
18
|
-
*
|
|
19
17
|
* @type {Snowflake}
|
|
20
18
|
*/
|
|
21
19
|
this.guildId = data.guild_id;
|
|
@@ -24,7 +22,6 @@ class GuildOnboarding extends Base {
|
|
|
24
22
|
|
|
25
23
|
/**
|
|
26
24
|
* The prompts shown during onboarding and in customize community
|
|
27
|
-
*
|
|
28
25
|
* @type {Collection<Snowflake, GuildOnboardingPrompt>}
|
|
29
26
|
*/
|
|
30
27
|
this.prompts = data.prompts.reduce(
|
|
@@ -34,7 +31,6 @@ class GuildOnboarding extends Base {
|
|
|
34
31
|
|
|
35
32
|
/**
|
|
36
33
|
* The ids of the channels that new members get opted into automatically
|
|
37
|
-
*
|
|
38
34
|
* @type {Collection<Snowflake, GuildChannel>}
|
|
39
35
|
*/
|
|
40
36
|
this.defaultChannels = data.default_channel_ids.reduce(
|
|
@@ -44,14 +40,12 @@ class GuildOnboarding extends Base {
|
|
|
44
40
|
|
|
45
41
|
/**
|
|
46
42
|
* Whether onboarding is enabled
|
|
47
|
-
*
|
|
48
43
|
* @type {boolean}
|
|
49
44
|
*/
|
|
50
45
|
this.enabled = data.enabled;
|
|
51
46
|
|
|
52
47
|
/**
|
|
53
48
|
* The mode of this onboarding
|
|
54
|
-
*
|
|
55
49
|
* @type {GuildOnboardingMode}
|
|
56
50
|
*/
|
|
57
51
|
this.mode = data.mode;
|
|
@@ -59,7 +53,6 @@ class GuildOnboarding extends Base {
|
|
|
59
53
|
|
|
60
54
|
/**
|
|
61
55
|
* The guild this onboarding is from
|
|
62
|
-
*
|
|
63
56
|
* @type {Guild}
|
|
64
57
|
* @readonly
|
|
65
58
|
*/
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { Collection } = require('@discordjs/collection');
|
|
4
|
-
const
|
|
5
|
-
const { GuildOnboardingPromptOption } = require('./GuildOnboardingPromptOption
|
|
4
|
+
const Base = require('./Base');
|
|
5
|
+
const { GuildOnboardingPromptOption } = require('./GuildOnboardingPromptOption');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Represents the data of a prompt of a guilds onboarding.
|
|
9
|
-
*
|
|
10
9
|
* @extends {Base}
|
|
11
10
|
*/
|
|
12
11
|
class GuildOnboardingPrompt extends Base {
|
|
@@ -15,21 +14,18 @@ class GuildOnboardingPrompt extends Base {
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* The id of the guild this onboarding prompt is from
|
|
18
|
-
*
|
|
19
17
|
* @type {Snowflake}
|
|
20
18
|
*/
|
|
21
19
|
this.guildId = guildId;
|
|
22
20
|
|
|
23
21
|
/**
|
|
24
22
|
* The id of the prompt
|
|
25
|
-
*
|
|
26
23
|
* @type {Snowflake}
|
|
27
24
|
*/
|
|
28
25
|
this.id = data.id;
|
|
29
26
|
|
|
30
27
|
/**
|
|
31
28
|
* The options available within the prompt
|
|
32
|
-
*
|
|
33
29
|
* @type {Collection<Snowflake, GuildOnboardingPromptOption>}
|
|
34
30
|
*/
|
|
35
31
|
this.options = data.options.reduce(
|
|
@@ -39,21 +35,18 @@ class GuildOnboardingPrompt extends Base {
|
|
|
39
35
|
|
|
40
36
|
/**
|
|
41
37
|
* The title of the prompt
|
|
42
|
-
*
|
|
43
38
|
* @type {string}
|
|
44
39
|
*/
|
|
45
40
|
this.title = data.title;
|
|
46
41
|
|
|
47
42
|
/**
|
|
48
43
|
* Whether users are limited to selecting one option for the prompt
|
|
49
|
-
*
|
|
50
44
|
* @type {boolean}
|
|
51
45
|
*/
|
|
52
46
|
this.singleSelect = data.single_select;
|
|
53
47
|
|
|
54
48
|
/**
|
|
55
49
|
* Whether the prompt is required before a user completes the onboarding flow
|
|
56
|
-
*
|
|
57
50
|
* @type {boolean}
|
|
58
51
|
*/
|
|
59
52
|
this.required = data.required;
|
|
@@ -61,14 +54,12 @@ class GuildOnboardingPrompt extends Base {
|
|
|
61
54
|
/**
|
|
62
55
|
* Whether the prompt is present in the onboarding flow.
|
|
63
56
|
* If `false`, the prompt will only appear in the Channels & Roles tab
|
|
64
|
-
*
|
|
65
57
|
* @type {boolean}
|
|
66
58
|
*/
|
|
67
59
|
this.inOnboarding = data.in_onboarding;
|
|
68
60
|
|
|
69
61
|
/**
|
|
70
62
|
* The type of the prompt
|
|
71
|
-
*
|
|
72
63
|
* @type {GuildOnboardingPromptType}
|
|
73
64
|
*/
|
|
74
65
|
this.type = data.type;
|
|
@@ -76,7 +67,6 @@ class GuildOnboardingPrompt extends Base {
|
|
|
76
67
|
|
|
77
68
|
/**
|
|
78
69
|
* The guild this onboarding prompt is from
|
|
79
|
-
*
|
|
80
70
|
* @type {Guild}
|
|
81
71
|
* @readonly
|
|
82
72
|
*/
|