@helyx/bot 0.4.44 → 0.4.46
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/CHANGELOG.md +15 -0
- package/dist/events.js +4 -0
- package/dist/interactions.js +18 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.46
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add explicit role-mention allowlists and member-leave identity metadata to the
|
|
8
|
+
module runtime contract. Upgrade Welcome with multiline user, role and channel
|
|
9
|
+
placeholders, an inline dashboard test send, and independent member-left
|
|
10
|
+
logging.
|
|
11
|
+
|
|
12
|
+
## 0.4.45
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Expose bounded structural user mentions to guild message event contributions without exposing message content, and include AFK in the reviewed self-host catalogue.
|
|
17
|
+
|
|
3
18
|
## 0.4.44
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/events.js
CHANGED
|
@@ -343,6 +343,7 @@ export function installModuleEvents(client, modules, logger, services) {
|
|
|
343
343
|
const authorDisplayName = message.member?.displayName ??
|
|
344
344
|
message.author.globalName ??
|
|
345
345
|
message.author.username;
|
|
346
|
+
const mentionedUserIds = [...message.mentions.users.keys()].slice(0, 25);
|
|
346
347
|
let classifiedMessage;
|
|
347
348
|
for (const { moduleId, classificationRequested, contribution, } of guildMessageContributions) {
|
|
348
349
|
try {
|
|
@@ -362,6 +363,7 @@ export function installModuleEvents(client, modules, logger, services) {
|
|
|
362
363
|
authorIsBot: false,
|
|
363
364
|
authorIsWebhook: false,
|
|
364
365
|
authorIsSystem: false,
|
|
366
|
+
mentionedUserIds,
|
|
365
367
|
get classification() {
|
|
366
368
|
if (!classificationRequested || !messageClassificationAvailable)
|
|
367
369
|
return unavailableGuildMessageClassification;
|
|
@@ -523,7 +525,9 @@ export function installModuleEvents(client, modules, logger, services) {
|
|
|
523
525
|
}
|
|
524
526
|
await contribution.execute({
|
|
525
527
|
serverId: member.guild.id,
|
|
528
|
+
serverName: member.guild.name,
|
|
526
529
|
memberId: member.id,
|
|
530
|
+
memberDisplayName: member.displayName,
|
|
527
531
|
memberIsBot: member.user.bot,
|
|
528
532
|
accountCreatedAt: member.user.createdAt,
|
|
529
533
|
joinedAt: member.joinedAt,
|
package/dist/interactions.js
CHANGED
|
@@ -1003,7 +1003,7 @@ export function normalizeDiscordPermission(permission) {
|
|
|
1003
1003
|
return permission.replaceAll(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
|
|
1004
1004
|
}
|
|
1005
1005
|
export function toReplyOptions(response) {
|
|
1006
|
-
const allowedMentions =
|
|
1006
|
+
const allowedMentions = toAllowedMentions(response.allowedUserMentionIds, response.allowedRoleMentionIds);
|
|
1007
1007
|
const selectRows = toSelectRows(response);
|
|
1008
1008
|
if (response.componentsV2) {
|
|
1009
1009
|
if (response.content !== undefined) {
|
|
@@ -1154,15 +1154,25 @@ export function toUpdateOptions(response) {
|
|
|
1154
1154
|
ephemeral: false,
|
|
1155
1155
|
});
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1158
|
-
if (userIds === undefined)
|
|
1157
|
+
function toAllowedMentions(userIds, roleIds) {
|
|
1158
|
+
if (userIds === undefined && roleIds === undefined)
|
|
1159
1159
|
return undefined;
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1160
|
+
validateAllowedMentionIds(userIds, "user");
|
|
1161
|
+
validateAllowedMentionIds(roleIds, "role");
|
|
1162
|
+
return {
|
|
1163
|
+
parse: [],
|
|
1164
|
+
...(userIds === undefined ? {} : { users: [...userIds] }),
|
|
1165
|
+
...(roleIds === undefined ? {} : { roles: [...roleIds] }),
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
function validateAllowedMentionIds(ids, label) {
|
|
1169
|
+
if (ids === undefined)
|
|
1170
|
+
return;
|
|
1171
|
+
if (ids.length > 100 ||
|
|
1172
|
+
new Set(ids).size !== ids.length ||
|
|
1173
|
+
ids.some((id) => !/^\d{17,20}$/u.test(id))) {
|
|
1174
|
+
throw new Error(`Allowed ${label} mentions must be unique Discord snowflakes`);
|
|
1164
1175
|
}
|
|
1165
|
-
return { parse: [], users: [...userIds] };
|
|
1166
1176
|
}
|
|
1167
1177
|
function toButtonEmoji(emojiIdentifier) {
|
|
1168
1178
|
const custom = /^([A-Za-z0-9_]{2,32}):(\d{17,20})$/u.exec(emojiIdentifier);
|