






















@@ -54,6 +54,7 @@ export async function handleDiscordMessageManagementAction(ctx: DiscordMessaging
5454throw new Error("Discord permissions are disabled.");
5555}
5656const channelId = ctx.resolveChannelId();
57+await ctx.assertReadTargetAllowed({ channelId });
5758const permissions = await discordMessagingActionRuntime.fetchChannelPermissionsDiscord(
5859channelId,
5960ctx.withOpts(),
@@ -79,6 +80,7 @@ export async function handleDiscordMessageManagementAction(ctx: DiscordMessaging
7980"Discord message fetch requires guildId, channelId, and messageId (or a valid messageLink).",
8081);
8182}
83+await ctx.assertReadTargetAllowed({ guildId, channelId });
8284const message = await discordMessagingActionRuntime.fetchMessageDiscord(
8385channelId,
8486messageId,
@@ -97,6 +99,7 @@ export async function handleDiscordMessageManagementAction(ctx: DiscordMessaging
9799throw new Error("Discord message reads are disabled.");
98100}
99101const channelId = ctx.resolveChannelId();
102+await ctx.assertReadTargetAllowed({ channelId });
100103const query = {
101104limit: readNumberParam(ctx.params, "limit"),
102105before: readStringParam(ctx.params, "before"),
@@ -172,6 +175,7 @@ export async function handleDiscordMessageManagementAction(ctx: DiscordMessaging
172175throw new Error("Discord pins are disabled.");
173176}
174177const channelId = ctx.resolveChannelId();
178+await ctx.assertReadTargetAllowed({ channelId });
175179const pins = await discordMessagingActionRuntime.listPinsDiscord(channelId, ctx.withOpts());
176180return jsonResult({ ok: true, pins: pins.map((pin) => ctx.normalizeMessage(pin)) });
177181}
@@ -191,6 +195,13 @@ export async function handleDiscordMessageManagementAction(ctx: DiscordMessaging
191195const authorIds = readStringArrayParam(ctx.params, "authorIds");
192196const limit = readNumberParam(ctx.params, "limit");
193197const channelIdList = [...(channelIds ?? []), ...(channelId ? [channelId] : [])];
198+if (channelIdList.length > 0) {
199+for (const targetChannelId of channelIdList) {
200+await ctx.assertReadTargetAllowed({ guildId, channelId: targetChannelId });
201+}
202+} else {
203+await ctx.assertGuildReadTargetAllowed({ guildId });
204+}
194205const authorIdList = [...(authorIds ?? []), ...(authorId ? [authorId] : [])];
195206const results = await discordMessagingActionRuntime.searchMessagesDiscord(
196207{
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。