@sapphire/discord.js-utilities 7.3.3-next.ab1708e3 → 7.3.3-next.beeba83b
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/dist/cjs/index.cjs +28 -28
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +5 -5
- package/dist/esm/index.d.mts +5 -5
- package/dist/esm/index.mjs +30 -30
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -311,7 +311,7 @@ var _MessagePrompterBaseStrategy = class _MessagePrompterBaseStrategy {
|
|
|
311
311
|
this.type = type;
|
|
312
312
|
this.timeout = options?.timeout ?? _MessagePrompterBaseStrategy.defaultStrategyOptions.timeout ?? 10 * 1e3;
|
|
313
313
|
this.explicitReturn = options?.explicitReturn ?? _MessagePrompterBaseStrategy.defaultStrategyOptions.explicitReturn ?? false;
|
|
314
|
-
this.editMessage = options?.editMessage ?? _MessagePrompterBaseStrategy.defaultStrategyOptions.editMessage ??
|
|
314
|
+
this.editMessage = options?.editMessage ?? _MessagePrompterBaseStrategy.defaultStrategyOptions.editMessage ?? void 0;
|
|
315
315
|
this.message = message;
|
|
316
316
|
}
|
|
317
317
|
async collectReactions(channel, authorOrFilter, reactions) {
|
|
@@ -372,7 +372,7 @@ __name(_MessagePrompterBaseStrategy, "MessagePrompterBaseStrategy");
|
|
|
372
372
|
__publicField(_MessagePrompterBaseStrategy, "defaultStrategyOptions", {
|
|
373
373
|
timeout: 10 * 1e3,
|
|
374
374
|
explicitReturn: false,
|
|
375
|
-
editMessage:
|
|
375
|
+
editMessage: void 0
|
|
376
376
|
});
|
|
377
377
|
var MessagePrompterBaseStrategy = _MessagePrompterBaseStrategy;
|
|
378
378
|
|
|
@@ -848,7 +848,7 @@ var _PaginatedMessage = class _PaginatedMessage {
|
|
|
848
848
|
* @returns The resolved template as a BaseMessageOptions object.
|
|
849
849
|
*/
|
|
850
850
|
static resolveTemplate(template) {
|
|
851
|
-
if (template ===
|
|
851
|
+
if (template === void 0) {
|
|
852
852
|
return {};
|
|
853
853
|
}
|
|
854
854
|
if (discord_js.isJSONEncodable(template)) {
|
|
@@ -1507,7 +1507,7 @@ var _PaginatedMessage = class _PaginatedMessage {
|
|
|
1507
1507
|
await safelyReplyToInteraction({
|
|
1508
1508
|
messageOrInteraction,
|
|
1509
1509
|
interactionEditReplyContent: __privateGet(this, _thisMazeWasNotMeantForYouContent),
|
|
1510
|
-
interactionReplyContent: { ...__privateGet(this, _thisMazeWasNotMeantForYouContent),
|
|
1510
|
+
interactionReplyContent: { ...__privateGet(this, _thisMazeWasNotMeantForYouContent), flags: discord_js.MessageFlags.Ephemeral },
|
|
1511
1511
|
componentUpdateContent: __privateGet(this, _thisMazeWasNotMeantForYouContent),
|
|
1512
1512
|
messageMethod: "reply",
|
|
1513
1513
|
messageMethodContent: __privateGet(this, _thisMazeWasNotMeantForYouContent)
|
|
@@ -1614,7 +1614,7 @@ var _PaginatedMessage = class _PaginatedMessage {
|
|
|
1614
1614
|
if (this.response.replied || this.response.deferred) {
|
|
1615
1615
|
await this.response.editReply(page);
|
|
1616
1616
|
} else {
|
|
1617
|
-
await this.response.reply({ ...page, content: page.content ??
|
|
1617
|
+
await this.response.reply({ ...page, content: page.content ?? void 0 });
|
|
1618
1618
|
}
|
|
1619
1619
|
} else if (isMessageInstance(this.response)) {
|
|
1620
1620
|
await this.response.edit(page);
|
|
@@ -1626,13 +1626,13 @@ var _PaginatedMessage = class _PaginatedMessage {
|
|
|
1626
1626
|
} else {
|
|
1627
1627
|
this.response = await messageOrInteraction.reply({
|
|
1628
1628
|
...page,
|
|
1629
|
-
content: page.content ??
|
|
1629
|
+
content: page.content ?? void 0,
|
|
1630
1630
|
fetchReply: true,
|
|
1631
1631
|
ephemeral: false
|
|
1632
1632
|
});
|
|
1633
1633
|
}
|
|
1634
1634
|
} else if (isTextBasedChannel(messageOrInteraction.channel)) {
|
|
1635
|
-
this.response = await messageOrInteraction.channel.send({ ...page, content: page.content ??
|
|
1635
|
+
this.response = await messageOrInteraction.channel.send({ ...page, content: page.content ?? void 0 });
|
|
1636
1636
|
}
|
|
1637
1637
|
}
|
|
1638
1638
|
/**
|
|
@@ -1654,7 +1654,7 @@ var _PaginatedMessage = class _PaginatedMessage {
|
|
|
1654
1654
|
return false;
|
|
1655
1655
|
}, "filter"),
|
|
1656
1656
|
time: this.idle,
|
|
1657
|
-
guild: isGuildBasedChannel(messageOrInteraction.channel) ? messageOrInteraction.channel.guild :
|
|
1657
|
+
guild: isGuildBasedChannel(messageOrInteraction.channel) ? messageOrInteraction.channel.guild : void 0,
|
|
1658
1658
|
channel: messageOrInteraction.channel,
|
|
1659
1659
|
interactionType: discord_js.InteractionType.MessageComponent,
|
|
1660
1660
|
...!utilities.isNullish(this.response) && !isAnyInteraction(this.response) ? {
|
|
@@ -1752,7 +1752,7 @@ var _PaginatedMessage = class _PaginatedMessage {
|
|
|
1752
1752
|
await safelyReplyToInteraction({
|
|
1753
1753
|
messageOrInteraction: interaction,
|
|
1754
1754
|
interactionEditReplyContent: updateOptions,
|
|
1755
|
-
interactionReplyContent: { ...__privateGet(this, _thisMazeWasNotMeantForYouContent),
|
|
1755
|
+
interactionReplyContent: { ...__privateGet(this, _thisMazeWasNotMeantForYouContent), flags: discord_js.MessageFlags.Ephemeral },
|
|
1756
1756
|
componentUpdateContent: updateOptions
|
|
1757
1757
|
});
|
|
1758
1758
|
}
|
|
@@ -1764,7 +1764,7 @@ var _PaginatedMessage = class _PaginatedMessage {
|
|
|
1764
1764
|
this.resolvePaginatedMessageInternationalizationContext(interaction, targetUser)
|
|
1765
1765
|
);
|
|
1766
1766
|
await interaction.reply(
|
|
1767
|
-
utilities.isObject(interactionReplyOptions) ? interactionReplyOptions : { content: interactionReplyOptions,
|
|
1767
|
+
utilities.isObject(interactionReplyOptions) ? interactionReplyOptions : { content: interactionReplyOptions, flags: discord_js.MessageFlags.Ephemeral, allowedMentions: { users: [], roles: [] } }
|
|
1768
1768
|
);
|
|
1769
1769
|
}
|
|
1770
1770
|
}
|
|
@@ -1781,7 +1781,7 @@ var _PaginatedMessage = class _PaginatedMessage {
|
|
|
1781
1781
|
void safelyReplyToInteraction({
|
|
1782
1782
|
messageOrInteraction: this.response,
|
|
1783
1783
|
interactionEditReplyContent: { components: [] },
|
|
1784
|
-
interactionReplyContent: { ...__privateGet(this, _thisMazeWasNotMeantForYouContent),
|
|
1784
|
+
interactionReplyContent: { ...__privateGet(this, _thisMazeWasNotMeantForYouContent), flags: discord_js.MessageFlags.Ephemeral },
|
|
1785
1785
|
componentUpdateContent: { components: [] },
|
|
1786
1786
|
messageMethod: "edit",
|
|
1787
1787
|
messageMethodContent: { components: [] }
|
|
@@ -1826,8 +1826,8 @@ var _PaginatedMessage = class _PaginatedMessage {
|
|
|
1826
1826
|
user: targetUser,
|
|
1827
1827
|
channel: messageOrInteraction.channel,
|
|
1828
1828
|
guild: isGuildBasedChannel(messageOrInteraction.channel) ? messageOrInteraction.channel.guild : null,
|
|
1829
|
-
interactionGuildLocale: isAnyInteraction(messageOrInteraction) ? messageOrInteraction.guildLocale :
|
|
1830
|
-
interactionLocale: isAnyInteraction(messageOrInteraction) ? messageOrInteraction.locale :
|
|
1829
|
+
interactionGuildLocale: isAnyInteraction(messageOrInteraction) ? messageOrInteraction.guildLocale : void 0,
|
|
1830
|
+
interactionLocale: isAnyInteraction(messageOrInteraction) ? messageOrInteraction.locale : void 0
|
|
1831
1831
|
};
|
|
1832
1832
|
return context;
|
|
1833
1833
|
}
|
|
@@ -1854,7 +1854,7 @@ var _PaginatedMessage = class _PaginatedMessage {
|
|
|
1854
1854
|
*/
|
|
1855
1855
|
applyTemplateEmbed(templateEmbed, pageEmbeds) {
|
|
1856
1856
|
if (utilities.isNullish(pageEmbeds)) {
|
|
1857
|
-
return templateEmbed ? [templateEmbed?.[0]] :
|
|
1857
|
+
return templateEmbed ? [templateEmbed?.[0]] : void 0;
|
|
1858
1858
|
}
|
|
1859
1859
|
if (utilities.isNullish(templateEmbed)) {
|
|
1860
1860
|
return pageEmbeds;
|
|
@@ -1874,17 +1874,17 @@ var _PaginatedMessage = class _PaginatedMessage {
|
|
|
1874
1874
|
for (const pageEmbed of pageEmbeds) {
|
|
1875
1875
|
const pageJson = discord_js.isJSONEncodable(pageEmbed) ? pageEmbed.toJSON() : pageEmbed;
|
|
1876
1876
|
mergedEmbeds.push({
|
|
1877
|
-
title: pageJson.title ?? jsonTemplate.title ??
|
|
1878
|
-
description: pageJson.description ?? jsonTemplate.description ??
|
|
1879
|
-
url: pageJson.url ?? jsonTemplate.url ??
|
|
1880
|
-
timestamp: (typeof pageJson.timestamp === "string" ? new Date(pageJson.timestamp).toISOString() : pageJson.timestamp) ?? (typeof jsonTemplate.timestamp === "string" ? new Date(jsonTemplate.timestamp).toISOString() : jsonTemplate.timestamp) ??
|
|
1881
|
-
color: pageJson.color ?? jsonTemplate.color ??
|
|
1877
|
+
title: pageJson.title ?? jsonTemplate.title ?? void 0,
|
|
1878
|
+
description: pageJson.description ?? jsonTemplate.description ?? void 0,
|
|
1879
|
+
url: pageJson.url ?? jsonTemplate.url ?? void 0,
|
|
1880
|
+
timestamp: (typeof pageJson.timestamp === "string" ? new Date(pageJson.timestamp).toISOString() : pageJson.timestamp) ?? (typeof jsonTemplate.timestamp === "string" ? new Date(jsonTemplate.timestamp).toISOString() : jsonTemplate.timestamp) ?? void 0,
|
|
1881
|
+
color: pageJson.color ?? jsonTemplate.color ?? void 0,
|
|
1882
1882
|
fields: this.mergeArrays(jsonTemplate.fields, pageJson.fields),
|
|
1883
|
-
author: pageJson.author ?? jsonTemplate.author ??
|
|
1884
|
-
thumbnail: pageJson.thumbnail ?? jsonTemplate.thumbnail ??
|
|
1885
|
-
image: pageJson.image ?? jsonTemplate.image ??
|
|
1886
|
-
video: pageJson.video ?? jsonTemplate.video ??
|
|
1887
|
-
footer: pageJson.footer ?? jsonTemplate.footer ??
|
|
1883
|
+
author: pageJson.author ?? jsonTemplate.author ?? void 0,
|
|
1884
|
+
thumbnail: pageJson.thumbnail ?? jsonTemplate.thumbnail ?? void 0,
|
|
1885
|
+
image: pageJson.image ?? jsonTemplate.image ?? void 0,
|
|
1886
|
+
video: pageJson.video ?? jsonTemplate.video ?? void 0,
|
|
1887
|
+
footer: pageJson.footer ?? jsonTemplate.footer ?? void 0
|
|
1888
1888
|
});
|
|
1889
1889
|
}
|
|
1890
1890
|
return mergedEmbeds;
|
|
@@ -2083,7 +2083,7 @@ __publicField(_PaginatedMessage, "selectMenuOptions", /* @__PURE__ */ __name((pa
|
|
|
2083
2083
|
* When modifying this it is recommended that the message is set to be ephemeral so only the user that is pressing the buttons can see them.
|
|
2084
2084
|
* Furthermore, we also recommend setting `allowedMentions: { users: [], roles: [] }`, so you don't have to worry about accidentally pinging anyone.
|
|
2085
2085
|
*
|
|
2086
|
-
* When setting just a string, we will add `{
|
|
2086
|
+
* When setting just a string, we will add `{ flags: MessageFlags.Ephemeral, allowedMentions: { users: [], roles: [] } }` for you.
|
|
2087
2087
|
*
|
|
2088
2088
|
* @param targetUser The {@link User} this {@link PaginatedMessage} was intended for.
|
|
2089
2089
|
* @param interactionUser The {@link User} that actually clicked the button.
|
|
@@ -2093,7 +2093,7 @@ __publicField(_PaginatedMessage, "selectMenuOptions", /* @__PURE__ */ __name((pa
|
|
|
2093
2093
|
*
|
|
2094
2094
|
* {
|
|
2095
2095
|
* content: `Please stop interacting with the components on this message. They are only for ${userMention(targetUser.id)}.`,
|
|
2096
|
-
*
|
|
2096
|
+
* flags: MessageFlags.Ephemeral,
|
|
2097
2097
|
* allowedMentions: { users: [], roles: [] }
|
|
2098
2098
|
* }
|
|
2099
2099
|
* ```
|
|
@@ -2118,14 +2118,14 @@ __publicField(_PaginatedMessage, "selectMenuOptions", /* @__PURE__ */ __name((pa
|
|
|
2118
2118
|
* content: `These buttons are only for ${userMention(
|
|
2119
2119
|
* targetUser.id
|
|
2120
2120
|
* )}. Press them as much as you want, but I won't do anything with your clicks.`,
|
|
2121
|
-
*
|
|
2121
|
+
* flags: MessageFlags.Ephemeral,
|
|
2122
2122
|
* allowedMentions: { users: [], roles: [] }
|
|
2123
2123
|
* });
|
|
2124
2124
|
* ```
|
|
2125
2125
|
*/
|
|
2126
2126
|
__publicField(_PaginatedMessage, "wrongUserInteractionReply", /* @__PURE__ */ __name((targetUser) => ({
|
|
2127
2127
|
content: `Please stop interacting with the components on this message. They are only for ${discord_js.userMention(targetUser.id)}.`,
|
|
2128
|
-
|
|
2128
|
+
flags: discord_js.MessageFlags.Ephemeral,
|
|
2129
2129
|
allowedMentions: { users: [], roles: [] }
|
|
2130
2130
|
}), "wrongUserInteractionReply"));
|
|
2131
2131
|
var PaginatedMessage = _PaginatedMessage;
|