@velanir/openclaw-participation-gate 0.1.0 → 0.1.1
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/index.js +5 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2149,6 +2149,9 @@ function messageText(event) {
|
|
|
2149
2149
|
function escapeRegExp(value) {
|
|
2150
2150
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2151
2151
|
}
|
|
2152
|
+
function decodeSlackMentions(content) {
|
|
2153
|
+
return content.replace(/<@[A-Z0-9]+>\s*\(([^)]+)\)/gi, (_match, displayName) => `@${displayName}`).replace(/<@[A-Z0-9]+\|([^>]+)>/gi, (_match, label) => `@${label}`).replace(/<@[A-Z0-9]+>/gi, " ");
|
|
2154
|
+
}
|
|
2152
2155
|
function namePattern(name) {
|
|
2153
2156
|
const trimmed = name.trim();
|
|
2154
2157
|
if (trimmed.length < 2) {
|
|
@@ -2289,8 +2292,8 @@ async function decideParticipation(params) {
|
|
|
2289
2292
|
if (params.event.isGroup !== true) {
|
|
2290
2293
|
return decision(true, "dm", "rule", startedAt);
|
|
2291
2294
|
}
|
|
2292
|
-
const content = messageText(params.event);
|
|
2293
|
-
if (!content) {
|
|
2295
|
+
const content = decodeSlackMentions(messageText(params.event));
|
|
2296
|
+
if (!content.trim()) {
|
|
2294
2297
|
return decision(true, "empty_message", "rule", startedAt);
|
|
2295
2298
|
}
|
|
2296
2299
|
const recentMessages = params.history.recent(
|
package/package.json
CHANGED