Live-verify the puppet DM path and expose the backend choice
This commit is contained in:
@@ -95,6 +95,25 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// DMs and group DMs: the bot cannot see them, so they always use the puppet.
|
||||
try {
|
||||
const dms = await window.VK.api.get("/api/dms?limit=50");
|
||||
for (const dm of dms ?? []) {
|
||||
const names = (dm.recipients ?? [])
|
||||
.map(recipient => recipient.username)
|
||||
.filter(Boolean)
|
||||
.join(", ");
|
||||
state.channels.push({
|
||||
id: dm.id,
|
||||
guildId: null,
|
||||
label: `${dm.name || names || "DM"} (${dm.type === 3 ? "group DM" : "DM"})`
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
// no cached DMs yet
|
||||
}
|
||||
|
||||
state.loadedChannels = true;
|
||||
} catch {
|
||||
state.channels = [];
|
||||
|
||||
@@ -770,11 +770,15 @@ function buildServer(): McpServer {
|
||||
.enum(["links", "download"])
|
||||
.optional()
|
||||
.describe("links indexes URLs (default); download fetches attachment bytes"),
|
||||
backend: z
|
||||
.enum(["auto", "slopbot", "puppet"])
|
||||
.optional()
|
||||
.describe("auto (default) picks slopbot for its guilds, the client otherwise"),
|
||||
confirm: z.boolean().optional().describe("Accept the near-limit warning")
|
||||
}
|
||||
},
|
||||
async ({ channelId, guildId, mode, confirm }) =>
|
||||
jsonText(await media.startScrape({ channelId, guildId: guildId ?? null, mode, confirm }))
|
||||
async ({ channelId, guildId, mode, backend, confirm }) =>
|
||||
jsonText(await media.startScrape({ channelId, guildId: guildId ?? null, mode, backend, confirm }))
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
|
||||
+4
-1
@@ -802,8 +802,11 @@ export function startWebUi(deps: WebUiDeps): WebUiHandle {
|
||||
const mode = req.body?.mode === "download" ? "download" : "links";
|
||||
const guildId = req.body?.guildId ? String(req.body.guildId) : null;
|
||||
const confirm = req.body?.confirm === true;
|
||||
const requested = String(req.body?.backend ?? "auto");
|
||||
const backend =
|
||||
requested === "slopbot" || requested === "puppet" ? requested : "auto";
|
||||
|
||||
const scrape = await deps.media.startScrape({ channelId, guildId, mode, confirm });
|
||||
const scrape = await deps.media.startScrape({ channelId, guildId, mode, confirm, backend });
|
||||
deps.getPuppet()?.appendAction({
|
||||
type: "media",
|
||||
action: "scrape",
|
||||
|
||||
Reference in New Issue
Block a user