@openclaw/discord 2026.5.12 → 2026.5.14-beta.2
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/{account-inspect-D7jL5YDH.js → account-inspect-B_N30NV0.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-BcwyaFd-.js → accounts-DnNVBDfc.js} +95 -4
- package/dist/action-runtime-api.js +1 -1
- package/dist/{allow-list-n8Ki-Rt3.js → allow-list-CBI-M84K.js} +24 -2
- package/dist/api.js +19 -21
- package/dist/{approval-handler.runtime-S-ircYcz.js → approval-handler.runtime-Uco62pII.js} +4 -4
- package/dist/{audit-BliEqCEc.js → audit-eSlKbMHw.js} +5 -5
- package/dist/{channel-Bliqi-Qi.js → channel-BjBa8nYY.js} +23 -25
- package/dist/{channel-actions-Cn_K00Vy.js → channel-actions-DANVAtKL.js} +4 -4
- package/dist/{channel-actions.runtime-DcsRvPnx.js → channel-actions.runtime-CpIslHS9.js} +7 -5
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-DR-xVYso.js → channel.setup-DBFcGRFD.js} +4 -5
- package/dist/{components-Dxq2mU57.js → components-Cgm7XT8-.js} +120 -3
- package/dist/{config-schema-D2KGskAp.js → config-schema-D7AtCpJa.js} +21 -1
- package/dist/contract-api.js +7 -7
- package/dist/{approval-native-Gtqpyfdj.js → conversation-identity-C3AI-1tz.js} +123 -6
- package/dist/{directory-config-CDl4JTCA.js → directory-config-CW_JusGS.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/directory-live-MrDSKsMf.js +159 -0
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{doctor-contract-BGjjFBdq.js → doctor-contract-ftWAMvBl.js} +1 -1
- package/dist/{doctor-jcX_qXsS.js → doctor-mn2XyjuF.js} +5 -5
- package/dist/{handle-action.guild-admin-C4phin-a.js → handle-action.guild-admin-DriifPwO.js} +1 -1
- package/dist/{inbound-context-jtKcY9on.js → inbound-context-DD7n3Q6U.js} +1 -1
- package/dist/{manager.runtime-DqMGETqp.js → manager.runtime-DauS2xA3.js} +107 -25
- package/dist/{message-handler-DIsnboy2.js → message-handler-CMHwRlxG.js} +7 -7
- package/dist/{message-handler.preflight-BRH-dv1o.js → message-handler.preflight-C0sT-ewp.js} +27 -17
- package/dist/{message-handler.process-Bs5wropA.js → message-handler.process-Cy7_-0H0.js} +46 -37
- package/dist/{message-utils-ByofKwPe.js → message-utils-N5UTOXQ2.js} +16 -12
- package/dist/{outbound-adapter-lWjkSeyP.js → outbound-adapter-Cw9JsRTY.js} +7 -10
- package/dist/{pluralkit-B1HTaBc9.js → pluralkit-B2AqgTHV.js} +1 -1
- package/dist/{preflight-audio-CD97vnac.js → preflight-audio-DFGpAvzi.js} +1 -1
- package/dist/{probe-BZtr8qle.js → probe-CiBYm-vD.js} +2 -2
- package/dist/{probe.runtime-0F0UzBoJ.js → probe.runtime-9hi1GYNU.js} +1 -1
- package/dist/{provider-DABvNRT0.js → provider-nzJg2k5t.js} +1039 -45
- package/dist/{provider-session.runtime-BZyP90-i.js → provider-session.runtime-DMxaLPB3.js} +3 -3
- package/dist/provider.runtime-S-wZdzK5.js +2 -0
- package/dist/{resolve-allowlist-common-CVHYb5Hb.js → resolve-allowlist-common-DybgkAjk.js} +3 -3
- package/dist/{resolve-channels-JNt3Ak6P.js → resolve-channels-u7_agBcm.js} +4 -4
- package/dist/{resolve-users-CrjbUxrL.js → resolve-users-Bc25I6OP.js} +3 -3
- package/dist/{runtime-CdnAT8R5.js → runtime-DL82ijB1.js} +102 -46
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +25 -26
- package/dist/runtime-api.lookup.js +6 -6
- package/dist/runtime-api.monitor-DbLcHuhE.js +5 -0
- package/dist/runtime-api.monitor.js +7 -8
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +5 -5
- package/dist/runtime-setter-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-BQ_sGK3J.js → security-audit-CLPZKYi4.js} +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-B7Gmz2DX.js → security-audit.runtime-CCm9leFJ.js} +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-DCFuSiBi.js → send-BqzTEkt9.js} +4 -6
- package/dist/{send.components-DxDqPJZQ.js → send.components-D6pXHVrU.js} +8 -10
- package/dist/{send.outbound-PM0J0F60.js → send.outbound-D8o8BW6q.js} +91 -7
- package/dist/{discord-BqYcwxvG.js → send.receipt-nKLxvA1s.js} +319 -1
- package/dist/{send.shared-Dza0jdso.js → send.shared-DSpva7uA.js} +4 -6
- package/dist/{sender-identity-w9rSI-nD.js → sender-identity-BTGL3VbF.js} +1 -1
- package/dist/session-key-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-Yp_M6Cfp.js → shared-0kdaIxXP.js} +16 -14
- package/dist/{subagent-hooks-CtN-hfXy.js → subagent-hooks-DhuBhwRw.js} +3 -3
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-B04UOvPg.js → system-events-Bnit0zkQ.js} +2 -2
- package/dist/{target-resolver-CgJei-kD.js → target-resolver-BsGT9hI7.js} +3 -6
- package/dist/targets-DwW6OieO.js +3 -0
- package/dist/test-api.js +4 -4
- package/dist/{thread-bindings-B4of4OmR.js → thread-bindings-C1f7Iim4.js} +6 -7
- package/dist/{thread-bindings.discord-api-BAw15EQb.js → thread-bindings.discord-api-DJACBZJ1.js} +67 -8
- package/dist/{thread-bindings.manager-DNFl10CA.js → thread-bindings.manager-DN_q0IW7.js} +4 -5
- package/dist/{thread-bindings.session-updates-D18cCLmN.js → thread-bindings.session-updates-ZnRRzzgf.js} +1 -1
- package/dist/timeouts.js +1 -1
- package/dist/{typing-_jePdFIw.js → typing-C_8U8J7E.js} +2 -2
- package/openclaw.plugin.json +68 -0
- package/package.json +6 -6
- package/dist/access-Dxmzr0ix.js +0 -89
- package/dist/approval-shared-BFnWKSQD.js +0 -93
- package/dist/channel-access-BL-wemES.js +0 -62
- package/dist/chunk-DYl-_5RL.js +0 -179
- package/dist/conversation-identity-CvIx6J7M.js +0 -31
- package/dist/directory-cache-Ddl-Oxue.js +0 -62
- package/dist/directory-live-ApUXOSj0.js +0 -101
- package/dist/doctor-shared-D_QLzu30.js +0 -4
- package/dist/format-D8TsaXxW.js +0 -24
- package/dist/mentions-BZoGn0ul.js +0 -88
- package/dist/normalize-Cu94FOqy.js +0 -58
- package/dist/outbound-session-route-BaJRt05p.js +0 -43
- package/dist/provider.runtime-Cmv1SFtb.js +0 -2
- package/dist/reply-delivery-CUSK6SA_.js +0 -191
- package/dist/route-resolution-BFfF9xmG.js +0 -268
- package/dist/runtime-api.monitor-W_dJ5EQu.js +0 -6
- package/dist/send.receipt-BAZw2Zsz.js +0 -35
- package/dist/shared-interactive-DavY6jYt.js +0 -79
- package/dist/target-parsing-D-H7nnh2.js +0 -51
- package/dist/targets-DToZUkgV.js +0 -3
- package/dist/threading-CLZ3v7-y.js +0 -475
- package/dist/token-BZtonk7d.js +0 -93
- /package/dist/{agent-components.runtime-zT8qPsnM.js → agent-components.runtime-CEMbMQcQ.js} +0 -0
- /package/dist/{api-DzNBVTto.js → api-DgQLz1wq.js} +0 -0
- /package/dist/{audit-core-BgDZSkIR.js → audit-core-DRyoXREU.js} +0 -0
- /package/dist/{channel-api-CTSWMrnD.js → channel-api-JudoSiJv.js} +0 -0
- /package/dist/{config-api-CFZtoMaS.js → config-api-oLS_52S7.js} +0 -0
- /package/dist/{gateway-registry-BKG4KIVC.js → gateway-registry-BKSpa4GB.js} +0 -0
- /package/dist/{preflight-audio.runtime-fXnUxxBa.js → preflight-audio.runtime-Drc-OFcp.js} +0 -0
- /package/dist/{preview-streaming-DCPAe24T.js → preview-streaming-CXTZydhx.js} +0 -0
- /package/dist/{runtime-BqCoo-zp.js → runtime-Tqtvj5GX.js} +0 -0
- /package/dist/{secret-config-contract-BCQNNS7N.js → secret-config-contract-B3347_eU.js} +0 -0
- /package/dist/{security-contract-DkCMKSvb.js → security-contract-DyCRvz_Q.js} +0 -0
- /package/dist/{security-doctor-BJH5YIGL.js → security-doctor-Cp-NqNdS.js} +0 -0
- /package/dist/{session-contract-D871HDFG.js → session-contract-ugfEa9Xc.js} +0 -0
- /package/dist/{session-key-normalization-BV82IME9.js → session-key-normalization-B7h83qD2.js} +0 -0
- /package/dist/{thread-bindings.state-SPlv6mh7.js → thread-bindings.state-BdBeo7Rx.js} +0 -0
- /package/dist/{timeouts-C3FYXWJX.js → timeouts-snXNwR4m.js} +0 -0
package/dist/chunk-DYl-_5RL.js
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { chunkMarkdownTextWithMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
2
|
-
//#region extensions/discord/src/chunk.ts
|
|
3
|
-
const DEFAULT_MAX_CHARS = 2e3;
|
|
4
|
-
const DEFAULT_MAX_LINES = 17;
|
|
5
|
-
const FENCE_RE = /^( {0,3})(`{3,}|~{3,})(.*)$/;
|
|
6
|
-
const CJK_PUNCTUATION_BREAK_AFTER_RE = /[、。,.!?;:)]}〉》」』】〕〗〙]/u;
|
|
7
|
-
function countLines(text) {
|
|
8
|
-
if (!text) return 0;
|
|
9
|
-
return text.split("\n").length;
|
|
10
|
-
}
|
|
11
|
-
function parseFenceLine(line) {
|
|
12
|
-
const match = line.match(FENCE_RE);
|
|
13
|
-
if (!match) return null;
|
|
14
|
-
const indent = match[1] ?? "";
|
|
15
|
-
const marker = match[2] ?? "";
|
|
16
|
-
return {
|
|
17
|
-
indent,
|
|
18
|
-
markerChar: marker[0] ?? "`",
|
|
19
|
-
markerLen: marker.length,
|
|
20
|
-
openLine: line
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function closeFenceLine(openFence) {
|
|
24
|
-
return `${openFence.indent}${openFence.markerChar.repeat(openFence.markerLen)}`;
|
|
25
|
-
}
|
|
26
|
-
function closeFenceIfNeeded(text, openFence) {
|
|
27
|
-
if (!openFence) return text;
|
|
28
|
-
const closeLine = closeFenceLine(openFence);
|
|
29
|
-
if (!text) return closeLine;
|
|
30
|
-
if (!text.endsWith("\n")) return `${text}\n${closeLine}`;
|
|
31
|
-
return `${text}${closeLine}`;
|
|
32
|
-
}
|
|
33
|
-
function isHighSurrogate(code) {
|
|
34
|
-
return code >= 55296 && code <= 56319;
|
|
35
|
-
}
|
|
36
|
-
function isLowSurrogate(code) {
|
|
37
|
-
return code >= 56320 && code <= 57343;
|
|
38
|
-
}
|
|
39
|
-
function clampToCodePointBoundary(text, index) {
|
|
40
|
-
const boundary = Math.min(Math.max(0, index), text.length);
|
|
41
|
-
if (boundary <= 0 || boundary >= text.length) return boundary;
|
|
42
|
-
const previous = text.charCodeAt(boundary - 1);
|
|
43
|
-
const next = text.charCodeAt(boundary);
|
|
44
|
-
if (isHighSurrogate(previous) && isLowSurrogate(next)) return boundary > 1 ? boundary - 1 : boundary + 1;
|
|
45
|
-
return boundary;
|
|
46
|
-
}
|
|
47
|
-
function findWhitespaceBreak(window) {
|
|
48
|
-
for (let i = window.length - 1; i >= 0; i--) if (/\s/.test(window[i])) return i;
|
|
49
|
-
return -1;
|
|
50
|
-
}
|
|
51
|
-
function findCjkPunctuationBreak(window) {
|
|
52
|
-
for (let end = window.length; end > 0;) {
|
|
53
|
-
const start = isLowSurrogate(window.charCodeAt(end - 1)) && end > 1 ? end - 2 : end - 1;
|
|
54
|
-
const char = window.slice(start, end);
|
|
55
|
-
if (start > 0 && CJK_PUNCTUATION_BREAK_AFTER_RE.test(char)) return end;
|
|
56
|
-
end = start;
|
|
57
|
-
}
|
|
58
|
-
return -1;
|
|
59
|
-
}
|
|
60
|
-
function splitLongLine(line, maxChars, opts) {
|
|
61
|
-
const limit = Math.max(1, Math.floor(maxChars));
|
|
62
|
-
if (line.length <= limit) return [line];
|
|
63
|
-
const out = [];
|
|
64
|
-
let remaining = line;
|
|
65
|
-
while (remaining.length > limit) {
|
|
66
|
-
if (opts.preserveWhitespace) {
|
|
67
|
-
const breakIdx = clampToCodePointBoundary(remaining, limit);
|
|
68
|
-
out.push(remaining.slice(0, breakIdx));
|
|
69
|
-
remaining = remaining.slice(breakIdx);
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
const window = remaining.slice(0, limit);
|
|
73
|
-
let breakIdx = findWhitespaceBreak(window);
|
|
74
|
-
if (breakIdx <= 0) breakIdx = findCjkPunctuationBreak(window);
|
|
75
|
-
if (breakIdx <= 0) breakIdx = clampToCodePointBoundary(remaining, limit);
|
|
76
|
-
out.push(remaining.slice(0, breakIdx));
|
|
77
|
-
remaining = remaining.slice(breakIdx);
|
|
78
|
-
}
|
|
79
|
-
if (remaining.length) out.push(remaining);
|
|
80
|
-
return out;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Chunks outbound Discord text by both character count and (soft) line count,
|
|
84
|
-
* while keeping fenced code blocks balanced across chunks.
|
|
85
|
-
*/
|
|
86
|
-
function chunkDiscordText(text, opts = {}) {
|
|
87
|
-
const maxChars = Math.max(1, Math.floor(opts.maxChars ?? DEFAULT_MAX_CHARS));
|
|
88
|
-
const maxLines = Math.max(1, Math.floor(opts.maxLines ?? DEFAULT_MAX_LINES));
|
|
89
|
-
const body = text ?? "";
|
|
90
|
-
if (!body) return [];
|
|
91
|
-
if (body.length <= maxChars && countLines(body) <= maxLines) return [body];
|
|
92
|
-
const lines = body.split("\n");
|
|
93
|
-
const chunks = [];
|
|
94
|
-
let current = "";
|
|
95
|
-
let currentLines = 0;
|
|
96
|
-
let openFence = null;
|
|
97
|
-
const flush = () => {
|
|
98
|
-
if (!current) return;
|
|
99
|
-
const payload = closeFenceIfNeeded(current, openFence);
|
|
100
|
-
if (payload.trim().length) chunks.push(payload);
|
|
101
|
-
current = "";
|
|
102
|
-
currentLines = 0;
|
|
103
|
-
if (openFence) {
|
|
104
|
-
current = openFence.openLine;
|
|
105
|
-
currentLines = 1;
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
for (const originalLine of lines) {
|
|
109
|
-
const fenceInfo = parseFenceLine(originalLine);
|
|
110
|
-
const wasInsideFence = openFence !== null;
|
|
111
|
-
let nextOpenFence = openFence;
|
|
112
|
-
if (fenceInfo) {
|
|
113
|
-
if (!openFence) nextOpenFence = fenceInfo;
|
|
114
|
-
else if (openFence.markerChar === fenceInfo.markerChar && fenceInfo.markerLen >= openFence.markerLen) nextOpenFence = null;
|
|
115
|
-
}
|
|
116
|
-
const reserveChars = nextOpenFence ? closeFenceLine(nextOpenFence).length + 1 : 0;
|
|
117
|
-
const reserveLines = nextOpenFence ? 1 : 0;
|
|
118
|
-
const effectiveMaxChars = maxChars - reserveChars;
|
|
119
|
-
const effectiveMaxLines = maxLines - reserveLines;
|
|
120
|
-
const charLimit = effectiveMaxChars > 0 ? effectiveMaxChars : maxChars;
|
|
121
|
-
const lineLimit = effectiveMaxLines > 0 ? effectiveMaxLines : maxLines;
|
|
122
|
-
const prefixLen = current.length > 0 ? current.length + 1 : 0;
|
|
123
|
-
const segments = splitLongLine(originalLine, Math.max(1, charLimit - prefixLen), { preserveWhitespace: wasInsideFence });
|
|
124
|
-
for (let segIndex = 0; segIndex < segments.length; segIndex++) {
|
|
125
|
-
const segment = segments[segIndex];
|
|
126
|
-
const isLineContinuation = segIndex > 0;
|
|
127
|
-
const addition = `${isLineContinuation ? "" : current.length > 0 ? "\n" : ""}${segment}`;
|
|
128
|
-
const nextLen = current.length + addition.length;
|
|
129
|
-
const nextLines = currentLines + (isLineContinuation ? 0 : 1);
|
|
130
|
-
if ((nextLen > charLimit || nextLines > lineLimit) && current.length > 0) flush();
|
|
131
|
-
if (current.length > 0) {
|
|
132
|
-
current += addition;
|
|
133
|
-
if (!isLineContinuation) currentLines += 1;
|
|
134
|
-
} else {
|
|
135
|
-
current = segment;
|
|
136
|
-
currentLines = 1;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
openFence = nextOpenFence;
|
|
140
|
-
}
|
|
141
|
-
if (current.length) {
|
|
142
|
-
const payload = closeFenceIfNeeded(current, openFence);
|
|
143
|
-
if (payload.trim().length) chunks.push(payload);
|
|
144
|
-
}
|
|
145
|
-
return rebalanceReasoningItalics(text, chunks);
|
|
146
|
-
}
|
|
147
|
-
function chunkDiscordTextWithMode(text, opts) {
|
|
148
|
-
if ((opts.chunkMode ?? "length") !== "newline") return chunkDiscordText(text, opts);
|
|
149
|
-
const lineChunks = chunkMarkdownTextWithMode(text, Math.max(1, Math.floor(opts.maxChars ?? DEFAULT_MAX_CHARS)), "newline");
|
|
150
|
-
const chunks = [];
|
|
151
|
-
for (const line of lineChunks) {
|
|
152
|
-
const nested = chunkDiscordText(line, opts);
|
|
153
|
-
if (!nested.length && line) {
|
|
154
|
-
chunks.push(line);
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
chunks.push(...nested);
|
|
158
|
-
}
|
|
159
|
-
return chunks;
|
|
160
|
-
}
|
|
161
|
-
function rebalanceReasoningItalics(source, chunks) {
|
|
162
|
-
if (chunks.length <= 1) return chunks;
|
|
163
|
-
if (!(source.startsWith("Reasoning:\n_") && source.trimEnd().endsWith("_"))) return chunks;
|
|
164
|
-
const adjusted = [...chunks];
|
|
165
|
-
for (let i = 0; i < adjusted.length; i++) {
|
|
166
|
-
const isLast = i === adjusted.length - 1;
|
|
167
|
-
const current = adjusted[i];
|
|
168
|
-
if (!current.trimEnd().endsWith("_")) adjusted[i] = `${current}_`;
|
|
169
|
-
if (isLast) break;
|
|
170
|
-
const next = adjusted[i + 1];
|
|
171
|
-
const leadingWhitespaceLen = next.length - next.trimStart().length;
|
|
172
|
-
const leadingWhitespace = next.slice(0, leadingWhitespaceLen);
|
|
173
|
-
const nextBody = next.slice(leadingWhitespaceLen);
|
|
174
|
-
if (!nextBody.startsWith("_")) adjusted[i + 1] = `${leadingWhitespace}_${nextBody}`;
|
|
175
|
-
}
|
|
176
|
-
return adjusted;
|
|
177
|
-
}
|
|
178
|
-
//#endregion
|
|
179
|
-
export { chunkDiscordTextWithMode as t };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { t as parseDiscordTarget } from "./target-parsing-D-H7nnh2.js";
|
|
2
|
-
import { normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
-
//#region extensions/discord/src/conversation-identity.ts
|
|
4
|
-
function normalizeDiscordTarget(raw, defaultKind) {
|
|
5
|
-
const trimmed = normalizeOptionalString(raw);
|
|
6
|
-
if (!trimmed) return;
|
|
7
|
-
return parseDiscordTarget(trimmed, { defaultKind })?.normalized;
|
|
8
|
-
}
|
|
9
|
-
function buildDiscordConversationIdentity(kind, rawId) {
|
|
10
|
-
const trimmed = normalizeOptionalString(rawId);
|
|
11
|
-
return trimmed ? `${kind}:${trimmed}` : void 0;
|
|
12
|
-
}
|
|
13
|
-
function resolveDiscordConversationIdentity(params) {
|
|
14
|
-
return params.isDirectMessage ? buildDiscordConversationIdentity("user", params.userId) : buildDiscordConversationIdentity("channel", params.channelId);
|
|
15
|
-
}
|
|
16
|
-
function resolveDiscordCurrentConversationIdentity(params) {
|
|
17
|
-
if (normalizeOptionalLowercaseString(params.chatType) === "direct") {
|
|
18
|
-
const senderTarget = normalizeDiscordTarget(params.from, "user");
|
|
19
|
-
if (senderTarget?.startsWith("user:")) return senderTarget;
|
|
20
|
-
}
|
|
21
|
-
for (const candidate of [
|
|
22
|
-
params.originatingTo,
|
|
23
|
-
params.commandTo,
|
|
24
|
-
params.fallbackTo
|
|
25
|
-
]) {
|
|
26
|
-
const target = normalizeDiscordTarget(candidate, "channel");
|
|
27
|
-
if (target) return target;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
//#endregion
|
|
31
|
-
export { resolveDiscordCurrentConversationIdentity as n, resolveDiscordConversationIdentity as t };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
-
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
3
|
-
//#region extensions/discord/src/directory-cache.ts
|
|
4
|
-
const DISCORD_DIRECTORY_CACHE_MAX_ENTRIES = 4e3;
|
|
5
|
-
const DISCORD_DISCRIMINATOR_SUFFIX = /#\d{4}$/;
|
|
6
|
-
const DIRECTORY_HANDLE_CACHE = /* @__PURE__ */ new Map();
|
|
7
|
-
function normalizeAccountCacheKey(accountId) {
|
|
8
|
-
return normalizeAccountId(accountId ?? DEFAULT_ACCOUNT_ID) || DEFAULT_ACCOUNT_ID;
|
|
9
|
-
}
|
|
10
|
-
function normalizeSnowflake(value) {
|
|
11
|
-
const text = normalizeOptionalStringifiedId(value) ?? "";
|
|
12
|
-
if (!/^\d+$/.test(text)) return null;
|
|
13
|
-
return text;
|
|
14
|
-
}
|
|
15
|
-
function normalizeHandleKey(raw) {
|
|
16
|
-
let handle = normalizeOptionalString(raw) ?? "";
|
|
17
|
-
if (!handle) return null;
|
|
18
|
-
if (handle.startsWith("@")) handle = normalizeOptionalString(handle.slice(1)) ?? "";
|
|
19
|
-
if (!handle || /\s/.test(handle)) return null;
|
|
20
|
-
return normalizeLowercaseStringOrEmpty(handle);
|
|
21
|
-
}
|
|
22
|
-
function ensureAccountCache(accountId) {
|
|
23
|
-
const cacheKey = normalizeAccountCacheKey(accountId);
|
|
24
|
-
const existing = DIRECTORY_HANDLE_CACHE.get(cacheKey);
|
|
25
|
-
if (existing) return existing;
|
|
26
|
-
const created = /* @__PURE__ */ new Map();
|
|
27
|
-
DIRECTORY_HANDLE_CACHE.set(cacheKey, created);
|
|
28
|
-
return created;
|
|
29
|
-
}
|
|
30
|
-
function setCacheEntry(cache, key, userId) {
|
|
31
|
-
if (cache.has(key)) cache.delete(key);
|
|
32
|
-
cache.set(key, userId);
|
|
33
|
-
if (cache.size <= DISCORD_DIRECTORY_CACHE_MAX_ENTRIES) return;
|
|
34
|
-
const oldest = cache.keys().next();
|
|
35
|
-
if (!oldest.done) cache.delete(oldest.value);
|
|
36
|
-
}
|
|
37
|
-
function rememberDiscordDirectoryUser(params) {
|
|
38
|
-
const userId = normalizeSnowflake(params.userId);
|
|
39
|
-
if (!userId) return;
|
|
40
|
-
const cache = ensureAccountCache(params.accountId);
|
|
41
|
-
for (const candidate of params.handles) {
|
|
42
|
-
if (typeof candidate !== "string") continue;
|
|
43
|
-
const handle = normalizeHandleKey(candidate);
|
|
44
|
-
if (!handle) continue;
|
|
45
|
-
setCacheEntry(cache, handle, userId);
|
|
46
|
-
const withoutDiscriminator = handle.replace(DISCORD_DISCRIMINATOR_SUFFIX, "");
|
|
47
|
-
if (withoutDiscriminator && withoutDiscriminator !== handle) setCacheEntry(cache, withoutDiscriminator, userId);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function resolveDiscordDirectoryUserId(params) {
|
|
51
|
-
const cache = DIRECTORY_HANDLE_CACHE.get(normalizeAccountCacheKey(params.accountId));
|
|
52
|
-
if (!cache) return;
|
|
53
|
-
const handle = normalizeHandleKey(params.handle);
|
|
54
|
-
if (!handle) return;
|
|
55
|
-
const direct = cache.get(handle);
|
|
56
|
-
if (direct) return direct;
|
|
57
|
-
const withoutDiscriminator = handle.replace(DISCORD_DISCRIMINATOR_SUFFIX, "");
|
|
58
|
-
if (!withoutDiscriminator || withoutDiscriminator === handle) return;
|
|
59
|
-
return cache.get(withoutDiscriminator);
|
|
60
|
-
}
|
|
61
|
-
//#endregion
|
|
62
|
-
export { resolveDiscordDirectoryUserId as n, rememberDiscordDirectoryUser as t };
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { Ft as __exportAll } from "./discord-BqYcwxvG.js";
|
|
2
|
-
import { t as normalizeDiscordToken } from "./token-BZtonk7d.js";
|
|
3
|
-
import { s as resolveDiscordAccount } from "./accounts-BcwyaFd-.js";
|
|
4
|
-
import { t as rememberDiscordDirectoryUser } from "./directory-cache-Ddl-Oxue.js";
|
|
5
|
-
import { n as fetchDiscord } from "./api-DzNBVTto.js";
|
|
6
|
-
import { a as normalizeDiscordSlug } from "./allow-list-n8Ki-Rt3.js";
|
|
7
|
-
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
|
-
//#region extensions/discord/src/directory-live.ts
|
|
9
|
-
var directory_live_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
-
listDiscordDirectoryGroupsLive: () => listDiscordDirectoryGroupsLive,
|
|
11
|
-
listDiscordDirectoryPeersLive: () => listDiscordDirectoryPeersLive
|
|
12
|
-
});
|
|
13
|
-
function normalizeQuery(value) {
|
|
14
|
-
return normalizeOptionalLowercaseString(value) ?? "";
|
|
15
|
-
}
|
|
16
|
-
function buildUserRank(user) {
|
|
17
|
-
return user.bot ? 0 : 1;
|
|
18
|
-
}
|
|
19
|
-
function resolveDiscordDirectoryAccess(params) {
|
|
20
|
-
const account = resolveDiscordAccount({
|
|
21
|
-
cfg: params.cfg,
|
|
22
|
-
accountId: params.accountId
|
|
23
|
-
});
|
|
24
|
-
const token = normalizeDiscordToken(account.token, "channels.discord.token");
|
|
25
|
-
if (!token) return null;
|
|
26
|
-
return {
|
|
27
|
-
token,
|
|
28
|
-
query: normalizeQuery(params.query),
|
|
29
|
-
accountId: account.accountId
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
async function listDiscordGuilds(token) {
|
|
33
|
-
return (await fetchDiscord("/users/@me/guilds", token)).filter((guild) => guild.id && guild.name);
|
|
34
|
-
}
|
|
35
|
-
async function listDiscordDirectoryGroupsLive(params) {
|
|
36
|
-
const access = resolveDiscordDirectoryAccess(params);
|
|
37
|
-
if (!access) return [];
|
|
38
|
-
const { token, query } = access;
|
|
39
|
-
const guilds = await listDiscordGuilds(token);
|
|
40
|
-
const rows = [];
|
|
41
|
-
for (const guild of guilds) {
|
|
42
|
-
const channels = await fetchDiscord(`/guilds/${guild.id}/channels`, token);
|
|
43
|
-
for (const channel of channels) {
|
|
44
|
-
const name = channel.name?.trim();
|
|
45
|
-
if (!name) continue;
|
|
46
|
-
if (query && !normalizeDiscordSlug(name).includes(normalizeDiscordSlug(query))) continue;
|
|
47
|
-
rows.push({
|
|
48
|
-
kind: "group",
|
|
49
|
-
id: `channel:${channel.id}`,
|
|
50
|
-
name,
|
|
51
|
-
handle: `#${name}`,
|
|
52
|
-
raw: channel
|
|
53
|
-
});
|
|
54
|
-
if (typeof params.limit === "number" && params.limit > 0 && rows.length >= params.limit) return rows;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return rows;
|
|
58
|
-
}
|
|
59
|
-
async function listDiscordDirectoryPeersLive(params) {
|
|
60
|
-
const access = resolveDiscordDirectoryAccess(params);
|
|
61
|
-
if (!access) return [];
|
|
62
|
-
const { token, query, accountId } = access;
|
|
63
|
-
if (!query) return [];
|
|
64
|
-
const guilds = await listDiscordGuilds(token);
|
|
65
|
-
const rows = [];
|
|
66
|
-
const limit = typeof params.limit === "number" && params.limit > 0 ? params.limit : 25;
|
|
67
|
-
for (const guild of guilds) {
|
|
68
|
-
const paramsObj = new URLSearchParams({
|
|
69
|
-
query,
|
|
70
|
-
limit: String(Math.min(limit, 100))
|
|
71
|
-
});
|
|
72
|
-
const members = await fetchDiscord(`/guilds/${guild.id}/members/search?${paramsObj.toString()}`, token);
|
|
73
|
-
for (const member of members) {
|
|
74
|
-
const user = member.user;
|
|
75
|
-
if (!user?.id) continue;
|
|
76
|
-
rememberDiscordDirectoryUser({
|
|
77
|
-
accountId,
|
|
78
|
-
userId: user.id,
|
|
79
|
-
handles: [
|
|
80
|
-
user.username,
|
|
81
|
-
user.global_name,
|
|
82
|
-
member.nick,
|
|
83
|
-
user.username ? `@${user.username}` : null
|
|
84
|
-
]
|
|
85
|
-
});
|
|
86
|
-
const name = member.nick?.trim() || user.global_name?.trim() || user.username?.trim();
|
|
87
|
-
rows.push({
|
|
88
|
-
kind: "user",
|
|
89
|
-
id: `user:${user.id}`,
|
|
90
|
-
name: name || void 0,
|
|
91
|
-
handle: user.username ? `@${user.username}` : void 0,
|
|
92
|
-
rank: buildUserRank(user),
|
|
93
|
-
raw: member
|
|
94
|
-
});
|
|
95
|
-
if (rows.length >= limit) return rows;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return rows;
|
|
99
|
-
}
|
|
100
|
-
//#endregion
|
|
101
|
-
export { listDiscordDirectoryGroupsLive as n, listDiscordDirectoryPeersLive as r, directory_live_exports as t };
|
package/dist/format-D8TsaXxW.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//#region extensions/discord/src/monitor/format.ts
|
|
2
|
-
function resolveDiscordSystemLocation(params) {
|
|
3
|
-
const { isDirectMessage, isGroupDm, guild, channelName } = params;
|
|
4
|
-
if (isDirectMessage) return "DM";
|
|
5
|
-
if (isGroupDm) return `Group DM #${channelName}`;
|
|
6
|
-
return guild?.name ? `${guild.name} #${channelName}` : `#${channelName}`;
|
|
7
|
-
}
|
|
8
|
-
function formatDiscordReactionEmoji(emoji) {
|
|
9
|
-
if (emoji.id && emoji.name) return `<:${emoji.name}:${emoji.id}>`;
|
|
10
|
-
if (emoji.id) return `emoji:${emoji.id}`;
|
|
11
|
-
return emoji.name ?? "emoji";
|
|
12
|
-
}
|
|
13
|
-
function formatDiscordUserTag(user) {
|
|
14
|
-
const discriminator = (user.discriminator ?? "").trim();
|
|
15
|
-
if (discriminator && discriminator !== "0") return `${user.username}#${discriminator}`;
|
|
16
|
-
return user.username ?? user.id;
|
|
17
|
-
}
|
|
18
|
-
function resolveTimestampMs(timestamp) {
|
|
19
|
-
if (!timestamp) return;
|
|
20
|
-
const parsed = Date.parse(timestamp);
|
|
21
|
-
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
export { resolveTimestampMs as i, formatDiscordUserTag as n, resolveDiscordSystemLocation as r, formatDiscordReactionEmoji as t };
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { n as resolveDiscordDirectoryUserId } from "./directory-cache-Ddl-Oxue.js";
|
|
2
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
-
//#region extensions/discord/src/mentions.ts
|
|
4
|
-
const MARKDOWN_CODE_SEGMENT_PATTERN = /```[\s\S]*?```|`[^`\n]*`/g;
|
|
5
|
-
const MENTION_CANDIDATE_PATTERN = /(^|[\s([{"'.,;:!?])@([a-z0-9_.-]{2,32}(?:#[0-9]{4})?)/gi;
|
|
6
|
-
const DISCORD_RESERVED_MENTIONS = new Set(["everyone", "here"]);
|
|
7
|
-
const DISCORD_DISCRIMINATOR_SUFFIX = /#\d{4}$/;
|
|
8
|
-
function normalizeSnowflake(value) {
|
|
9
|
-
const text = normalizeOptionalStringifiedId(value) ?? "";
|
|
10
|
-
if (!/^\d+$/.test(text)) return null;
|
|
11
|
-
return text;
|
|
12
|
-
}
|
|
13
|
-
function formatMention(params) {
|
|
14
|
-
const userId = params.userId == null ? null : normalizeSnowflake(params.userId);
|
|
15
|
-
const roleId = params.roleId == null ? null : normalizeSnowflake(params.roleId);
|
|
16
|
-
const channelId = params.channelId == null ? null : normalizeSnowflake(params.channelId);
|
|
17
|
-
const values = [
|
|
18
|
-
userId ? {
|
|
19
|
-
kind: "user",
|
|
20
|
-
id: userId
|
|
21
|
-
} : null,
|
|
22
|
-
roleId ? {
|
|
23
|
-
kind: "role",
|
|
24
|
-
id: roleId
|
|
25
|
-
} : null,
|
|
26
|
-
channelId ? {
|
|
27
|
-
kind: "channel",
|
|
28
|
-
id: channelId
|
|
29
|
-
} : null
|
|
30
|
-
].filter((entry) => Boolean(entry));
|
|
31
|
-
if (values.length !== 1) throw new Error("formatMention requires exactly one of userId, roleId, or channelId");
|
|
32
|
-
const target = values[0];
|
|
33
|
-
if (target.kind === "user") return `<@${target.id}>`;
|
|
34
|
-
if (target.kind === "role") return `<@&${target.id}>`;
|
|
35
|
-
return `<#${target.id}>`;
|
|
36
|
-
}
|
|
37
|
-
function normalizeHandleKey(raw) {
|
|
38
|
-
let handle = normalizeOptionalString(raw) ?? "";
|
|
39
|
-
if (!handle) return null;
|
|
40
|
-
if (handle.startsWith("@")) handle = normalizeOptionalString(handle.slice(1)) ?? "";
|
|
41
|
-
if (!handle || /\s/.test(handle)) return null;
|
|
42
|
-
return normalizeLowercaseStringOrEmpty(handle);
|
|
43
|
-
}
|
|
44
|
-
function resolveConfiguredMentionAlias(handle, mentionAliases) {
|
|
45
|
-
const key = normalizeHandleKey(handle);
|
|
46
|
-
if (!key || !mentionAliases) return;
|
|
47
|
-
const withoutDiscriminator = key.replace(DISCORD_DISCRIMINATOR_SUFFIX, "");
|
|
48
|
-
for (const [rawAlias, rawUserId] of Object.entries(mentionAliases)) {
|
|
49
|
-
const alias = normalizeHandleKey(rawAlias);
|
|
50
|
-
if (!alias) continue;
|
|
51
|
-
const aliasWithoutDiscriminator = alias.replace(DISCORD_DISCRIMINATOR_SUFFIX, "");
|
|
52
|
-
if (alias === key || withoutDiscriminator && withoutDiscriminator !== key && alias === withoutDiscriminator || aliasWithoutDiscriminator && aliasWithoutDiscriminator !== alias && aliasWithoutDiscriminator === key) {
|
|
53
|
-
const userId = normalizeSnowflake(rawUserId);
|
|
54
|
-
if (userId) return userId;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function rewritePlainTextMentions(text, params) {
|
|
59
|
-
if (!text.includes("@")) return text;
|
|
60
|
-
return text.replace(MENTION_CANDIDATE_PATTERN, (match, prefix, rawHandle) => {
|
|
61
|
-
const handle = normalizeOptionalString(rawHandle) ?? "";
|
|
62
|
-
if (!handle) return match;
|
|
63
|
-
const lookup = normalizeLowercaseStringOrEmpty(handle);
|
|
64
|
-
if (DISCORD_RESERVED_MENTIONS.has(lookup)) return match;
|
|
65
|
-
const userId = resolveConfiguredMentionAlias(handle, params.mentionAliases) ?? resolveDiscordDirectoryUserId({
|
|
66
|
-
accountId: params.accountId,
|
|
67
|
-
handle
|
|
68
|
-
});
|
|
69
|
-
if (!userId) return match;
|
|
70
|
-
return `${String(prefix ?? "")}${formatMention({ userId })}`;
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
function rewriteDiscordKnownMentions(text, params) {
|
|
74
|
-
if (!text.includes("@")) return text;
|
|
75
|
-
let rewritten = "";
|
|
76
|
-
let offset = 0;
|
|
77
|
-
MARKDOWN_CODE_SEGMENT_PATTERN.lastIndex = 0;
|
|
78
|
-
for (const match of text.matchAll(MARKDOWN_CODE_SEGMENT_PATTERN)) {
|
|
79
|
-
const matchIndex = match.index ?? 0;
|
|
80
|
-
rewritten += rewritePlainTextMentions(text.slice(offset, matchIndex), params);
|
|
81
|
-
rewritten += match[0];
|
|
82
|
-
offset = matchIndex + match[0].length;
|
|
83
|
-
}
|
|
84
|
-
rewritten += rewritePlainTextMentions(text.slice(offset), params);
|
|
85
|
-
return rewritten;
|
|
86
|
-
}
|
|
87
|
-
//#endregion
|
|
88
|
-
export { rewriteDiscordKnownMentions as n, formatMention as t };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { t as parseDiscordTarget } from "./target-parsing-D-H7nnh2.js";
|
|
2
|
-
//#region extensions/discord/src/normalize.ts
|
|
3
|
-
function normalizeDiscordMessagingTarget(raw) {
|
|
4
|
-
return parseDiscordTarget(raw, { defaultKind: "channel" })?.normalized;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Normalize a Discord outbound target for delivery. Bare numeric IDs are
|
|
8
|
-
* prefixed with "channel:" to avoid the ambiguous-target error in
|
|
9
|
-
* parseDiscordTarget, unless the ID is explicitly configured as an allowed DM
|
|
10
|
-
* sender. All other formats pass through unchanged.
|
|
11
|
-
*/
|
|
12
|
-
function normalizeDiscordOutboundTarget(to, allowFrom) {
|
|
13
|
-
const trimmed = to?.trim();
|
|
14
|
-
if (!trimmed) return {
|
|
15
|
-
ok: false,
|
|
16
|
-
error: /* @__PURE__ */ new Error("Discord recipient is required. Use \"channel:<id>\" for channels or \"user:<id>\" for DMs.")
|
|
17
|
-
};
|
|
18
|
-
if (/^\d+$/.test(trimmed)) {
|
|
19
|
-
if (allowFromContainsDiscordUserId(allowFrom, trimmed)) return {
|
|
20
|
-
ok: true,
|
|
21
|
-
to: `user:${trimmed}`
|
|
22
|
-
};
|
|
23
|
-
return {
|
|
24
|
-
ok: true,
|
|
25
|
-
to: `channel:${trimmed}`
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
ok: true,
|
|
30
|
-
to: trimmed
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function allowFromContainsDiscordUserId(allowFrom, userId) {
|
|
34
|
-
const normalizedUserId = userId.trim();
|
|
35
|
-
if (!normalizedUserId) return false;
|
|
36
|
-
return (allowFrom ?? []).some((entry) => normalizeAllowFromDiscordUserId(entry) === normalizedUserId);
|
|
37
|
-
}
|
|
38
|
-
function normalizeAllowFromDiscordUserId(entry) {
|
|
39
|
-
const trimmed = entry.trim().toLowerCase();
|
|
40
|
-
if (!trimmed || trimmed === "*") return;
|
|
41
|
-
const mentionMatch = /^<@!?(\d+)>$/.exec(trimmed);
|
|
42
|
-
if (mentionMatch) return mentionMatch[1];
|
|
43
|
-
const prefixedMatch = /^(?:discord:)?user:(\d+)$/.exec(trimmed);
|
|
44
|
-
if (prefixedMatch) return prefixedMatch[1];
|
|
45
|
-
const discordMatch = /^discord:(\d+)$/.exec(trimmed);
|
|
46
|
-
if (discordMatch) return discordMatch[1];
|
|
47
|
-
return /^\d+$/.test(trimmed) ? trimmed : void 0;
|
|
48
|
-
}
|
|
49
|
-
function looksLikeDiscordTargetId(raw) {
|
|
50
|
-
const trimmed = raw.trim();
|
|
51
|
-
if (!trimmed) return false;
|
|
52
|
-
if (/^<@!?\d+>$/.test(trimmed)) return true;
|
|
53
|
-
if (/^(user|channel|discord):/i.test(trimmed)) return true;
|
|
54
|
-
if (/^\d{6,}$/.test(trimmed)) return true;
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
//#endregion
|
|
58
|
-
export { normalizeDiscordOutboundTarget as i, looksLikeDiscordTargetId as n, normalizeDiscordMessagingTarget as r, allowFromContainsDiscordUserId as t };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { t as parseDiscordTarget } from "./target-parsing-D-H7nnh2.js";
|
|
2
|
-
import { buildOutboundBaseSessionKey } from "openclaw/plugin-sdk/routing";
|
|
3
|
-
import { buildThreadAwareOutboundSessionRoute } from "openclaw/plugin-sdk/channel-core";
|
|
4
|
-
//#region extensions/discord/src/outbound-session-route.ts
|
|
5
|
-
function resolveDiscordOutboundSessionRoute(params) {
|
|
6
|
-
const parsed = parseDiscordTarget(params.target, { defaultKind: resolveDiscordOutboundTargetKindHint(params) });
|
|
7
|
-
if (!parsed) return null;
|
|
8
|
-
const isDm = parsed.kind === "user";
|
|
9
|
-
const peer = {
|
|
10
|
-
kind: isDm ? "direct" : "channel",
|
|
11
|
-
id: parsed.id
|
|
12
|
-
};
|
|
13
|
-
const baseSessionKey = buildOutboundBaseSessionKey({
|
|
14
|
-
cfg: params.cfg,
|
|
15
|
-
agentId: params.agentId,
|
|
16
|
-
channel: "discord",
|
|
17
|
-
accountId: params.accountId,
|
|
18
|
-
peer
|
|
19
|
-
});
|
|
20
|
-
return buildThreadAwareOutboundSessionRoute({
|
|
21
|
-
route: {
|
|
22
|
-
sessionKey: baseSessionKey,
|
|
23
|
-
baseSessionKey,
|
|
24
|
-
peer,
|
|
25
|
-
chatType: isDm ? "direct" : "channel",
|
|
26
|
-
from: isDm ? `discord:${parsed.id}` : `discord:channel:${parsed.id}`,
|
|
27
|
-
to: isDm ? `user:${parsed.id}` : `channel:${parsed.id}`
|
|
28
|
-
},
|
|
29
|
-
threadId: params.threadId,
|
|
30
|
-
precedence: ["threadId"],
|
|
31
|
-
useSuffix: false
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
function resolveDiscordOutboundTargetKindHint(params) {
|
|
35
|
-
const resolvedKind = params.resolvedTarget?.kind;
|
|
36
|
-
if (resolvedKind === "user") return "user";
|
|
37
|
-
if (resolvedKind === "group" || resolvedKind === "channel") return "channel";
|
|
38
|
-
const target = params.target.trim();
|
|
39
|
-
if (/^channel:/i.test(target)) return "channel";
|
|
40
|
-
if (/^(user:|discord:|@|<@!?)/i.test(target)) return "user";
|
|
41
|
-
}
|
|
42
|
-
//#endregion
|
|
43
|
-
export { resolveDiscordOutboundSessionRoute as t };
|