@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
package/src/util/DataResolver.js
CHANGED
|
@@ -7,59 +7,29 @@ const { fetch } = require('undici');
|
|
|
7
7
|
const { DiscordjsError, DiscordjsTypeError, ErrorCodes } = require('../errors');
|
|
8
8
|
const Invite = require('../structures/Invite');
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
* The DataResolver identifies different objects and tries to resolve a specific piece of information from them.
|
|
12
|
-
* @private
|
|
13
|
-
*/
|
|
10
|
+
|
|
14
11
|
class DataResolver extends null {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Data that can be resolved to give a template code. This can be:
|
|
24
|
-
* * A template code
|
|
25
|
-
* * A template URL
|
|
26
|
-
* @typedef {string} GuildTemplateResolvable
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Resolves the string to a code based on the passed regex.
|
|
31
|
-
* @param {string} data The string to resolve
|
|
32
|
-
* @param {RegExp} regex The RegExp used to extract the code
|
|
33
|
-
* @returns {string}
|
|
34
|
-
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
35
17
|
static resolveCode(data, regex) {
|
|
36
18
|
return regex.exec(data)?.[1] ?? data;
|
|
37
19
|
}
|
|
38
20
|
|
|
39
|
-
|
|
40
|
-
* Resolves InviteResolvable to an invite code.
|
|
41
|
-
* @param {InviteResolvable} data The invite resolvable to resolve
|
|
42
|
-
* @returns {string}
|
|
43
|
-
*/
|
|
21
|
+
|
|
44
22
|
static resolveInviteCode(data) {
|
|
45
23
|
return this.resolveCode(data, Invite.InvitesPattern);
|
|
46
24
|
}
|
|
47
25
|
|
|
48
|
-
|
|
49
|
-
* Resolves GuildTemplateResolvable to a template code.
|
|
50
|
-
* @param {GuildTemplateResolvable} data The template resolvable to resolve
|
|
51
|
-
* @returns {string}
|
|
52
|
-
*/
|
|
26
|
+
|
|
53
27
|
static resolveGuildTemplateCode(data) {
|
|
54
28
|
const GuildTemplate = require('../structures/GuildTemplate');
|
|
55
29
|
return this.resolveCode(data, GuildTemplate.GuildTemplatesPattern);
|
|
56
30
|
}
|
|
57
31
|
|
|
58
|
-
|
|
59
|
-
* Resolves a Base64Resolvable, a string, or a BufferResolvable to a Base 64 image.
|
|
60
|
-
* @param {BufferResolvable|Base64Resolvable} image The image to be resolved
|
|
61
|
-
* @returns {Promise<?string>}
|
|
62
|
-
*/
|
|
32
|
+
|
|
63
33
|
static async resolveImage(image) {
|
|
64
34
|
if (!image) return null;
|
|
65
35
|
if (typeof image === 'string' && image.startsWith('data:')) {
|
|
@@ -69,48 +39,21 @@ class DataResolver extends null {
|
|
|
69
39
|
return this.resolveBase64(file.data);
|
|
70
40
|
}
|
|
71
41
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
* * A base64 string
|
|
76
|
-
* @typedef {Buffer|string} Base64Resolvable
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Resolves a Base64Resolvable to a Base 64 image.
|
|
81
|
-
* @param {Base64Resolvable} data The base 64 resolvable you want to resolve
|
|
82
|
-
* @returns {?string}
|
|
83
|
-
*/
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
84
45
|
static resolveBase64(data) {
|
|
85
46
|
if (Buffer.isBuffer(data)) return `data:image/jpg;base64,${data.toString('base64')}`;
|
|
86
47
|
return data;
|
|
87
48
|
}
|
|
88
49
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* @external Stream
|
|
100
|
-
* @see {@link https://nodejs.org/api/stream.html}
|
|
101
|
-
*/
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* @typedef {Object} ResolvedFile
|
|
105
|
-
* @property {Buffer} data Buffer containing the file data
|
|
106
|
-
* @property {string} [contentType] Content type of the file
|
|
107
|
-
*/
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Resolves a BufferResolvable to a Buffer.
|
|
111
|
-
* @param {BufferResolvable|Stream} resource The buffer or stream resolvable to resolve
|
|
112
|
-
* @returns {Promise<ResolvedFile>}
|
|
113
|
-
*/
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
114
57
|
static async resolveFile(resource) {
|
|
115
58
|
if (Buffer.isBuffer(resource)) return { data: resource };
|
|
116
59
|
|
|
@@ -121,7 +64,7 @@ class DataResolver extends null {
|
|
|
121
64
|
}
|
|
122
65
|
|
|
123
66
|
if (typeof resource === 'string') {
|
|
124
|
-
if (/^https
|
|
67
|
+
if (/^https?:\/\
|
|
125
68
|
const res = await fetch(resource);
|
|
126
69
|
return { data: Buffer.from(await res.arrayBuffer()), contentType: res.headers.get('content-type') };
|
|
127
70
|
}
|
package/src/util/Events.js
CHANGED
|
@@ -1,87 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @typedef {Object} Events
|
|
5
|
-
* @property {string} ApplicationCommandPermissionsUpdate applicationCommandPermissionsUpdate
|
|
6
|
-
* @property {string} AutoModerationActionExecution autoModerationActionExecution
|
|
7
|
-
* @property {string} AutoModerationRuleCreate autoModerationRuleCreate
|
|
8
|
-
* @property {string} AutoModerationRuleDelete autoModerationRuleDelete
|
|
9
|
-
* @property {string} AutoModerationRuleUpdate autoModerationRuleUpdate
|
|
10
|
-
* @property {string} CacheSweep cacheSweep
|
|
11
|
-
* @property {string} ChannelCreate channelCreate
|
|
12
|
-
* @property {string} ChannelDelete channelDelete
|
|
13
|
-
* @property {string} ChannelPinsUpdate channelPinsUpdate
|
|
14
|
-
* @property {string} ChannelUpdate channelUpdate
|
|
15
|
-
* @property {string} ClientReady ready
|
|
16
|
-
* @property {string} Debug debug
|
|
17
|
-
* @property {string} Error error
|
|
18
|
-
* @property {string} GuildAuditLogEntryCreate guildAuditLogEntryCreate
|
|
19
|
-
* @property {string} GuildBanAdd guildBanAdd
|
|
20
|
-
* @property {string} GuildBanRemove guildBanRemove
|
|
21
|
-
* @property {string} GuildCreate guildCreate
|
|
22
|
-
* @property {string} GuildDelete guildDelete
|
|
23
|
-
* @property {string} GuildEmojiCreate emojiCreate
|
|
24
|
-
* @property {string} GuildEmojiDelete emojiDelete
|
|
25
|
-
* @property {string} GuildEmojiUpdate emojiUpdate
|
|
26
|
-
* @property {string} GuildIntegrationsUpdate guildIntegrationsUpdate
|
|
27
|
-
* @property {string} GuildMemberAdd guildMemberAdd
|
|
28
|
-
* @property {string} GuildMemberAvailable guildMemberAvailable
|
|
29
|
-
* @property {string} GuildMemberRemove guildMemberRemove
|
|
30
|
-
* @property {string} GuildMembersChunk guildMembersChunk
|
|
31
|
-
* @property {string} GuildMemberUpdate guildMemberUpdate
|
|
32
|
-
* @property {string} GuildRoleCreate roleCreate
|
|
33
|
-
* @property {string} GuildRoleDelete roleDelete
|
|
34
|
-
* @property {string} GuildRoleUpdate roleUpdate
|
|
35
|
-
* @property {string} GuildScheduledEventCreate guildScheduledEventCreate
|
|
36
|
-
* @property {string} GuildScheduledEventDelete guildScheduledEventDelete
|
|
37
|
-
* @property {string} GuildScheduledEventUpdate guildScheduledEventUpdate
|
|
38
|
-
* @property {string} GuildScheduledEventUserAdd guildScheduledEventUserAdd
|
|
39
|
-
* @property {string} GuildScheduledEventUserRemove guildScheduledEventUserRemove
|
|
40
|
-
* @property {string} GuildStickerCreate stickerCreate
|
|
41
|
-
* @property {string} GuildStickerDelete stickerDelete
|
|
42
|
-
* @property {string} GuildStickerUpdate stickerUpdate
|
|
43
|
-
* @property {string} GuildUnavailable guildUnavailable
|
|
44
|
-
* @property {string} GuildUpdate guildUpdate
|
|
45
|
-
* @property {string} InteractionCreate interactionCreate
|
|
46
|
-
* @property {string} Invalidated invalidated
|
|
47
|
-
* @property {string} InviteCreate inviteCreate
|
|
48
|
-
* @property {string} InviteDelete inviteDelete
|
|
49
|
-
* @property {string} MessageBulkDelete messageDeleteBulk
|
|
50
|
-
* @property {string} MessageCreate messageCreate
|
|
51
|
-
* @property {string} MessageDelete messageDelete
|
|
52
|
-
* @property {string} MessageReactionAdd messageReactionAdd
|
|
53
|
-
* @property {string} MessageReactionRemove messageReactionRemove
|
|
54
|
-
* @property {string} MessageReactionRemoveAll messageReactionRemoveAll
|
|
55
|
-
* @property {string} MessageReactionRemoveEmoji messageReactionRemoveEmoji
|
|
56
|
-
* @property {string} MessageUpdate messageUpdate
|
|
57
|
-
* @property {string} PresenceUpdate presenceUpdate
|
|
58
|
-
* @property {string} ShardDisconnect shardDisconnect
|
|
59
|
-
* @property {string} ShardError shardError
|
|
60
|
-
* @property {string} ShardReady shardReady
|
|
61
|
-
* @property {string} ShardReconnecting shardReconnecting
|
|
62
|
-
* @property {string} ShardResume shardResume
|
|
63
|
-
* @property {string} StageInstanceCreate stageInstanceCreate
|
|
64
|
-
* @property {string} StageInstanceDelete stageInstanceDelete
|
|
65
|
-
* @property {string} StageInstanceUpdate stageInstanceUpdate
|
|
66
|
-
* @property {string} ThreadCreate threadCreate
|
|
67
|
-
* @property {string} ThreadDelete threadDelete
|
|
68
|
-
* @property {string} ThreadListSync threadListSync
|
|
69
|
-
* @property {string} ThreadMembersUpdate threadMembersUpdate
|
|
70
|
-
* @property {string} ThreadMemberUpdate threadMemberUpdate
|
|
71
|
-
* @property {string} ThreadUpdate threadUpdate
|
|
72
|
-
* @property {string} TypingStart typingStart
|
|
73
|
-
* @property {string} UserUpdate userUpdate
|
|
74
|
-
* @property {string} VoiceServerUpdate voiceServerUpdate
|
|
75
|
-
* @property {string} VoiceStateUpdate voiceStateUpdate
|
|
76
|
-
* @property {string} Warn warn
|
|
77
|
-
* @property {string} WebhooksUpdate webhookUpdate
|
|
78
|
-
*/
|
|
79
3
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
* @ignore
|
|
84
|
-
*/
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
85
7
|
module.exports = {
|
|
86
8
|
ApplicationCommandPermissionsUpdate: 'applicationCommandPermissionsUpdate',
|
|
87
9
|
AutoModerationActionExecution: 'autoModerationActionExecution',
|
package/src/util/Formatters.js
CHANGED
|
@@ -21,389 +21,142 @@ const {
|
|
|
21
21
|
userMention,
|
|
22
22
|
} = require('@discordjs/builders');
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
* Formats the content into underscored text.
|
|
66
|
-
* @method underscore
|
|
67
|
-
* @param {string} content The content to wrap
|
|
68
|
-
* @returns {string}
|
|
69
|
-
*/
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Formats the content into strike-through text.
|
|
73
|
-
* @method strikethrough
|
|
74
|
-
* @param {string} content The content to wrap
|
|
75
|
-
* @returns {string}
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Formats the content into a quote.
|
|
80
|
-
* <info>This needs to be at the start of the line for Discord to format it.</info>
|
|
81
|
-
* @method quote
|
|
82
|
-
* @param {string} content The content to wrap
|
|
83
|
-
* @returns {string}
|
|
84
|
-
*/
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Formats the content into a block quote.
|
|
88
|
-
* <info>This needs to be at the start of the line for Discord to format it.</info>
|
|
89
|
-
* @method blockQuote
|
|
90
|
-
* @param {string} content The content to wrap
|
|
91
|
-
* @returns {string}
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Wraps the URL into `<>`, which stops it from embedding.
|
|
96
|
-
* @method hideLinkEmbed
|
|
97
|
-
* @param {string} content The content to wrap
|
|
98
|
-
* @returns {string}
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Formats the content and the URL into a masked URL with an optional title.
|
|
103
|
-
* @method hyperlink
|
|
104
|
-
* @param {string} content The content to display
|
|
105
|
-
* @param {string} url The URL the content links to
|
|
106
|
-
* @param {string} [title] The title shown when hovering on the masked link
|
|
107
|
-
* @returns {string}
|
|
108
|
-
*/
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Formats the content into spoiler text.
|
|
112
|
-
* @method spoiler
|
|
113
|
-
* @param {string} content The content to spoiler
|
|
114
|
-
* @returns {string}
|
|
115
|
-
*/
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Formats a user id into a user mention.
|
|
119
|
-
* @method userMention
|
|
120
|
-
* @param {Snowflake} userId The user id to format
|
|
121
|
-
* @returns {string}
|
|
122
|
-
*/
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Formats a channel id into a channel mention.
|
|
126
|
-
* @method channelMention
|
|
127
|
-
* @param {Snowflake} channelId The channel id to format
|
|
128
|
-
* @returns {string}
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Formats a role id into a role mention.
|
|
133
|
-
* @method roleMention
|
|
134
|
-
* @param {Snowflake} roleId The role id to format
|
|
135
|
-
* @returns {string}
|
|
136
|
-
*/
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Formats an emoji id into a fully qualified emoji identifier.
|
|
140
|
-
* @method formatEmoji
|
|
141
|
-
* @param {Snowflake} emojiId The emoji id to format
|
|
142
|
-
* @param {boolean} [animated=false] Whether the emoji is animated
|
|
143
|
-
* @returns {string}
|
|
144
|
-
*/
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Formats a channel link for a channel.
|
|
148
|
-
* @method channelLink
|
|
149
|
-
* @param {Snowflake} channelId The id of the channel
|
|
150
|
-
* @param {Snowflake} [guildId] The id of the guild
|
|
151
|
-
* @returns {string}
|
|
152
|
-
*/
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Formats a message link for a channel.
|
|
156
|
-
* @method messageLink
|
|
157
|
-
* @param {Snowflake} channelId The id of the channel
|
|
158
|
-
* @param {Snowflake} messageId The id of the message
|
|
159
|
-
* @param {Snowflake} [guildId] The id of the guild
|
|
160
|
-
* @returns {string}
|
|
161
|
-
*/
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* A message formatting timestamp style, as defined in
|
|
165
|
-
* [here](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles).
|
|
166
|
-
* * `t` Short time format, consisting of hours and minutes, e.g. 16:20.
|
|
167
|
-
* * `T` Long time format, consisting of hours, minutes, and seconds, e.g. 16:20:30.
|
|
168
|
-
* * `d` Short date format, consisting of day, month, and year, e.g. 20/04/2021.
|
|
169
|
-
* * `D` Long date format, consisting of day, month, and year, e.g. 20 April 2021.
|
|
170
|
-
* * `f` Short date-time format, consisting of short date and short time formats, e.g. 20 April 2021 16:20.
|
|
171
|
-
* * `F` Long date-time format, consisting of long date and short time formats, e.g. Tuesday, 20 April 2021 16:20.
|
|
172
|
-
* * `R` Relative time format, consisting of a relative duration format, e.g. 2 months ago.
|
|
173
|
-
* @typedef {string} TimestampStylesString
|
|
174
|
-
*/
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Formats a date into a short date-time string.
|
|
178
|
-
* @method time
|
|
179
|
-
* @param {number|Date} [date] The date to format
|
|
180
|
-
* @param {TimestampStylesString} [style] The style to use
|
|
181
|
-
* @returns {string}
|
|
182
|
-
*/
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Contains various Discord-specific functions for formatting messages.
|
|
186
|
-
* @deprecated This class is redundant as all methods of the class can be imported from discord.js directly.
|
|
187
|
-
*/
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
188
65
|
class Formatters extends null {
|
|
189
|
-
|
|
190
|
-
* Formats the content into a block quote.
|
|
191
|
-
* <info>This needs to be at the start of the line for Discord to format it.</info>
|
|
192
|
-
* @method blockQuote
|
|
193
|
-
* @memberof Formatters
|
|
194
|
-
* @param {string} content The content to wrap
|
|
195
|
-
* @returns {string}
|
|
196
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
197
|
-
*/
|
|
66
|
+
|
|
198
67
|
static blockQuote = deprecate(
|
|
199
68
|
blockQuote,
|
|
200
69
|
'Formatters.blockQuote() is deprecated. Import this method directly from discord.js instead.',
|
|
201
70
|
);
|
|
202
71
|
|
|
203
|
-
|
|
204
|
-
* Formats the content into bold text.
|
|
205
|
-
* @method bold
|
|
206
|
-
* @memberof Formatters
|
|
207
|
-
* @param {string} content The content to wrap
|
|
208
|
-
* @returns {string}
|
|
209
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
210
|
-
*/
|
|
72
|
+
|
|
211
73
|
static bold = deprecate(
|
|
212
74
|
bold,
|
|
213
75
|
'Formatters.bold() is deprecated. Import this method directly from discord.js instead.',
|
|
214
76
|
);
|
|
215
77
|
|
|
216
|
-
|
|
217
|
-
* Formats a channel id into a channel mention.
|
|
218
|
-
* @method channelMention
|
|
219
|
-
* @memberof Formatters
|
|
220
|
-
* @param {Snowflake} channelId The channel id to format
|
|
221
|
-
* @returns {string}
|
|
222
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
223
|
-
*/
|
|
78
|
+
|
|
224
79
|
static channelMention = deprecate(
|
|
225
80
|
channelMention,
|
|
226
81
|
'Formatters.channelMention() is deprecated. Import this method directly from discord.js instead.',
|
|
227
82
|
);
|
|
228
83
|
|
|
229
|
-
|
|
230
|
-
* Wraps the content inside a code block with an optional language.
|
|
231
|
-
* @method codeBlock
|
|
232
|
-
* @memberof Formatters
|
|
233
|
-
* @param {string} contentOrLanguage The language to use or content if a second parameter isn't provided
|
|
234
|
-
* @param {string} [content] The content to wrap
|
|
235
|
-
* @returns {string}
|
|
236
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
237
|
-
*/
|
|
84
|
+
|
|
238
85
|
static codeBlock = deprecate(
|
|
239
86
|
codeBlock,
|
|
240
87
|
'Formatters.codeBlock() is deprecated. Import this method directly from discord.js instead.',
|
|
241
88
|
);
|
|
242
89
|
|
|
243
|
-
|
|
244
|
-
* Formats an emoji id into a fully qualified emoji identifier.
|
|
245
|
-
* @method formatEmoji
|
|
246
|
-
* @memberof Formatters
|
|
247
|
-
* @param {string} emojiId The emoji id to format
|
|
248
|
-
* @param {boolean} [animated=false] Whether the emoji is animated
|
|
249
|
-
* @returns {string}
|
|
250
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
251
|
-
*/
|
|
90
|
+
|
|
252
91
|
static formatEmoji = deprecate(
|
|
253
92
|
formatEmoji,
|
|
254
93
|
'Formatters.formatEmoji() is deprecated. Import this method directly from discord.js instead.',
|
|
255
94
|
);
|
|
256
95
|
|
|
257
|
-
|
|
258
|
-
* Wraps the URL into `<>`, which stops it from embedding.
|
|
259
|
-
* @method hideLinkEmbed
|
|
260
|
-
* @memberof Formatters
|
|
261
|
-
* @param {string} content The content to wrap
|
|
262
|
-
* @returns {string}
|
|
263
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
264
|
-
*/
|
|
96
|
+
|
|
265
97
|
static hideLinkEmbed = deprecate(
|
|
266
98
|
hideLinkEmbed,
|
|
267
99
|
'Formatters.hideLinkEmbed() is deprecated. Import this method directly from discord.js instead.',
|
|
268
100
|
);
|
|
269
101
|
|
|
270
|
-
|
|
271
|
-
* Formats the content and the URL into a masked URL with an optional title.
|
|
272
|
-
* @method hyperlink
|
|
273
|
-
* @memberof Formatters
|
|
274
|
-
* @param {string} content The content to display
|
|
275
|
-
* @param {string} url The URL the content links to
|
|
276
|
-
* @param {string} [title] The title shown when hovering on the masked link
|
|
277
|
-
* @returns {string}
|
|
278
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
279
|
-
*/
|
|
102
|
+
|
|
280
103
|
static hyperlink = deprecate(
|
|
281
104
|
hyperlink,
|
|
282
105
|
'Formatters.hyperlink() is deprecated. Import this method directly from discord.js instead.',
|
|
283
106
|
);
|
|
284
107
|
|
|
285
|
-
|
|
286
|
-
* Wraps the content inside \`backticks\`, which formats it as inline code.
|
|
287
|
-
* @method inlineCode
|
|
288
|
-
* @memberof Formatters
|
|
289
|
-
* @param {string} content The content to wrap
|
|
290
|
-
* @returns {string}
|
|
291
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
292
|
-
*/
|
|
108
|
+
|
|
293
109
|
static inlineCode = deprecate(
|
|
294
110
|
inlineCode,
|
|
295
111
|
'Formatters.inlineCode() is deprecated. Import this method directly from discord.js instead.',
|
|
296
112
|
);
|
|
297
113
|
|
|
298
|
-
|
|
299
|
-
* Formats the content into italic text.
|
|
300
|
-
* @method italic
|
|
301
|
-
* @memberof Formatters
|
|
302
|
-
* @param {string} content The content to wrap
|
|
303
|
-
* @returns {string}
|
|
304
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
305
|
-
*/
|
|
114
|
+
|
|
306
115
|
static italic = deprecate(
|
|
307
116
|
italic,
|
|
308
117
|
'Formatters.italic() is deprecated. Import this method directly from discord.js instead.',
|
|
309
118
|
);
|
|
310
119
|
|
|
311
|
-
|
|
312
|
-
* Formats the content into a quote. This needs to be at the start of the line for Discord to format it.
|
|
313
|
-
* @method quote
|
|
314
|
-
* @memberof Formatters
|
|
315
|
-
* @param {string} content The content to wrap
|
|
316
|
-
* @returns {string}
|
|
317
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
318
|
-
*/
|
|
120
|
+
|
|
319
121
|
static quote = deprecate(
|
|
320
122
|
quote,
|
|
321
123
|
'Formatters.quote() is deprecated. Import this method directly from discord.js instead.',
|
|
322
124
|
);
|
|
323
125
|
|
|
324
|
-
|
|
325
|
-
* Formats a role id into a role mention.
|
|
326
|
-
* @method roleMention
|
|
327
|
-
* @memberof Formatters
|
|
328
|
-
* @param {Snowflake} roleId The role id to format
|
|
329
|
-
* @returns {string}
|
|
330
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
331
|
-
*/
|
|
126
|
+
|
|
332
127
|
static roleMention = deprecate(
|
|
333
128
|
roleMention,
|
|
334
129
|
'Formatters.roleMention() is deprecated. Import this method directly from discord.js instead.',
|
|
335
130
|
);
|
|
336
131
|
|
|
337
|
-
|
|
338
|
-
* Formats the content into spoiler text.
|
|
339
|
-
* @method spoiler
|
|
340
|
-
* @memberof Formatters
|
|
341
|
-
* @param {string} content The content to spoiler
|
|
342
|
-
* @returns {string}
|
|
343
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
344
|
-
*/
|
|
132
|
+
|
|
345
133
|
static spoiler = deprecate(
|
|
346
134
|
spoiler,
|
|
347
135
|
'Formatters.spoiler() is deprecated. Import this method directly from discord.js instead.',
|
|
348
136
|
);
|
|
349
137
|
|
|
350
|
-
|
|
351
|
-
* Formats the content into strike-through text.
|
|
352
|
-
* @method strikethrough
|
|
353
|
-
* @memberof Formatters
|
|
354
|
-
* @param {string} content The content to wrap
|
|
355
|
-
* @returns {string}
|
|
356
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
357
|
-
*/
|
|
138
|
+
|
|
358
139
|
static strikethrough = deprecate(
|
|
359
140
|
strikethrough,
|
|
360
141
|
'Formatters.strikethrough() is deprecated. Import this method directly from discord.js instead.',
|
|
361
142
|
);
|
|
362
143
|
|
|
363
|
-
|
|
364
|
-
* Formats a date into a short date-time string.
|
|
365
|
-
* @method time
|
|
366
|
-
* @memberof Formatters
|
|
367
|
-
* @param {number|Date} [date] The date to format
|
|
368
|
-
* @param {TimestampStylesString} [style] The style to use
|
|
369
|
-
* @returns {string}
|
|
370
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
371
|
-
*/
|
|
144
|
+
|
|
372
145
|
static time = deprecate(
|
|
373
146
|
time,
|
|
374
147
|
'Formatters.time() is deprecated. Import this method directly from discord.js instead.',
|
|
375
148
|
);
|
|
376
149
|
|
|
377
|
-
|
|
378
|
-
* The message formatting timestamp
|
|
379
|
-
* [styles](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles) supported by Discord.
|
|
380
|
-
* @type {Object<string, TimestampStylesString>}
|
|
381
|
-
* @memberof Formatters
|
|
382
|
-
* @deprecated Import this property directly from discord.js instead.
|
|
383
|
-
*/
|
|
150
|
+
|
|
384
151
|
static TimestampStyles = TimestampStyles;
|
|
385
152
|
|
|
386
|
-
|
|
387
|
-
* Formats the content into underscored text.
|
|
388
|
-
* @method underscore
|
|
389
|
-
* @memberof Formatters
|
|
390
|
-
* @param {string} content The content to wrap
|
|
391
|
-
* @returns {string}
|
|
392
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
393
|
-
*/
|
|
153
|
+
|
|
394
154
|
static underscore = deprecate(
|
|
395
155
|
underscore,
|
|
396
156
|
'Formatters.underscore() is deprecated. Import this method directly from discord.js instead.',
|
|
397
157
|
);
|
|
398
158
|
|
|
399
|
-
|
|
400
|
-
* Formats a user id into a user mention.
|
|
401
|
-
* @method userMention
|
|
402
|
-
* @memberof Formatters
|
|
403
|
-
* @param {Snowflake} userId The user id to format
|
|
404
|
-
* @returns {string}
|
|
405
|
-
* @deprecated Import this method directly from discord.js instead.
|
|
406
|
-
*/
|
|
159
|
+
|
|
407
160
|
static userMention = deprecate(
|
|
408
161
|
userMention,
|
|
409
162
|
'Formatters.userMention() is deprecated. Import this method directly from discord.js instead.',
|