fix: Giveaway bugs
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user