aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Foxx <[email protected]>2024-02-16 22:13:45 -0500
committerGitHub <[email protected]>2024-02-16 21:13:45 -0600
commit1d5729fd6c9f7dc5f2f9ca599fcdd8fdbe138c84 (patch)
treec8b8bf32dd58fd4f252edf4813b9e2d9ad12de83
parentaba622cb8d02eb1a82f7ad144d3cfe90af2cf311 (diff)
downloadmuse-1d5729fd6c9f7dc5f2f9ca599fcdd8fdbe138c84.tar.xz
muse-1d5729fd6c9f7dc5f2f9ca599fcdd8fdbe138c84.zip
fix: Ensure guild settings exist in DB before updating (#999)
-rw-r--r--package.json1
-rw-r--r--src/commands/config.ts3
2 files changed, 4 insertions, 0 deletions
diff --git a/package.json b/package.json
index d39eaf0..853d9d9 100644
--- a/package.json
+++ b/package.json
@@ -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"
diff --git a/src/commands/config.ts b/src/commands/config.ts
index ae3bc45..7f25a2e 100644
--- a/src/commands/config.ts
+++ b/src/commands/config.ts
@@ -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')!;