const mongoose = require("mongoose");
const LevelDB = require("./level");
// Rest of the code
[...]
const Dashboard = new DBD.Dashboard({
[...]
settings: [
[...]
{
categoryId: "level",
categoryName: "Levels",
categoryDescription: "Setup the level system for the bot",
categoryImageURL: 'https://cdn.discordapp.com/attachments/1062107362879619123/1062107518983221328/zeenbot.png',
categoryOptionsList: [
{
optionId: "levelchannel",
optionName: "Level Up Channel",
optionDescription: "Set the channel for the level up notifications",
optionType: DBD.formTypes.channelsSelect(false, channelTypes = [ChannelType.GuildText]),
getActualSet: async ({ guild }) => {
let data = await LevelUpDB.findOne({ Guild: guild.id }).catch(err => { })
if (data) return data.Channel
else return null
},
setNew: async ({ guild, newData }) => {
let data = await LevelUpDB.findOne({ Guild: guild.id }).catch(err => { })
if (!newData) newData = null
if (!data) {
data = new LevelUpDB({
Guild: guild.id,
Channel: newData,
})
await data.save()
} else {
data.Channel = newData
await data.save()
}
return
}
},
{
optionId: "levelcardbg",
optionName: "Level card background URL",
optionDescription: "Set the background image for the level card",
optionType: DBD.formTypes.input("https://wallpaper.dog/large/961978.jpg", 1, 200, false, false),
getActualSet: async ({ guild }) => {
let data = await LevelDB.findOne({ Guild: guild.id }).catch(err => { })
if (data) return data.BackgroundImage
else return null
},
setNew: async ({ guild, newData }) => {
let data = await LevelDB.find({ Guild: guild.id }).catch(err => { })
if (!newData) newData = null
if (!data) {
data = new LevelDB({
Guild: guild.id,
BackgroundImage: newData,
})
await data.save()
} else {
// Iterate through the array and update the data
for (const d of data) {
d.BackgroundImage = newData
await d.save()
}
}
return
}
}
]
},
],
[...]