@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
|
@@ -18,10 +18,7 @@ const { setPosition } = require('../util/Util');
|
|
|
18
18
|
|
|
19
19
|
let cacheWarningEmitted = false;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
* Manages API methods for GuildChannels and stores their cache.
|
|
23
|
-
* @extends {CachedManager}
|
|
24
|
-
*/
|
|
21
|
+
|
|
25
22
|
class GuildChannelManager extends CachedManager {
|
|
26
23
|
constructor(guild, iterable) {
|
|
27
24
|
super(guild.client, GuildChannel, iterable);
|
|
@@ -37,19 +34,11 @@ class GuildChannelManager extends CachedManager {
|
|
|
37
34
|
);
|
|
38
35
|
}
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
* The guild this Manager belongs to
|
|
42
|
-
* @type {Guild}
|
|
43
|
-
*/
|
|
37
|
+
|
|
44
38
|
this.guild = guild;
|
|
45
39
|
}
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
* The number of channels in this managers cache excluding thread channels
|
|
49
|
-
* that do not count towards a guild's maximum channels restriction.
|
|
50
|
-
* @type {number}
|
|
51
|
-
* @readonly
|
|
52
|
-
*/
|
|
41
|
+
|
|
53
42
|
get channelCountWithoutThreads() {
|
|
54
43
|
return this.cache.reduce((acc, channel) => {
|
|
55
44
|
if (ThreadChannelTypes.includes(channel.type)) return acc;
|
|
@@ -57,11 +46,7 @@ class GuildChannelManager extends CachedManager {
|
|
|
57
46
|
}, 0);
|
|
58
47
|
}
|
|
59
48
|
|
|
60
|
-
|
|
61
|
-
* The cache of this Manager
|
|
62
|
-
* @type {Collection<Snowflake, GuildChannel|ThreadChannel>}
|
|
63
|
-
* @name GuildChannelManager#cache
|
|
64
|
-
*/
|
|
49
|
+
|
|
65
50
|
|
|
66
51
|
_add(channel) {
|
|
67
52
|
const existing = this.cache.get(channel.id);
|
|
@@ -70,41 +55,21 @@ class GuildChannelManager extends CachedManager {
|
|
|
70
55
|
return channel;
|
|
71
56
|
}
|
|
72
57
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
* * A ThreadChannel object
|
|
77
|
-
* * A Snowflake
|
|
78
|
-
* @typedef {GuildChannel|ThreadChannel|Snowflake} GuildChannelResolvable
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Resolves a GuildChannelResolvable to a Channel object.
|
|
83
|
-
* @param {GuildChannelResolvable} channel The GuildChannel resolvable to resolve
|
|
84
|
-
* @returns {?(GuildChannel|ThreadChannel)}
|
|
85
|
-
*/
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
86
61
|
resolve(channel) {
|
|
87
62
|
if (channel instanceof ThreadChannel) return super.resolve(channel.id);
|
|
88
63
|
return super.resolve(channel);
|
|
89
64
|
}
|
|
90
65
|
|
|
91
|
-
|
|
92
|
-
* Resolves a GuildChannelResolvable to a channel id.
|
|
93
|
-
* @param {GuildChannelResolvable} channel The GuildChannel resolvable to resolve
|
|
94
|
-
* @returns {?Snowflake}
|
|
95
|
-
*/
|
|
66
|
+
|
|
96
67
|
resolveId(channel) {
|
|
97
68
|
if (channel instanceof ThreadChannel) return super.resolveId(channel.id);
|
|
98
69
|
return super.resolveId(channel);
|
|
99
70
|
}
|
|
100
71
|
|
|
101
|
-
|
|
102
|
-
* Adds the target channel to a channel's followers.
|
|
103
|
-
* @param {NewsChannel|Snowflake} channel The channel to follow
|
|
104
|
-
* @param {TextChannelResolvable} targetChannel The channel where published announcements will be posted at
|
|
105
|
-
* @param {string} [reason] Reason for creating the webhook
|
|
106
|
-
* @returns {Promise<Snowflake>} Returns created target webhook id.
|
|
107
|
-
*/
|
|
72
|
+
|
|
108
73
|
async addFollower(channel, targetChannel, reason) {
|
|
109
74
|
const channelId = this.resolveId(channel);
|
|
110
75
|
const targetChannelId = this.resolveId(targetChannel);
|
|
@@ -116,34 +81,9 @@ class GuildChannelManager extends CachedManager {
|
|
|
116
81
|
return webhook_id;
|
|
117
82
|
}
|
|
118
83
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
* @property {?CategoryChannelResolvable} [parent] Parent of the new channel
|
|
123
|
-
*/
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Creates a new channel in the guild.
|
|
127
|
-
* @param {GuildChannelCreateOptions} options Options for creating the new channel
|
|
128
|
-
* @returns {Promise<GuildChannel>}
|
|
129
|
-
* @example
|
|
130
|
-
* // Create a new text channel
|
|
131
|
-
* guild.channels.create({ name: 'new-general', reason: 'Needed a cool new channel' })
|
|
132
|
-
* .then(console.log)
|
|
133
|
-
* .catch(console.error);
|
|
134
|
-
* @example
|
|
135
|
-
* // Create a new channel with permission overwrites
|
|
136
|
-
* guild.channels.create({
|
|
137
|
-
* name: 'new-general',
|
|
138
|
-
* type: ChannelType.GuildVoice,
|
|
139
|
-
* permissionOverwrites: [
|
|
140
|
-
* {
|
|
141
|
-
* id: message.author.id,
|
|
142
|
-
* deny: [PermissionFlagsBits.ViewChannel],
|
|
143
|
-
* },
|
|
144
|
-
* ],
|
|
145
|
-
* })
|
|
146
|
-
*/
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
147
87
|
async create({
|
|
148
88
|
name,
|
|
149
89
|
type,
|
|
@@ -192,27 +132,9 @@ class GuildChannelManager extends CachedManager {
|
|
|
192
132
|
return this.client.actions.ChannelCreate.handle(data).channel;
|
|
193
133
|
}
|
|
194
134
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
* The channel to create the webhook for
|
|
199
|
-
*/
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Creates a webhook for the channel.
|
|
203
|
-
* @param {WebhookCreateOptions} options Options for creating the webhook
|
|
204
|
-
* @returns {Promise<Webhook>} Returns the created Webhook
|
|
205
|
-
* @example
|
|
206
|
-
* // Create a webhook for the current channel
|
|
207
|
-
* guild.channels.createWebhook({
|
|
208
|
-
* channel: '222197033908436994',
|
|
209
|
-
* name: 'Snek',
|
|
210
|
-
* avatar: 'https://i.imgur.com/mI8XcpG.jpg',
|
|
211
|
-
* reason: 'Needed a cool new Webhook'
|
|
212
|
-
* })
|
|
213
|
-
* .then(console.log)
|
|
214
|
-
* .catch(console.error)
|
|
215
|
-
*/
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
216
138
|
async createWebhook({ channel, name, avatar, reason }) {
|
|
217
139
|
const id = this.resolveId(channel);
|
|
218
140
|
if (!id) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'channel', 'GuildChannelResolvable');
|
|
@@ -229,46 +151,9 @@ class GuildChannelManager extends CachedManager {
|
|
|
229
151
|
return new Webhook(this.client, data);
|
|
230
152
|
}
|
|
231
153
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
* @property {string} [name] The name of the channel
|
|
236
|
-
* @property {ChannelType} [type] The type of the channel (only conversion between text and news is supported)
|
|
237
|
-
* @property {number} [position] The position of the channel
|
|
238
|
-
* @property {?string} [topic] The topic of the text channel
|
|
239
|
-
* @property {boolean} [nsfw] Whether the channel is NSFW
|
|
240
|
-
* @property {number} [bitrate] The bitrate of the voice channel
|
|
241
|
-
* @property {number} [userLimit] The user limit of the voice channel
|
|
242
|
-
* @property {?CategoryChannelResolvable} [parent] The parent of the channel
|
|
243
|
-
* @property {boolean} [lockPermissions]
|
|
244
|
-
* Lock the permissions of the channel to what the parent's permissions are
|
|
245
|
-
* @property {OverwriteResolvable[]|Collection<Snowflake, OverwriteResolvable>} [permissionOverwrites]
|
|
246
|
-
* Permission overwrites for the channel
|
|
247
|
-
* @property {number} [rateLimitPerUser] The rate limit per user (slowmode) for the channel in seconds
|
|
248
|
-
* @property {ThreadAutoArchiveDuration} [defaultAutoArchiveDuration]
|
|
249
|
-
* The default auto archive duration for all new threads in this channel
|
|
250
|
-
* @property {?string} [rtcRegion] The RTC region of the channel
|
|
251
|
-
* @property {?VideoQualityMode} [videoQualityMode] The camera video quality mode of the channel
|
|
252
|
-
* @property {GuildForumTagData[]} [availableTags] The tags to set as available in a forum channel
|
|
253
|
-
* @property {?DefaultReactionEmoji} [defaultReactionEmoji] The emoji to set as the default reaction emoji
|
|
254
|
-
* @property {number} [defaultThreadRateLimitPerUser] The rate limit per user (slowmode) to set on forum posts
|
|
255
|
-
* @property {ChannelFlagsResolvable} [flags] The flags to set on the channel
|
|
256
|
-
* @property {?SortOrderType} [defaultSortOrder] The default sort order mode to set on the channel
|
|
257
|
-
* @property {ForumLayoutType} [defaultForumLayout] The default forum layout to set on the channel
|
|
258
|
-
* @property {string} [reason] Reason for editing this channel
|
|
259
|
-
*/
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Edits the channel.
|
|
263
|
-
* @param {GuildChannelResolvable} channel The channel to edit
|
|
264
|
-
* @param {GuildChannelEditOptions} options Options for editing the channel
|
|
265
|
-
* @returns {Promise<GuildChannel>}
|
|
266
|
-
* @example
|
|
267
|
-
* // Edit a channel
|
|
268
|
-
* guild.channels.edit('222197033908436994', { name: 'new-channel' })
|
|
269
|
-
* .then(console.log)
|
|
270
|
-
* .catch(console.error);
|
|
271
|
-
*/
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
272
157
|
async edit(channel, options) {
|
|
273
158
|
channel = this.resolve(channel);
|
|
274
159
|
if (!channel) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'channel', 'GuildChannelResolvable');
|
|
@@ -325,18 +210,7 @@ class GuildChannelManager extends CachedManager {
|
|
|
325
210
|
return this.client.actions.ChannelUpdate.handle(newData).updated;
|
|
326
211
|
}
|
|
327
212
|
|
|
328
|
-
|
|
329
|
-
* Sets a new position for the guild channel.
|
|
330
|
-
* @param {GuildChannelResolvable} channel The channel to set the position for
|
|
331
|
-
* @param {number} position The new position for the guild channel
|
|
332
|
-
* @param {SetChannelPositionOptions} options Options for setting position
|
|
333
|
-
* @returns {Promise<GuildChannel>}
|
|
334
|
-
* @example
|
|
335
|
-
* // Set a new channel position
|
|
336
|
-
* guild.channels.setPosition('222078374472843266', 2)
|
|
337
|
-
* .then(newChannel => console.log(`Channel's new position is ${newChannel.position}`))
|
|
338
|
-
* .catch(console.error);
|
|
339
|
-
*/
|
|
213
|
+
|
|
340
214
|
async setPosition(channel, position, { relative, reason } = {}) {
|
|
341
215
|
channel = this.resolve(channel);
|
|
342
216
|
if (!channel) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'channel', 'GuildChannelResolvable');
|
|
@@ -357,22 +231,7 @@ class GuildChannelManager extends CachedManager {
|
|
|
357
231
|
return channel;
|
|
358
232
|
}
|
|
359
233
|
|
|
360
|
-
|
|
361
|
-
* Obtains one or more guild channels from Discord, or the channel cache if they're already available.
|
|
362
|
-
* @param {Snowflake} [id] The channel's id
|
|
363
|
-
* @param {BaseFetchOptions} [options] Additional options for this fetch
|
|
364
|
-
* @returns {Promise<?GuildChannel|ThreadChannel|Collection<Snowflake, ?GuildChannel>>}
|
|
365
|
-
* @example
|
|
366
|
-
* // Fetch all channels from the guild (excluding threads)
|
|
367
|
-
* message.guild.channels.fetch()
|
|
368
|
-
* .then(channels => console.log(`There are ${channels.size} channels.`))
|
|
369
|
-
* .catch(console.error);
|
|
370
|
-
* @example
|
|
371
|
-
* // Fetch a single channel
|
|
372
|
-
* message.guild.channels.fetch('222197033908436994')
|
|
373
|
-
* .then(channel => console.log(`The channel name is: ${channel.name}`))
|
|
374
|
-
* .catch(console.error);
|
|
375
|
-
*/
|
|
234
|
+
|
|
376
235
|
async fetch(id, { cache = true, force = false } = {}) {
|
|
377
236
|
if (id && !force) {
|
|
378
237
|
const existing = this.cache.get(id);
|
|
@@ -381,7 +240,7 @@ class GuildChannelManager extends CachedManager {
|
|
|
381
240
|
|
|
382
241
|
if (id) {
|
|
383
242
|
const data = await this.client.rest.get(Routes.channel(id));
|
|
384
|
-
|
|
243
|
+
|
|
385
244
|
if (this.guild.id !== data.guild_id) throw new DiscordjsError(ErrorCodes.GuildChannelUnowned);
|
|
386
245
|
return this.client.channels._add(data, this.guild, { cache });
|
|
387
246
|
}
|
|
@@ -392,16 +251,7 @@ class GuildChannelManager extends CachedManager {
|
|
|
392
251
|
return channels;
|
|
393
252
|
}
|
|
394
253
|
|
|
395
|
-
|
|
396
|
-
* Fetches all webhooks for the channel.
|
|
397
|
-
* @param {GuildChannelResolvable} channel The channel to fetch webhooks for
|
|
398
|
-
* @returns {Promise<Collection<Snowflake, Webhook>>}
|
|
399
|
-
* @example
|
|
400
|
-
* // Fetch webhooks
|
|
401
|
-
* guild.channels.fetchWebhooks('769862166131245066')
|
|
402
|
-
* .then(hooks => console.log(`This channel has ${hooks.size} hooks`))
|
|
403
|
-
* .catch(console.error);
|
|
404
|
-
*/
|
|
254
|
+
|
|
405
255
|
async fetchWebhooks(channel) {
|
|
406
256
|
const id = this.resolveId(channel);
|
|
407
257
|
if (!id) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'channel', 'GuildChannelResolvable');
|
|
@@ -409,32 +259,11 @@ class GuildChannelManager extends CachedManager {
|
|
|
409
259
|
return data.reduce((hooks, hook) => hooks.set(hook.id, new Webhook(this.client, hook)), new Collection());
|
|
410
260
|
}
|
|
411
261
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
*/
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* The data needed for updating a channel's position.
|
|
421
|
-
* @typedef {Object} ChannelPosition
|
|
422
|
-
* @property {GuildChannel|Snowflake} channel Channel to update
|
|
423
|
-
* @property {number} [position] New position for the channel
|
|
424
|
-
* @property {CategoryChannelResolvable} [parent] Parent channel for this channel
|
|
425
|
-
* @property {boolean} [lockPermissions] If the overwrites should be locked to the parents overwrites
|
|
426
|
-
*/
|
|
427
|
-
|
|
428
|
-
/**
|
|
429
|
-
* Batch-updates the guild's channels' positions.
|
|
430
|
-
* <info>Only one channel's parent can be changed at a time</info>
|
|
431
|
-
* @param {ChannelPosition[]} channelPositions Channel positions to update
|
|
432
|
-
* @returns {Promise<Guild>}
|
|
433
|
-
* @example
|
|
434
|
-
* guild.channels.setPositions([{ channel: channelId, position: newChannelIndex }])
|
|
435
|
-
* .then(guild => console.log(`Updated channel positions for ${guild}`))
|
|
436
|
-
* .catch(console.error);
|
|
437
|
-
*/
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
438
267
|
async setPositions(channelPositions) {
|
|
439
268
|
channelPositions = channelPositions.map(r => ({
|
|
440
269
|
id: this.client.channels.resolveId(r.channel),
|
|
@@ -450,39 +279,15 @@ class GuildChannelManager extends CachedManager {
|
|
|
450
279
|
}).guild;
|
|
451
280
|
}
|
|
452
281
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
* @property {Collection<Snowflake, ThreadChannel>} threads The threads that were fetched
|
|
457
|
-
* @property {Collection<Snowflake, ThreadMember>} members The thread members in the received threads
|
|
458
|
-
*/
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* Obtains all active thread channels in the guild.
|
|
462
|
-
* @param {boolean} [cache=true] Whether to cache the fetched data
|
|
463
|
-
* @returns {Promise<FetchedThreads>}
|
|
464
|
-
* @example
|
|
465
|
-
* // Fetch all threads from the guild
|
|
466
|
-
* message.guild.channels.fetchActiveThreads()
|
|
467
|
-
* .then(fetched => console.log(`There are ${fetched.threads.size} threads.`))
|
|
468
|
-
* .catch(console.error);
|
|
469
|
-
*/
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
470
285
|
async fetchActiveThreads(cache = true) {
|
|
471
286
|
const raw = await this.client.rest.get(Routes.guildActiveThreads(this.guild.id));
|
|
472
287
|
return GuildTextThreadManager._mapThreads(raw, this.client, { guild: this.guild, cache });
|
|
473
288
|
}
|
|
474
289
|
|
|
475
|
-
|
|
476
|
-
* Deletes the channel.
|
|
477
|
-
* @param {GuildChannelResolvable} channel The channel to delete
|
|
478
|
-
* @param {string} [reason] Reason for deleting this channel
|
|
479
|
-
* @returns {Promise<void>}
|
|
480
|
-
* @example
|
|
481
|
-
* // Delete the channel
|
|
482
|
-
* guild.channels.delete('858850993013260338', 'making room for new channels')
|
|
483
|
-
* .then(console.log)
|
|
484
|
-
* .catch(console.error);
|
|
485
|
-
*/
|
|
290
|
+
|
|
486
291
|
async delete(channel, reason) {
|
|
487
292
|
const id = this.resolveId(channel);
|
|
488
293
|
if (!id) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'channel', 'GuildChannelResolvable');
|
|
@@ -6,18 +6,12 @@ const BaseGuildEmojiManager = require('./BaseGuildEmojiManager');
|
|
|
6
6
|
const { DiscordjsError, DiscordjsTypeError, ErrorCodes } = require('../errors');
|
|
7
7
|
const DataResolver = require('../util/DataResolver');
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
* Manages API methods for GuildEmojis and stores their cache.
|
|
11
|
-
* @extends {BaseGuildEmojiManager}
|
|
12
|
-
*/
|
|
9
|
+
|
|
13
10
|
class GuildEmojiManager extends BaseGuildEmojiManager {
|
|
14
11
|
constructor(guild, iterable) {
|
|
15
12
|
super(guild.client, iterable);
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
* The guild this manager belongs to
|
|
19
|
-
* @type {Guild}
|
|
20
|
-
*/
|
|
14
|
+
|
|
21
15
|
this.guild = guild;
|
|
22
16
|
}
|
|
23
17
|
|
|
@@ -25,30 +19,9 @@ class GuildEmojiManager extends BaseGuildEmojiManager {
|
|
|
25
19
|
return super._add(data, cache, { extras: [this.guild] });
|
|
26
20
|
}
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* @property {BufferResolvable|Base64Resolvable} attachment The image for the emoji
|
|
32
|
-
* @property {string} name The name for the emoji
|
|
33
|
-
* @property {Collection<Snowflake, Role>|RoleResolvable[]} [roles] The roles to limit the emoji to
|
|
34
|
-
* @property {string} [reason] The reason for creating the emoji
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Creates a new custom emoji in the guild.
|
|
39
|
-
* @param {GuildEmojiCreateOptions} options Options for creating the emoji
|
|
40
|
-
* @returns {Promise<Emoji>} The created emoji
|
|
41
|
-
* @example
|
|
42
|
-
* // Create a new emoji from a URL
|
|
43
|
-
* guild.emojis.create({ attachment: 'https://i.imgur.com/w3duR07.png', name: 'rip' })
|
|
44
|
-
* .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
|
|
45
|
-
* .catch(console.error);
|
|
46
|
-
* @example
|
|
47
|
-
* // Create a new emoji from a file on your computer
|
|
48
|
-
* guild.emojis.create({ attachment: './memes/banana.png', name: 'banana' })
|
|
49
|
-
* .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
|
|
50
|
-
* .catch(console.error);
|
|
51
|
-
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
52
25
|
async create({ attachment, name, roles, reason }) {
|
|
53
26
|
attachment = await DataResolver.resolveImage(attachment);
|
|
54
27
|
if (!attachment) throw new DiscordjsTypeError(ErrorCodes.ReqResourceType);
|
|
@@ -77,22 +50,7 @@ class GuildEmojiManager extends BaseGuildEmojiManager {
|
|
|
77
50
|
return this.client.actions.GuildEmojiCreate.handle(this.guild, emoji).emoji;
|
|
78
51
|
}
|
|
79
52
|
|
|
80
|
-
|
|
81
|
-
* Obtains one or more emojis from Discord, or the emoji cache if they're already available.
|
|
82
|
-
* @param {Snowflake} [id] The emoji's id
|
|
83
|
-
* @param {BaseFetchOptions} [options] Additional options for this fetch
|
|
84
|
-
* @returns {Promise<GuildEmoji|Collection<Snowflake, GuildEmoji>>}
|
|
85
|
-
* @example
|
|
86
|
-
* // Fetch all emojis from the guild
|
|
87
|
-
* message.guild.emojis.fetch()
|
|
88
|
-
* .then(emojis => console.log(`There are ${emojis.size} emojis.`))
|
|
89
|
-
* .catch(console.error);
|
|
90
|
-
* @example
|
|
91
|
-
* // Fetch a single emoji
|
|
92
|
-
* message.guild.emojis.fetch('222078108977594368')
|
|
93
|
-
* .then(emoji => console.log(`The emoji name is: ${emoji.name}`))
|
|
94
|
-
* .catch(console.error);
|
|
95
|
-
*/
|
|
53
|
+
|
|
96
54
|
async fetch(id, { cache = true, force = false } = {}) {
|
|
97
55
|
if (id) {
|
|
98
56
|
if (!force) {
|
|
@@ -109,24 +67,14 @@ class GuildEmojiManager extends BaseGuildEmojiManager {
|
|
|
109
67
|
return emojis;
|
|
110
68
|
}
|
|
111
69
|
|
|
112
|
-
|
|
113
|
-
* Deletes an emoji.
|
|
114
|
-
* @param {EmojiResolvable} emoji The Emoji resolvable to delete
|
|
115
|
-
* @param {string} [reason] Reason for deleting the emoji
|
|
116
|
-
* @returns {Promise<void>}
|
|
117
|
-
*/
|
|
70
|
+
|
|
118
71
|
async delete(emoji, reason) {
|
|
119
72
|
const id = this.resolveId(emoji);
|
|
120
73
|
if (!id) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'emoji', 'EmojiResolvable', true);
|
|
121
74
|
await this.client.rest.delete(Routes.guildEmoji(this.guild.id, id), { reason });
|
|
122
75
|
}
|
|
123
76
|
|
|
124
|
-
|
|
125
|
-
* Edits an emoji.
|
|
126
|
-
* @param {EmojiResolvable} emoji The Emoji resolvable to edit
|
|
127
|
-
* @param {GuildEmojiEditOptions} options The options to provide
|
|
128
|
-
* @returns {Promise<GuildEmoji>}
|
|
129
|
-
*/
|
|
77
|
+
|
|
130
78
|
async edit(emoji, options) {
|
|
131
79
|
const id = this.resolveId(emoji);
|
|
132
80
|
if (!id) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'emoji', 'EmojiResolvable', true);
|
|
@@ -147,11 +95,7 @@ class GuildEmojiManager extends BaseGuildEmojiManager {
|
|
|
147
95
|
return this._add(newData);
|
|
148
96
|
}
|
|
149
97
|
|
|
150
|
-
|
|
151
|
-
* Fetches the author for this emoji
|
|
152
|
-
* @param {EmojiResolvable} emoji The emoji to fetch the author of
|
|
153
|
-
* @returns {Promise<User>}
|
|
154
|
-
*/
|
|
98
|
+
|
|
155
99
|
async fetchAuthor(emoji) {
|
|
156
100
|
emoji = this.resolve(emoji);
|
|
157
101
|
if (!emoji) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'emoji', 'EmojiResolvable', true);
|
|
@@ -5,40 +5,23 @@ const DataManager = require('./DataManager');
|
|
|
5
5
|
const { DiscordjsTypeError, ErrorCodes } = require('../errors');
|
|
6
6
|
const { Role } = require('../structures/Role');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
* Manages API methods for roles belonging to emojis and stores their cache.
|
|
10
|
-
* @extends {DataManager}
|
|
11
|
-
*/
|
|
8
|
+
|
|
12
9
|
class GuildEmojiRoleManager extends DataManager {
|
|
13
10
|
constructor(emoji) {
|
|
14
11
|
super(emoji.client, Role);
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
* The emoji belonging to this manager
|
|
18
|
-
* @type {GuildEmoji}
|
|
19
|
-
*/
|
|
13
|
+
|
|
20
14
|
this.emoji = emoji;
|
|
21
|
-
|
|
22
|
-
* The guild belonging to this manager
|
|
23
|
-
* @type {Guild}
|
|
24
|
-
*/
|
|
15
|
+
|
|
25
16
|
this.guild = emoji.guild;
|
|
26
17
|
}
|
|
27
18
|
|
|
28
|
-
|
|
29
|
-
* The cache of roles belonging to this emoji
|
|
30
|
-
* @type {Collection<Snowflake, Role>}
|
|
31
|
-
* @readonly
|
|
32
|
-
*/
|
|
19
|
+
|
|
33
20
|
get cache() {
|
|
34
21
|
return this.guild.roles.cache.filter(role => this.emoji._roles.includes(role.id));
|
|
35
22
|
}
|
|
36
23
|
|
|
37
|
-
|
|
38
|
-
* Adds a role (or multiple roles) to the list of roles that can use this emoji.
|
|
39
|
-
* @param {RoleResolvable|RoleResolvable[]|Collection<Snowflake, Role>} roleOrRoles The role or roles to add
|
|
40
|
-
* @returns {Promise<GuildEmoji>}
|
|
41
|
-
*/
|
|
24
|
+
|
|
42
25
|
add(roleOrRoles) {
|
|
43
26
|
if (!Array.isArray(roleOrRoles) && !(roleOrRoles instanceof Collection)) roleOrRoles = [roleOrRoles];
|
|
44
27
|
|
|
@@ -55,11 +38,7 @@ class GuildEmojiRoleManager extends DataManager {
|
|
|
55
38
|
return this.set(newRoles);
|
|
56
39
|
}
|
|
57
40
|
|
|
58
|
-
|
|
59
|
-
* Removes a role (or multiple roles) from the list of roles that can use this emoji.
|
|
60
|
-
* @param {RoleResolvable|RoleResolvable[]|Collection<Snowflake, Role>} roleOrRoles The role or roles to remove
|
|
61
|
-
* @returns {Promise<GuildEmoji>}
|
|
62
|
-
*/
|
|
41
|
+
|
|
63
42
|
remove(roleOrRoles) {
|
|
64
43
|
if (!Array.isArray(roleOrRoles) && !(roleOrRoles instanceof Collection)) roleOrRoles = [roleOrRoles];
|
|
65
44
|
|
|
@@ -76,21 +55,7 @@ class GuildEmojiRoleManager extends DataManager {
|
|
|
76
55
|
return this.set(newRoles);
|
|
77
56
|
}
|
|
78
57
|
|
|
79
|
-
|
|
80
|
-
* Sets the role(s) that can use this emoji.
|
|
81
|
-
* @param {Collection<Snowflake, Role>|RoleResolvable[]} roles The roles or role ids to apply
|
|
82
|
-
* @returns {Promise<GuildEmoji>}
|
|
83
|
-
* @example
|
|
84
|
-
* // Set the emoji's roles to a single role
|
|
85
|
-
* guildEmoji.roles.set(['391156570408615936'])
|
|
86
|
-
* .then(console.log)
|
|
87
|
-
* .catch(console.error);
|
|
88
|
-
* @example
|
|
89
|
-
* // Remove all roles from an emoji
|
|
90
|
-
* guildEmoji.roles.set([])
|
|
91
|
-
* .then(console.log)
|
|
92
|
-
* .catch(console.error);
|
|
93
|
-
*/
|
|
58
|
+
|
|
94
59
|
set(roles) {
|
|
95
60
|
return this.emoji.edit({ roles });
|
|
96
61
|
}
|
|
@@ -101,11 +66,7 @@ class GuildEmojiRoleManager extends DataManager {
|
|
|
101
66
|
return clone;
|
|
102
67
|
}
|
|
103
68
|
|
|
104
|
-
|
|
105
|
-
* Patches the roles for this manager's cache
|
|
106
|
-
* @param {Snowflake[]} roles The new roles
|
|
107
|
-
* @private
|
|
108
|
-
*/
|
|
69
|
+
|
|
109
70
|
_patch(roles) {
|
|
110
71
|
this.emoji._roles = roles;
|
|
111
72
|
}
|
|
@@ -5,49 +5,15 @@ const ThreadManager = require('./ThreadManager');
|
|
|
5
5
|
const { DiscordjsTypeError, ErrorCodes } = require('../errors');
|
|
6
6
|
const MessagePayload = require('../structures/MessagePayload');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
* Manages API methods for threads in forum channels and stores their cache.
|
|
10
|
-
* @extends {ThreadManager}
|
|
11
|
-
*/
|
|
8
|
+
|
|
12
9
|
class GuildForumThreadManager extends ThreadManager {
|
|
13
|
-
|
|
14
|
-
* The channel this Manager belongs to
|
|
15
|
-
* @name GuildForumThreadManager#channel
|
|
16
|
-
* @type {ForumChannel}
|
|
17
|
-
*/
|
|
10
|
+
|
|
18
11
|
|
|
19
|
-
|
|
20
|
-
* @typedef {BaseMessageOptions} GuildForumThreadMessageCreateOptions
|
|
21
|
-
* @property {StickerResolvable} [stickers] The stickers to send with the message
|
|
22
|
-
* @property {BitFieldResolvable} [flags] The flags to send with the message
|
|
23
|
-
* <info>Only `MessageFlags.SuppressEmbeds` and `MessageFlags.SuppressNotifications` can be set.</info>
|
|
24
|
-
*/
|
|
12
|
+
|
|
25
13
|
|
|
26
|
-
|
|
27
|
-
* Options for creating a thread.
|
|
28
|
-
* @typedef {StartThreadOptions} GuildForumThreadCreateOptions
|
|
29
|
-
* @property {GuildForumThreadMessageCreateOptions|MessagePayload} message The message associated with the thread post
|
|
30
|
-
* @property {Snowflake[]} [appliedTags] The tags to apply to the thread
|
|
31
|
-
*/
|
|
14
|
+
|
|
32
15
|
|
|
33
|
-
|
|
34
|
-
* Creates a new thread in the channel.
|
|
35
|
-
* @param {GuildForumThreadCreateOptions} [options] Options to create a new thread
|
|
36
|
-
* @returns {Promise<ThreadChannel>}
|
|
37
|
-
* @example
|
|
38
|
-
* // Create a new forum post
|
|
39
|
-
* forum.threads
|
|
40
|
-
* .create({
|
|
41
|
-
* name: 'Food Talk',
|
|
42
|
-
* autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
|
|
43
|
-
* message: {
|
|
44
|
-
* content: 'Discuss your favorite food!',
|
|
45
|
-
* },
|
|
46
|
-
* reason: 'Needed a separate thread for food',
|
|
47
|
-
* })
|
|
48
|
-
* .then(threadChannel => console.log(threadChannel))
|
|
49
|
-
* .catch(console.error);
|
|
50
|
-
*/
|
|
16
|
+
|
|
51
17
|
async create({
|
|
52
18
|
name,
|
|
53
19
|
autoArchiveDuration = this.channel.defaultAutoArchiveDuration,
|