@velliajs/discord 1.0.2 → 1.0.4
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 +4 -11
- package/package.json +3 -3
- package/src/client/BaseClient.js +7 -28
- package/src/client/Client.js +116 -283
- package/src/client/WebhookClient.js +17 -59
- package/src/client/actions/Action.js +0 -10
- package/src/client/actions/ActionsManager.js +3 -3
- package/src/client/actions/ApplicationCommandPermissionsUpdate.js +2 -15
- package/src/client/actions/AutoModerationActionExecution.js +1 -6
- package/src/client/actions/AutoModerationRuleCreate.js +1 -6
- package/src/client/actions/AutoModerationRuleDelete.js +1 -6
- package/src/client/actions/AutoModerationRuleUpdate.js +1 -7
- package/src/client/actions/ChannelCreate.js +1 -5
- package/src/client/actions/ChannelDelete.js +1 -5
- package/src/client/actions/GuildAuditLogEntryCreate.js +1 -6
- package/src/client/actions/GuildBanAdd.js +1 -5
- package/src/client/actions/GuildBanRemove.js +1 -5
- package/src/client/actions/GuildDelete.js +6 -14
- package/src/client/actions/GuildEmojiCreate.js +1 -5
- package/src/client/actions/GuildEmojiDelete.js +1 -5
- package/src/client/actions/GuildEmojiUpdate.js +1 -6
- package/src/client/actions/GuildEmojisUpdate.js +4 -4
- package/src/client/actions/GuildIntegrationsUpdate.js +1 -5
- package/src/client/actions/GuildMemberRemove.js +1 -5
- package/src/client/actions/GuildMemberUpdate.js +2 -11
- package/src/client/actions/GuildRoleCreate.js +1 -5
- package/src/client/actions/GuildRoleDelete.js +1 -5
- package/src/client/actions/GuildRoleUpdate.js +1 -6
- package/src/client/actions/GuildScheduledEventCreate.js +1 -5
- package/src/client/actions/GuildScheduledEventDelete.js +1 -5
- package/src/client/actions/GuildScheduledEventUpdate.js +1 -6
- package/src/client/actions/GuildScheduledEventUserAdd.js +1 -6
- package/src/client/actions/GuildScheduledEventUserRemove.js +1 -6
- package/src/client/actions/GuildStickerCreate.js +1 -5
- package/src/client/actions/GuildStickerDelete.js +1 -5
- package/src/client/actions/GuildStickerUpdate.js +1 -6
- package/src/client/actions/GuildStickersUpdate.js +4 -4
- package/src/client/actions/GuildUpdate.js +1 -6
- package/src/client/actions/InteractionCreate.js +3 -7
- package/src/client/actions/InviteCreate.js +1 -7
- package/src/client/actions/InviteDelete.js +1 -7
- package/src/client/actions/MessageCreate.js +1 -5
- package/src/client/actions/MessageDelete.js +1 -5
- package/src/client/actions/MessageDeleteBulk.js +1 -6
- package/src/client/actions/MessageReactionAdd.js +5 -18
- package/src/client/actions/MessageReactionRemove.js +5 -16
- package/src/client/actions/MessageReactionRemoveAll.js +4 -9
- package/src/client/actions/MessageReactionRemoveEmoji.js +1 -5
- package/src/client/actions/PresenceUpdate.js +1 -6
- package/src/client/actions/StageInstanceCreate.js +1 -5
- package/src/client/actions/StageInstanceDelete.js +1 -5
- package/src/client/actions/StageInstanceUpdate.js +1 -6
- package/src/client/actions/ThreadCreate.js +1 -6
- package/src/client/actions/ThreadDelete.js +1 -5
- package/src/client/actions/ThreadListSync.js +2 -7
- package/src/client/actions/ThreadMemberUpdate.js +2 -7
- package/src/client/actions/ThreadMembersUpdate.js +2 -9
- package/src/client/actions/TypingStart.js +1 -5
- package/src/client/actions/UserUpdate.js +1 -8
- package/src/client/actions/VoiceStateUpdate.js +4 -9
- package/src/client/actions/WebhooksUpdate.js +1 -6
- package/src/client/voice/ClientVoiceManager.js +3 -13
- package/src/client/websocket/WebSocketManager.js +25 -117
- package/src/client/websocket/WebSocketShard.js +29 -116
- package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.js +2 -8
- package/src/client/websocket/handlers/CHANNEL_UPDATE.js +1 -6
- package/src/client/websocket/handlers/GUILD_CREATE.js +3 -7
- package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.js +2 -16
- package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +1 -5
- package/src/client/websocket/handlers/MESSAGE_UPDATE.js +1 -6
- package/src/client/websocket/handlers/RESUMED.js +1 -6
- package/src/client/websocket/handlers/THREAD_UPDATE.js +1 -6
- package/src/errors/DJSError.js +3 -14
- package/src/errors/ErrorCodes.js +2 -164
- package/src/index.js +6 -6
- package/src/managers/ApplicationCommandManager.js +14 -130
- package/src/managers/ApplicationCommandPermissionsManager.js +31 -202
- package/src/managers/AutoModerationRuleManager.js +17 -145
- package/src/managers/BaseGuildEmojiManager.js +7 -38
- package/src/managers/BaseManager.js +2 -10
- package/src/managers/CachedManager.js +3 -17
- package/src/managers/CategoryChannelChildManager.js +6 -48
- package/src/managers/ChannelManager.js +11 -52
- package/src/managers/DataManager.js +5 -27
- package/src/managers/GuildApplicationCommandManager.js +3 -12
- package/src/managers/GuildBanManager.js +16 -105
- package/src/managers/GuildChannelManager.js +31 -226
- package/src/managers/GuildEmojiManager.js +9 -65
- package/src/managers/GuildEmojiRoleManager.js +8 -47
- package/src/managers/GuildForumThreadManager.js +5 -39
- package/src/managers/GuildInviteManager.js +18 -117
- package/src/managers/GuildManager.js +14 -115
- package/src/managers/GuildMemberManager.js +38 -256
- package/src/managers/GuildMemberRoleManager.js +13 -76
- package/src/managers/GuildScheduledEventManager.js +25 -128
- package/src/managers/GuildStickerManager.js +16 -96
- package/src/managers/GuildTextThreadManager.js +4 -47
- package/src/managers/MessageManager.js +23 -137
- package/src/managers/PermissionOverwriteManager.js +10 -78
- package/src/managers/PresenceManager.js +6 -27
- package/src/managers/ReactionManager.js +7 -40
- package/src/managers/ReactionUserManager.js +6 -29
- package/src/managers/RoleManager.js +29 -177
- package/src/managers/StageInstanceManager.js +14 -77
- package/src/managers/ThreadManager.js +23 -113
- package/src/managers/ThreadMemberManager.js +20 -89
- package/src/managers/UserManager.js +13 -65
- package/src/managers/VoiceStateManager.js +3 -13
- package/src/sharding/Shard.js +42 -158
- package/src/sharding/ShardClientUtil.js +17 -101
- package/src/sharding/ShardingManager.js +34 -151
- package/src/structures/ActionRow.js +4 -21
- package/src/structures/ActionRowBuilder.js +3 -13
- package/src/structures/AnonymousGuild.js +10 -43
- package/src/structures/ApplicationCommand.js +54 -308
- package/src/structures/ApplicationRoleConnectionMetadata.js +7 -27
- package/src/structures/Attachment.js +16 -65
- package/src/structures/AttachmentBuilder.js +13 -58
- package/src/structures/AutoModerationActionExecution.js +16 -69
- package/src/structures/AutoModerationRule.js +32 -164
- package/src/structures/AutocompleteInteraction.js +10 -52
- package/src/structures/Base.js +2 -10
- package/src/structures/BaseChannel.js +16 -80
- package/src/structures/BaseGuild.js +13 -59
- package/src/structures/BaseGuildEmoji.js +5 -21
- package/src/structures/BaseGuildTextChannel.js +19 -100
- package/src/structures/BaseGuildVoiceChannel.js +21 -110
- package/src/structures/BaseInteraction.js +40 -196
- package/src/structures/BaseSelectMenuComponent.js +6 -29
- package/src/structures/ButtonBuilder.js +4 -18
- package/src/structures/ButtonComponent.js +7 -34
- package/src/structures/ButtonInteraction.js +1 -4
- package/src/structures/CategoryChannel.js +5 -30
- package/src/structures/ChannelSelectMenuBuilder.js +3 -13
- package/src/structures/ChannelSelectMenuComponent.js +2 -9
- package/src/structures/ChannelSelectMenuInteraction.js +3 -12
- package/src/structures/ChatInputCommandInteraction.js +3 -13
- package/src/structures/ClientApplication.js +20 -83
- package/src/structures/ClientPresence.js +5 -20
- package/src/structures/ClientUser.js +21 -118
- package/src/structures/CommandInteraction.js +21 -96
- package/src/structures/CommandInteractionOptionResolver.js +26 -147
- package/src/structures/Component.js +5 -21
- package/src/structures/ContextMenuCommandInteraction.js +4 -18
- package/src/structures/DMChannel.js +17 -52
- package/src/structures/DirectoryChannel.js +4 -16
- package/src/structures/Embed.js +21 -107
- package/src/structures/EmbedBuilder.js +4 -18
- package/src/structures/Emoji.js +12 -60
- package/src/structures/ForumChannel.js +30 -140
- package/src/structures/Guild.js +117 -697
- package/src/structures/GuildAuditLogs.js +7 -32
- package/src/structures/GuildAuditLogsEntry.js +27 -135
- package/src/structures/GuildBan.js +6 -26
- package/src/structures/GuildChannel.js +36 -188
- package/src/structures/GuildEmoji.js +13 -67
- package/src/structures/GuildMember.js +47 -270
- package/src/structures/GuildPreview.js +19 -84
- package/src/structures/GuildPreviewEmoji.js +3 -13
- package/src/structures/GuildScheduledEvent.js +46 -250
- package/src/structures/GuildTemplate.js +24 -108
- package/src/structures/Integration.js +25 -103
- package/src/structures/IntegrationApplication.js +8 -32
- package/src/structures/InteractionCollector.js +22 -113
- package/src/structures/InteractionResponse.js +11 -46
- package/src/structures/InteractionWebhook.js +8 -33
- package/src/structures/Invite.js +27 -131
- package/src/structures/InviteGuild.js +2 -8
- package/src/structures/InviteStageInstance.js +9 -39
- package/src/structures/MentionableSelectMenuBuilder.js +3 -14
- package/src/structures/MentionableSelectMenuComponent.js +1 -4
- package/src/structures/MentionableSelectMenuInteraction.js +5 -20
- package/src/structures/Message.js +85 -460
- package/src/structures/MessageCollector.js +14 -70
- package/src/structures/MessageComponentInteraction.js +14 -57
- package/src/structures/MessageContextMenuCommandInteraction.js +2 -9
- package/src/structures/MessageMentions.js +25 -136
- package/src/structures/MessagePayload.js +24 -94
- package/src/structures/MessageReaction.js +13 -51
- package/src/structures/ModalBuilder.js +3 -13
- package/src/structures/ModalSubmitFields.js +5 -22
- package/src/structures/ModalSubmitInteraction.js +17 -61
- package/src/structures/NewsChannel.js +2 -16
- package/src/structures/OAuth2Guild.js +3 -12
- package/src/structures/PartialGroupDMChannel.js +7 -27
- package/src/structures/PermissionOverwrites.js +20 -99
- package/src/structures/Presence.js +45 -190
- package/src/structures/ReactionCollector.js +20 -108
- package/src/structures/ReactionEmoji.js +2 -10
- package/src/structures/Role.js +39 -261
- package/src/structures/RoleSelectMenuBuilder.js +3 -13
- package/src/structures/RoleSelectMenuComponent.js +1 -4
- package/src/structures/RoleSelectMenuInteraction.js +3 -12
- package/src/structures/SelectMenuBuilder.js +1 -4
- package/src/structures/SelectMenuComponent.js +1 -4
- package/src/structures/SelectMenuInteraction.js +1 -4
- package/src/structures/SelectMenuOptionBuilder.js +1 -4
- package/src/structures/StageChannel.js +12 -84
- package/src/structures/StageInstance.js +16 -87
- package/src/structures/Sticker.js +25 -124
- package/src/structures/StickerPack.js +12 -52
- package/src/structures/StringSelectMenuBuilder.js +6 -29
- package/src/structures/StringSelectMenuComponent.js +2 -9
- package/src/structures/StringSelectMenuInteraction.js +2 -8
- package/src/structures/StringSelectMenuOptionBuilder.js +4 -18
- package/src/structures/Team.js +11 -52
- package/src/structures/TeamMember.js +7 -33
- package/src/structures/TextChannel.js +3 -14
- package/src/structures/TextInputBuilder.js +3 -13
- package/src/structures/TextInputComponent.js +3 -14
- package/src/structures/ThreadChannel.js +59 -305
- package/src/structures/ThreadMember.js +12 -55
- package/src/structures/Typing.js +8 -35
- package/src/structures/User.js +29 -151
- package/src/structures/UserContextMenuCommandInteraction.js +3 -14
- package/src/structures/UserSelectMenuBuilder.js +3 -13
- package/src/structures/UserSelectMenuComponent.js +1 -4
- package/src/structures/UserSelectMenuInteraction.js +4 -16
- package/src/structures/VoiceChannel.js +8 -67
- package/src/structures/VoiceRegion.js +6 -23
- package/src/structures/VoiceState.js +28 -140
- package/src/structures/Webhook.js +37 -227
- package/src/structures/WelcomeChannel.js +7 -29
- package/src/structures/WelcomeScreen.js +5 -20
- package/src/structures/Widget.js +9 -40
- package/src/structures/WidgetMember.js +15 -61
- package/src/structures/interfaces/Application.js +10 -49
- package/src/structures/interfaces/Collector.js +34 -155
- package/src/structures/interfaces/InteractionResponses.js +25 -164
- package/src/structures/interfaces/TextBasedChannel.js +37 -232
- package/src/util/APITypes.js +183 -456
- package/src/util/ActivityFlagsBitField.js +3 -15
- package/src/util/ApplicationFlagsBitField.js +3 -15
- package/src/util/BitField.js +17 -82
- package/src/util/ChannelFlagsBitField.js +7 -30
- package/src/util/Channels.js +5 -35
- package/src/util/Colors.js +3 -38
- package/src/util/Components.js +21 -75
- package/src/util/Constants.js +17 -144
- package/src/util/DataResolver.js +20 -77
- package/src/util/Events.js +3 -81
- package/src/util/Formatters.js +58 -305
- package/src/util/GuildMemberFlagsBitField.js +7 -30
- package/src/util/IntentsBitField.js +4 -23
- package/src/util/LimitedCollection.js +4 -21
- package/src/util/MessageFlagsBitField.js +5 -21
- package/src/util/Options.js +24 -137
- package/src/util/Partials.js +3 -30
- package/src/util/PermissionsBitField.js +12 -67
- package/src/util/ShardEvents.js +3 -15
- package/src/util/Status.js +3 -17
- package/src/util/Sweepers.js +35 -184
- package/src/util/SystemChannelFlagsBitField.js +7 -32
- package/src/util/ThreadMemberFlagsBitField.js +5 -21
- package/src/util/Transformers.js +2 -11
- package/src/util/UserFlagsBitField.js +5 -21
- package/src/util/Util.js +30 -169
- package/src/util/WebSocketShardEvents.js +3 -14
|
@@ -8,66 +8,24 @@ const { DiscordjsTypeError, DiscordjsError, ErrorCodes } = require('../errors');
|
|
|
8
8
|
const { GuildScheduledEvent } = require('../structures/GuildScheduledEvent');
|
|
9
9
|
const DataResolver = require('../util/DataResolver');
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
* Manages API methods for GuildScheduledEvents and stores their cache.
|
|
13
|
-
* @extends {CachedManager}
|
|
14
|
-
*/
|
|
11
|
+
|
|
15
12
|
class GuildScheduledEventManager extends CachedManager {
|
|
16
13
|
constructor(guild, iterable) {
|
|
17
14
|
super(guild.client, GuildScheduledEvent, iterable);
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
* The guild this manager belongs to
|
|
21
|
-
* @type {Guild}
|
|
22
|
-
*/
|
|
16
|
+
|
|
23
17
|
this.guild = guild;
|
|
24
18
|
}
|
|
25
19
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* * A GuildScheduledEvent object
|
|
36
|
-
* @typedef {Snowflake|GuildScheduledEvent} GuildScheduledEventResolvable
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Options used to create a guild scheduled event.
|
|
41
|
-
* @typedef {Object} GuildScheduledEventCreateOptions
|
|
42
|
-
* @property {string} name The name of the guild scheduled event
|
|
43
|
-
* @property {DateResolvable} scheduledStartTime The time to schedule the event at
|
|
44
|
-
* @property {DateResolvable} [scheduledEndTime] The time to end the event at
|
|
45
|
-
* <warn>This is required if `entityType` is {@link GuildScheduledEventEntityType.External}</warn>
|
|
46
|
-
* @property {GuildScheduledEventPrivacyLevel} privacyLevel The privacy level of the guild scheduled event
|
|
47
|
-
* @property {GuildScheduledEventEntityType} entityType The scheduled entity type of the event
|
|
48
|
-
* @property {string} [description] The description of the guild scheduled event
|
|
49
|
-
* @property {GuildVoiceChannelResolvable} [channel] The channel of the guild scheduled event
|
|
50
|
-
* <warn>This is required if `entityType` is {@link GuildScheduledEventEntityType.StageInstance} or
|
|
51
|
-
* {@link GuildScheduledEventEntityType.Voice}</warn>
|
|
52
|
-
* @property {GuildScheduledEventEntityMetadataOptions} [entityMetadata] The entity metadata of the
|
|
53
|
-
* guild scheduled event
|
|
54
|
-
* <warn>This is required if `entityType` is {@link GuildScheduledEventEntityType.External}</warn>
|
|
55
|
-
* @property {?(BufferResolvable|Base64Resolvable)} [image] The cover image of the guild scheduled event
|
|
56
|
-
* @property {string} [reason] The reason for creating the guild scheduled event
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Options used to set entity metadata of a guild scheduled event.
|
|
61
|
-
* @typedef {Object} GuildScheduledEventEntityMetadataOptions
|
|
62
|
-
* @property {string} [location] The location of the guild scheduled event
|
|
63
|
-
* <warn>This is required if `entityType` is {@link GuildScheduledEventEntityType.External}</warn>
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Creates a new guild scheduled event.
|
|
68
|
-
* @param {GuildScheduledEventCreateOptions} options Options for creating the guild scheduled event
|
|
69
|
-
* @returns {Promise<GuildScheduledEvent>}
|
|
70
|
-
*/
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
71
29
|
async create(options) {
|
|
72
30
|
if (typeof options !== 'object') throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'options', 'object', true);
|
|
73
31
|
let {
|
|
@@ -111,27 +69,11 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
111
69
|
return this._add(data);
|
|
112
70
|
}
|
|
113
71
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
*/
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Options used to fetch multiple guild scheduled events from a guild.
|
|
123
|
-
* @typedef {Object} FetchGuildScheduledEventsOptions
|
|
124
|
-
* @property {boolean} [cache] Whether or not to cache the fetched guild scheduled events
|
|
125
|
-
* @property {boolean} [withUserCount=true] Whether to fetch the number of users subscribed to each scheduled event
|
|
126
|
-
* should be returned
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Obtains one or more guild scheduled events from Discord, or the guild cache if it's already available.
|
|
131
|
-
* @param {GuildScheduledEventResolvable|FetchGuildScheduledEventOptions|FetchGuildScheduledEventsOptions} [options]
|
|
132
|
-
* The id of the guild scheduled event or options
|
|
133
|
-
* @returns {Promise<GuildScheduledEvent|Collection<Snowflake, GuildScheduledEvent>>}
|
|
134
|
-
*/
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
135
77
|
async fetch(options = {}) {
|
|
136
78
|
const id = this.resolveId(options.guildScheduledEvent ?? options);
|
|
137
79
|
|
|
@@ -161,31 +103,9 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
161
103
|
);
|
|
162
104
|
}
|
|
163
105
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
* @property {string} [name] The name of the guild scheduled event
|
|
168
|
-
* @property {DateResolvable} [scheduledStartTime] The time to schedule the event at
|
|
169
|
-
* @property {DateResolvable} [scheduledEndTime] The time to end the event at
|
|
170
|
-
* @property {GuildScheduledEventPrivacyLevel} [privacyLevel] The privacy level of the guild scheduled event
|
|
171
|
-
* @property {GuildScheduledEventEntityType} [entityType] The scheduled entity type of the event
|
|
172
|
-
* @property {string} [description] The description of the guild scheduled event
|
|
173
|
-
* @property {?GuildVoiceChannelResolvable} [channel] The channel of the guild scheduled event
|
|
174
|
-
* @property {GuildScheduledEventStatus} [status] The status of the guild scheduled event
|
|
175
|
-
* @property {GuildScheduledEventEntityMetadataOptions} [entityMetadata] The entity metadata of the
|
|
176
|
-
* guild scheduled event
|
|
177
|
-
* <warn>This can be modified only if `entityType` of the `GuildScheduledEvent` to be edited is
|
|
178
|
-
* {@link GuildScheduledEventEntityType.External}</warn>
|
|
179
|
-
* @property {?(BufferResolvable|Base64Resolvable)} [image] The cover image of the guild scheduled event
|
|
180
|
-
* @property {string} [reason] The reason for editing the guild scheduled event
|
|
181
|
-
*/
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Edits a guild scheduled event.
|
|
185
|
-
* @param {GuildScheduledEventResolvable} guildScheduledEvent The guild scheduled event to edit
|
|
186
|
-
* @param {GuildScheduledEventEditOptions} options Options to edit the guild scheduled event
|
|
187
|
-
* @returns {Promise<GuildScheduledEvent>}
|
|
188
|
-
*/
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
189
109
|
async edit(guildScheduledEvent, options) {
|
|
190
110
|
const guildScheduledEventId = this.resolveId(guildScheduledEvent);
|
|
191
111
|
if (!guildScheduledEventId) throw new DiscordjsError(ErrorCodes.GuildScheduledEventResolve);
|
|
@@ -231,11 +151,7 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
231
151
|
return this._add(data);
|
|
232
152
|
}
|
|
233
153
|
|
|
234
|
-
|
|
235
|
-
* Deletes a guild scheduled event.
|
|
236
|
-
* @param {GuildScheduledEventResolvable} guildScheduledEvent The guild scheduled event to delete
|
|
237
|
-
* @returns {Promise<void>}
|
|
238
|
-
*/
|
|
154
|
+
|
|
239
155
|
async delete(guildScheduledEvent) {
|
|
240
156
|
const guildScheduledEventId = this.resolveId(guildScheduledEvent);
|
|
241
157
|
if (!guildScheduledEventId) throw new DiscordjsError(ErrorCodes.GuildScheduledEventResolve);
|
|
@@ -243,30 +159,11 @@ class GuildScheduledEventManager extends CachedManager {
|
|
|
243
159
|
await this.client.rest.delete(Routes.guildScheduledEvent(this.guild.id, guildScheduledEventId));
|
|
244
160
|
}
|
|
245
161
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
* @property {Snowflake} [before] Consider only users before this user id
|
|
252
|
-
* @property {Snowflake} [after] Consider only users after this user id
|
|
253
|
-
* <warn>If both `before` and `after` are provided, only `before` is respected</warn>
|
|
254
|
-
*/
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Represents a subscriber of a {@link GuildScheduledEvent}
|
|
258
|
-
* @typedef {Object} GuildScheduledEventUser
|
|
259
|
-
* @property {Snowflake} guildScheduledEventId The id of the guild scheduled event which the user subscribed to
|
|
260
|
-
* @property {User} user The user that subscribed to the guild scheduled event
|
|
261
|
-
* @property {?GuildMember} member The guild member associated with the user, if any
|
|
262
|
-
*/
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Fetches subscribers of a guild scheduled event.
|
|
266
|
-
* @param {GuildScheduledEventResolvable} guildScheduledEvent The guild scheduled event to fetch subscribers of
|
|
267
|
-
* @param {FetchGuildScheduledEventSubscribersOptions} [options={}] Options for fetching the subscribers
|
|
268
|
-
* @returns {Promise<Collection<Snowflake, GuildScheduledEventUser>>}
|
|
269
|
-
*/
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
270
167
|
async fetchSubscribers(guildScheduledEvent, options = {}) {
|
|
271
168
|
const guildScheduledEventId = this.resolveId(guildScheduledEvent);
|
|
272
169
|
if (!guildScheduledEventId) throw new DiscordjsError(ErrorCodes.GuildScheduledEventResolve);
|
|
@@ -7,56 +7,24 @@ const { DiscordjsTypeError, ErrorCodes } = require('../errors');
|
|
|
7
7
|
const MessagePayload = require('../structures/MessagePayload');
|
|
8
8
|
const { Sticker } = require('../structures/Sticker');
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
* Manages API methods for Guild Stickers and stores their cache.
|
|
12
|
-
* @extends {CachedManager}
|
|
13
|
-
*/
|
|
10
|
+
|
|
14
11
|
class GuildStickerManager extends CachedManager {
|
|
15
12
|
constructor(guild, iterable) {
|
|
16
13
|
super(guild.client, Sticker, iterable);
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
* The guild this manager belongs to
|
|
20
|
-
* @type {Guild}
|
|
21
|
-
*/
|
|
15
|
+
|
|
22
16
|
this.guild = guild;
|
|
23
17
|
}
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
* The cache of Guild Stickers
|
|
27
|
-
* @type {Collection<Snowflake, Sticker>}
|
|
28
|
-
* @name GuildStickerManager#cache
|
|
29
|
-
*/
|
|
19
|
+
|
|
30
20
|
|
|
31
21
|
_add(data, cache) {
|
|
32
22
|
return super._add(data, cache, { extras: [this.guild] });
|
|
33
23
|
}
|
|
34
24
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* @property {AttachmentPayload|BufferResolvable|Stream} file The file for the sticker
|
|
39
|
-
* @property {string} name The name for the sticker
|
|
40
|
-
* @property {string} tags The Discord name of a unicode emoji representing the sticker's expression
|
|
41
|
-
* @property {?string} [description] The description for the sticker
|
|
42
|
-
* @property {string} [reason] Reason for creating the sticker
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Creates a new custom sticker in the guild.
|
|
47
|
-
* @param {GuildStickerCreateOptions} options Options for creating a guild sticker
|
|
48
|
-
* @returns {Promise<Sticker>} The created sticker
|
|
49
|
-
* @example
|
|
50
|
-
* // Create a new sticker from a URL
|
|
51
|
-
* guild.stickers.create({ file: 'https://i.imgur.com/w3duR07.png', name: 'rip', tags: 'headstone' })
|
|
52
|
-
* .then(sticker => console.log(`Created new sticker with name ${sticker.name}!`))
|
|
53
|
-
* .catch(console.error);
|
|
54
|
-
* @example
|
|
55
|
-
* // Create a new sticker from a file on your computer
|
|
56
|
-
* guild.stickers.create({ file: './memes/banana.png', name: 'banana', tags: 'banana' })
|
|
57
|
-
* .then(sticker => console.log(`Created new sticker with name ${sticker.name}!`))
|
|
58
|
-
* .catch(console.error);
|
|
59
|
-
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
60
28
|
async create({ file, name, tags, description, reason } = {}) {
|
|
61
29
|
const resolvedFile = await MessagePayload.resolveFile(file);
|
|
62
30
|
if (!resolvedFile) throw new DiscordjsTypeError(ErrorCodes.ReqResourceType);
|
|
@@ -73,37 +41,13 @@ class GuildStickerManager extends CachedManager {
|
|
|
73
41
|
return this.client.actions.GuildStickerCreate.handle(this.guild, sticker).sticker;
|
|
74
42
|
}
|
|
75
43
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Resolves a StickerResolvable to a Sticker object.
|
|
85
|
-
* @method resolve
|
|
86
|
-
* @memberof GuildStickerManager
|
|
87
|
-
* @instance
|
|
88
|
-
* @param {StickerResolvable} sticker The Sticker resolvable to identify
|
|
89
|
-
* @returns {?Sticker}
|
|
90
|
-
*/
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Resolves a StickerResolvable to a Sticker id string.
|
|
94
|
-
* @method resolveId
|
|
95
|
-
* @memberof GuildStickerManager
|
|
96
|
-
* @instance
|
|
97
|
-
* @param {StickerResolvable} sticker The Sticker resolvable to identify
|
|
98
|
-
* @returns {?Snowflake}
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Edits a sticker.
|
|
103
|
-
* @param {StickerResolvable} sticker The sticker to edit
|
|
104
|
-
* @param {GuildStickerEditOptions} [options={}] The new data for the sticker
|
|
105
|
-
* @returns {Promise<Sticker>}
|
|
106
|
-
*/
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
107
51
|
async edit(sticker, options = {}) {
|
|
108
52
|
const stickerId = this.resolveId(sticker);
|
|
109
53
|
if (!stickerId) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'sticker', 'StickerResolvable');
|
|
@@ -122,12 +66,7 @@ class GuildStickerManager extends CachedManager {
|
|
|
122
66
|
return this._add(d);
|
|
123
67
|
}
|
|
124
68
|
|
|
125
|
-
|
|
126
|
-
* Deletes a sticker.
|
|
127
|
-
* @param {StickerResolvable} sticker The sticker to delete
|
|
128
|
-
* @param {string} [reason] Reason for deleting this sticker
|
|
129
|
-
* @returns {Promise<void>}
|
|
130
|
-
*/
|
|
69
|
+
|
|
131
70
|
async delete(sticker, reason) {
|
|
132
71
|
sticker = this.resolveId(sticker);
|
|
133
72
|
if (!sticker) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'sticker', 'StickerResolvable');
|
|
@@ -135,22 +74,7 @@ class GuildStickerManager extends CachedManager {
|
|
|
135
74
|
await this.client.rest.delete(Routes.guildSticker(this.guild.id, sticker), { reason });
|
|
136
75
|
}
|
|
137
76
|
|
|
138
|
-
|
|
139
|
-
* Obtains one or more stickers from Discord, or the sticker cache if they're already available.
|
|
140
|
-
* @param {Snowflake} [id] The Sticker's id
|
|
141
|
-
* @param {BaseFetchOptions} [options] Additional options for this fetch
|
|
142
|
-
* @returns {Promise<Sticker|Collection<Snowflake, Sticker>>}
|
|
143
|
-
* @example
|
|
144
|
-
* // Fetch all stickers from the guild
|
|
145
|
-
* message.guild.stickers.fetch()
|
|
146
|
-
* .then(stickers => console.log(`There are ${stickers.size} stickers.`))
|
|
147
|
-
* .catch(console.error);
|
|
148
|
-
* @example
|
|
149
|
-
* // Fetch a single sticker
|
|
150
|
-
* message.guild.stickers.fetch('222078108977594368')
|
|
151
|
-
* .then(sticker => console.log(`The sticker name is: ${sticker.name}`))
|
|
152
|
-
* .catch(console.error);
|
|
153
|
-
*/
|
|
77
|
+
|
|
154
78
|
async fetch(id, { cache = true, force = false } = {}) {
|
|
155
79
|
if (id) {
|
|
156
80
|
if (!force) {
|
|
@@ -165,11 +89,7 @@ class GuildStickerManager extends CachedManager {
|
|
|
165
89
|
return new Collection(data.map(sticker => [sticker.id, this._add(sticker, cache)]));
|
|
166
90
|
}
|
|
167
91
|
|
|
168
|
-
|
|
169
|
-
* Fetches the user who uploaded this sticker, if this is a guild sticker.
|
|
170
|
-
* @param {StickerResolvable} sticker The sticker to fetch the user for
|
|
171
|
-
* @returns {Promise<?User>}
|
|
172
|
-
*/
|
|
92
|
+
|
|
173
93
|
async fetchUser(sticker) {
|
|
174
94
|
sticker = this.resolve(sticker);
|
|
175
95
|
if (!sticker) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'sticker', 'StickerResolvable');
|
|
@@ -4,56 +4,13 @@ const { ChannelType, Routes } = require('discord-api-types/v10');
|
|
|
4
4
|
const ThreadManager = require('./ThreadManager');
|
|
5
5
|
const { DiscordjsTypeError, ErrorCodes } = require('../errors');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
* Manages API methods for {@link ThreadChannel} objects and stores their cache.
|
|
9
|
-
* @extends {ThreadManager}
|
|
10
|
-
*/
|
|
7
|
+
|
|
11
8
|
class GuildTextThreadManager extends ThreadManager {
|
|
12
|
-
|
|
13
|
-
* The channel this Manager belongs to
|
|
14
|
-
* @name GuildTextThreadManager#channel
|
|
15
|
-
* @type {TextChannel|NewsChannel}
|
|
16
|
-
*/
|
|
9
|
+
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
* Options for creating a thread. <warn>Only one of `startMessage` or `type` can be defined.</warn>
|
|
20
|
-
* @typedef {StartThreadOptions} ThreadCreateOptions
|
|
21
|
-
* @property {MessageResolvable} [startMessage] The message to start a thread from.
|
|
22
|
-
* <warn>If this is defined, then the `type` of thread gets inferred automatically and cannot be changed.</warn>
|
|
23
|
-
* @property {ThreadChannelTypes} [type] The type of thread to create.
|
|
24
|
-
* Defaults to {@link ChannelType.PublicThread} if created in a {@link TextChannel}
|
|
25
|
-
* <warn>When creating threads in a {@link NewsChannel}, this is ignored and is always
|
|
26
|
-
* {@link ChannelType.AnnouncementThread}</warn>
|
|
27
|
-
* @property {boolean} [invitable] Whether non-moderators can add other non-moderators to the thread
|
|
28
|
-
* <info>Can only be set when type will be {@link ChannelType.PrivateThread}</info>
|
|
29
|
-
*/
|
|
11
|
+
|
|
30
12
|
|
|
31
|
-
|
|
32
|
-
* Creates a new thread in the channel.
|
|
33
|
-
* @param {ThreadCreateOptions} [options] Options to create a new thread
|
|
34
|
-
* @returns {Promise<ThreadChannel>}
|
|
35
|
-
* @example
|
|
36
|
-
* // Create a new public thread
|
|
37
|
-
* channel.threads
|
|
38
|
-
* .create({
|
|
39
|
-
* name: 'food-talk',
|
|
40
|
-
* autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
|
|
41
|
-
* reason: 'Needed a separate thread for food',
|
|
42
|
-
* })
|
|
43
|
-
* .then(threadChannel => console.log(threadChannel))
|
|
44
|
-
* .catch(console.error);
|
|
45
|
-
* @example
|
|
46
|
-
* // Create a new private thread
|
|
47
|
-
* channel.threads
|
|
48
|
-
* .create({
|
|
49
|
-
* name: 'mod-talk',
|
|
50
|
-
* autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
|
|
51
|
-
* type: ChannelType.PrivateThread,
|
|
52
|
-
* reason: 'Needed a separate thread for moderation',
|
|
53
|
-
* })
|
|
54
|
-
* .then(threadChannel => console.log(threadChannel))
|
|
55
|
-
* .catch(console.error);
|
|
56
|
-
*/
|
|
13
|
+
|
|
57
14
|
async create({
|
|
58
15
|
name,
|
|
59
16
|
autoArchiveDuration = this.channel.defaultAutoArchiveDuration,
|
|
@@ -9,82 +9,28 @@ const { Message } = require('../structures/Message');
|
|
|
9
9
|
const MessagePayload = require('../structures/MessagePayload');
|
|
10
10
|
const { resolvePartialEmoji } = require('../util/Util');
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
* Manages API methods for Messages and holds their cache.
|
|
14
|
-
* @extends {CachedManager}
|
|
15
|
-
*/
|
|
12
|
+
|
|
16
13
|
class MessageManager extends CachedManager {
|
|
17
14
|
constructor(channel, iterable) {
|
|
18
15
|
super(channel.client, Message, iterable);
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
* The channel that the messages belong to
|
|
22
|
-
* @type {TextBasedChannels}
|
|
23
|
-
*/
|
|
17
|
+
|
|
24
18
|
this.channel = channel;
|
|
25
19
|
}
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
* The cache of Messages
|
|
29
|
-
* @type {Collection<Snowflake, Message>}
|
|
30
|
-
* @name MessageManager#cache
|
|
31
|
-
*/
|
|
21
|
+
|
|
32
22
|
|
|
33
23
|
_add(data, cache) {
|
|
34
24
|
return super._add(data, cache);
|
|
35
25
|
}
|
|
36
26
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Options used to fetch a message.
|
|
46
|
-
* @typedef {BaseFetchOptions} FetchMessageOptions
|
|
47
|
-
* @property {MessageResolvable} message The message to fetch
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Options used to fetch multiple messages.
|
|
52
|
-
* <info>The `before`, `after`, and `around` parameters are mutually exclusive.</info>
|
|
53
|
-
* @typedef {Object} FetchMessagesOptions
|
|
54
|
-
* @property {number} [limit] The maximum number of messages to return
|
|
55
|
-
* @property {Snowflake} [before] Consider only messages before this id
|
|
56
|
-
* @property {Snowflake} [after] Consider only messages after this id
|
|
57
|
-
* @property {Snowflake} [around] Consider only messages around this id
|
|
58
|
-
* @property {boolean} [cache] Whether to cache the fetched messages
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Fetches message(s) from a channel.
|
|
63
|
-
* <info>The returned Collection does not contain reaction users of the messages if they were not cached.
|
|
64
|
-
* Those need to be fetched separately in such a case.</info>
|
|
65
|
-
* @param {MessageResolvable|FetchMessageOptions|FetchMessagesOptions} [options] Options for fetching message(s)
|
|
66
|
-
* @returns {Promise<Message|Collection<Snowflake, Message>>}
|
|
67
|
-
* @example
|
|
68
|
-
* // Fetch a message
|
|
69
|
-
* channel.messages.fetch('99539446449315840')
|
|
70
|
-
* .then(message => console.log(message.content))
|
|
71
|
-
* .catch(console.error);
|
|
72
|
-
* @example
|
|
73
|
-
* // Fetch a maximum of 10 messages without caching
|
|
74
|
-
* channel.messages.fetch({ limit: 10, cache: false })
|
|
75
|
-
* .then(messages => console.log(`Received ${messages.size} messages`))
|
|
76
|
-
* .catch(console.error);
|
|
77
|
-
* @example
|
|
78
|
-
* // Fetch a maximum of 10 messages without caching around a message id
|
|
79
|
-
* channel.messages.fetch({ limit: 10, cache: false, around: '99539446449315840' })
|
|
80
|
-
* .then(messages => console.log(`Received ${messages.size} messages`))
|
|
81
|
-
* .catch(console.error);
|
|
82
|
-
* @example
|
|
83
|
-
* // Fetch messages and filter by a user id
|
|
84
|
-
* channel.messages.fetch()
|
|
85
|
-
* .then(messages => console.log(`${messages.filter(m => m.author.id === '84484653687267328').size} messages`))
|
|
86
|
-
* .catch(console.error);
|
|
87
|
-
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
88
34
|
fetch(options) {
|
|
89
35
|
if (!options) return this._fetchMany();
|
|
90
36
|
const { message, cache, force } = options;
|
|
@@ -111,18 +57,7 @@ class MessageManager extends CachedManager {
|
|
|
111
57
|
return data.reduce((_data, message) => _data.set(message.id, this._add(message, options.cache)), new Collection());
|
|
112
58
|
}
|
|
113
59
|
|
|
114
|
-
|
|
115
|
-
* Fetches the pinned messages of this channel and returns a collection of them.
|
|
116
|
-
* <info>The returned Collection does not contain any reaction data of the messages.
|
|
117
|
-
* Those need to be fetched separately.</info>
|
|
118
|
-
* @param {boolean} [cache=true] Whether to cache the message(s)
|
|
119
|
-
* @returns {Promise<Collection<Snowflake, Message>>}
|
|
120
|
-
* @example
|
|
121
|
-
* // Get pinned messages
|
|
122
|
-
* channel.messages.fetchPinned()
|
|
123
|
-
* .then(messages => console.log(`Received ${messages.size} messages`))
|
|
124
|
-
* .catch(console.error);
|
|
125
|
-
*/
|
|
60
|
+
|
|
126
61
|
async fetchPinned(cache = true) {
|
|
127
62
|
const data = await this.client.rest.get(Routes.channelPins(this.channel.id));
|
|
128
63
|
const messages = new Collection();
|
|
@@ -130,39 +65,13 @@ class MessageManager extends CachedManager {
|
|
|
130
65
|
return messages;
|
|
131
66
|
}
|
|
132
67
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
*/
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Resolves a {@link MessageResolvable} to a {@link Message} id.
|
|
144
|
-
* @method resolveId
|
|
145
|
-
* @memberof MessageManager
|
|
146
|
-
* @instance
|
|
147
|
-
* @param {MessageResolvable} message The message resolvable to resolve
|
|
148
|
-
* @returns {?Snowflake}
|
|
149
|
-
*/
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Options that can be passed to edit a message.
|
|
153
|
-
* @typedef {BaseMessageOptions} MessageEditOptions
|
|
154
|
-
* @property {AttachmentPayload[]} [attachments] An array of attachments to keep,
|
|
155
|
-
* all attachments will be kept if omitted
|
|
156
|
-
* @property {MessageFlags} [flags] Which flags to set for the message
|
|
157
|
-
* <info>Only the {@link MessageFlags.SuppressEmbeds} flag can be modified.</info>
|
|
158
|
-
*/
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Edits a message, even if it's not cached.
|
|
162
|
-
* @param {MessageResolvable} message The message to edit
|
|
163
|
-
* @param {string|MessageEditOptions|MessagePayload} options The options to edit the message
|
|
164
|
-
* @returns {Promise<Message>}
|
|
165
|
-
*/
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
166
75
|
async edit(message, options) {
|
|
167
76
|
const messageId = this.resolveId(message);
|
|
168
77
|
if (!messageId) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'message', 'MessageResolvable');
|
|
@@ -184,11 +93,7 @@ class MessageManager extends CachedManager {
|
|
|
184
93
|
return this._add(d);
|
|
185
94
|
}
|
|
186
95
|
|
|
187
|
-
|
|
188
|
-
* Publishes a message in an announcement channel to all channels following it, even if it's not cached.
|
|
189
|
-
* @param {MessageResolvable} message The message to publish
|
|
190
|
-
* @returns {Promise<Message>}
|
|
191
|
-
*/
|
|
96
|
+
|
|
192
97
|
async crosspost(message) {
|
|
193
98
|
message = this.resolveId(message);
|
|
194
99
|
if (!message) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'message', 'MessageResolvable');
|
|
@@ -197,12 +102,7 @@ class MessageManager extends CachedManager {
|
|
|
197
102
|
return this.cache.get(data.id) ?? this._add(data);
|
|
198
103
|
}
|
|
199
104
|
|
|
200
|
-
|
|
201
|
-
* Pins a message to the channel's pinned messages, even if it's not cached.
|
|
202
|
-
* @param {MessageResolvable} message The message to pin
|
|
203
|
-
* @param {string} [reason] Reason for pinning
|
|
204
|
-
* @returns {Promise<void>}
|
|
205
|
-
*/
|
|
105
|
+
|
|
206
106
|
async pin(message, reason) {
|
|
207
107
|
message = this.resolveId(message);
|
|
208
108
|
if (!message) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'message', 'MessageResolvable');
|
|
@@ -210,12 +110,7 @@ class MessageManager extends CachedManager {
|
|
|
210
110
|
await this.client.rest.put(Routes.channelPin(this.channel.id, message), { reason });
|
|
211
111
|
}
|
|
212
112
|
|
|
213
|
-
|
|
214
|
-
* Unpins a message from the channel's pinned messages, even if it's not cached.
|
|
215
|
-
* @param {MessageResolvable} message The message to unpin
|
|
216
|
-
* @param {string} [reason] Reason for unpinning
|
|
217
|
-
* @returns {Promise<void>}
|
|
218
|
-
*/
|
|
113
|
+
|
|
219
114
|
async unpin(message, reason) {
|
|
220
115
|
message = this.resolveId(message);
|
|
221
116
|
if (!message) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'message', 'MessageResolvable');
|
|
@@ -223,12 +118,7 @@ class MessageManager extends CachedManager {
|
|
|
223
118
|
await this.client.rest.delete(Routes.channelPin(this.channel.id, message), { reason });
|
|
224
119
|
}
|
|
225
120
|
|
|
226
|
-
|
|
227
|
-
* Adds a reaction to a message, even if it's not cached.
|
|
228
|
-
* @param {MessageResolvable} message The message to react to
|
|
229
|
-
* @param {EmojiIdentifierResolvable} emoji The emoji to react with
|
|
230
|
-
* @returns {Promise<void>}
|
|
231
|
-
*/
|
|
121
|
+
|
|
232
122
|
async react(message, emoji) {
|
|
233
123
|
message = this.resolveId(message);
|
|
234
124
|
if (!message) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'message', 'MessageResolvable');
|
|
@@ -243,11 +133,7 @@ class MessageManager extends CachedManager {
|
|
|
243
133
|
await this.client.rest.put(Routes.channelMessageOwnReaction(this.channel.id, message, emojiId));
|
|
244
134
|
}
|
|
245
135
|
|
|
246
|
-
|
|
247
|
-
* Deletes a message, even if it's not cached.
|
|
248
|
-
* @param {MessageResolvable} message The message to delete
|
|
249
|
-
* @returns {Promise<void>}
|
|
250
|
-
*/
|
|
136
|
+
|
|
251
137
|
async delete(message) {
|
|
252
138
|
message = this.resolveId(message);
|
|
253
139
|
if (!message) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'message', 'MessageResolvable');
|