fix: Ensure guild settings exist in DB before updating (#999)

This commit is contained in:
Matt Foxx 2024-02-16 22:13:45 -05:00 committed by GitHub
parent aba622cb8d
commit 1d5729fd6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View file

@ -25,6 +25,7 @@
"migrations:generate": "npm run prisma:with-env migrate dev",
"migrations:run": "npm run prisma:with-env migrate deploy",
"prisma:with-env": "npm run env:set-database-url prisma",
"prisma:generate": "prisma generate",
"env:set-database-url": "tsx src/scripts/run-with-database-url.ts",
"release": "release-it",
"build": "tsc"

View file

@ -38,6 +38,9 @@ export default class implements Command {
.setDescription('show all settings'));
async execute(interaction: ChatInputCommandInteraction) {
// Ensure guild settings exist before trying to update
await getGuildSettings(interaction.guild!.id);
switch (interaction.options.getSubcommand()) {
case 'set-playlist-limit': {
const limit: number = interaction.options.getInteger('limit')!;