@velliajs/discord 1.0.3 → 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/package.json +1 -1
- 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
|
@@ -2,33 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
const { BaseChannel } = require('./BaseChannel');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
* Represents a channel that displays a directory of guilds.
|
|
7
|
-
* @extends {BaseChannel}
|
|
8
|
-
*/
|
|
5
|
+
|
|
9
6
|
class DirectoryChannel extends BaseChannel {
|
|
10
7
|
constructor(guild, data, client) {
|
|
11
8
|
super(client, data);
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
* The guild the channel is in
|
|
15
|
-
* @type {InviteGuild}
|
|
16
|
-
*/
|
|
10
|
+
|
|
17
11
|
this.guild = guild;
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
* The id of the guild the channel is in
|
|
21
|
-
* @type {Snowflake}
|
|
22
|
-
*/
|
|
13
|
+
|
|
23
14
|
this.guildId = guild.id;
|
|
24
15
|
}
|
|
25
16
|
|
|
26
17
|
_patch(data) {
|
|
27
18
|
super._patch(data);
|
|
28
|
-
|
|
29
|
-
* The channel's name
|
|
30
|
-
* @type {string}
|
|
31
|
-
*/
|
|
19
|
+
|
|
32
20
|
this.name = data.name;
|
|
33
21
|
}
|
|
34
22
|
}
|
package/src/structures/Embed.js
CHANGED
|
@@ -3,86 +3,46 @@
|
|
|
3
3
|
const { embedLength } = require('@discordjs/builders');
|
|
4
4
|
const isEqual = require('fast-deep-equal');
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
* Represents an embed.
|
|
8
|
-
*/
|
|
6
|
+
|
|
9
7
|
class Embed {
|
|
10
8
|
constructor(data) {
|
|
11
|
-
|
|
12
|
-
* The API embed data.
|
|
13
|
-
* @type {APIEmbed}
|
|
14
|
-
* @readonly
|
|
15
|
-
*/
|
|
9
|
+
|
|
16
10
|
this.data = { ...data };
|
|
17
11
|
}
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
* An array of fields of this embed.
|
|
21
|
-
* @type {Array<APIEmbedField>}
|
|
22
|
-
* @readonly
|
|
23
|
-
*/
|
|
13
|
+
|
|
24
14
|
get fields() {
|
|
25
15
|
return this.data.fields ?? [];
|
|
26
16
|
}
|
|
27
17
|
|
|
28
|
-
|
|
29
|
-
* The title of this embed.
|
|
30
|
-
* @type {?string}
|
|
31
|
-
* @readonly
|
|
32
|
-
*/
|
|
18
|
+
|
|
33
19
|
get title() {
|
|
34
20
|
return this.data.title ?? null;
|
|
35
21
|
}
|
|
36
22
|
|
|
37
|
-
|
|
38
|
-
* The description of this embed.
|
|
39
|
-
* @type {?string}
|
|
40
|
-
* @readonly
|
|
41
|
-
*/
|
|
23
|
+
|
|
42
24
|
get description() {
|
|
43
25
|
return this.data.description ?? null;
|
|
44
26
|
}
|
|
45
27
|
|
|
46
|
-
|
|
47
|
-
* The URL of this embed.
|
|
48
|
-
* @type {?string}
|
|
49
|
-
* @readonly
|
|
50
|
-
*/
|
|
28
|
+
|
|
51
29
|
get url() {
|
|
52
30
|
return this.data.url ?? null;
|
|
53
31
|
}
|
|
54
32
|
|
|
55
|
-
|
|
56
|
-
* The color of this embed.
|
|
57
|
-
* @type {?number}
|
|
58
|
-
* @readonly
|
|
59
|
-
*/
|
|
33
|
+
|
|
60
34
|
get color() {
|
|
61
35
|
return this.data.color ?? null;
|
|
62
36
|
}
|
|
63
37
|
|
|
64
|
-
|
|
65
|
-
* The timestamp of this embed. This is in an ISO 8601 format.
|
|
66
|
-
* @type {?string}
|
|
67
|
-
* @readonly
|
|
68
|
-
*/
|
|
38
|
+
|
|
69
39
|
get timestamp() {
|
|
70
40
|
return this.data.timestamp ?? null;
|
|
71
41
|
}
|
|
72
42
|
|
|
73
|
-
|
|
74
|
-
* @typedef {Object} EmbedAssetData
|
|
75
|
-
* @property {?string} url The URL of the image
|
|
76
|
-
* @property {?string} proxyURL The proxy URL of the image
|
|
77
|
-
* @property {?number} height The height of the image
|
|
78
|
-
* @property {?number} width The width of the image
|
|
79
|
-
*/
|
|
43
|
+
|
|
80
44
|
|
|
81
|
-
|
|
82
|
-
* The thumbnail of this embed.
|
|
83
|
-
* @type {?EmbedAssetData}
|
|
84
|
-
* @readonly
|
|
85
|
-
*/
|
|
45
|
+
|
|
86
46
|
get thumbnail() {
|
|
87
47
|
if (!this.data.thumbnail) return null;
|
|
88
48
|
return {
|
|
@@ -93,11 +53,7 @@ class Embed {
|
|
|
93
53
|
};
|
|
94
54
|
}
|
|
95
55
|
|
|
96
|
-
|
|
97
|
-
* The image of this embed.
|
|
98
|
-
* @type {?EmbedAssetData}
|
|
99
|
-
* @readonly
|
|
100
|
-
*/
|
|
56
|
+
|
|
101
57
|
get image() {
|
|
102
58
|
if (!this.data.image) return null;
|
|
103
59
|
return {
|
|
@@ -108,11 +64,7 @@ class Embed {
|
|
|
108
64
|
};
|
|
109
65
|
}
|
|
110
66
|
|
|
111
|
-
|
|
112
|
-
* The video of this embed.
|
|
113
|
-
* @type {?EmbedAssetData}
|
|
114
|
-
* @readonly
|
|
115
|
-
*/
|
|
67
|
+
|
|
116
68
|
get video() {
|
|
117
69
|
if (!this.data.video) return null;
|
|
118
70
|
return {
|
|
@@ -123,19 +75,9 @@ class Embed {
|
|
|
123
75
|
};
|
|
124
76
|
}
|
|
125
77
|
|
|
126
|
-
|
|
127
|
-
* @typedef {Object} EmbedAuthorData
|
|
128
|
-
* @property {string} name The name of the author
|
|
129
|
-
* @property {?string} url The URL of the author
|
|
130
|
-
* @property {?string} iconURL The icon URL of the author
|
|
131
|
-
* @property {?string} proxyIconURL The proxy icon URL of the author
|
|
132
|
-
*/
|
|
78
|
+
|
|
133
79
|
|
|
134
|
-
|
|
135
|
-
* The author of this embed.
|
|
136
|
-
* @type {?EmbedAuthorData}
|
|
137
|
-
* @readonly
|
|
138
|
-
*/
|
|
80
|
+
|
|
139
81
|
get author() {
|
|
140
82
|
if (!this.data.author) return null;
|
|
141
83
|
return {
|
|
@@ -146,27 +88,14 @@ class Embed {
|
|
|
146
88
|
};
|
|
147
89
|
}
|
|
148
90
|
|
|
149
|
-
|
|
150
|
-
* The provider of this embed.
|
|
151
|
-
* @type {?APIEmbedProvider}
|
|
152
|
-
* @readonly
|
|
153
|
-
*/
|
|
91
|
+
|
|
154
92
|
get provider() {
|
|
155
93
|
return this.data.provider ?? null;
|
|
156
94
|
}
|
|
157
95
|
|
|
158
|
-
|
|
159
|
-
* @typedef {Object} EmbedFooterData
|
|
160
|
-
* @property {string} text The text of the footer
|
|
161
|
-
* @property {?string} iconURL The URL of the icon
|
|
162
|
-
* @property {?string} proxyIconURL The proxy URL of the icon
|
|
163
|
-
*/
|
|
96
|
+
|
|
164
97
|
|
|
165
|
-
|
|
166
|
-
* The footer of this embed.
|
|
167
|
-
* @type {?EmbedFooterData}
|
|
168
|
-
* @readonly
|
|
169
|
-
*/
|
|
98
|
+
|
|
170
99
|
get footer() {
|
|
171
100
|
if (!this.data.footer) return null;
|
|
172
101
|
return {
|
|
@@ -176,39 +105,24 @@ class Embed {
|
|
|
176
105
|
};
|
|
177
106
|
}
|
|
178
107
|
|
|
179
|
-
|
|
180
|
-
* The accumulated length for the embed title, description, fields, footer text, and author name.
|
|
181
|
-
* @type {number}
|
|
182
|
-
* @readonly
|
|
183
|
-
*/
|
|
108
|
+
|
|
184
109
|
get length() {
|
|
185
110
|
return embedLength(this.data);
|
|
186
111
|
}
|
|
187
112
|
|
|
188
|
-
|
|
189
|
-
* The hex color of this embed.
|
|
190
|
-
* @type {?string}
|
|
191
|
-
* @readonly
|
|
192
|
-
*/
|
|
113
|
+
|
|
193
114
|
get hexColor() {
|
|
194
115
|
return typeof this.data.color === 'number'
|
|
195
116
|
? `#${this.data.color.toString(16).padStart(6, '0')}`
|
|
196
117
|
: this.data.color ?? null;
|
|
197
118
|
}
|
|
198
119
|
|
|
199
|
-
|
|
200
|
-
* Returns the API-compatible JSON for this embed.
|
|
201
|
-
* @returns {APIEmbed}
|
|
202
|
-
*/
|
|
120
|
+
|
|
203
121
|
toJSON() {
|
|
204
122
|
return { ...this.data };
|
|
205
123
|
}
|
|
206
124
|
|
|
207
|
-
|
|
208
|
-
* Whether the given embeds are equal.
|
|
209
|
-
* @param {Embed|APIEmbed} other The embed to compare against
|
|
210
|
-
* @returns {boolean}
|
|
211
|
-
*/
|
|
125
|
+
|
|
212
126
|
equals(other) {
|
|
213
127
|
if (other instanceof Embed) {
|
|
214
128
|
return isEqual(other.data, this.data);
|
|
@@ -5,29 +5,18 @@ const { isJSONEncodable } = require('@discordjs/util');
|
|
|
5
5
|
const { toSnakeCase } = require('../util/Transformers');
|
|
6
6
|
const { resolveColor } = require('../util/Util');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
* Represents an embed builder.
|
|
10
|
-
* @extends {BuildersEmbed}
|
|
11
|
-
*/
|
|
8
|
+
|
|
12
9
|
class EmbedBuilder extends BuildersEmbed {
|
|
13
10
|
constructor(data) {
|
|
14
11
|
super(toSnakeCase(data));
|
|
15
12
|
}
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
* Sets the color of this embed
|
|
19
|
-
* @param {?ColorResolvable} color The color of the embed
|
|
20
|
-
* @returns {EmbedBuilder}
|
|
21
|
-
*/
|
|
14
|
+
|
|
22
15
|
setColor(color) {
|
|
23
16
|
return super.setColor(color && resolveColor(color));
|
|
24
17
|
}
|
|
25
18
|
|
|
26
|
-
|
|
27
|
-
* Creates a new embed builder from JSON data
|
|
28
|
-
* @param {EmbedBuilder|Embed|APIEmbed} other The other data
|
|
29
|
-
* @returns {EmbedBuilder}
|
|
30
|
-
*/
|
|
19
|
+
|
|
31
20
|
static from(other) {
|
|
32
21
|
return new this(isJSONEncodable(other) ? other.toJSON() : other);
|
|
33
22
|
}
|
|
@@ -35,7 +24,4 @@ class EmbedBuilder extends BuildersEmbed {
|
|
|
35
24
|
|
|
36
25
|
module.exports = EmbedBuilder;
|
|
37
26
|
|
|
38
|
-
|
|
39
|
-
* @external BuildersEmbed
|
|
40
|
-
* @see {@link https://discord.js.org/docs/packages/builders/stable/EmbedBuilder:Class}
|
|
41
|
-
*/
|
|
27
|
+
|
package/src/structures/Emoji.js
CHANGED
|
@@ -3,89 +3,44 @@
|
|
|
3
3
|
const { DiscordSnowflake } = require('@sapphire/snowflake');
|
|
4
4
|
const Base = require('./Base');
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* @property {?Snowflake} id The emoji's id
|
|
10
|
-
* @property {?string} name The emoji's name
|
|
11
|
-
* @property {?boolean} animated Whether the emoji is animated
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Represents an emoji, see {@link GuildEmoji} and {@link ReactionEmoji}.
|
|
16
|
-
* @extends {Base}
|
|
17
|
-
*/
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
18
9
|
class Emoji extends Base {
|
|
19
10
|
constructor(client, emoji) {
|
|
20
11
|
super(client);
|
|
21
|
-
|
|
22
|
-
* Whether or not the emoji is animated
|
|
23
|
-
* @type {?boolean}
|
|
24
|
-
*/
|
|
12
|
+
|
|
25
13
|
this.animated = emoji.animated ?? null;
|
|
26
14
|
|
|
27
|
-
|
|
28
|
-
* The emoji's name
|
|
29
|
-
* @type {?string}
|
|
30
|
-
*/
|
|
15
|
+
|
|
31
16
|
this.name = emoji.name ?? null;
|
|
32
17
|
|
|
33
|
-
|
|
34
|
-
* The emoji's id
|
|
35
|
-
* @type {?Snowflake}
|
|
36
|
-
*/
|
|
18
|
+
|
|
37
19
|
this.id = emoji.id;
|
|
38
20
|
}
|
|
39
21
|
|
|
40
|
-
|
|
41
|
-
* The identifier of this emoji, used for message reactions
|
|
42
|
-
* @type {string}
|
|
43
|
-
* @readonly
|
|
44
|
-
*/
|
|
22
|
+
|
|
45
23
|
get identifier() {
|
|
46
24
|
if (this.id) return `${this.animated ? 'a:' : ''}${this.name}:${this.id}`;
|
|
47
25
|
return encodeURIComponent(this.name);
|
|
48
26
|
}
|
|
49
27
|
|
|
50
|
-
|
|
51
|
-
* The URL to the emoji file if it's a custom emoji
|
|
52
|
-
* @type {?string}
|
|
53
|
-
* @readonly
|
|
54
|
-
*/
|
|
28
|
+
|
|
55
29
|
get url() {
|
|
56
30
|
return this.id && this.client.rest.cdn.emoji(this.id, this.animated ? 'gif' : 'png');
|
|
57
31
|
}
|
|
58
32
|
|
|
59
|
-
|
|
60
|
-
* The timestamp the emoji was created at, or null if unicode
|
|
61
|
-
* @type {?number}
|
|
62
|
-
* @readonly
|
|
63
|
-
*/
|
|
33
|
+
|
|
64
34
|
get createdTimestamp() {
|
|
65
35
|
return this.id && DiscordSnowflake.timestampFrom(this.id);
|
|
66
36
|
}
|
|
67
37
|
|
|
68
|
-
|
|
69
|
-
* The time the emoji was created at, or null if unicode
|
|
70
|
-
* @type {?Date}
|
|
71
|
-
* @readonly
|
|
72
|
-
*/
|
|
38
|
+
|
|
73
39
|
get createdAt() {
|
|
74
40
|
return this.id && new Date(this.createdTimestamp);
|
|
75
41
|
}
|
|
76
42
|
|
|
77
|
-
|
|
78
|
-
* When concatenated with a string, this automatically returns the text required to form a graphical emoji on Discord
|
|
79
|
-
* instead of the Emoji object.
|
|
80
|
-
* @returns {string}
|
|
81
|
-
* @example
|
|
82
|
-
* // Send a custom emoji from a guild:
|
|
83
|
-
* const emoji = guild.emojis.cache.first();
|
|
84
|
-
* msg.channel.send(`Hello! ${emoji}`);
|
|
85
|
-
* @example
|
|
86
|
-
* // Send the emoji used in a reaction to the channel the reaction is part of
|
|
87
|
-
* reaction.message.channel.send(`The emoji used was: ${reaction.emoji}`);
|
|
88
|
-
*/
|
|
43
|
+
|
|
89
44
|
toString() {
|
|
90
45
|
return this.id ? `<${this.animated ? 'a' : ''}:${this.name}:${this.id}>` : this.name;
|
|
91
46
|
}
|
|
@@ -102,7 +57,4 @@ class Emoji extends Base {
|
|
|
102
57
|
|
|
103
58
|
exports.Emoji = Emoji;
|
|
104
59
|
|
|
105
|
-
|
|
106
|
-
* @external APIEmoji
|
|
107
|
-
* @see {@link https://discord.com/developers/docs/resources/emoji#emoji-object}
|
|
108
|
-
*/
|
|
60
|
+
|
|
@@ -5,49 +5,20 @@ const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
|
|
5
5
|
const GuildForumThreadManager = require('../managers/GuildForumThreadManager');
|
|
6
6
|
const { transformAPIGuildForumTag, transformAPIGuildDefaultReaction } = require('../util/Channels');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* @property {string} name The name of the tag
|
|
18
|
-
* @property {boolean} moderated Whether this tag can only be added to or removed from threads
|
|
19
|
-
* by a member with the `ManageThreads` permission
|
|
20
|
-
* @property {?GuildForumTagEmoji} emoji The emoji of this tag
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @typedef {Object} GuildForumTagData
|
|
25
|
-
* @property {Snowflake} [id] The id of the tag
|
|
26
|
-
* @property {string} name The name of the tag
|
|
27
|
-
* @property {boolean} [moderated] Whether this tag can only be added to or removed from threads
|
|
28
|
-
* by a member with the `ManageThreads` permission
|
|
29
|
-
* @property {?GuildForumTagEmoji} [emoji] The emoji of this tag
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @typedef {Object} DefaultReactionEmoji
|
|
34
|
-
* @property {?Snowflake} id The id of a guild's custom emoji
|
|
35
|
-
* @property {?string} name The unicode character of the emoji
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Represents a channel that only contains threads
|
|
40
|
-
* @extends {GuildChannel}
|
|
41
|
-
* @implements {TextBasedChannel}
|
|
42
|
-
*/
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
43
17
|
class ForumChannel extends GuildChannel {
|
|
44
18
|
constructor(guild, data, client) {
|
|
45
19
|
super(guild, data, client, false);
|
|
46
20
|
|
|
47
|
-
|
|
48
|
-
* A manager of the threads belonging to this channel
|
|
49
|
-
* @type {GuildForumThreadManager}
|
|
50
|
-
*/
|
|
21
|
+
|
|
51
22
|
this.threads = new GuildForumThreadManager(this);
|
|
52
23
|
|
|
53
24
|
this._patch(data);
|
|
@@ -56,20 +27,14 @@ class ForumChannel extends GuildChannel {
|
|
|
56
27
|
_patch(data) {
|
|
57
28
|
super._patch(data);
|
|
58
29
|
if ('available_tags' in data) {
|
|
59
|
-
|
|
60
|
-
* The set of tags that can be used in this channel.
|
|
61
|
-
* @type {GuildForumTag[]}
|
|
62
|
-
*/
|
|
30
|
+
|
|
63
31
|
this.availableTags = data.available_tags.map(tag => transformAPIGuildForumTag(tag));
|
|
64
32
|
} else {
|
|
65
33
|
this.availableTags ??= [];
|
|
66
34
|
}
|
|
67
35
|
|
|
68
36
|
if ('default_reaction_emoji' in data) {
|
|
69
|
-
|
|
70
|
-
* The emoji to show in the add reaction button on a thread in a guild forum channel
|
|
71
|
-
* @type {?DefaultReactionEmoji}
|
|
72
|
-
*/
|
|
37
|
+
|
|
73
38
|
this.defaultReactionEmoji = data.default_reaction_emoji
|
|
74
39
|
? transformAPIGuildDefaultReaction(data.default_reaction_emoji)
|
|
75
40
|
: null;
|
|
@@ -78,171 +43,96 @@ class ForumChannel extends GuildChannel {
|
|
|
78
43
|
}
|
|
79
44
|
|
|
80
45
|
if ('default_thread_rate_limit_per_user' in data) {
|
|
81
|
-
|
|
82
|
-
* The initial rate limit per user (slowmode) to set on newly created threads in a channel.
|
|
83
|
-
* @type {?number}
|
|
84
|
-
*/
|
|
46
|
+
|
|
85
47
|
this.defaultThreadRateLimitPerUser = data.default_thread_rate_limit_per_user;
|
|
86
48
|
} else {
|
|
87
49
|
this.defaultThreadRateLimitPerUser ??= null;
|
|
88
50
|
}
|
|
89
51
|
|
|
90
52
|
if ('rate_limit_per_user' in data) {
|
|
91
|
-
|
|
92
|
-
* The rate limit per user (slowmode) for this channel.
|
|
93
|
-
* @type {?number}
|
|
94
|
-
*/
|
|
53
|
+
|
|
95
54
|
this.rateLimitPerUser = data.rate_limit_per_user;
|
|
96
55
|
} else {
|
|
97
56
|
this.rateLimitPerUser ??= null;
|
|
98
57
|
}
|
|
99
58
|
|
|
100
59
|
if ('default_auto_archive_duration' in data) {
|
|
101
|
-
|
|
102
|
-
* The default auto archive duration for newly created threads in this channel.
|
|
103
|
-
* @type {?ThreadAutoArchiveDuration}
|
|
104
|
-
*/
|
|
60
|
+
|
|
105
61
|
this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
|
|
106
62
|
} else {
|
|
107
63
|
this.defaultAutoArchiveDuration ??= null;
|
|
108
64
|
}
|
|
109
65
|
|
|
110
66
|
if ('nsfw' in data) {
|
|
111
|
-
|
|
112
|
-
* If this channel is considered NSFW.
|
|
113
|
-
* @type {boolean}
|
|
114
|
-
*/
|
|
67
|
+
|
|
115
68
|
this.nsfw = data.nsfw;
|
|
116
69
|
} else {
|
|
117
70
|
this.nsfw ??= false;
|
|
118
71
|
}
|
|
119
72
|
|
|
120
73
|
if ('topic' in data) {
|
|
121
|
-
|
|
122
|
-
* The topic of this channel.
|
|
123
|
-
* @type {?string}
|
|
124
|
-
*/
|
|
74
|
+
|
|
125
75
|
this.topic = data.topic;
|
|
126
76
|
}
|
|
127
77
|
|
|
128
78
|
if ('default_sort_order' in data) {
|
|
129
|
-
|
|
130
|
-
* The default sort order mode used to order posts
|
|
131
|
-
* @type {?SortOrderType}
|
|
132
|
-
*/
|
|
79
|
+
|
|
133
80
|
this.defaultSortOrder = data.default_sort_order;
|
|
134
81
|
} else {
|
|
135
82
|
this.defaultSortOrder ??= null;
|
|
136
83
|
}
|
|
137
84
|
|
|
138
|
-
|
|
139
|
-
* The default layout type used to display posts
|
|
140
|
-
* @type {ForumLayoutType}
|
|
141
|
-
*/
|
|
85
|
+
|
|
142
86
|
this.defaultForumLayout = data.default_forum_layout;
|
|
143
87
|
}
|
|
144
88
|
|
|
145
|
-
|
|
146
|
-
* Sets the available tags for this forum channel
|
|
147
|
-
* @param {GuildForumTagData[]} availableTags The tags to set as available in this channel
|
|
148
|
-
* @param {string} [reason] Reason for changing the available tags
|
|
149
|
-
* @returns {Promise<ForumChannel>}
|
|
150
|
-
*/
|
|
89
|
+
|
|
151
90
|
setAvailableTags(availableTags, reason) {
|
|
152
91
|
return this.edit({ availableTags, reason });
|
|
153
92
|
}
|
|
154
93
|
|
|
155
|
-
|
|
156
|
-
* Sets the default reaction emoji for this channel
|
|
157
|
-
* @param {?DefaultReactionEmoji} defaultReactionEmoji The emoji to set as the default reaction emoji
|
|
158
|
-
* @param {string} [reason] Reason for changing the default reaction emoji
|
|
159
|
-
* @returns {Promise<ForumChannel>}
|
|
160
|
-
*/
|
|
94
|
+
|
|
161
95
|
setDefaultReactionEmoji(defaultReactionEmoji, reason) {
|
|
162
96
|
return this.edit({ defaultReactionEmoji, reason });
|
|
163
97
|
}
|
|
164
98
|
|
|
165
|
-
|
|
166
|
-
* Sets the default rate limit per user (slowmode) for new threads in this channel
|
|
167
|
-
* @param {number} defaultThreadRateLimitPerUser The rate limit to set on newly created threads in this channel
|
|
168
|
-
* @param {string} [reason] Reason for changing the default rate limit
|
|
169
|
-
* @returns {Promise<ForumChannel>}
|
|
170
|
-
*/
|
|
99
|
+
|
|
171
100
|
setDefaultThreadRateLimitPerUser(defaultThreadRateLimitPerUser, reason) {
|
|
172
101
|
return this.edit({ defaultThreadRateLimitPerUser, reason });
|
|
173
102
|
}
|
|
174
103
|
|
|
175
|
-
|
|
176
|
-
* Creates an invite to this guild channel.
|
|
177
|
-
* @param {InviteCreateOptions} [options={}] The options for creating the invite
|
|
178
|
-
* @returns {Promise<Invite>}
|
|
179
|
-
* @example
|
|
180
|
-
* // Create an invite to a channel
|
|
181
|
-
* channel.createInvite()
|
|
182
|
-
* .then(invite => console.log(`Created an invite with a code of ${invite.code}`))
|
|
183
|
-
* .catch(console.error);
|
|
184
|
-
*/
|
|
104
|
+
|
|
185
105
|
createInvite(options) {
|
|
186
106
|
return this.guild.invites.create(this.id, options);
|
|
187
107
|
}
|
|
188
108
|
|
|
189
|
-
|
|
190
|
-
* Fetches a collection of invites to this guild channel.
|
|
191
|
-
* Resolves with a collection mapping invites by their codes.
|
|
192
|
-
* @param {boolean} [cache=true] Whether to cache the fetched invites
|
|
193
|
-
* @returns {Promise<Collection<string, Invite>>}
|
|
194
|
-
*/
|
|
109
|
+
|
|
195
110
|
fetchInvites(cache) {
|
|
196
111
|
return this.guild.invites.fetch({ channelId: this.id, cache });
|
|
197
112
|
}
|
|
198
113
|
|
|
199
|
-
|
|
200
|
-
* Sets the default auto archive duration for all newly created threads in this channel.
|
|
201
|
-
* @param {ThreadAutoArchiveDuration} defaultAutoArchiveDuration The new default auto archive duration
|
|
202
|
-
* @param {string} [reason] Reason for changing the channel's default auto archive duration
|
|
203
|
-
* @returns {Promise<ForumChannel>}
|
|
204
|
-
*/
|
|
114
|
+
|
|
205
115
|
setDefaultAutoArchiveDuration(defaultAutoArchiveDuration, reason) {
|
|
206
116
|
return this.edit({ defaultAutoArchiveDuration, reason });
|
|
207
117
|
}
|
|
208
118
|
|
|
209
|
-
|
|
210
|
-
* Sets a new topic for the guild channel.
|
|
211
|
-
* @param {?string} topic The new topic for the guild channel
|
|
212
|
-
* @param {string} [reason] Reason for changing the guild channel's topic
|
|
213
|
-
* @returns {Promise<ForumChannel>}
|
|
214
|
-
* @example
|
|
215
|
-
* // Set a new channel topic
|
|
216
|
-
* channel.setTopic('needs more rate limiting')
|
|
217
|
-
* .then(newChannel => console.log(`Channel's new topic is ${newChannel.topic}`))
|
|
218
|
-
* .catch(console.error);
|
|
219
|
-
*/
|
|
119
|
+
|
|
220
120
|
setTopic(topic, reason) {
|
|
221
121
|
return this.edit({ topic, reason });
|
|
222
122
|
}
|
|
223
123
|
|
|
224
|
-
|
|
225
|
-
* Sets the default sort order mode used to order posts
|
|
226
|
-
* @param {?SortOrderType} defaultSortOrder The default sort order mode to set on this channel
|
|
227
|
-
* @param {string} [reason] Reason for changing the default sort order
|
|
228
|
-
* @returns {Promise<ForumChannel>}
|
|
229
|
-
*/
|
|
124
|
+
|
|
230
125
|
setDefaultSortOrder(defaultSortOrder, reason) {
|
|
231
126
|
return this.edit({ defaultSortOrder, reason });
|
|
232
127
|
}
|
|
233
128
|
|
|
234
|
-
|
|
235
|
-
* Sets the default forum layout type used to display posts
|
|
236
|
-
* @param {ForumLayoutType} defaultForumLayout The default forum layout type to set on this channel
|
|
237
|
-
* @param {string} [reason] Reason for changing the default forum layout
|
|
238
|
-
* @returns {Promise<ForumChannel>}
|
|
239
|
-
*/
|
|
129
|
+
|
|
240
130
|
setDefaultForumLayout(defaultForumLayout, reason) {
|
|
241
131
|
return this.edit({ defaultForumLayout, reason });
|
|
242
132
|
}
|
|
243
133
|
|
|
244
|
-
|
|
245
|
-
|
|
134
|
+
|
|
135
|
+
|
|
246
136
|
createWebhook() {}
|
|
247
137
|
fetchWebhooks() {}
|
|
248
138
|
setNSFW() {}
|