🩹 fix api config
This commit is contained in:
parent
8f11f99de2
commit
bdcce1ee72
1 changed files with 10 additions and 8 deletions
|
@ -218,13 +218,15 @@ module.exports = async (client) => {
|
|||
optionType: DBD.formTypes.input('https://bg.zyner.org/api/'),
|
||||
getActualSet: async ({ guild, user }) => {
|
||||
const api = await apis.findOne({ guildId: guild.id });
|
||||
|
||||
if (!api) {
|
||||
apis.create({ guildId: guild.id });
|
||||
}
|
||||
|
||||
return api.url;
|
||||
},
|
||||
setNew: async ({ guild, newData }) => {
|
||||
const api = await apis.findOne(
|
||||
{ guildId: guild.id },
|
||||
{ new: true, upsert: true }
|
||||
);
|
||||
const api = await apis.findOne({ guildId: guild.id });
|
||||
|
||||
api.url = newData || api.url;
|
||||
|
||||
|
@ -239,10 +241,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 },
|
||||
{ new: true, upsert: true }
|
||||
);
|
||||
const api = await apis.findOne({ guildId: guild.id });
|
||||
if (!api) {
|
||||
apis.create({ guildId: guild.id });
|
||||
}
|
||||
return api.token;
|
||||
},
|
||||
setNew: async ({ guild, newData }) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue