From 3aa25df87687a10b8b7185a9714226d2607edab3 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Wed, 14 Feb 2024 11:10:14 -0500 Subject: [PATCH 1/2] chore: Add prisma generate npm script If a user switches branches or changes schema.prisma without running `npm install` the generated client will be out of sync with the schema. Adding a npm run script makes doing this easier without needing to have primsa installed globally. --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index d39eaf07..853d9d95 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" From 4dbfd46460c6516d73d6d9056219a0fbcf1f198f Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Wed, 14 Feb 2024 11:13:34 -0500 Subject: [PATCH 2/2] fix: Ensure guild settings exist in DB before updating If a user: * runs muse and adds the bot to their guild * deletes database (EX recreates docker container) * runs muse and tries to update config before doing anything else Then muse tries to update settings that were not created since guild-create event was not fired due to bot already existing in user's guild. Fix this by always getting/creating guild settings before updating any from config command --- src/commands/config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/commands/config.ts b/src/commands/config.ts index ae3bc458..7f25a2e7 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')!;