fix: Giveaway bugs

This commit is contained in:
smueller
2026-07-24 10:33:56 +02:00
parent bd1b55fff7
commit f2406fb6d7
7 changed files with 74 additions and 25 deletions

View File

@@ -13,7 +13,7 @@ import { completeVerification } from './modules/verification/handlers.js';
import { closePoll } from './modules/utility/poll.js';
import { sendReminder } from './modules/utility/reminders.js';
import { expireSelfRole } from './modules/selfroles/service.js';
import { endGiveaway, runGiveawayCreateJob } from './modules/giveaways/index.js';
import { endGiveaway, runGiveawayCreateJob, GiveawayError } from './modules/giveaways/index.js';
import { closeInactiveTickets } from './modules/tickets/index.js';
import { expireBirthdayRole, runBirthdayCheck } from './modules/birthdays/index.js';
import { ensureStatsRecurringJobs, startStatsWorker } from './modules/stats/index.js';
@@ -303,7 +303,17 @@ export function startWorkers(context: BotContext): Worker[] {
giveawayQueueName,
async (job) => {
if (job.name === 'giveawayEnd') {
await endGiveaway(context, (job.data as GiveawayEndJob).giveawayId);
try {
await endGiveaway(context, (job.data as GiveawayEndJob).giveawayId);
} catch (error) {
if (
error instanceof GiveawayError &&
(error.code === 'already_ended' || error.code === 'not_found')
) {
return;
}
throw error;
}
return;
}
if (job.name === 'giveawayCreate') {