diff options
| author | Federico Rapetti <[email protected]> | 2023-03-04 22:39:33 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-03-04 15:39:33 -0600 |
| commit | 02ee8aefc86b3a9902827874260d59115e73af13 (patch) | |
| tree | 8f45eb55926d49183a059748c59e756dc3fbc25f /src/commands | |
| parent | 6926e39c5679e75c9ca6ef1a123abdce3d7ff992 (diff) | |
| download | muse-02ee8aefc86b3a9902827874260d59115e73af13.tar.xz muse-02ee8aefc86b3a9902827874260d59115e73af13.zip | |
Create guild settings if not found (#911)
Co-authored-by: Max Isom <[email protected]>
Diffstat (limited to 'src/commands')
| -rw-r--r-- | src/commands/config.ts | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/commands/config.ts b/src/commands/config.ts index 9ed78d7..158f4f4 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -3,6 +3,7 @@ import {ChatInputCommandInteraction, EmbedBuilder, PermissionFlagsBits} from 'di import {injectable} from 'inversify'; import {prisma} from '../utils/db.js'; import Command from './index.js'; +import {getGuildSettings} from '../utils/get-guild-settings'; @injectable() export default class implements Command { @@ -96,11 +97,7 @@ export default class implements Command { case 'get': { const embed = new EmbedBuilder().setTitle('Config'); - const config = await prisma.setting.findUnique({where: {guildId: interaction.guild!.id}}); - - if (!config) { - throw new Error('no config found'); - } + const config = await getGuildSettings(interaction.guild!.id); const settingsToShow = { 'Playlist Limit': config.playlistLimit, |
