Skip to content

Commit

Permalink
fix: update dev command to set manual benefits flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Snazzah committed Dec 16, 2024
1 parent 038f455 commit c831b20
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,34 @@ export default class BotCommand extends SlashCommand {
return { content: 'Invalid subcommand.', ephemeral: true };
}
case 'smw': {
if (ctx.options.smw.maxwebhooks < 1) return { content: 'Max webhooks must be greater than 0.', ephemeral: true };
if (ctx.options.smw.maxwebhooks < 0)
return { content: 'Max webhooks must be a positive number. Set to 0 to remove the manual benefits flag.', ephemeral: true };

if (ctx.options.smw.maxwebhooks === 0) {
await prisma.server.upsert({
where: { serverID: ctx.options.smw.id },
create: {
serverID: ctx.options.smw.id,
manualBenefits: false
},
update: {
manualBenefits: false
}
});

return { content: 'Manual benefits flag removed.', ephemeral: true };
}

await prisma.server.upsert({
where: { serverID: ctx.options.smw.id },
create: {
serverID: ctx.options.smw.id,
maxWebhooks: ctx.options.smw.maxwebhooks
maxWebhooks: ctx.options.smw.maxwebhooks,
manualBenefits: true
},
update: {
maxWebhooks: ctx.options.smw.maxwebhooks
maxWebhooks: ctx.options.smw.maxwebhooks,
manualBenefits: true
}
});

Expand Down

0 comments on commit c831b20

Please sign in to comment.