forked from pinks/eris
1
0
Fork 0

fix: cancel command

This commit is contained in:
pinks 2023-09-23 01:40:21 +02:00
parent 77231afa00
commit 10b57926ed
1 changed files with 1 additions and 1 deletions

View File

@ -4,7 +4,7 @@ import { Context } from "./mod.ts";
export async function cancelCommand(ctx: Context) {
const jobs = await generationQueue.getAllJobs();
const userJobs = jobs
.filter((job) => job.lockUntil > new Date())
.filter((job) => job.lockUntil < new Date())
.filter((j) => j.state.from.id === ctx.from?.id);
for (const job of userJobs) await generationQueue.deleteJob(job.id);
await ctx.reply(`Cancelled ${userJobs.length} jobs`);