From 8f11f99de2b08dde88aec522c16c601cd808ce6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20Olausson=20Holten=C3=A4s?= Date: Mon, 14 Mar 2022 23:15:10 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20fix=20api=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dashboard/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/dashboard/index.js b/src/dashboard/index.js index 35d7341..c6e9b5a 100644 --- a/src/dashboard/index.js +++ b/src/dashboard/index.js @@ -221,7 +221,10 @@ module.exports = async (client) => { return api.url; }, setNew: async ({ guild, newData }) => { - const api = await apis.findOne({ guildId: guild.id }); + const api = await apis.findOne( + { guildId: guild.id }, + { new: true, upsert: true } + ); api.url = newData || api.url; @@ -236,7 +239,10 @@ module.exports = async (client) => { optionDescription: 'Configure your controlpanel.gg Token', optionType: DBD.formTypes.input('1'), getActualSet: async ({ guild, user }) => { - const api = await apis.findOne({ guildId: guild.id }); + const api = await apis.findOne( + { guildId: guild.id }, + { new: true, upsert: true } + ); return api.token; }, setNew: async ({ guild, newData }) => {