@openclaw/discord 2026.8.1 → 2026.8.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-BY-ve3yH.js +45 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-CfQ-vSyf.js → accounts-CwJQoLjM.js} +89 -45
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-Dl-TOyOX.js → activities-api-CkKcHUB6.js} +14 -13
- package/dist/activities-api.js +1 -1
- package/dist/{allow-list-BDMimASD.js → allow-list-C2JuH-R0.js} +10 -6
- package/dist/{api-DNVbJyEy.js → api-BfmEP6wp.js} +6 -5
- package/dist/api.js +17 -17
- package/dist/{approval-handler.runtime-q4Zqo44V.js → approval-handler.runtime-DZM6Kt1Z.js} +8 -7
- package/dist/{audit-DgrvFPGt.js → audit-DIbQA4VT.js} +8 -7
- package/dist/{channel-BsQUalPw.js → channel-CarzU3bg.js} +24 -22
- package/dist/{channel-actions.runtime-UMGGIfSy.js → channel-actions.runtime-B2wMqeVK.js} +13 -11
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-rPs4dsk_.js → channel.setup-z_ewMVa9.js} +18 -18
- package/dist/{components-Dk35LTf_.js → components-gvRA0oaI.js} +1 -1
- package/dist/{config-schema-CxPqtVI1.js → config-schema-B797-Spt.js} +5 -4
- package/dist/{conversation-binding-route-BjvX4e35.js → conversation-binding-route-DPpBRpYI.js} +1 -1
- package/dist/{directory-config-B7DY_pNG.js → directory-config-AA8wQx0D.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DuAXKkan.js → directory-live-D_kFz_Fj.js} +4 -4
- package/dist/{doctor-zQTtn6hm.js → doctor-QQTOkBfW.js} +5 -5
- package/dist/{doctor-contract-DsWvKIXF.js → doctor-contract-Co5vRCZ6.js} +9 -6
- package/dist/doctor-contract-api.js +3 -2
- package/dist/{handle-action.guild-admin-DZewwLr1.js → handle-action.guild-admin-Cc88ZGon.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{ingress-identity-CzZKcPK8.js → ingress-identity-BCzfPPYM.js} +1 -1
- package/dist/{message-handler-C5By3yl5.js → message-handler-CAeEpqWo.js} +14 -10
- package/dist/{message-handler.preflight-DrszWuHw.js → message-handler.preflight-CoKoE3dY.js} +24 -19
- package/dist/{message-handler.process-DyFPDLCt.js → message-handler.process-cdIJ_fDT.js} +56 -74
- package/dist/{message-text-Ca8M6TU8.js → message-text-C0K4-fkg.js} +9 -4
- package/dist/{outbound-adapter-Dif8p481.js → outbound-adapter-Ch0At5Ra.js} +34 -24
- package/dist/{outbound-components-wjv7yyAj.js → outbound-components-Bnt_7x7r.js} +3 -3
- package/dist/{outbound-session-route-Bn4uXaoE.js → outbound-session-route-CzzerX2K.js} +10 -7
- package/dist/{owner-access-UlYi9t0M.js → owner-access-yc1sX7Gx.js} +7 -6
- package/dist/{pluralkit-9EuEN4UD.js → pluralkit-B3cUVI7i.js} +2 -2
- package/dist/{probe-n6ZXxK8V.js → probe-3ovFAp3b.js} +3 -3
- package/dist/{probe.runtime-CN4bdPfZ.js → probe.runtime-BckHn3cJ.js} +1 -1
- package/dist/{provider-LXiOcJrH.js → provider-CjI8BSzS.js} +97 -76
- package/dist/{provider-session.runtime-DSNe7r2W.js → provider-session.runtime-DdKRMcE9.js} +3 -3
- package/dist/provider.runtime-Bo1WbLLr.js +2 -0
- package/dist/{realtime-session.runtime-DOViOIjY.js → realtime-session.runtime-37IC-p5K.js} +5 -5
- package/dist/{resolve-allowlist-common-BLoYaxEG.js → resolve-allowlist-common-BJ5UZNNT.js} +3 -3
- package/dist/{resolve-channels-D2yl_2CN.js → resolve-channels-BexR2eUn.js} +4 -4
- package/dist/{resolve-users-BLxfqajZ.js → resolve-users-BtXBCH5W.js} +5 -4
- package/dist/{retry-after-DdLPmPoa.js → retry-after-BrLjLUJi.js} +2 -1
- package/dist/{retry-DqHCW6PV.js → retry-t5RcEsPk.js} +37 -29
- package/dist/{runtime-DrxVBTtp.js → runtime-BNlDfLwS.js} +2 -2
- package/dist/{runtime-BYamRVPN.js → runtime-DydyfxST.js} +126 -92
- package/dist/runtime-api.js +19 -19
- package/dist/{secret-config-contract-B3i6WxV5.js → secret-config-contract-DFu9hfU8.js} +14 -6
- package/dist/secret-contract-api.js +1 -1
- package/dist/{send-UJHiAm4C.js → send-mTKSBdmZ.js} +76 -48
- package/dist/{send.components-CrBJpGT_.js → send.components-nsPnc7kK.js} +20 -14
- package/dist/{send.outbound-D7JYmfm9.js → send.outbound-CaOs9Zy1.js} +34 -20
- package/dist/{send.shared-DZJ1akvQ.js → send.shared-BJHt0Vyf.js} +24 -17
- package/dist/{sender-identity-BJtfyise.js → sender-identity-Dt0imZyY.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-Dii2HTn7.js → shared-BNesVA4P.js} +17 -14
- package/dist/{subagent-hooks-JyGrtQIl.js → subagent-hooks-IeZVPLGj.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-BEmcj4xJ.js → system-events-Be5EJI3b.js} +2 -2
- package/dist/{target-resolver-V-IYae6s.js → target-resolver-C0MnwEki.js} +6 -5
- package/dist/targets-DQSye1Rv.js +3 -0
- package/dist/{thread-bindings-DvYP79fy.js → thread-bindings-wECUSIIG.js} +6 -5
- package/dist/{thread-bindings.manager-Clm77DBM.js → thread-bindings.manager-B-3UHCc1.js} +28 -25
- package/dist/{thread-bindings.session-updates-CJb-BpPL.js → thread-bindings.session-updates-CC7HoQvt.js} +2 -1
- package/dist/{threading-CXuu_7o9.js → threading-te5ADPQI.js} +8 -6
- package/dist/{timeouts-B9cy6RvQ.js → timeouts-D86uWLt_.js} +1 -1
- package/dist/{transcripts-source-BLEMH_yi.js → transcripts-source-DkUhR7YK.js} +3 -3
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-B9snnwMe.js → typing-DAwJF5VT.js} +2 -2
- package/dist/{voice-runtime-DY6_o73o.js → voice-runtime-COyYYTDD.js} +348 -14
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/README.md +1 -1
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/conforms.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/package.json +3 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubArray.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubObject.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubString.d.ts +2 -0
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/package.json +1 -1
- package/openclaw.plugin.json +2 -2
- package/package.json +5 -5
- package/dist/account-inspect-BDfKyuvL.js +0 -89
- package/dist/provider.runtime-DiInaDXO.js +0 -2
- package/dist/sdk-runtime-6tfgYDjY.js +0 -338
- package/dist/targets-CQp53cGj.js +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-
|
|
1
|
+
import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-BrLjLUJi.js";
|
|
2
2
|
import "node:module";
|
|
3
3
|
import { redactIdentifier, redactSensitiveFieldValue } from "openclaw/plugin-sdk/logging-core";
|
|
4
4
|
import { ApplicationCommandOptionType, ApplicationCommandType, ButtonStyle, ComponentType, GatewayDispatchEvents, InteractionContextType, InteractionResponseType, InteractionType, MessageFlags, Routes, TextInputStyle } from "discord-api-types/v10";
|
|
@@ -2129,7 +2129,8 @@ function redactDiscordErrorBody(body, fieldKey = "", sensitiveAncestorKey, state
|
|
|
2129
2129
|
return redacted;
|
|
2130
2130
|
}
|
|
2131
2131
|
function readDiscordCode(body) {
|
|
2132
|
-
|
|
2132
|
+
const value = body && typeof body === "object" && "code" in body ? body.code : void 0;
|
|
2133
|
+
return parseStrictNonNegativeInteger(value);
|
|
2133
2134
|
}
|
|
2134
2135
|
function readDiscordMessage(body, fallback) {
|
|
2135
2136
|
const value = body && typeof body === "object" && "message" in body ? body.message : void 0;
|
|
@@ -2139,7 +2140,8 @@ function isUnknownDiscordVoiceStateError(err) {
|
|
|
2139
2140
|
return (err && typeof err === "object" && "discordCode" in err ? parseStrictNonNegativeInteger(err.discordCode) : void 0) === DISCORD_UNKNOWN_VOICE_STATE || /unknown voice state/i.test(formatErrorMessage(err));
|
|
2140
2141
|
}
|
|
2141
2142
|
function readRetryAfter(body, response, fallbackSeconds = 0) {
|
|
2142
|
-
|
|
2143
|
+
const bodyValue = body && typeof body === "object" && "retry_after" in body ? body.retry_after : void 0;
|
|
2144
|
+
return parseDiscordRetryAfterBodySeconds(bodyValue) ?? parseRetryAfterHeaderSeconds(response.headers.get("Retry-After")) ?? fallbackSeconds;
|
|
2143
2145
|
}
|
|
2144
2146
|
function readDiscordRateLimitBucket(response) {
|
|
2145
2147
|
const value = response.headers.get("X-RateLimit-Bucket")?.trim();
|
|
@@ -2151,7 +2153,8 @@ function readDiscordRateLimitScope(response) {
|
|
|
2151
2153
|
}
|
|
2152
2154
|
var DiscordError = class extends Error {
|
|
2153
2155
|
constructor(response, body) {
|
|
2154
|
-
const
|
|
2156
|
+
const fallbackMessage = `Discord API request failed (${response.status})`;
|
|
2157
|
+
const redactedMessage = redactSensitiveFieldValue("message", readDiscordMessage(body, fallbackMessage));
|
|
2155
2158
|
const redactedBody = redactDiscordErrorBody(body);
|
|
2156
2159
|
super(redactedMessage);
|
|
2157
2160
|
this.name = "DiscordError";
|
|
@@ -2224,7 +2227,7 @@ function appendQuery(path, query) {
|
|
|
2224
2227
|
}
|
|
2225
2228
|
//#endregion
|
|
2226
2229
|
//#region extensions/discord/src/internal/rest-scheduler.ts
|
|
2227
|
-
const INVALID_REQUEST_WINDOW_MS =
|
|
2230
|
+
const INVALID_REQUEST_WINDOW_MS = 6e5;
|
|
2228
2231
|
const requestPriorities = [
|
|
2229
2232
|
"critical",
|
|
2230
2233
|
"standard",
|
|
@@ -2613,7 +2616,7 @@ const defaultLaneOptions = {
|
|
|
2613
2616
|
weight: 1
|
|
2614
2617
|
}
|
|
2615
2618
|
};
|
|
2616
|
-
const DISCORD_REST_RESPONSE_BODY_MAX_BYTES =
|
|
2619
|
+
const DISCORD_REST_RESPONSE_BODY_MAX_BYTES = 8388608;
|
|
2617
2620
|
const GZIP_MAGIC = [31, 139];
|
|
2618
2621
|
function createResponseBodyOverflowError(size) {
|
|
2619
2622
|
return /* @__PURE__ */ new Error(`Discord REST response body exceeds ${DISCORD_REST_RESPONSE_BODY_MAX_BYTES} bytes (received ${size})`);
|
|
@@ -3132,9 +3135,10 @@ function parseDiscordProviderPrefixedTarget(raw) {
|
|
|
3132
3135
|
return buildMessagingTarget(kind, id, `${kind}:${id}`);
|
|
3133
3136
|
}
|
|
3134
3137
|
function resolveDiscordChannelId(raw) {
|
|
3138
|
+
const target = parseDiscordTarget(raw, { defaultKind: "channel" });
|
|
3135
3139
|
return requireTargetKind({
|
|
3136
3140
|
platform: "Discord",
|
|
3137
|
-
target
|
|
3141
|
+
target,
|
|
3138
3142
|
kind: "channel"
|
|
3139
3143
|
});
|
|
3140
3144
|
}
|
|
@@ -3173,8 +3177,9 @@ function normalizeDiscordOutboundTarget(to, allowFrom) {
|
|
|
3173
3177
|
function allowFromContainsDiscordUserId(allowFrom, userId) {
|
|
3174
3178
|
const normalizedUserId = userId.trim();
|
|
3175
3179
|
if (!normalizedUserId) return false;
|
|
3180
|
+
const normalizedAllowFrom = (allowFrom ?? []).map(normalizeAllowFromDiscordUserId).filter((entry) => Boolean(entry));
|
|
3176
3181
|
return resolveAllowlistMatchByCandidates({
|
|
3177
|
-
allowList:
|
|
3182
|
+
allowList: normalizedAllowFrom,
|
|
3178
3183
|
candidates: [{
|
|
3179
3184
|
value: normalizedUserId,
|
|
3180
3185
|
source: "id"
|
|
@@ -3249,28 +3254,29 @@ function createDiscordSendReceiptFromResults(params) {
|
|
|
3249
3254
|
};
|
|
3250
3255
|
}
|
|
3251
3256
|
function createDiscordSendReceipt(params) {
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3257
|
+
const results = params.platformMessageIds.map((messageId) => messageId.trim()).filter((messageId) => messageId && messageId !== "unknown").map((messageId, index) => {
|
|
3258
|
+
const result = {
|
|
3259
|
+
channel: "discord",
|
|
3260
|
+
messageId
|
|
3261
|
+
};
|
|
3262
|
+
if (params.channelId) result.channelId = params.channelId;
|
|
3263
|
+
if (params.reply?.scope === "first" && index === 0) {
|
|
3264
|
+
const rawResult = {
|
|
3255
3265
|
channel: "discord",
|
|
3256
3266
|
messageId
|
|
3257
3267
|
};
|
|
3258
|
-
if (params.channelId)
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
});
|
|
3271
|
-
}
|
|
3272
|
-
return result;
|
|
3273
|
-
}),
|
|
3268
|
+
if (params.channelId) rawResult.channelId = params.channelId;
|
|
3269
|
+
result.receipt = createMessageReceiptFromOutboundResults({
|
|
3270
|
+
results: [rawResult],
|
|
3271
|
+
kind: params.kind,
|
|
3272
|
+
threadId: params.threadId,
|
|
3273
|
+
replyToId: params.reply.messageId
|
|
3274
|
+
});
|
|
3275
|
+
}
|
|
3276
|
+
return result;
|
|
3277
|
+
});
|
|
3278
|
+
return createMessageReceiptFromOutboundResults({
|
|
3279
|
+
results,
|
|
3274
3280
|
kind: params.kind,
|
|
3275
3281
|
threadId: params.threadId,
|
|
3276
3282
|
replyToId: params.reply?.scope === "all" ? params.reply.messageId : void 0
|
|
@@ -3389,7 +3395,8 @@ function chunkDiscordText(text, opts = {}) {
|
|
|
3389
3395
|
const reopenPrefixLen = fenceToReserve ? reopenFenceLine(fenceToReserve, maxChars)?.length ?? 0 : 0;
|
|
3390
3396
|
const prefixLen = current.length > 0 ? current.length + 1 : 0;
|
|
3391
3397
|
const reopenBudget = reopenPrefixLen > 0 ? reopenPrefixLen + 1 : 0;
|
|
3392
|
-
const
|
|
3398
|
+
const segmentLimit = Math.max(1, charLimit - Math.max(prefixLen, reopenBudget));
|
|
3399
|
+
const segments = chunkTextForOutbound(originalLine, segmentLimit, { preserveWhitespace: wasInsideFence });
|
|
3393
3400
|
for (let segIndex = 0; segIndex < segments.length; segIndex++) {
|
|
3394
3401
|
const segment = segments[segIndex];
|
|
3395
3402
|
const isLineContinuation = segIndex > 0;
|
|
@@ -3530,7 +3537,8 @@ const DISCORD_TRANSIENT_MESSAGE_RE = /\b(?:bad gateway|fetch failed|network erro
|
|
|
3530
3537
|
const ambiguousDiscordMessageCreates = /* @__PURE__ */ new WeakSet();
|
|
3531
3538
|
function readDiscordErrorStatus(err) {
|
|
3532
3539
|
if (!err || typeof err !== "object") return;
|
|
3533
|
-
|
|
3540
|
+
const raw = "status" in err && err.status !== void 0 ? err.status : "statusCode" in err && err.statusCode !== void 0 ? err.statusCode : void 0;
|
|
3541
|
+
return parseStrictNonNegativeInteger(raw);
|
|
3534
3542
|
}
|
|
3535
3543
|
function classifyDiscordDeliveryFailure(error) {
|
|
3536
3544
|
const candidates = collectErrorGraphCandidates(error, (current) => [current.cause, current.error]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as resolveDiscordAccount, g as selectDiscordActivitiesRuntimeConfig, n as isDiscordAccountEnabledForRuntime, r as listDiscordAccountIds } from "./accounts-
|
|
2
|
-
import { z as resolveDiscordProxyFetchForAccount } from "./send.shared-
|
|
1
|
+
import { c as resolveDiscordAccount, g as selectDiscordActivitiesRuntimeConfig, n as isDiscordAccountEnabledForRuntime, r as listDiscordAccountIds } from "./accounts-CwJQoLjM.js";
|
|
2
|
+
import { z as resolveDiscordProxyFetchForAccount } from "./send.shared-BJHt0Vyf.js";
|
|
3
3
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
//#region extensions/discord/src/activities/config.ts
|
|
5
5
|
function resolveDiscordActivitiesConfig(account, env = process.env) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { f as resolveDiscordReplyReference, u as createReusableDiscordReplyReference, v as resolveDiscordChannelId } from "./retry-
|
|
2
|
-
import { h as readDiscordComponentSpec, m as coerceDiscordComponentParam } from "./components-
|
|
3
|
-
import { o as mergeDiscordAccountConfig, s as resolveDefaultDiscordAccountId, t as createDiscordActionGate } from "./accounts-
|
|
4
|
-
import { r as sendDiscordComponentMessage } from "./send.components-
|
|
5
|
-
import { a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, n as isDiscordGroupAllowedByPolicy, v as resolveGroupDmAllow } from "./allow-list-
|
|
6
|
-
import { F as createDiscordRuntimeAccountContext, T as hasAnyGuildPermissionDiscord, U as getGateway, d as resolveDiscordTargetChannelId, v as canManageGuildMemberRoleDiscord, w as hasAnyChannelPermissionDiscord, x as fetchChannelPermissionsDiscord, y as canManageGuildRoleDiscord } from "./send.shared-
|
|
7
|
-
import { r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-
|
|
1
|
+
import { f as resolveDiscordReplyReference, u as createReusableDiscordReplyReference, v as resolveDiscordChannelId } from "./retry-t5RcEsPk.js";
|
|
2
|
+
import { h as readDiscordComponentSpec, m as coerceDiscordComponentParam } from "./components-gvRA0oaI.js";
|
|
3
|
+
import { o as mergeDiscordAccountConfig, s as resolveDefaultDiscordAccountId, t as createDiscordActionGate } from "./accounts-CwJQoLjM.js";
|
|
4
|
+
import { r as sendDiscordComponentMessage } from "./send.components-nsPnc7kK.js";
|
|
5
|
+
import { a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, n as isDiscordGroupAllowedByPolicy, v as resolveGroupDmAllow } from "./allow-list-C2JuH-R0.js";
|
|
6
|
+
import { F as createDiscordRuntimeAccountContext, T as hasAnyGuildPermissionDiscord, U as getGateway, d as resolveDiscordTargetChannelId, v as canManageGuildMemberRoleDiscord, w as hasAnyChannelPermissionDiscord, x as fetchChannelPermissionsDiscord, y as canManageGuildRoleDiscord } from "./send.shared-BJHt0Vyf.js";
|
|
7
|
+
import { r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-CaOs9Zy1.js";
|
|
8
8
|
import { t as isDiscordThreadChannelType } from "./channel-type-CVLZyGYS.js";
|
|
9
9
|
import { n as getPresence } from "./presence-cache-z1N8MbJ3.js";
|
|
10
|
-
import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, l as DiscordThreadInitialMessageError, m as listPinsDiscord, n as fetchReactionsDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, w as fetchGuildInfoDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-
|
|
11
|
-
import "./targets-
|
|
10
|
+
import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, l as DiscordThreadInitialMessageError, m as listPinsDiscord, n as fetchReactionsDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, w as fetchGuildInfoDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-mTKSBdmZ.js";
|
|
11
|
+
import "./targets-DQSye1Rv.js";
|
|
12
12
|
import { ChannelType, PermissionFlagsBits } from "discord-api-types/v10";
|
|
13
13
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
14
14
|
import { asBoolean, isRecord, normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -656,7 +656,8 @@ async function resolveGuildAdminActionPermissions(params) {
|
|
|
656
656
|
cfg: params.cfg,
|
|
657
657
|
accountId: params.accountId
|
|
658
658
|
}));
|
|
659
|
-
|
|
659
|
+
const channelType = "type" in channel ? channel.type : void 0;
|
|
660
|
+
if (!isDiscordThreadChannelType(channelType)) return params.guard.permissions;
|
|
660
661
|
return params.values.archived === false && !("name" in params.values) && !("topic" in params.values) && !("position" in params.values) && !("parentId" in params.values) && !("clearParent" in params.values) && !("nsfw" in params.values) && !("rateLimitPerUser" in params.values) && !("locked" in params.values) && !("autoArchiveDuration" in params.values) && !isLockedThreadChannel(channel) ? [PermissionFlagsBits.ManageThreads, PermissionFlagsBits.SendMessagesInThreads] : [PermissionFlagsBits.ManageThreads];
|
|
661
662
|
}
|
|
662
663
|
async function verifySenderGuildAdminPermission(params) {
|
|
@@ -763,9 +764,10 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
|
|
|
763
764
|
if (!isActionEnabled("roleInfo")) throw new Error("Discord role info is disabled.");
|
|
764
765
|
const guildId = readStringParam(params, "guildId", { required: true });
|
|
765
766
|
await assertGuildMetadataReadAllowed(guildId);
|
|
767
|
+
const roles = await discordGuildActionRuntime.fetchRoleInfoDiscord(guildId, withOpts());
|
|
766
768
|
return jsonResult({
|
|
767
769
|
ok: true,
|
|
768
|
-
roles
|
|
770
|
+
roles
|
|
769
771
|
});
|
|
770
772
|
}
|
|
771
773
|
case "emojiList": {
|
|
@@ -784,9 +786,10 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
|
|
|
784
786
|
...animated ? { animated } : {}
|
|
785
787
|
}] : []).toSorted((left, right) => left.name.localeCompare(right.name) || left.identifier.localeCompare(right.identifier));
|
|
786
788
|
const gateway = getGateway(accountId ?? resolveDefaultDiscordAccountId(cfg));
|
|
789
|
+
const emojis = gateway ? await gateway.fetchGuildEmojis(guildId, fetchEmojis) : await fetchEmojis();
|
|
787
790
|
return jsonResult({
|
|
788
791
|
ok: true,
|
|
789
|
-
emojis:
|
|
792
|
+
emojis: emojis.slice(0, limit)
|
|
790
793
|
});
|
|
791
794
|
}
|
|
792
795
|
case "emojiUpload": {
|
|
@@ -795,14 +798,15 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
|
|
|
795
798
|
const name = readStringParam(params, "name", { required: true });
|
|
796
799
|
const mediaUrl = readStringParam(params, "mediaUrl", { required: true });
|
|
797
800
|
const roleIds = readStringArrayParam(params, "roleIds");
|
|
801
|
+
const emoji = await discordGuildActionRuntime.uploadEmojiDiscord({
|
|
802
|
+
guildId,
|
|
803
|
+
name,
|
|
804
|
+
mediaUrl,
|
|
805
|
+
roleIds: roleIds?.length ? roleIds : void 0
|
|
806
|
+
}, withOpts());
|
|
798
807
|
return jsonResult({
|
|
799
808
|
ok: true,
|
|
800
|
-
emoji
|
|
801
|
-
guildId,
|
|
802
|
-
name,
|
|
803
|
-
mediaUrl,
|
|
804
|
-
roleIds: roleIds?.length ? roleIds : void 0
|
|
805
|
-
}, withOpts())
|
|
809
|
+
emoji
|
|
806
810
|
});
|
|
807
811
|
}
|
|
808
812
|
case "stickerUpload": {
|
|
@@ -812,15 +816,16 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
|
|
|
812
816
|
const description = readStringParam(params, "description", { required: true });
|
|
813
817
|
const tags = readStringParam(params, "tags", { required: true });
|
|
814
818
|
const mediaUrl = readStringParam(params, "mediaUrl", { required: true });
|
|
819
|
+
const sticker = await discordGuildActionRuntime.uploadStickerDiscord({
|
|
820
|
+
guildId,
|
|
821
|
+
name,
|
|
822
|
+
description,
|
|
823
|
+
tags,
|
|
824
|
+
mediaUrl
|
|
825
|
+
}, withOpts());
|
|
815
826
|
return jsonResult({
|
|
816
827
|
ok: true,
|
|
817
|
-
sticker
|
|
818
|
-
guildId,
|
|
819
|
-
name,
|
|
820
|
-
description,
|
|
821
|
-
tags,
|
|
822
|
-
mediaUrl
|
|
823
|
-
}, withOpts())
|
|
828
|
+
sticker
|
|
824
829
|
});
|
|
825
830
|
}
|
|
826
831
|
case "roleAdd":
|
|
@@ -845,9 +850,10 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
|
|
|
845
850
|
if (!isActionEnabled("channelInfo")) throw new Error("Discord channel info is disabled.");
|
|
846
851
|
const channelId = readStringParam(params, "channelId", { required: true });
|
|
847
852
|
await readTargetGate.assertReadTargetAllowed({ channelId });
|
|
853
|
+
const channel = await discordGuildActionRuntime.fetchChannelInfoDiscord(channelId, withOpts());
|
|
848
854
|
return jsonResult({
|
|
849
855
|
ok: true,
|
|
850
|
-
channel
|
|
856
|
+
channel
|
|
851
857
|
});
|
|
852
858
|
}
|
|
853
859
|
case "channelList": {
|
|
@@ -855,12 +861,13 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
|
|
|
855
861
|
const guildId = readStringParam(params, "guildId", { required: true });
|
|
856
862
|
await assertGuildMetadataReadAllowed(guildId, { filteredResults: true });
|
|
857
863
|
const channels = await discordGuildActionRuntime.listGuildChannelsDiscord(guildId, withOpts());
|
|
864
|
+
const visibleChannels = await readTargetGate.filterGuildChannelList({
|
|
865
|
+
guildId,
|
|
866
|
+
channels
|
|
867
|
+
});
|
|
858
868
|
return jsonResult({
|
|
859
869
|
ok: true,
|
|
860
|
-
channels:
|
|
861
|
-
guildId,
|
|
862
|
-
channels
|
|
863
|
-
})
|
|
870
|
+
channels: visibleChannels
|
|
864
871
|
});
|
|
865
872
|
}
|
|
866
873
|
case "voiceStatus": {
|
|
@@ -868,18 +875,20 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
|
|
|
868
875
|
const guildId = readStringParam(params, "guildId", { required: true });
|
|
869
876
|
await assertGuildMetadataReadAllowed(guildId);
|
|
870
877
|
const userId = readStringParam(params, "userId", { required: true });
|
|
878
|
+
const voice = await discordGuildActionRuntime.fetchVoiceStatusDiscord(guildId, userId, withOpts());
|
|
871
879
|
return jsonResult({
|
|
872
880
|
ok: true,
|
|
873
|
-
voice
|
|
881
|
+
voice
|
|
874
882
|
});
|
|
875
883
|
}
|
|
876
884
|
case "eventList": {
|
|
877
885
|
if (!isActionEnabled("events")) throw new Error("Discord events are disabled.");
|
|
878
886
|
const guildId = readStringParam(params, "guildId", { required: true });
|
|
879
887
|
await assertGuildMetadataReadAllowed(guildId);
|
|
888
|
+
const events = await discordGuildActionRuntime.listScheduledEventsDiscord(guildId, withOpts());
|
|
880
889
|
return jsonResult({
|
|
881
890
|
ok: true,
|
|
882
|
-
events
|
|
891
|
+
events
|
|
883
892
|
});
|
|
884
893
|
}
|
|
885
894
|
case "eventCreate": {
|
|
@@ -906,27 +915,33 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
|
|
|
906
915
|
image,
|
|
907
916
|
privacy_level: 2
|
|
908
917
|
};
|
|
918
|
+
const event = await discordGuildActionRuntime.createScheduledEventDiscord(guildId, payload, withOpts());
|
|
909
919
|
return jsonResult({
|
|
910
920
|
ok: true,
|
|
911
|
-
event
|
|
921
|
+
event
|
|
912
922
|
});
|
|
913
923
|
}
|
|
914
|
-
case "channelCreate":
|
|
924
|
+
case "channelCreate": {
|
|
915
925
|
if (!isActionEnabled("channels")) throw new Error("Discord channel management is disabled.");
|
|
926
|
+
const channel = await discordGuildActionRuntime.createChannelDiscord(readDiscordChannelCreateParams(params), withOpts());
|
|
916
927
|
return jsonResult({
|
|
917
928
|
ok: true,
|
|
918
|
-
channel
|
|
929
|
+
channel
|
|
919
930
|
});
|
|
920
|
-
|
|
931
|
+
}
|
|
932
|
+
case "channelEdit": {
|
|
921
933
|
if (!isActionEnabled("channels")) throw new Error("Discord channel management is disabled.");
|
|
934
|
+
const channel = await discordGuildActionRuntime.editChannelDiscord(readDiscordChannelEditParams(params), withOpts());
|
|
922
935
|
return jsonResult({
|
|
923
936
|
ok: true,
|
|
924
|
-
channel
|
|
937
|
+
channel
|
|
925
938
|
});
|
|
939
|
+
}
|
|
926
940
|
case "channelDelete": {
|
|
927
941
|
if (!isActionEnabled("channels")) throw new Error("Discord channel management is disabled.");
|
|
928
942
|
const channelId = readStringParam(params, "channelId", { required: true });
|
|
929
|
-
|
|
943
|
+
const result = await discordGuildActionRuntime.deleteChannelDiscord(channelId, withOpts());
|
|
944
|
+
return jsonResult(result);
|
|
930
945
|
}
|
|
931
946
|
case "channelMove":
|
|
932
947
|
if (!isActionEnabled("channels")) throw new Error("Discord channel management is disabled.");
|
|
@@ -937,14 +952,15 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
|
|
|
937
952
|
const guildId = readStringParam(params, "guildId", { required: true });
|
|
938
953
|
const name = readStringParam(params, "name", { required: true });
|
|
939
954
|
const position = readNonNegativeIntegerParam(params, "position");
|
|
955
|
+
const channel = await discordGuildActionRuntime.createChannelDiscord({
|
|
956
|
+
guildId,
|
|
957
|
+
name,
|
|
958
|
+
type: 4,
|
|
959
|
+
position: position ?? void 0
|
|
960
|
+
}, withOpts());
|
|
940
961
|
return jsonResult({
|
|
941
962
|
ok: true,
|
|
942
|
-
category:
|
|
943
|
-
guildId,
|
|
944
|
-
name,
|
|
945
|
-
type: 4,
|
|
946
|
-
position: position ?? void 0
|
|
947
|
-
}, withOpts())
|
|
963
|
+
category: channel
|
|
948
964
|
});
|
|
949
965
|
}
|
|
950
966
|
case "categoryEdit": {
|
|
@@ -952,19 +968,21 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
|
|
|
952
968
|
const categoryId = readStringParam(params, "categoryId", { required: true });
|
|
953
969
|
const name = readStringParam(params, "name");
|
|
954
970
|
const position = readNonNegativeIntegerParam(params, "position");
|
|
971
|
+
const channel = await discordGuildActionRuntime.editChannelDiscord({
|
|
972
|
+
channelId: categoryId,
|
|
973
|
+
name: name ?? void 0,
|
|
974
|
+
position: position ?? void 0
|
|
975
|
+
}, withOpts());
|
|
955
976
|
return jsonResult({
|
|
956
977
|
ok: true,
|
|
957
|
-
category:
|
|
958
|
-
channelId: categoryId,
|
|
959
|
-
name: name ?? void 0,
|
|
960
|
-
position: position ?? void 0
|
|
961
|
-
}, withOpts())
|
|
978
|
+
category: channel
|
|
962
979
|
});
|
|
963
980
|
}
|
|
964
981
|
case "categoryDelete": {
|
|
965
982
|
if (!isActionEnabled("channels")) throw new Error("Discord channel management is disabled.");
|
|
966
983
|
const categoryId = readStringParam(params, "categoryId", { required: true });
|
|
967
|
-
|
|
984
|
+
const result = await discordGuildActionRuntime.deleteChannelDiscord(categoryId, withOpts());
|
|
985
|
+
return jsonResult(result);
|
|
968
986
|
}
|
|
969
987
|
case "channelPermissionSet": {
|
|
970
988
|
if (!isActionEnabled("channels")) throw new Error("Discord channel management is disabled.");
|
|
@@ -1020,9 +1038,10 @@ async function handleDiscordMessageManagementAction(ctx) {
|
|
|
1020
1038
|
if (!ctx.isActionEnabled("permissions")) throw new Error("Discord permissions are disabled.");
|
|
1021
1039
|
const channelId = ctx.resolveChannelId();
|
|
1022
1040
|
await ctx.assertReadTargetAllowed({ channelId });
|
|
1041
|
+
const permissions = await discordMessagingActionRuntime.fetchChannelPermissionsDiscord(channelId, ctx.withOpts());
|
|
1023
1042
|
return jsonResult({
|
|
1024
1043
|
ok: true,
|
|
1025
|
-
permissions
|
|
1044
|
+
permissions
|
|
1026
1045
|
});
|
|
1027
1046
|
}
|
|
1028
1047
|
case "fetchMessage": {
|
|
@@ -1061,10 +1080,11 @@ async function handleDiscordMessageManagementAction(ctx) {
|
|
|
1061
1080
|
after: readStringParam(ctx.params, "after"),
|
|
1062
1081
|
around: readStringParam(ctx.params, "around")
|
|
1063
1082
|
};
|
|
1083
|
+
const messages = assertDiscordMessageListResult(await discordMessagingActionRuntime.readMessagesDiscord(channelId, query, ctx.withOpts()));
|
|
1064
1084
|
return jsonResult({
|
|
1065
1085
|
ok: true,
|
|
1066
1086
|
channelId,
|
|
1067
|
-
messages:
|
|
1087
|
+
messages: messages.map((message) => ctx.normalizeMessage(message))
|
|
1068
1088
|
});
|
|
1069
1089
|
}
|
|
1070
1090
|
case "editMessage": {
|
|
@@ -1073,9 +1093,10 @@ async function handleDiscordMessageManagementAction(ctx) {
|
|
|
1073
1093
|
const messageId = readStringParam(ctx.params, "messageId", { required: true });
|
|
1074
1094
|
const content = readStringParam(ctx.params, "content", { required: true });
|
|
1075
1095
|
await ctx.assertReadTargetAllowed({ channelId });
|
|
1096
|
+
const message = await discordMessagingActionRuntime.editMessageDiscord(channelId, messageId, { content }, ctx.withOpts());
|
|
1076
1097
|
return jsonResult({
|
|
1077
1098
|
ok: true,
|
|
1078
|
-
message
|
|
1099
|
+
message
|
|
1079
1100
|
});
|
|
1080
1101
|
}
|
|
1081
1102
|
case "deleteMessage": {
|
|
@@ -1106,9 +1127,10 @@ async function handleDiscordMessageManagementAction(ctx) {
|
|
|
1106
1127
|
if (!ctx.isActionEnabled("pins")) throw new Error("Discord pins are disabled.");
|
|
1107
1128
|
const channelId = ctx.resolveChannelId();
|
|
1108
1129
|
await ctx.assertReadTargetAllowed({ channelId });
|
|
1130
|
+
const pins = await discordMessagingActionRuntime.listPinsDiscord(channelId, ctx.withOpts());
|
|
1109
1131
|
return jsonResult({
|
|
1110
1132
|
ok: true,
|
|
1111
|
-
pins:
|
|
1133
|
+
pins: pins.map((pin) => ctx.normalizeMessage(pin))
|
|
1112
1134
|
});
|
|
1113
1135
|
}
|
|
1114
1136
|
case "searchMessages": {
|
|
@@ -1183,9 +1205,10 @@ async function handleDiscordReactionMessagingAction(ctx) {
|
|
|
1183
1205
|
}
|
|
1184
1206
|
if (isEmpty) {
|
|
1185
1207
|
await ctx.assertReadTargetAllowed({ channelId });
|
|
1208
|
+
const removed = await discordMessagingActionRuntime.removeOwnReactionsDiscord(channelId, messageId, ctx.withReactionRuntimeOptions());
|
|
1186
1209
|
return jsonResult({
|
|
1187
1210
|
ok: true,
|
|
1188
|
-
removed:
|
|
1211
|
+
removed: removed.removed
|
|
1189
1212
|
});
|
|
1190
1213
|
}
|
|
1191
1214
|
await ctx.assertReadTargetAllowed({ channelId });
|
|
@@ -1201,9 +1224,10 @@ async function handleDiscordReactionMessagingAction(ctx) {
|
|
|
1201
1224
|
const messageId = readStringParam(ctx.params, "messageId", { required: true });
|
|
1202
1225
|
const limit = readPositiveIntegerParam(ctx.params, "limit");
|
|
1203
1226
|
await ctx.assertReadTargetAllowed({ channelId });
|
|
1227
|
+
const reactions = await discordMessagingActionRuntime.fetchReactionsDiscord(channelId, messageId, ctx.withReactionRuntimeOptions({ limit }));
|
|
1204
1228
|
return jsonResult({
|
|
1205
1229
|
ok: true,
|
|
1206
|
-
reactions
|
|
1230
|
+
reactions
|
|
1207
1231
|
});
|
|
1208
1232
|
}
|
|
1209
1233
|
default: return;
|
|
@@ -1269,7 +1293,8 @@ async function appendDiscordThreadRenameResult(ctx, params) {
|
|
|
1269
1293
|
};
|
|
1270
1294
|
}
|
|
1271
1295
|
try {
|
|
1272
|
-
|
|
1296
|
+
const channel = await discordMessagingActionRuntime.fetchChannelInfoDiscord(channelId, ctx.withOpts());
|
|
1297
|
+
if (!isDiscordThreadChannelType(channel.type)) return {
|
|
1273
1298
|
...params.payload,
|
|
1274
1299
|
warning: "Discord threadName was ignored because the send target is not a thread."
|
|
1275
1300
|
};
|
|
@@ -1302,12 +1327,13 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1302
1327
|
required: true,
|
|
1303
1328
|
label: "stickerIds"
|
|
1304
1329
|
});
|
|
1330
|
+
const result = await discordMessagingActionRuntime.sendStickerDiscord(to, stickerIds, ctx.withOpts({
|
|
1331
|
+
content,
|
|
1332
|
+
...ctx.params.silent === true ? { silent: true } : {}
|
|
1333
|
+
}));
|
|
1305
1334
|
return jsonResult({
|
|
1306
1335
|
ok: true,
|
|
1307
|
-
result
|
|
1308
|
-
content,
|
|
1309
|
-
...ctx.params.silent === true ? { silent: true } : {}
|
|
1310
|
-
}))
|
|
1336
|
+
result
|
|
1311
1337
|
});
|
|
1312
1338
|
}
|
|
1313
1339
|
case "sendMessage": {
|
|
@@ -1366,17 +1392,18 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1366
1392
|
if (!mediaUrl) throw new Error("Voice messages require a media file reference (mediaUrl, path, or filePath).");
|
|
1367
1393
|
if (content && content.trim()) throw new Error("Voice messages cannot include text content (Discord limitation). Remove the content parameter.");
|
|
1368
1394
|
assertMediaNotDataUrl(mediaUrl);
|
|
1395
|
+
const result = await discordMessagingActionRuntime.sendVoiceMessageDiscord(to, mediaUrl, {
|
|
1396
|
+
...ctx.withOpts(),
|
|
1397
|
+
reply: resolveActionReplyReference(ctx, replyTo),
|
|
1398
|
+
silent,
|
|
1399
|
+
mediaAccess: ctx.options?.mediaAccess,
|
|
1400
|
+
mediaLocalRoots: ctx.options?.mediaLocalRoots,
|
|
1401
|
+
mediaReadFile: ctx.options?.mediaReadFile
|
|
1402
|
+
});
|
|
1369
1403
|
return jsonResult(await appendDiscordThreadRenameResult(ctx, {
|
|
1370
1404
|
payload: {
|
|
1371
1405
|
ok: true,
|
|
1372
|
-
result
|
|
1373
|
-
...ctx.withOpts(),
|
|
1374
|
-
reply: resolveActionReplyReference(ctx, replyTo),
|
|
1375
|
-
silent,
|
|
1376
|
-
mediaAccess: ctx.options?.mediaAccess,
|
|
1377
|
-
mediaLocalRoots: ctx.options?.mediaLocalRoots,
|
|
1378
|
-
mediaReadFile: ctx.options?.mediaReadFile
|
|
1379
|
-
}),
|
|
1406
|
+
result,
|
|
1380
1407
|
voiceMessage: true
|
|
1381
1408
|
},
|
|
1382
1409
|
target: to,
|
|
@@ -1419,9 +1446,10 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1419
1446
|
appliedTags: readStringArrayParam(ctx.params, "appliedTags") ?? void 0
|
|
1420
1447
|
};
|
|
1421
1448
|
try {
|
|
1449
|
+
const thread = await discordMessagingActionRuntime.createThreadDiscord(channelId, payload, ctx.withOpts());
|
|
1422
1450
|
return jsonResult({
|
|
1423
1451
|
ok: true,
|
|
1424
|
-
thread
|
|
1452
|
+
thread
|
|
1425
1453
|
});
|
|
1426
1454
|
} catch (error) {
|
|
1427
1455
|
if (error instanceof DiscordThreadInitialMessageError) {
|
|
@@ -1453,14 +1481,15 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1453
1481
|
guildId,
|
|
1454
1482
|
channelTargetRequiredMessage: "Discord active thread lists require a wildcard channel allowlist so each read target can be authorized."
|
|
1455
1483
|
});
|
|
1484
|
+
const threads = await discordMessagingActionRuntime.listThreadsDiscord({
|
|
1485
|
+
guildId,
|
|
1486
|
+
channelId,
|
|
1487
|
+
includeArchived,
|
|
1488
|
+
before,
|
|
1489
|
+
limit
|
|
1490
|
+
}, ctx.withOpts());
|
|
1456
1491
|
return jsonResult(normalizeDiscordThreadListActionResult({
|
|
1457
|
-
value:
|
|
1458
|
-
guildId,
|
|
1459
|
-
channelId,
|
|
1460
|
-
includeArchived,
|
|
1461
|
-
before,
|
|
1462
|
-
limit
|
|
1463
|
-
}, ctx.withOpts()),
|
|
1492
|
+
value: threads,
|
|
1464
1493
|
guildId,
|
|
1465
1494
|
channelId,
|
|
1466
1495
|
includeArchived: includeArchived === true,
|
|
@@ -1474,17 +1503,18 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1474
1503
|
const content = readStringParam(ctx.params, "content", { required: true });
|
|
1475
1504
|
const mediaUrl = readStringParam(ctx.params, "mediaUrl");
|
|
1476
1505
|
const replyTo = readStringParam(ctx.params, "replyTo");
|
|
1506
|
+
const result = await discordMessagingActionRuntime.sendMessageDiscord(`channel:${channelId}`, content, {
|
|
1507
|
+
...ctx.withOpts(),
|
|
1508
|
+
mediaUrl,
|
|
1509
|
+
mediaAccess: ctx.options?.mediaAccess,
|
|
1510
|
+
mediaLocalRoots: ctx.options?.mediaLocalRoots,
|
|
1511
|
+
mediaReadFile: ctx.options?.mediaReadFile,
|
|
1512
|
+
reply: resolveActionReplyReference(ctx, replyTo),
|
|
1513
|
+
...ctx.params.silent === true ? { silent: true } : {}
|
|
1514
|
+
});
|
|
1477
1515
|
return jsonResult({
|
|
1478
1516
|
ok: true,
|
|
1479
|
-
result
|
|
1480
|
-
...ctx.withOpts(),
|
|
1481
|
-
mediaUrl,
|
|
1482
|
-
mediaAccess: ctx.options?.mediaAccess,
|
|
1483
|
-
mediaLocalRoots: ctx.options?.mediaLocalRoots,
|
|
1484
|
-
mediaReadFile: ctx.options?.mediaReadFile,
|
|
1485
|
-
reply: resolveActionReplyReference(ctx, replyTo),
|
|
1486
|
-
...ctx.params.silent === true ? { silent: true } : {}
|
|
1487
|
-
})
|
|
1517
|
+
result
|
|
1488
1518
|
});
|
|
1489
1519
|
}
|
|
1490
1520
|
default: return;
|
|
@@ -1561,16 +1591,19 @@ async function handleDiscordModerationAction(action, params, isActionEnabled, cf
|
|
|
1561
1591
|
cfg
|
|
1562
1592
|
});
|
|
1563
1593
|
switch (command.action) {
|
|
1564
|
-
case "timeout":
|
|
1565
|
-
|
|
1566
|
-
member: await discordModerationActionRuntime.timeoutMemberDiscord({
|
|
1594
|
+
case "timeout": {
|
|
1595
|
+
const member = await discordModerationActionRuntime.timeoutMemberDiscord({
|
|
1567
1596
|
guildId: command.guildId,
|
|
1568
1597
|
userId: command.userId,
|
|
1569
1598
|
durationMinutes: command.durationMinutes,
|
|
1570
1599
|
until: command.until,
|
|
1571
1600
|
reason: command.reason
|
|
1572
|
-
}, withOpts())
|
|
1573
|
-
|
|
1601
|
+
}, withOpts());
|
|
1602
|
+
return jsonResult({
|
|
1603
|
+
ok: true,
|
|
1604
|
+
member
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1574
1607
|
case "kick":
|
|
1575
1608
|
await discordModerationActionRuntime.kickMemberDiscord({
|
|
1576
1609
|
guildId: command.guildId,
|
|
@@ -1701,9 +1734,10 @@ const moderationActions = /* @__PURE__ */ new Set([
|
|
|
1701
1734
|
]);
|
|
1702
1735
|
async function handleDiscordAction(params, cfg, options) {
|
|
1703
1736
|
const action = readStringParam(params, "action", { required: true });
|
|
1737
|
+
const accountId = readStringParam(params, "accountId");
|
|
1704
1738
|
const isActionEnabled = createDiscordActionGate({
|
|
1705
1739
|
cfg,
|
|
1706
|
-
accountId
|
|
1740
|
+
accountId
|
|
1707
1741
|
});
|
|
1708
1742
|
if (messagingActions.has(action)) return await handleDiscordMessagingAction(action, params, isActionEnabled, cfg, options);
|
|
1709
1743
|
if (guildActions.has(action)) return await handleDiscordGuildAction(action, params, isActionEnabled, cfg, options);
|