Add message counting and date-bounded scrapes
This commit is contained in:
+23
-1
@@ -832,6 +832,24 @@ export function startWebUi(deps: WebUiDeps): WebUiHandle {
|
||||
})
|
||||
);
|
||||
|
||||
app.post(
|
||||
"/api/media/count",
|
||||
wrap(async (req, res) => {
|
||||
const channelId = String(req.body?.channelId ?? "");
|
||||
if (!channelId) throw new HttpError(400, "channelId is required");
|
||||
|
||||
res.json({
|
||||
ok: true,
|
||||
result: await deps.media.countMessages({
|
||||
channelId,
|
||||
guildId: req.body?.guildId ? String(req.body.guildId) : null,
|
||||
after: req.body?.after ? String(req.body.after) : null,
|
||||
before: req.body?.before ? String(req.body.before) : null
|
||||
})
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
app.get(
|
||||
"/api/media/errors",
|
||||
wrap(async (_req, res) => {
|
||||
@@ -859,6 +877,8 @@ export function startWebUi(deps: WebUiDeps): WebUiHandle {
|
||||
const backend =
|
||||
requested === "slopbot" || requested === "puppet" ? requested : "auto";
|
||||
const downloadDir = req.body?.downloadDir ? String(req.body.downloadDir) : null;
|
||||
const after = req.body?.after ? String(req.body.after) : null;
|
||||
const before = req.body?.before ? String(req.body.before) : null;
|
||||
|
||||
const scrape = await deps.media.startScrape({
|
||||
channelId,
|
||||
@@ -866,7 +886,9 @@ export function startWebUi(deps: WebUiDeps): WebUiHandle {
|
||||
mode,
|
||||
confirm,
|
||||
backend,
|
||||
downloadDir
|
||||
downloadDir,
|
||||
after,
|
||||
before
|
||||
});
|
||||
deps.getPuppet()?.appendAction({
|
||||
type: "media",
|
||||
|
||||
Reference in New Issue
Block a user