@openclaw/discord 2026.9.1-beta.1 → 2026.9.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-q-9PaaHH.js → activities-api-CTcGq3Hf.js} +30 -17
- package/dist/activities-api.js +1 -1
- package/dist/{allow-list-BDMimASD.js → allow-list-DBTtR2dz.js} +13 -35
- package/dist/{api-DNVbJyEy.js → api-BfmEP6wp.js} +6 -5
- package/dist/api.js +18 -18
- package/dist/{approval-handler.runtime-B7qhK3fR.js → approval-handler.runtime-DUSe5fyH.js} +19 -12
- package/dist/{audit-CBEv_ERu.js → audit-DpPfwoJM.js} +8 -7
- package/dist/{channel-Dx1tMTfx.js → channel-BHajPgwR.js} +29 -23
- package/dist/{channel-actions.runtime-CLWWu9nC.js → channel-actions.runtime-DS8pXo0S.js} +38 -38
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-DOzXS2Pk.js → channel.setup-BWmMe1tT.js} +18 -18
- package/dist/command-owners-D78sAoOz.js +10 -0
- package/dist/{components-B9V5o361.js → components-BimX47Mq.js} +111 -149
- package/dist/{config-schema-BR13IAx6.js → config-schema-B797-Spt.js} +19 -12
- package/dist/{conversation-binding-route-DJYrY2TQ.js → conversation-binding-route-DuR5NGIx.js} +1 -1
- package/dist/{directory-config-BK6eqekJ.js → directory-config-CD2v2Szs.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DSAJSrJk.js → directory-live-DaJzWJ2N.js} +4 -4
- package/dist/{doctor-Cm7Y1pJ2.js → doctor-D4HH1inA.js} +9 -6
- package/dist/{doctor-contract-DsWvKIXF.js → doctor-contract-Co5vRCZ6.js} +9 -6
- package/dist/doctor-contract-api.js +31 -28
- package/dist/{handle-action.guild-admin-BdwCRHmm.js → handle-action.guild-admin-4We6wWQU.js} +6 -3
- package/dist/index.js +1 -1
- package/dist/ingress-identity-XNmW-mZS.js +60 -0
- package/dist/{message-handler-BXpWZyni.js → message-handler-DhgBabyU.js} +61 -70
- package/dist/{message-handler.preflight-Ba5LAY_X.js → message-handler.preflight-oZ7dQCd0.js} +41 -101
- package/dist/{message-handler.process-3HEzmemS.js → message-handler.process-BzCYf1pa.js} +82 -108
- package/dist/{message-text-aiwO5R2F.js → message-text-DK4NnBg-.js} +11 -6
- package/dist/{outbound-adapter-BE4jSq2d.js → outbound-adapter-CtggmGh9.js} +52 -67
- package/dist/{outbound-components-oLpg8Qzb.js → outbound-components-Dn8SJWMS.js} +5 -4
- package/dist/{outbound-session-route-Cg15ZFJd.js → outbound-session-route-Q_HEusBQ.js} +57 -15
- package/dist/{owner-access-UlYi9t0M.js → owner-access-Cp8r6Ipf.js} +9 -7
- package/dist/{pluralkit-Tiyl70dx.js → pluralkit-BY75YcK0.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-session.runtime-B9xe-Qaf.js → provider-session.runtime-BL2lHBH7.js} +3 -3
- package/dist/{provider-B11xwilq.js → provider-uKmmrDM4.js} +299 -136
- package/dist/provider.runtime-C-IkWF2w.js +2 -0
- package/dist/{realtime-session.runtime-CU8IQUS-.js → realtime-session.runtime-CGYm1t_0.js} +798 -448
- package/dist/{resolve-allowlist-common-BLoYaxEG.js → resolve-allowlist-common-sKIKy-cF.js} +3 -3
- package/dist/{resolve-channels-C2sT_n67.js → resolve-channels-CoiMlWy0.js} +4 -4
- package/dist/{resolve-users-CzpjLwjy.js → resolve-users-DJpiokfW.js} +5 -4
- package/dist/{retry-Cv4jCU5Z.js → retry-DQt1zDgH.js} +356 -214
- package/dist/{retry-after-DdLPmPoa.js → retry-after-BrLjLUJi.js} +2 -1
- package/dist/{runtime-CY4PRMF-.js → runtime-BHsdEdr5.js} +2 -2
- package/dist/{runtime-BHrTlFkf.js → runtime-Ghtfh5ZA.js} +151 -109
- package/dist/runtime-api.js +20 -20
- package/dist/{secret-config-contract-B3i6WxV5.js → secret-config-contract-DFu9hfU8.js} +14 -6
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-BfJhAXZp.js → security-audit-DKfK-iPY.js} +10 -11
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-BVKF9VtY.js → security-audit.runtime-sKZyKgpx.js} +1 -1
- package/dist/{send-C49MFF9j.js → send-CZeWKUiA.js} +132 -100
- package/dist/{send.components-DKKAw5VX.js → send.components-BG5IDABj.js} +21 -15
- package/dist/{send.outbound-zam0TrZx.js → send.outbound-DHuFUL6W.js} +42 -63
- package/dist/{send.shared-JjljcV4O.js → send.shared-B0n_fWzu.js} +77 -149
- package/dist/{sender-identity-BJtfyise.js → sender-identity-B8Ncfi63.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-_5EcP4jW.js → shared-C3dKun_X.js} +24 -15
- package/dist/{subagent-hooks-DQzvOptn.js → subagent-hooks-ZoQXEI1E.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-C7yxaHWP.js → system-events-DFF_awl7.js} +2 -2
- package/dist/{target-resolver-vxIh6O3-.js → target-resolver-DLtHDwMK.js} +6 -5
- package/dist/targets-BObRyaKX.js +3 -0
- package/dist/{thread-bindings-DW5F9vat.js → thread-bindings-DKvsNjQR.js} +7 -6
- package/dist/{thread-bindings.manager-ByOtwjo_.js → thread-bindings.manager-pbbRT5gb.js} +38 -29
- package/dist/{thread-bindings.session-updates-CJb-BpPL.js → thread-bindings.session-updates-t6jeFB1-.js} +3 -2
- package/dist/{thread-bindings.state-D8OMdk4O.js → thread-bindings.state-DtgOqsbX.js} +34 -1
- package/dist/{threading-agH1T_6s.js → threading-BCx49X-6.js} +8 -6
- package/dist/{timeouts-B9cy6RvQ.js → timeouts-D86uWLt_.js} +1 -1
- package/dist/{transcripts-source-BR11iHA4.js → transcripts-source-Dc6Nnli5.js} +55 -7
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-Dc_YMY2e.js → typing-CuopV-Hi.js} +2 -2
- package/dist/{voice-runtime-DIeaa8fJ.js → voice-runtime-BQnILUbG.js} +492 -105
- 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/@discordjs/voice/node_modules/@types/node/README.md +1 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/buffer.buffer.d.ts +5 -5
- package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +2 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +16 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +10 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +52 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +210 -28
- package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +6 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +36 -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/build/format/json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/json_pointer.mjs +2 -2
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/system/memory/assign.mjs +2 -1
- package/node_modules/typebox/build/system/memory/create.mjs +3 -4
- package/node_modules/typebox/build/system/memory/discard.mjs +2 -2
- package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
- package/node_modules/typebox/build/system/memory/update.mjs +3 -2
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/undici/docs/docs/api/Client.md +4 -0
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +3 -2
- package/node_modules/undici/docs/docs/api/EventSource.md +4 -0
- package/node_modules/undici/docs/docs/api/Interceptors.md +7 -3
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +7 -1
- package/node_modules/undici/lib/cache/memory-cache-store.js +2 -2
- package/node_modules/undici/lib/core/symbols.js +2 -0
- package/node_modules/undici/lib/dispatcher/agent.js +7 -2
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +7 -4
- package/node_modules/undici/lib/dispatcher/client-h1.js +12 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +43 -3
- package/node_modules/undici/lib/dispatcher/client.js +3 -2
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +13 -1
- package/node_modules/undici/lib/dispatcher/dispatcher.js +15 -1
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +3 -0
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +10 -3
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -1
- package/node_modules/undici/lib/dispatcher/retry-agent.js +3 -0
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +1 -1
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +91 -21
- package/node_modules/undici/lib/handler/cache-handler.js +29 -5
- package/node_modules/undici/lib/handler/decorator-handler.js +7 -1
- package/node_modules/undici/lib/handler/deduplication-handler.js +12 -6
- package/node_modules/undici/lib/handler/redirect-handler.js +21 -4
- package/node_modules/undici/lib/handler/retry-handler.js +148 -30
- package/node_modules/undici/lib/interceptor/cache.js +65 -12
- package/node_modules/undici/lib/interceptor/decompress.js +115 -13
- package/node_modules/undici/lib/interceptor/deduplicate.js +5 -4
- package/node_modules/undici/lib/interceptor/dns.js +7 -0
- package/node_modules/undici/lib/interceptor/dump.js +10 -23
- package/node_modules/undici/lib/mock/mock-agent.js +13 -1
- package/node_modules/undici/lib/mock/mock-utils.js +11 -10
- package/node_modules/undici/lib/util/cache.js +45 -3
- package/node_modules/undici/lib/web/cookies/parse.js +150 -147
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +28 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +13 -3
- package/node_modules/undici/lib/web/fetch/index.js +6 -0
- package/node_modules/undici/lib/web/fetch/request.js +2 -3
- package/node_modules/undici/lib/web/fetch/util.js +6 -1
- package/node_modules/undici/lib/web/webidl/index.js +3 -3
- package/node_modules/undici/lib/web/websocket/connection.js +1 -1
- package/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
- package/node_modules/undici/package.json +3 -3
- package/node_modules/undici/types/client.d.ts +10 -0
- package/node_modules/undici/types/interceptors.d.ts +2 -0
- package/node_modules/undici/types/mock-agent.d.ts +11 -10
- package/node_modules/undici/types/socks5-proxy-agent.d.ts +2 -0
- package/openclaw.plugin.json +15 -8
- package/package.json +7 -6
- package/skills/discord/SKILL.md +1 -1
- package/dist/account-inspect-BDfKyuvL.js +0 -89
- package/dist/provider.runtime-DiYaHvOz.js +0 -2
- package/dist/sdk-runtime-4geQHtXc.js +0 -338
- package/dist/targets-CtTKvntJ.js +0 -3
|
@@ -3,7 +3,8 @@ import { asFiniteNumberInRange, parseStrictFiniteNumber } from "openclaw/plugin-
|
|
|
3
3
|
const RETRY_AFTER_BODY_SECONDS_RE = /^(?:\d+\.?\d*|\.\d+)$/;
|
|
4
4
|
const MAX_SAFE_RETRY_AFTER_SECONDS = Number.MAX_SAFE_INTEGER / 1e3;
|
|
5
5
|
function parseDiscordRetryAfterBodySeconds(value) {
|
|
6
|
-
|
|
6
|
+
const seconds = typeof value === "number" ? value : typeof value === "string" && RETRY_AFTER_BODY_SECONDS_RE.test(value.trim()) ? parseStrictFiniteNumber(value.trim()) : void 0;
|
|
7
|
+
return asFiniteNumberInRange(seconds, {
|
|
7
8
|
min: 0,
|
|
8
9
|
max: MAX_SAFE_RETRY_AFTER_SECONDS
|
|
9
10
|
});
|
|
@@ -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-B0n_fWzu.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 {
|
|
2
|
-
import {
|
|
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
|
|
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 { d as createReusableDiscordReplyReference, p as resolveDiscordReplyReference, y as resolveDiscordChannelId } from "./retry-DQt1zDgH.js";
|
|
2
|
+
import { h as readDiscordComponentSpec, m as coerceDiscordComponentParam } from "./components-BimX47Mq.js";
|
|
3
|
+
import { o as mergeDiscordAccountConfig, s as resolveDefaultDiscordAccountId, t as createDiscordActionGate } from "./accounts-CwJQoLjM.js";
|
|
4
|
+
import { r as sendDiscordComponentMessage } from "./send.components-BG5IDABj.js";
|
|
5
|
+
import { _ as resolveGroupDmAllow, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, n as isDiscordGroupAllowedByPolicy } from "./allow-list-DBTtR2dz.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-B0n_fWzu.js";
|
|
7
|
+
import { r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-DHuFUL6W.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-CZeWKUiA.js";
|
|
11
|
+
import "./targets-BObRyaKX.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,21 +1080,27 @@ 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": {
|
|
1071
1091
|
if (!ctx.isActionEnabled("messages")) throw new Error("Discord message edits are disabled.");
|
|
1072
1092
|
const channelId = ctx.resolveChannelId();
|
|
1073
1093
|
const messageId = readStringParam(ctx.params, "messageId", { required: true });
|
|
1074
|
-
const content = readStringParam(ctx.params, "content", {
|
|
1094
|
+
const content = readStringParam(ctx.params, "content", {
|
|
1095
|
+
required: true,
|
|
1096
|
+
allowEmpty: true,
|
|
1097
|
+
trim: false
|
|
1098
|
+
});
|
|
1075
1099
|
await ctx.assertReadTargetAllowed({ channelId });
|
|
1100
|
+
const message = await discordMessagingActionRuntime.editMessageDiscord(channelId, messageId, { content }, ctx.withOpts());
|
|
1076
1101
|
return jsonResult({
|
|
1077
1102
|
ok: true,
|
|
1078
|
-
message
|
|
1103
|
+
message
|
|
1079
1104
|
});
|
|
1080
1105
|
}
|
|
1081
1106
|
case "deleteMessage": {
|
|
@@ -1106,9 +1131,10 @@ async function handleDiscordMessageManagementAction(ctx) {
|
|
|
1106
1131
|
if (!ctx.isActionEnabled("pins")) throw new Error("Discord pins are disabled.");
|
|
1107
1132
|
const channelId = ctx.resolveChannelId();
|
|
1108
1133
|
await ctx.assertReadTargetAllowed({ channelId });
|
|
1134
|
+
const pins = await discordMessagingActionRuntime.listPinsDiscord(channelId, ctx.withOpts());
|
|
1109
1135
|
return jsonResult({
|
|
1110
1136
|
ok: true,
|
|
1111
|
-
pins:
|
|
1137
|
+
pins: pins.map((pin) => ctx.normalizeMessage(pin))
|
|
1112
1138
|
});
|
|
1113
1139
|
}
|
|
1114
1140
|
case "searchMessages": {
|
|
@@ -1183,9 +1209,10 @@ async function handleDiscordReactionMessagingAction(ctx) {
|
|
|
1183
1209
|
}
|
|
1184
1210
|
if (isEmpty) {
|
|
1185
1211
|
await ctx.assertReadTargetAllowed({ channelId });
|
|
1212
|
+
const removed = await discordMessagingActionRuntime.removeOwnReactionsDiscord(channelId, messageId, ctx.withReactionRuntimeOptions());
|
|
1186
1213
|
return jsonResult({
|
|
1187
1214
|
ok: true,
|
|
1188
|
-
removed:
|
|
1215
|
+
removed: removed.removed
|
|
1189
1216
|
});
|
|
1190
1217
|
}
|
|
1191
1218
|
await ctx.assertReadTargetAllowed({ channelId });
|
|
@@ -1201,9 +1228,10 @@ async function handleDiscordReactionMessagingAction(ctx) {
|
|
|
1201
1228
|
const messageId = readStringParam(ctx.params, "messageId", { required: true });
|
|
1202
1229
|
const limit = readPositiveIntegerParam(ctx.params, "limit");
|
|
1203
1230
|
await ctx.assertReadTargetAllowed({ channelId });
|
|
1231
|
+
const reactions = await discordMessagingActionRuntime.fetchReactionsDiscord(channelId, messageId, ctx.withReactionRuntimeOptions({ limit }));
|
|
1204
1232
|
return jsonResult({
|
|
1205
1233
|
ok: true,
|
|
1206
|
-
reactions
|
|
1234
|
+
reactions
|
|
1207
1235
|
});
|
|
1208
1236
|
}
|
|
1209
1237
|
default: return;
|
|
@@ -1269,7 +1297,8 @@ async function appendDiscordThreadRenameResult(ctx, params) {
|
|
|
1269
1297
|
};
|
|
1270
1298
|
}
|
|
1271
1299
|
try {
|
|
1272
|
-
|
|
1300
|
+
const channel = await discordMessagingActionRuntime.fetchChannelInfoDiscord(channelId, ctx.withOpts());
|
|
1301
|
+
if (!isDiscordThreadChannelType(channel.type)) return {
|
|
1273
1302
|
...params.payload,
|
|
1274
1303
|
warning: "Discord threadName was ignored because the send target is not a thread."
|
|
1275
1304
|
};
|
|
@@ -1297,17 +1326,18 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1297
1326
|
case "sticker": {
|
|
1298
1327
|
if (!ctx.isActionEnabled("stickers")) throw new Error("Discord stickers are disabled.");
|
|
1299
1328
|
const to = readStringParam(ctx.params, "to", { required: true });
|
|
1300
|
-
const content = readStringParam(ctx.params, "content");
|
|
1329
|
+
const content = readStringParam(ctx.params, "content", { trim: false });
|
|
1301
1330
|
const stickerIds = readStringArrayParam(ctx.params, "stickerIds", {
|
|
1302
1331
|
required: true,
|
|
1303
1332
|
label: "stickerIds"
|
|
1304
1333
|
});
|
|
1334
|
+
const result = await discordMessagingActionRuntime.sendStickerDiscord(to, stickerIds, ctx.withOpts({
|
|
1335
|
+
content,
|
|
1336
|
+
...ctx.params.silent === true ? { silent: true } : {}
|
|
1337
|
+
}));
|
|
1305
1338
|
return jsonResult({
|
|
1306
1339
|
ok: true,
|
|
1307
|
-
result
|
|
1308
|
-
content,
|
|
1309
|
-
...ctx.params.silent === true ? { silent: true } : {}
|
|
1310
|
-
}))
|
|
1340
|
+
result
|
|
1311
1341
|
});
|
|
1312
1342
|
}
|
|
1313
1343
|
case "sendMessage": {
|
|
@@ -1316,7 +1346,7 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1316
1346
|
const asVoice = ctx.params.asVoice === true;
|
|
1317
1347
|
const silent = ctx.params.silent === true;
|
|
1318
1348
|
const suppressEmbeds = ctx.params.suppressEmbeds === void 0 ? void 0 : ctx.params.suppressEmbeds === true;
|
|
1319
|
-
const rawComponents = ctx.params.components;
|
|
1349
|
+
const rawComponents = coerceDiscordComponentParam(ctx.params.components);
|
|
1320
1350
|
const componentSpec = hasDiscordComponentObjectKeys(rawComponents) ? discordMessagingActionRuntime.readDiscordComponentSpec(rawComponents) : null;
|
|
1321
1351
|
const components = Array.isArray(rawComponents) || typeof rawComponents === "function" ? rawComponents : void 0;
|
|
1322
1352
|
const mediaUrl = readStringParam(ctx.params, "mediaUrl", { trim: false }) ?? readStringParam(ctx.params, "path", { trim: false }) ?? readStringParam(ctx.params, "filePath", { trim: false });
|
|
@@ -1324,7 +1354,8 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1324
1354
|
const embeds = Array.isArray(rawEmbeds) ? rawEmbeds : void 0;
|
|
1325
1355
|
const content = readStringParam(ctx.params, "content", {
|
|
1326
1356
|
required: !asVoice && !componentSpec && !components && !embeds?.length && !mediaUrl,
|
|
1327
|
-
allowEmpty: true
|
|
1357
|
+
allowEmpty: true,
|
|
1358
|
+
trim: false
|
|
1328
1359
|
});
|
|
1329
1360
|
const filename = readStringParam(ctx.params, "filename");
|
|
1330
1361
|
const replyTo = readStringParam(ctx.params, "replyTo");
|
|
@@ -1366,17 +1397,18 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1366
1397
|
if (!mediaUrl) throw new Error("Voice messages require a media file reference (mediaUrl, path, or filePath).");
|
|
1367
1398
|
if (content && content.trim()) throw new Error("Voice messages cannot include text content (Discord limitation). Remove the content parameter.");
|
|
1368
1399
|
assertMediaNotDataUrl(mediaUrl);
|
|
1400
|
+
const result = await discordMessagingActionRuntime.sendVoiceMessageDiscord(to, mediaUrl, {
|
|
1401
|
+
...ctx.withOpts(),
|
|
1402
|
+
reply: resolveActionReplyReference(ctx, replyTo),
|
|
1403
|
+
silent,
|
|
1404
|
+
mediaAccess: ctx.options?.mediaAccess,
|
|
1405
|
+
mediaLocalRoots: ctx.options?.mediaLocalRoots,
|
|
1406
|
+
mediaReadFile: ctx.options?.mediaReadFile
|
|
1407
|
+
});
|
|
1369
1408
|
return jsonResult(await appendDiscordThreadRenameResult(ctx, {
|
|
1370
1409
|
payload: {
|
|
1371
1410
|
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
|
-
}),
|
|
1411
|
+
result,
|
|
1380
1412
|
voiceMessage: true
|
|
1381
1413
|
},
|
|
1382
1414
|
target: to,
|
|
@@ -1410,7 +1442,7 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1410
1442
|
const channelId = ctx.resolveChannelId();
|
|
1411
1443
|
const name = readStringParam(ctx.params, "name", { required: true });
|
|
1412
1444
|
const messageId = readStringParam(ctx.params, "messageId");
|
|
1413
|
-
const content = readStringParam(ctx.params, "content");
|
|
1445
|
+
const content = readStringParam(ctx.params, "content", { trim: false });
|
|
1414
1446
|
const payload = {
|
|
1415
1447
|
name,
|
|
1416
1448
|
messageId,
|
|
@@ -1419,9 +1451,10 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1419
1451
|
appliedTags: readStringArrayParam(ctx.params, "appliedTags") ?? void 0
|
|
1420
1452
|
};
|
|
1421
1453
|
try {
|
|
1454
|
+
const thread = await discordMessagingActionRuntime.createThreadDiscord(channelId, payload, ctx.withOpts());
|
|
1422
1455
|
return jsonResult({
|
|
1423
1456
|
ok: true,
|
|
1424
|
-
thread
|
|
1457
|
+
thread
|
|
1425
1458
|
});
|
|
1426
1459
|
} catch (error) {
|
|
1427
1460
|
if (error instanceof DiscordThreadInitialMessageError) {
|
|
@@ -1453,14 +1486,15 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1453
1486
|
guildId,
|
|
1454
1487
|
channelTargetRequiredMessage: "Discord active thread lists require a wildcard channel allowlist so each read target can be authorized."
|
|
1455
1488
|
});
|
|
1489
|
+
const threads = await discordMessagingActionRuntime.listThreadsDiscord({
|
|
1490
|
+
guildId,
|
|
1491
|
+
channelId,
|
|
1492
|
+
includeArchived,
|
|
1493
|
+
before,
|
|
1494
|
+
limit
|
|
1495
|
+
}, ctx.withOpts());
|
|
1456
1496
|
return jsonResult(normalizeDiscordThreadListActionResult({
|
|
1457
|
-
value:
|
|
1458
|
-
guildId,
|
|
1459
|
-
channelId,
|
|
1460
|
-
includeArchived,
|
|
1461
|
-
before,
|
|
1462
|
-
limit
|
|
1463
|
-
}, ctx.withOpts()),
|
|
1497
|
+
value: threads,
|
|
1464
1498
|
guildId,
|
|
1465
1499
|
channelId,
|
|
1466
1500
|
includeArchived: includeArchived === true,
|
|
@@ -1471,20 +1505,24 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1471
1505
|
case "threadReply": {
|
|
1472
1506
|
if (!ctx.isActionEnabled("threads")) throw new Error("Discord threads are disabled.");
|
|
1473
1507
|
const channelId = ctx.resolveChannelId();
|
|
1474
|
-
const content = readStringParam(ctx.params, "content", {
|
|
1508
|
+
const content = readStringParam(ctx.params, "content", {
|
|
1509
|
+
required: true,
|
|
1510
|
+
trim: false
|
|
1511
|
+
});
|
|
1475
1512
|
const mediaUrl = readStringParam(ctx.params, "mediaUrl");
|
|
1476
1513
|
const replyTo = readStringParam(ctx.params, "replyTo");
|
|
1514
|
+
const result = await discordMessagingActionRuntime.sendMessageDiscord(`channel:${channelId}`, content, {
|
|
1515
|
+
...ctx.withOpts(),
|
|
1516
|
+
mediaUrl,
|
|
1517
|
+
mediaAccess: ctx.options?.mediaAccess,
|
|
1518
|
+
mediaLocalRoots: ctx.options?.mediaLocalRoots,
|
|
1519
|
+
mediaReadFile: ctx.options?.mediaReadFile,
|
|
1520
|
+
reply: resolveActionReplyReference(ctx, replyTo),
|
|
1521
|
+
...ctx.params.silent === true ? { silent: true } : {}
|
|
1522
|
+
});
|
|
1477
1523
|
return jsonResult({
|
|
1478
1524
|
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
|
-
})
|
|
1525
|
+
result
|
|
1488
1526
|
});
|
|
1489
1527
|
}
|
|
1490
1528
|
default: return;
|
|
@@ -1561,16 +1599,19 @@ async function handleDiscordModerationAction(action, params, isActionEnabled, cf
|
|
|
1561
1599
|
cfg
|
|
1562
1600
|
});
|
|
1563
1601
|
switch (command.action) {
|
|
1564
|
-
case "timeout":
|
|
1565
|
-
|
|
1566
|
-
member: await discordModerationActionRuntime.timeoutMemberDiscord({
|
|
1602
|
+
case "timeout": {
|
|
1603
|
+
const member = await discordModerationActionRuntime.timeoutMemberDiscord({
|
|
1567
1604
|
guildId: command.guildId,
|
|
1568
1605
|
userId: command.userId,
|
|
1569
1606
|
durationMinutes: command.durationMinutes,
|
|
1570
1607
|
until: command.until,
|
|
1571
1608
|
reason: command.reason
|
|
1572
|
-
}, withOpts())
|
|
1573
|
-
|
|
1609
|
+
}, withOpts());
|
|
1610
|
+
return jsonResult({
|
|
1611
|
+
ok: true,
|
|
1612
|
+
member
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1574
1615
|
case "kick":
|
|
1575
1616
|
await discordModerationActionRuntime.kickMemberDiscord({
|
|
1576
1617
|
guildId: command.guildId,
|
|
@@ -1591,14 +1632,14 @@ async function handleDiscordModerationAction(action, params, isActionEnabled, cf
|
|
|
1591
1632
|
}
|
|
1592
1633
|
//#endregion
|
|
1593
1634
|
//#region extensions/discord/src/actions/runtime.presence.ts
|
|
1594
|
-
const ACTIVITY_TYPE_MAP =
|
|
1595
|
-
playing
|
|
1596
|
-
streaming
|
|
1597
|
-
listening
|
|
1598
|
-
watching
|
|
1599
|
-
custom
|
|
1600
|
-
competing
|
|
1601
|
-
|
|
1635
|
+
const ACTIVITY_TYPE_MAP = /* @__PURE__ */ new Map([
|
|
1636
|
+
["playing", 0],
|
|
1637
|
+
["streaming", 1],
|
|
1638
|
+
["listening", 2],
|
|
1639
|
+
["watching", 3],
|
|
1640
|
+
["custom", 4],
|
|
1641
|
+
["competing", 5]
|
|
1642
|
+
]);
|
|
1602
1643
|
const VALID_STATUSES = /* @__PURE__ */ new Set([
|
|
1603
1644
|
"online",
|
|
1604
1645
|
"dnd",
|
|
@@ -1619,9 +1660,9 @@ async function handleDiscordPresenceAction(action, params, isActionEnabled, cfg)
|
|
|
1619
1660
|
const activityName = readStringParam(params, "activityName");
|
|
1620
1661
|
const activities = [];
|
|
1621
1662
|
if (activityTypeRaw || activityName) {
|
|
1622
|
-
if (!activityTypeRaw) throw new Error(`activityType is required when activityName is provided. Valid types: ${
|
|
1623
|
-
const typeNum = ACTIVITY_TYPE_MAP
|
|
1624
|
-
if (typeNum === void 0) throw new Error(`Invalid activityType "${activityTypeRaw}". Must be one of: ${
|
|
1663
|
+
if (!activityTypeRaw) throw new Error(`activityType is required when activityName is provided. Valid types: ${[...ACTIVITY_TYPE_MAP.keys()].join(", ")}`);
|
|
1664
|
+
const typeNum = ACTIVITY_TYPE_MAP.get(normalizeLowercaseStringOrEmpty(activityTypeRaw));
|
|
1665
|
+
if (typeNum === void 0) throw new Error(`Invalid activityType "${activityTypeRaw}". Must be one of: ${[...ACTIVITY_TYPE_MAP.keys()].join(", ")}`);
|
|
1625
1666
|
const activity = {
|
|
1626
1667
|
name: activityName ?? "",
|
|
1627
1668
|
type: typeNum
|
|
@@ -1701,9 +1742,10 @@ const moderationActions = /* @__PURE__ */ new Set([
|
|
|
1701
1742
|
]);
|
|
1702
1743
|
async function handleDiscordAction(params, cfg, options) {
|
|
1703
1744
|
const action = readStringParam(params, "action", { required: true });
|
|
1745
|
+
const accountId = readStringParam(params, "accountId");
|
|
1704
1746
|
const isActionEnabled = createDiscordActionGate({
|
|
1705
1747
|
cfg,
|
|
1706
|
-
accountId
|
|
1748
|
+
accountId
|
|
1707
1749
|
});
|
|
1708
1750
|
if (messagingActions.has(action)) return await handleDiscordMessagingAction(action, params, isActionEnabled, cfg, options);
|
|
1709
1751
|
if (guildActions.has(action)) return await handleDiscordGuildAction(action, params, isActionEnabled, cfg, options);
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { n as registerBuiltDiscordComponentMessage, r as sendDiscordComponentMessage, t as editDiscordComponentMessage } from "./send.components-
|
|
1
|
+
import { n as registerBuiltDiscordComponentMessage, r as sendDiscordComponentMessage, t as editDiscordComponentMessage } from "./send.components-BG5IDABj.js";
|
|
2
2
|
import { r as setDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
3
|
-
import { n as listDiscordDirectoryGroupsLive, r as listDiscordDirectoryPeersLive } from "./directory-live-
|
|
4
|
-
import { _ as
|
|
5
|
-
import { C as hasAllGuildPermissionsDiscord, G as unregisterGateway, H as clearGateways, S as fetchMemberGuildPermissionsDiscord, T as hasAnyGuildPermissionDiscord, U as getGateway, W as registerGateway, _ as DiscordSendError, x as fetchChannelPermissionsDiscord } from "./send.shared-
|
|
6
|
-
import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-
|
|
3
|
+
import { n as listDiscordDirectoryGroupsLive, r as listDiscordDirectoryPeersLive } from "./directory-live-DaJzWJ2N.js";
|
|
4
|
+
import { _ as resolveGroupDmAllow, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, d as resolveDiscordGuildEntry, g as resolveDiscordShouldRequireMention, n as isDiscordGroupAllowedByPolicy, r as normalizeDiscordAllowList, s as resolveDiscordChannelConfig, t as allowListMatches, u as resolveDiscordCommandAuthorized, v as shouldEmitDiscordReactionNotification } from "./allow-list-DBTtR2dz.js";
|
|
5
|
+
import { C as hasAllGuildPermissionsDiscord, G as unregisterGateway, H as clearGateways, S as fetchMemberGuildPermissionsDiscord, T as hasAnyGuildPermissionDiscord, U as getGateway, W as registerGateway, _ as DiscordSendError, x as fetchChannelPermissionsDiscord } from "./send.shared-B0n_fWzu.js";
|
|
6
|
+
import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-DHuFUL6W.js";
|
|
7
7
|
import { i as setPresence, n as getPresence, r as presenceCacheSize, t as clearPresences } from "./presence-cache-z1N8MbJ3.js";
|
|
8
|
-
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, c as sendWebhookMessageDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, m as listPinsDiscord, n as fetchReactionsDiscord, o as sendTypingDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-
|
|
9
|
-
import { a as isAbortError, i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, l as runDiscordTaskWithTimeout, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, o as normalizeDiscordInboundWorkerTimeoutMs, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, s as normalizeDiscordListenerTimeoutMs, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-
|
|
10
|
-
import { c as readDiscordChannelMoveParams, i as requiredGuildPermissionForModerationAction, l as readDiscordParentIdParam, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-
|
|
11
|
-
import { p as discordMessageActions, t as resolveDiscordOutboundSessionRoute } from "./outbound-session-route-
|
|
12
|
-
import {
|
|
13
|
-
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-
|
|
14
|
-
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-
|
|
15
|
-
import { t as resolveDiscordUserAllowlist } from "./resolve-users-
|
|
16
|
-
import { _ as resolveThreadBindingThreadName, g as resolveThreadBindingIntroText, h as formatThreadBindingDurationLabel, m as resolveThreadBindingPersonaFromRecord, n as createThreadBindingManager, p as resolveThreadBindingPersona, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-
|
|
17
|
-
import { a as reconcileAcpThreadBindingsOnStartup, c as resolveDiscordThreadBindingMaxAgeMs, i as listThreadBindingsForAccount, l as resolveThreadBindingsEnabled, n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey, s as resolveDiscordThreadBindingIdleTimeoutMs } from "./thread-bindings-
|
|
18
|
-
import { i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-
|
|
19
|
-
import { r as collectDiscordAuditChannelIds, t as auditDiscordChannelPermissions } from "./audit-
|
|
20
|
-
import { d as
|
|
21
|
-
import { o as sanitizeDiscordThreadName, r as resolveDiscordReplyTarget } from "./threading-
|
|
22
|
-
import { t as createDiscordMessageHandler } from "./message-handler-
|
|
8
|
+
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, c as sendWebhookMessageDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, m as listPinsDiscord, n as fetchReactionsDiscord, o as sendTypingDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-CZeWKUiA.js";
|
|
9
|
+
import { a as isAbortError, i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, l as runDiscordTaskWithTimeout, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, o as normalizeDiscordInboundWorkerTimeoutMs, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, s as normalizeDiscordListenerTimeoutMs, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-D86uWLt_.js";
|
|
10
|
+
import { c as readDiscordChannelMoveParams, i as requiredGuildPermissionForModerationAction, l as readDiscordParentIdParam, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-Ghtfh5ZA.js";
|
|
11
|
+
import { p as discordMessageActions, t as resolveDiscordOutboundSessionRoute } from "./outbound-session-route-Q_HEusBQ.js";
|
|
12
|
+
import { b as resolveThreadBindingMaxAgeExpiresAt, v as resolveThreadBindingIdleTimeoutMs, x as resolveThreadBindingMaxAgeMs, y as resolveThreadBindingInactivityExpiresAt } from "./thread-bindings.state-DtgOqsbX.js";
|
|
13
|
+
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-t6jeFB1-.js";
|
|
14
|
+
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-CoiMlWy0.js";
|
|
15
|
+
import { t as resolveDiscordUserAllowlist } from "./resolve-users-DJpiokfW.js";
|
|
16
|
+
import { _ as resolveThreadBindingThreadName, g as resolveThreadBindingIntroText, h as formatThreadBindingDurationLabel, m as resolveThreadBindingPersonaFromRecord, n as createThreadBindingManager, p as resolveThreadBindingPersona, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-pbbRT5gb.js";
|
|
17
|
+
import { a as reconcileAcpThreadBindingsOnStartup, c as resolveDiscordThreadBindingMaxAgeMs, i as listThreadBindingsForAccount, l as resolveThreadBindingsEnabled, n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey, s as resolveDiscordThreadBindingIdleTimeoutMs } from "./thread-bindings-DKvsNjQR.js";
|
|
18
|
+
import { i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-3ovFAp3b.js";
|
|
19
|
+
import { r as collectDiscordAuditChannelIds, t as auditDiscordChannelPermissions } from "./audit-DpPfwoJM.js";
|
|
20
|
+
import { d as resolveDiscordGatewayIntents, f as waitForDiscordGatewayPluginRegistration, p as createDiscordNativeCommand, t as monitorDiscordProvider, u as createDiscordGatewayPlugin, y as registerDiscordListener } from "./provider-uKmmrDM4.js";
|
|
21
|
+
import { o as sanitizeDiscordThreadName, r as resolveDiscordReplyTarget } from "./threading-BCx49X-6.js";
|
|
22
|
+
import { t as createDiscordMessageHandler } from "./message-handler-DhgBabyU.js";
|
|
23
23
|
export { DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS, DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, DiscordSendError, addRoleDiscord, allowListMatches, auditDiscordChannelPermissions, autoBindSpawnedDiscordSubagent, banMemberDiscord, clearGateways, clearPresences, collectDiscordAuditChannelIds, createChannelDiscord, createDiscordGatewayPlugin, createDiscordMessageHandler, createDiscordNativeCommand, createNoopThreadBindingManager, createScheduledEventDiscord, createThreadBindingManager, createThreadDiscord, deleteChannelDiscord, deleteMessageDiscord, discordMessageActions, editChannelDiscord, editDiscordComponentMessage, editMessageDiscord, fetchChannelInfoDiscord, fetchChannelPermissionsDiscord, fetchDiscordApplicationId, fetchDiscordApplicationSummary, fetchMemberGuildPermissionsDiscord, fetchMemberInfoDiscord, fetchMessageDiscord, fetchReactionsDiscord, fetchRoleInfoDiscord, fetchVoiceStatusDiscord, formatThreadBindingDurationLabel, getGateway, getPresence, getThreadBindingManager, handleDiscordAction, hasAllGuildPermissionsDiscord, hasAnyGuildPermissionDiscord, isAbortError, isDiscordGroupAllowedByPolicy, isDiscordModerationAction, kickMemberDiscord, listDiscordDirectoryGroupsLive, listDiscordDirectoryPeersLive, listGuildChannelsDiscord, listGuildEmojisDiscord, listPinsDiscord, listScheduledEventsDiscord, listThreadBindingsBySessionKey, listThreadBindingsForAccount, listThreadsDiscord, monitorDiscordProvider, moveChannelDiscord, normalizeDiscordAllowList, normalizeDiscordInboundWorkerTimeoutMs, normalizeDiscordListenerTimeoutMs, normalizeDiscordSlug, parseApplicationIdFromToken, pinMessageDiscord, presenceCacheSize, probeDiscord, reactMessageDiscord, readDiscordChannelCreateParams, readDiscordChannelEditParams, readDiscordChannelMoveParams, readDiscordModerationCommand, readDiscordParentIdParam, readMessagesDiscord, reconcileAcpThreadBindingsOnStartup, registerBuiltDiscordComponentMessage, registerDiscordListener, registerGateway, removeChannelPermissionDiscord, removeOwnReactionsDiscord, removeReactionDiscord, removeRoleDiscord, requiredGuildPermissionForModerationAction, resolveDiscordChannelAllowlist, resolveDiscordChannelConfig, resolveDiscordChannelConfigWithFallback, resolveDiscordCommandAuthorized, resolveDiscordGatewayIntents, resolveDiscordGuildEntry, resolveDiscordOutboundSessionRoute, resolveDiscordPrivilegedIntentsFromFlags, resolveDiscordReplyTarget, resolveDiscordShouldRequireMention, resolveDiscordThreadBindingIdleTimeoutMs, resolveDiscordThreadBindingMaxAgeMs, resolveDiscordUserAllowlist, resolveEventCoverImage, resolveGroupDmAllow, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingInactivityExpiresAt, resolveThreadBindingIntroText, resolveThreadBindingMaxAgeExpiresAt, resolveThreadBindingMaxAgeMs, resolveThreadBindingPersona, resolveThreadBindingPersonaFromRecord, resolveThreadBindingThreadName, resolveThreadBindingsEnabled, runDiscordTaskWithTimeout, sanitizeDiscordThreadName, searchMessagesDiscord, sendDiscordComponentMessage, sendMessageDiscord, sendPollDiscord, sendStickerDiscord, sendTypingDiscord, sendVoiceMessageDiscord, sendWebhookMessageDiscord, setChannelPermissionDiscord, setDiscordRuntime, setPresence, setThreadBindingIdleTimeoutBySessionKey, setThreadBindingMaxAgeBySessionKey, shouldEmitDiscordReactionNotification, timeoutMemberDiscord, unbindThreadBindingsBySessionKey, unpinMessageDiscord, unregisterGateway, uploadEmojiDiscord, uploadStickerDiscord, waitForDiscordGatewayPluginRegistration };
|