lolka.js 0.1.3 → 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 +227 -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 +2392 -1768
- package/typings/index.d.ts +2392 -1768
- 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
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
const { Collection } = require('@discordjs/collection');
|
|
4
4
|
const { Routes } = require('discord-api-types/v10');
|
|
5
|
-
const
|
|
6
|
-
const {
|
|
7
|
-
const {
|
|
5
|
+
const DataManager = require('./DataManager');
|
|
6
|
+
const { DiscordjsTypeError, ErrorCodes } = require('../errors');
|
|
7
|
+
const { Role } = require('../structures/Role');
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Manages API methods for roles of a GuildMember and stores their cache.
|
|
11
|
-
*
|
|
12
11
|
* @extends {DataManager}
|
|
13
12
|
*/
|
|
14
13
|
class GuildMemberRoleManager extends DataManager {
|
|
@@ -17,14 +16,12 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* The GuildMember this manager belongs to
|
|
20
|
-
*
|
|
21
19
|
* @type {GuildMember}
|
|
22
20
|
*/
|
|
23
21
|
this.member = member;
|
|
24
22
|
|
|
25
23
|
/**
|
|
26
24
|
* The Guild this manager belongs to
|
|
27
|
-
*
|
|
28
25
|
* @type {Guild}
|
|
29
26
|
*/
|
|
30
27
|
this.guild = member.guild;
|
|
@@ -32,7 +29,6 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
32
29
|
|
|
33
30
|
/**
|
|
34
31
|
* The roles of this member
|
|
35
|
-
*
|
|
36
32
|
* @type {Collection<Snowflake, Role>}
|
|
37
33
|
* @readonly
|
|
38
34
|
*/
|
|
@@ -52,7 +48,6 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
52
48
|
|
|
53
49
|
/**
|
|
54
50
|
* The role of the member used to hoist them in a separate category in the users list
|
|
55
|
-
*
|
|
56
51
|
* @type {?Role}
|
|
57
52
|
* @readonly
|
|
58
53
|
*/
|
|
@@ -64,19 +59,17 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
64
59
|
|
|
65
60
|
/**
|
|
66
61
|
* The role of the member used to set their role icon
|
|
67
|
-
*
|
|
68
62
|
* @type {?Role}
|
|
69
63
|
* @readonly
|
|
70
64
|
*/
|
|
71
65
|
get icon() {
|
|
72
|
-
const iconRoles = this.cache.filter(role => role.icon
|
|
66
|
+
const iconRoles = this.cache.filter(role => role.icon || role.unicodeEmoji);
|
|
73
67
|
if (!iconRoles.size) return null;
|
|
74
68
|
return iconRoles.reduce((prev, role) => (role.comparePositionTo(prev) > 0 ? role : prev));
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
/**
|
|
78
72
|
* The role of the member used to set their color
|
|
79
|
-
*
|
|
80
73
|
* @type {?Role}
|
|
81
74
|
* @readonly
|
|
82
75
|
*/
|
|
@@ -88,7 +81,6 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
88
81
|
|
|
89
82
|
/**
|
|
90
83
|
* The role of the member with the highest position
|
|
91
|
-
*
|
|
92
84
|
* @type {Role}
|
|
93
85
|
* @readonly
|
|
94
86
|
*/
|
|
@@ -98,7 +90,6 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
98
90
|
|
|
99
91
|
/**
|
|
100
92
|
* The premium subscriber role of the guild, if present on the member
|
|
101
|
-
*
|
|
102
93
|
* @type {?Role}
|
|
103
94
|
* @readonly
|
|
104
95
|
*/
|
|
@@ -109,7 +100,6 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
109
100
|
/**
|
|
110
101
|
* The managed role this member created when joining the guild, if any
|
|
111
102
|
* <info>Only ever available on bots</info>
|
|
112
|
-
*
|
|
113
103
|
* @type {?Role}
|
|
114
104
|
* @readonly
|
|
115
105
|
*/
|
|
@@ -122,7 +112,6 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
122
112
|
* Adds a role (or multiple roles) to the member.
|
|
123
113
|
*
|
|
124
114
|
* <info>Uses the idempotent PUT route for singular roles, otherwise PATCHes the underlying guild member</info>
|
|
125
|
-
*
|
|
126
115
|
* @param {RoleResolvable|RoleResolvable[]|Collection<Snowflake, Role>} roleOrRoles The role or roles to add
|
|
127
116
|
* @param {string} [reason] Reason for adding the role(s)
|
|
128
117
|
* @returns {Promise<GuildMember>}
|
|
@@ -135,15 +124,14 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
135
124
|
if (!resolvedRole) {
|
|
136
125
|
throw new DiscordjsTypeError(ErrorCodes.InvalidElement, 'Array or Collection', 'roles', role);
|
|
137
126
|
}
|
|
138
|
-
|
|
139
127
|
resolvedRoles.push(resolvedRole);
|
|
140
128
|
}
|
|
141
129
|
|
|
142
130
|
const newRoles = [...new Set(resolvedRoles.concat(...this.cache.keys()))];
|
|
143
131
|
return this.set(newRoles, reason);
|
|
144
132
|
} else {
|
|
145
|
-
|
|
146
|
-
if (
|
|
133
|
+
roleOrRoles = this.guild.roles.resolveId(roleOrRoles);
|
|
134
|
+
if (roleOrRoles === null) {
|
|
147
135
|
throw new DiscordjsTypeError(
|
|
148
136
|
ErrorCodes.InvalidType,
|
|
149
137
|
'roles',
|
|
@@ -151,10 +139,10 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
151
139
|
);
|
|
152
140
|
}
|
|
153
141
|
|
|
154
|
-
await this.client.rest.put(Routes.guildMemberRole(this.guild.id, this.member.id,
|
|
142
|
+
await this.client.rest.put(Routes.guildMemberRole(this.guild.id, this.member.id, roleOrRoles), { reason });
|
|
155
143
|
|
|
156
144
|
const clone = this.member._clone();
|
|
157
|
-
clone._roles = [...this.cache.keys(),
|
|
145
|
+
clone._roles = [...this.cache.keys(), roleOrRoles];
|
|
158
146
|
return clone;
|
|
159
147
|
}
|
|
160
148
|
}
|
|
@@ -163,7 +151,6 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
163
151
|
* Removes a role (or multiple roles) from the member.
|
|
164
152
|
*
|
|
165
153
|
* <info>Uses the idempotent DELETE route for singular roles, otherwise PATCHes the underlying guild member</info>
|
|
166
|
-
*
|
|
167
154
|
* @param {RoleResolvable|RoleResolvable[]|Collection<Snowflake, Role>} roleOrRoles The role or roles to remove
|
|
168
155
|
* @param {string} [reason] Reason for removing the role(s)
|
|
169
156
|
* @returns {Promise<GuildMember>}
|
|
@@ -176,15 +163,14 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
176
163
|
if (!resolvedRole) {
|
|
177
164
|
throw new DiscordjsTypeError(ErrorCodes.InvalidElement, 'Array or Collection', 'roles', role);
|
|
178
165
|
}
|
|
179
|
-
|
|
180
166
|
resolvedRoles.push(resolvedRole);
|
|
181
167
|
}
|
|
182
168
|
|
|
183
169
|
const newRoles = this.cache.filter(role => !resolvedRoles.includes(role.id));
|
|
184
170
|
return this.set(newRoles, reason);
|
|
185
171
|
} else {
|
|
186
|
-
|
|
187
|
-
if (
|
|
172
|
+
roleOrRoles = this.guild.roles.resolveId(roleOrRoles);
|
|
173
|
+
if (roleOrRoles === null) {
|
|
188
174
|
throw new DiscordjsTypeError(
|
|
189
175
|
ErrorCodes.InvalidType,
|
|
190
176
|
'roles',
|
|
@@ -192,10 +178,10 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
192
178
|
);
|
|
193
179
|
}
|
|
194
180
|
|
|
195
|
-
await this.client.rest.delete(Routes.guildMemberRole(this.guild.id, this.member.id,
|
|
181
|
+
await this.client.rest.delete(Routes.guildMemberRole(this.guild.id, this.member.id, roleOrRoles), { reason });
|
|
196
182
|
|
|
197
183
|
const clone = this.member._clone();
|
|
198
|
-
const newRoles = this.cache.filter(role => role.id !==
|
|
184
|
+
const newRoles = this.cache.filter(role => role.id !== roleOrRoles);
|
|
199
185
|
clone._roles = [...newRoles.keys()];
|
|
200
186
|
return clone;
|
|
201
187
|
}
|
|
@@ -203,7 +189,6 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
203
189
|
|
|
204
190
|
/**
|
|
205
191
|
* Sets the roles applied to the member.
|
|
206
|
-
*
|
|
207
192
|
* @param {Collection<Snowflake, Role>|RoleResolvable[]} roles The roles or role ids to apply
|
|
208
193
|
* @param {string} [reason] Reason for applying the roles
|
|
209
194
|
* @returns {Promise<GuildMember>}
|
|
@@ -218,7 +203,7 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
218
203
|
* .then(member => console.log(`Member roles is now of ${member.roles.cache.size} size`))
|
|
219
204
|
* .catch(console.error);
|
|
220
205
|
*/
|
|
221
|
-
|
|
206
|
+
set(roles, reason) {
|
|
222
207
|
return this.member.edit({ roles, reason });
|
|
223
208
|
}
|
|
224
209
|
|
|
@@ -229,4 +214,4 @@ class GuildMemberRoleManager extends DataManager {
|
|
|
229
214
|
}
|
|
230
215
|
}
|
|
231
216
|
|
|
232
|
-
exports
|
|
217
|
+
module.exports = GuildMemberRoleManager;
|
|
@@ -1,35 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const { DiscordjsTypeError, ErrorCodes } = require('../errors/index.js');
|
|
5
|
-
const { MessageManager } = require('./MessageManager.js');
|
|
3
|
+
const MessageManager = require('./MessageManager');
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* Manages API methods for messages in a guild and holds their cache.
|
|
9
|
-
*
|
|
10
7
|
* @extends {MessageManager}
|
|
11
8
|
*/
|
|
12
9
|
class GuildMessageManager extends MessageManager {
|
|
13
10
|
/**
|
|
14
11
|
* The channel that the messages belong to
|
|
15
|
-
*
|
|
16
12
|
* @name GuildMessageManager#channel
|
|
17
13
|
* @type {GuildTextBasedChannel}
|
|
18
14
|
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Publishes a message in an announcement channel to all channels following it, even if it's not cached.
|
|
22
|
-
*
|
|
23
|
-
* @param {MessageResolvable} message The message to publish
|
|
24
|
-
* @returns {Promise<Message>}
|
|
25
|
-
*/
|
|
26
|
-
async crosspost(message) {
|
|
27
|
-
const messageId = this.resolveId(message);
|
|
28
|
-
if (!messageId) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'message', 'MessageResolvable');
|
|
29
|
-
|
|
30
|
-
const data = await this.client.rest.post(Routes.channelMessageCrosspost(this.channel.id, messageId));
|
|
31
|
-
return this.cache.get(data.id) ?? this._add(data);
|
|
32
|
-
}
|
|
33
15
|
}
|
|
34
16
|
|
|
35
|
-
exports
|
|
17
|
+
module.exports = GuildMessageManager;
|
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
const { Collection } = require('@discordjs/collection');
|
|
4
4
|
const { makeURLSearchParams } = require('@discordjs/rest');
|
|
5
5
|
const { GuildScheduledEventEntityType, Routes } = require('discord-api-types/v10');
|
|
6
|
-
const
|
|
7
|
-
const {
|
|
8
|
-
const {
|
|
9
|
-
const {
|
|
10
|
-
const {
|
|
6
|
+
const CachedManager = require('./CachedManager');
|
|
7
|
+
const { DiscordjsTypeError, DiscordjsError, ErrorCodes } = require('../errors');
|
|
8
|
+
const { GuildScheduledEvent } = require('../structures/GuildScheduledEvent');
|
|
9
|
+
const { resolveImage } = require('../util/DataResolver');
|
|
10
|
+
const { _transformGuildScheduledEventRecurrenceRule } = require('../util/Transformers');
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Manages API methods for GuildScheduledEvents and stores their cache.
|
|
14
|
-
*
|
|
15
14
|
* @extends {CachedManager}
|
|
16
15
|
*/
|
|
17
16
|
class GuildScheduledEventManager extends CachedManager {
|
|
@@ -20,7 +19,6 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* The guild this manager belongs to
|
|
23
|
-
*
|
|
24
22
|
* @type {Guild}
|
|
25
23
|
*/
|
|
26
24
|
this.guild = guild;
|
|
@@ -28,22 +26,19 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
28
26
|
|
|
29
27
|
/**
|
|
30
28
|
* The cache of this manager
|
|
31
|
-
*
|
|
32
29
|
* @type {Collection<Snowflake, GuildScheduledEvent>}
|
|
33
30
|
* @name GuildScheduledEventManager#cache
|
|
34
31
|
*/
|
|
35
32
|
|
|
36
33
|
/**
|
|
37
34
|
* Data that resolves to give a GuildScheduledEvent object. This can be:
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
35
|
+
* * A Snowflake
|
|
36
|
+
* * A GuildScheduledEvent object
|
|
41
37
|
* @typedef {Snowflake|GuildScheduledEvent} GuildScheduledEventResolvable
|
|
42
38
|
*/
|
|
43
39
|
|
|
44
40
|
/**
|
|
45
41
|
* Options for setting a recurrence rule for a guild scheduled event.
|
|
46
|
-
*
|
|
47
42
|
* @typedef {Object} GuildScheduledEventRecurrenceRuleOptions
|
|
48
43
|
* @property {DateResolvable} startAt The time the recurrence rule interval starts at
|
|
49
44
|
* @property {GuildScheduledEventRecurrenceRuleFrequency} frequency How often the event occurs
|
|
@@ -56,7 +51,6 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
56
51
|
|
|
57
52
|
/**
|
|
58
53
|
* Options used to create a guild scheduled event.
|
|
59
|
-
*
|
|
60
54
|
* @typedef {Object} GuildScheduledEventCreateOptions
|
|
61
55
|
* @property {string} name The name of the guild scheduled event
|
|
62
56
|
* @property {DateResolvable} scheduledStartTime The time to schedule the event at
|
|
@@ -79,7 +73,6 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
79
73
|
|
|
80
74
|
/**
|
|
81
75
|
* Options used to set entity metadata of a guild scheduled event.
|
|
82
|
-
*
|
|
83
76
|
* @typedef {Object} GuildScheduledEventEntityMetadataOptions
|
|
84
77
|
* @property {string} [location] The location of the guild scheduled event
|
|
85
78
|
* <warn>This is required if `entityType` is {@link GuildScheduledEventEntityType.External}</warn>
|
|
@@ -87,13 +80,12 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
87
80
|
|
|
88
81
|
/**
|
|
89
82
|
* Creates a new guild scheduled event.
|
|
90
|
-
*
|
|
91
83
|
* @param {GuildScheduledEventCreateOptions} options Options for creating the guild scheduled event
|
|
92
84
|
* @returns {Promise<GuildScheduledEvent>}
|
|
93
85
|
*/
|
|
94
86
|
async create(options) {
|
|
95
87
|
if (typeof options !== 'object') throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'options', 'object', true);
|
|
96
|
-
|
|
88
|
+
let {
|
|
97
89
|
privacyLevel,
|
|
98
90
|
entityType,
|
|
99
91
|
channel,
|
|
@@ -107,8 +99,7 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
107
99
|
recurrenceRule,
|
|
108
100
|
} = options;
|
|
109
101
|
|
|
110
|
-
let channel_id;
|
|
111
|
-
let entity_metadata;
|
|
102
|
+
let entity_metadata, channel_id;
|
|
112
103
|
if (entityType === GuildScheduledEventEntityType.External) {
|
|
113
104
|
channel_id = channel === undefined ? channel : null;
|
|
114
105
|
entity_metadata = { location: entityMetadata?.location };
|
|
@@ -139,7 +130,6 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
139
130
|
|
|
140
131
|
/**
|
|
141
132
|
* Options used to fetch a single guild scheduled event from a guild.
|
|
142
|
-
*
|
|
143
133
|
* @typedef {BaseFetchOptions} FetchGuildScheduledEventOptions
|
|
144
134
|
* @property {GuildScheduledEventResolvable} guildScheduledEvent The guild scheduled event to fetch
|
|
145
135
|
* @property {boolean} [withUserCount=true] Whether to fetch the number of users subscribed to the scheduled event
|
|
@@ -147,7 +137,6 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
147
137
|
|
|
148
138
|
/**
|
|
149
139
|
* Options used to fetch multiple guild scheduled events from a guild.
|
|
150
|
-
*
|
|
151
140
|
* @typedef {Object} FetchGuildScheduledEventsOptions
|
|
152
141
|
* @property {boolean} [cache] Whether or not to cache the fetched guild scheduled events
|
|
153
142
|
* @property {boolean} [withUserCount=true] Whether to fetch the number of users subscribed to each scheduled event
|
|
@@ -156,7 +145,6 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
156
145
|
|
|
157
146
|
/**
|
|
158
147
|
* Obtains one or more guild scheduled events from Discord, or the guild cache if it's already available.
|
|
159
|
-
*
|
|
160
148
|
* @param {GuildScheduledEventResolvable|FetchGuildScheduledEventOptions|FetchGuildScheduledEventsOptions} [options]
|
|
161
149
|
* The id of the guild scheduled event or options
|
|
162
150
|
* @returns {Promise<GuildScheduledEvent|Collection<Snowflake, GuildScheduledEvent>>}
|
|
@@ -170,10 +158,10 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
170
158
|
if (existing) return existing;
|
|
171
159
|
}
|
|
172
160
|
|
|
173
|
-
const
|
|
161
|
+
const data = await this.client.rest.get(Routes.guildScheduledEvent(this.guild.id, id), {
|
|
174
162
|
query: makeURLSearchParams({ with_user_count: options.withUserCount ?? true }),
|
|
175
163
|
});
|
|
176
|
-
return this._add(
|
|
164
|
+
return this._add(data, options.cache);
|
|
177
165
|
}
|
|
178
166
|
|
|
179
167
|
const data = await this.client.rest.get(Routes.guildScheduledEvents(this.guild.id), {
|
|
@@ -189,7 +177,6 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
189
177
|
|
|
190
178
|
/**
|
|
191
179
|
* Options used to edit a guild scheduled event.
|
|
192
|
-
*
|
|
193
180
|
* @typedef {Object} GuildScheduledEventEditOptions
|
|
194
181
|
* @property {string} [name] The name of the guild scheduled event
|
|
195
182
|
* @property {DateResolvable} [scheduledStartTime] The time to schedule the event at
|
|
@@ -211,7 +198,6 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
211
198
|
|
|
212
199
|
/**
|
|
213
200
|
* Edits a guild scheduled event.
|
|
214
|
-
*
|
|
215
201
|
* @param {GuildScheduledEventResolvable} guildScheduledEvent The guild scheduled event to edit
|
|
216
202
|
* @param {GuildScheduledEventEditOptions} options Options to edit the guild scheduled event
|
|
217
203
|
* @returns {Promise<GuildScheduledEvent>}
|
|
@@ -221,7 +207,7 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
221
207
|
if (!guildScheduledEventId) throw new DiscordjsError(ErrorCodes.GuildScheduledEventResolve);
|
|
222
208
|
|
|
223
209
|
if (typeof options !== 'object') throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'options', 'object', true);
|
|
224
|
-
|
|
210
|
+
let {
|
|
225
211
|
privacyLevel,
|
|
226
212
|
entityType,
|
|
227
213
|
channel,
|
|
@@ -265,7 +251,6 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
265
251
|
|
|
266
252
|
/**
|
|
267
253
|
* Deletes a guild scheduled event.
|
|
268
|
-
*
|
|
269
254
|
* @param {GuildScheduledEventResolvable} guildScheduledEvent The guild scheduled event to delete
|
|
270
255
|
* @returns {Promise<void>}
|
|
271
256
|
*/
|
|
@@ -278,7 +263,6 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
278
263
|
|
|
279
264
|
/**
|
|
280
265
|
* Options used to fetch subscribers of a guild scheduled event
|
|
281
|
-
*
|
|
282
266
|
* @typedef {Object} FetchGuildScheduledEventSubscribersOptions
|
|
283
267
|
* @property {number} [limit] The maximum numbers of users to fetch
|
|
284
268
|
* @property {boolean} [withMember] Whether to fetch guild member data of the users
|
|
@@ -289,7 +273,6 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
289
273
|
|
|
290
274
|
/**
|
|
291
275
|
* Represents a subscriber of a {@link GuildScheduledEvent}
|
|
292
|
-
*
|
|
293
276
|
* @typedef {Object} GuildScheduledEventUser
|
|
294
277
|
* @property {Snowflake} guildScheduledEventId The id of the guild scheduled event which the user subscribed to
|
|
295
278
|
* @property {User} user The user that subscribed to the guild scheduled event
|
|
@@ -298,7 +281,6 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
298
281
|
|
|
299
282
|
/**
|
|
300
283
|
* Fetches subscribers of a guild scheduled event.
|
|
301
|
-
*
|
|
302
284
|
* @param {GuildScheduledEventResolvable} guildScheduledEvent The guild scheduled event to fetch subscribers of
|
|
303
285
|
* @param {FetchGuildScheduledEventSubscribersOptions} [options={}] Options for fetching the subscribers
|
|
304
286
|
* @returns {Promise<Collection<Snowflake, GuildScheduledEventUser>>}
|
|
@@ -330,4 +312,4 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
330
312
|
}
|
|
331
313
|
}
|
|
332
314
|
|
|
333
|
-
exports
|
|
315
|
+
module.exports = GuildScheduledEventManager;
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
const { Collection } = require('@discordjs/collection');
|
|
4
4
|
const { lazy } = require('@discordjs/util');
|
|
5
5
|
const { Routes } = require('discord-api-types/v10');
|
|
6
|
+
const CachedManager = require('./CachedManager.js');
|
|
6
7
|
const { DiscordjsTypeError, ErrorCodes } = require('../errors/index.js');
|
|
7
8
|
const { SoundboardSound } = require('../structures/SoundboardSound.js');
|
|
8
9
|
const { resolveBase64, resolveFile } = require('../util/DataResolver.js');
|
|
9
|
-
const { CachedManager } = require('./CachedManager.js');
|
|
10
10
|
|
|
11
11
|
const fileTypeMime = lazy(() => require('magic-bytes.js').filetypemime);
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Manages API methods for Soundboard Sounds and stores their cache.
|
|
15
|
-
*
|
|
16
15
|
* @extends {CachedManager}
|
|
17
16
|
*/
|
|
18
17
|
class GuildSoundboardSoundManager extends CachedManager {
|
|
@@ -21,7 +20,6 @@ class GuildSoundboardSoundManager extends CachedManager {
|
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* The guild this manager belongs to
|
|
24
|
-
*
|
|
25
23
|
* @type {Guild}
|
|
26
24
|
*/
|
|
27
25
|
this.guild = guild;
|
|
@@ -29,7 +27,6 @@ class GuildSoundboardSoundManager extends CachedManager {
|
|
|
29
27
|
|
|
30
28
|
/**
|
|
31
29
|
* The cache of Soundboard Sounds
|
|
32
|
-
*
|
|
33
30
|
* @type {Collection<Snowflake, SoundboardSound>}
|
|
34
31
|
* @name GuildSoundboardSoundManager#cache
|
|
35
32
|
*/
|
|
@@ -40,15 +37,13 @@ class GuildSoundboardSoundManager extends CachedManager {
|
|
|
40
37
|
|
|
41
38
|
/**
|
|
42
39
|
* Data that resolves to give a SoundboardSound object. This can be:
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
40
|
+
* * A SoundboardSound object
|
|
41
|
+
* * A Snowflake
|
|
46
42
|
* @typedef {SoundboardSound|Snowflake} SoundboardSoundResolvable
|
|
47
43
|
*/
|
|
48
44
|
|
|
49
45
|
/**
|
|
50
46
|
* Resolves a SoundboardSoundResolvable to a SoundboardSound object.
|
|
51
|
-
*
|
|
52
47
|
* @method resolve
|
|
53
48
|
* @memberof GuildSoundboardSoundManager
|
|
54
49
|
* @instance
|
|
@@ -58,7 +53,6 @@ class GuildSoundboardSoundManager extends CachedManager {
|
|
|
58
53
|
|
|
59
54
|
/**
|
|
60
55
|
* Resolves a {@link SoundboardSoundResolvable} to a {@link SoundboardSound} id.
|
|
61
|
-
*
|
|
62
56
|
* @param {SoundboardSoundResolvable} soundboardSound The soundboard sound resolvable to resolve
|
|
63
57
|
* @returns {?Snowflake}
|
|
64
58
|
*/
|
|
@@ -70,7 +64,6 @@ class GuildSoundboardSoundManager extends CachedManager {
|
|
|
70
64
|
|
|
71
65
|
/**
|
|
72
66
|
* Options used to create a soundboard sound in a guild.
|
|
73
|
-
*
|
|
74
67
|
* @typedef {Object} GuildSoundboardSoundCreateOptions
|
|
75
68
|
* @property {BufferResolvable|Stream} file The file for the soundboard sound
|
|
76
69
|
* @property {string} name The name for the soundboard sound
|
|
@@ -83,7 +76,6 @@ class GuildSoundboardSoundManager extends CachedManager {
|
|
|
83
76
|
|
|
84
77
|
/**
|
|
85
78
|
* Creates a new guild soundboard sound.
|
|
86
|
-
*
|
|
87
79
|
* @param {GuildSoundboardSoundCreateOptions} options Options for creating a guild soundboard sound
|
|
88
80
|
* @returns {Promise<SoundboardSound>} The created soundboard sound
|
|
89
81
|
* @example
|
|
@@ -111,7 +103,6 @@ class GuildSoundboardSoundManager extends CachedManager {
|
|
|
111
103
|
|
|
112
104
|
/**
|
|
113
105
|
* Data for editing a soundboard sound.
|
|
114
|
-
*
|
|
115
106
|
* @typedef {Object} GuildSoundboardSoundEditOptions
|
|
116
107
|
* @property {string} [name] The name of the soundboard sound
|
|
117
108
|
* @property {?number} [volume] The volume (a double) of the soundboard sound, from 0 (inclusive) to 1
|
|
@@ -122,7 +113,6 @@ class GuildSoundboardSoundManager extends CachedManager {
|
|
|
122
113
|
|
|
123
114
|
/**
|
|
124
115
|
* Edits a soundboard sound.
|
|
125
|
-
*
|
|
126
116
|
* @param {SoundboardSoundResolvable} soundboardSound The soundboard sound to edit
|
|
127
117
|
* @param {GuildSoundboardSoundEditOptions} [options={}] The new data for the soundboard sound
|
|
128
118
|
* @returns {Promise<SoundboardSound>}
|
|
@@ -155,7 +145,6 @@ class GuildSoundboardSoundManager extends CachedManager {
|
|
|
155
145
|
|
|
156
146
|
/**
|
|
157
147
|
* Deletes a soundboard sound.
|
|
158
|
-
*
|
|
159
148
|
* @param {SoundboardSoundResolvable} soundboardSound The soundboard sound to delete
|
|
160
149
|
* @param {string} [reason] Reason for deleting this soundboard sound
|
|
161
150
|
* @returns {Promise<void>}
|
|
@@ -170,21 +159,19 @@ class GuildSoundboardSoundManager extends CachedManager {
|
|
|
170
159
|
|
|
171
160
|
/**
|
|
172
161
|
* Options used to fetch a soundboard sound.
|
|
173
|
-
*
|
|
174
162
|
* @typedef {BaseFetchOptions} FetchSoundboardSoundOptions
|
|
175
163
|
* @property {SoundboardSoundResolvable} soundboardSound The soundboard sound to fetch
|
|
176
164
|
*/
|
|
177
165
|
|
|
178
166
|
/**
|
|
179
167
|
* Options used to fetch soundboard sounds from Discord
|
|
180
|
-
*
|
|
181
168
|
* @typedef {Object} FetchGuildSoundboardSoundsOptions
|
|
182
169
|
* @property {boolean} [cache] Whether to cache the fetched soundboard sounds
|
|
183
170
|
*/
|
|
184
171
|
|
|
172
|
+
/* eslint-disable max-len */
|
|
185
173
|
/**
|
|
186
174
|
* Obtains one or more soundboard sounds from Discord, or the soundboard sound cache if they're already available.
|
|
187
|
-
*
|
|
188
175
|
* @param {SoundboardSoundResolvable|FetchSoundboardSoundOptions|FetchGuildSoundboardSoundsOptions} [options] Options for fetching soundboard sound(s)
|
|
189
176
|
* @returns {Promise<SoundboardSound|Collection<Snowflake, SoundboardSound>>}
|
|
190
177
|
* @example
|
|
@@ -198,6 +185,7 @@ class GuildSoundboardSoundManager extends CachedManager {
|
|
|
198
185
|
* .then(sounds => console.log(`There are ${sounds.size} soundboard sounds.`))
|
|
199
186
|
* .catch(console.error);
|
|
200
187
|
*/
|
|
188
|
+
/* eslint-enable max-len */
|
|
201
189
|
async fetch(options) {
|
|
202
190
|
if (!options) return this._fetchMany();
|
|
203
191
|
const { cache, force, soundboardSound } = options;
|