Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
107 kB
1
Indexable
Never
const { ChannelType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js')
const SoftUI = require('dbd-soft-ui');
const DBD = require("discord-dashboard")
const { callbackify } = require('util')
const config = require("../../Systems/config")

module.exports =
{
    name: "ready",
    async execute(client) {
        let Information = [];
        let Moderation = [];
        let Applications = [];
        let TicketSystem = [];
        let Servermoderation = [];
        let Levelsystem = [];
        let giveAwaysystem = [];

        const info = client.commands.filter(x => x.category === "Information")
        const mod = client.commands.filter(x => x.category === "Moderations")
        const Apply = client.commands.filter(x => x.category === "Applications")
        const Server = client.commands.filter(x => x.category === "Servermoderation")
        let Level = client.commands.filter(x => x.category === "levelSystem")
        let giveAway = client.commands.filter(x => x.category === "GiveAway")
        let ticket = client.commands.filter(x => x.category === "TicketSystem")

        CommandPush(info, Information)
        CommandPush(mod, Moderation)
        CommandPush(Server, Servermoderation)
        CommandPush(Apply, Applications)
        CommandPush(Level, Levelsystem)
        CommandPush(giveAway, giveAwaysystem)
        CommandPush(ticket, TicketSystem)

        await DBD.useLicense(config.dbd.license);
        DBD.Dashboard = DBD.UpdatedClass();

        /** */ //Schemas for options
   /** */ const LvlDB = require("../../Structures/Schemas/LevelSys")
   /** */ const WelcomeDB = require("../../Structures/Schemas/Welcome")
   /** */ const verifyDB = require('../../Structures/Schemas/verification')
   /** */ const generallogs = require("../../Structures/Schemas/GeneralLogs")
   /** */ const logschannel = require("../../Structures/Schemas/LogsChannel")
   /** */ const messLogChannel = require("../../Structures/Schemas/messagelogschannel")
   /** */ const messLogs = require("../../Structures/Schemas/messagellogs")
   /** */ const countGStatus = require("../../Structures/Schemas/CountGameStatus")
   /** */ const countGStats = require("../../Structures/Schemas/CountGameStats")
   /** */ const StaffRoles = require("../../Structures/Schemas/StaffRoles")
   /** */ const ticketSys = require('../../Structures/Schemas/ticketsys')
   /** */ const applySys = require("../../Structures/Schemas/applications")
        /** */ //End of schema options

        const Handler = new DBD.Handler(
            /*
                    Keyv storage instance
                    Example: { store: new KeyvMongo('mongodb://user:pass@localhost:27017/dbname') }
        
                    Can be left empty to use the default storage (Keyv with SQLite)
                */
        );

        const Dashboard = new DBD.Dashboard({
            port: config.dbd.port,
            client: config.discord.client,
            redirectUri: config.dbd.redirectUri,
            domain: config.dbd.domain,
            ownerIDs: config.dbd.ownerIDs,
            useThemeMaintenance: true,
            useTheme404: true,
            bot: client,
            invite: {
                clientId: client.user.id,
                scopes: ["bot", "applications.commands", "guilds", "identify"],
                permissions: '8',
                redirectUri: "http://maindroid.xyz/manage/",
            },
            theme: SoftUI({
                storage: Handler,
                customThemeOptions: {
                    index: async ({ req }) => {
                        let username = req.session?.user?.username || "Guest"
                        let userIcon = req.session?.user?.avatarURL || "https://w5fc.org/wp-content/uploads/2021/05/s9biyhs4lix61.jpg"

                        const cards = [
                            {
                                title: "Hello",
                                icon: `${userIcon}`,
                                getValue: username,
                                progressBar: {
                                    enabled: false,
                                    getProgress: client.guilds.cache.size
                                }
                            },
                            // Include 3 more cards
                        ]
                        const graph = {
                            values: [690, 524, 345, 645, 478, 592, 468, 783, 459, 230, 621, 345],
                            labels: ["1m", "2m", "3m", "4m", "5m", "6m", "7m", "8m", "9m", "10m"]
                        }
                        return {
                            graph,
                            cards,
                        }
                    },
                },
                websiteName: "Maindroid",
                colorScheme: "blue",
                supporteMail: "tonyvewijk@gmail.com",
                dbdriver: "mongodb+srv://tonymelony:A199966!asdsf@serverlessinstance0.jthzl.mongodb.net/data",
                icons: {
                    favicon: '/img/maindroid.png',
                    noGuildIcon: "https://pnggrid.com/wp-content/uploads/2021/05/Discord-Logo-Circle-1024x1024.png",
                    sidebar: {
                        darkUrl: '/img/maindroid.png',
                        lightUrl: '/img/maindroid.png',
                        hideName: false,
                        borderRadius: false,
                        alignCenter: true
                    },
                },
                index: {
                    card: {
                        category: "Soft UI",
                        title: "Maindroid - The control of everything!",
                        description: "Maindroid Discord management panel.",
                        image: "/img/maindroid.png",
                        link: {
                            enabled: true,
                            url: "https://discord.gg/bVAB4rUeQ8"
                        }
                    },
                    card1: {
                        category: "",
                        title: "test",
                        description: "Maindroid Discord management panel.",

                    },
                    graph: {
                        enabled: false,
                        lineGraph: false,
                        title: 'Memory Usage',
                        tag: 'Memory (MB)',
                        max: 100
                    },
                },
                sweetalert: {
                    errors: {},
                    success: {
                        login: "Successfully logged in!",
                    }
                },
                preloader: {
                    image: "/img/maindroid.png",
                    spinner: true,
                    text: "Page is loading",
                },
                admin: {
                    pterodactyl: {
                        enabled: false,
                    }
                },
                commands: [
                    {
                        category: `Information`,
                        subTitle: `Commands`,
                        categoryId: '1',
                        hideAlias: true,
                        list: Information
                    },
                    {
                        category: `Moderation`,
                        subTitle: `Commands`,
                        categoryId: '2',
                        hideAlias: true,
                        list: Moderation
                    },
                    {
                        category: `Server Moderation`,
                        subTitle: `Commands`,
                        categoryId: '3',
                        hideAlias: true,
                        list: Servermoderation
                    },
                    {
                        category: `TicketSystem`,
                        subTitle: `Commands`,
                        categoryId: '4',
                        hideAlias: true,
                        list: TicketSystem
                    },
                    {
                        category: `Applysystem`,
                        subTitle: `Commands`,
                        categoryId: '5',
                        hideAlias: true,
                        list: Applications
                    },
                    {
                        category: `Levelsystem`,
                        subTitle: `Commands`,
                        categoryId: '6',
                        hideAlias: true,
                        list: Levelsystem
                    },
                    {
                        category: `GiveAway`,
                        subTitle: `Commands`,
                        categoryId: '7',
                        hideAlias: true,
                        list: giveAwaysystem
                    },

                ],
            }),
            settings: [
                {
                    categoryId: "welcome",
                    categoryName: "Welcome System",
                    categoryImageURL: '/img/hand-wave-icon.webp',
                    categoryDescription: "Setup the Welcome Channel.",
                    categoryOptionsList: [
                        {
                            optionId: 'weltg',
                            optionName: "system on/of",
                            optionDescription: "",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                minimalbutton: {
                                    first: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await WelcomeDB.findOne({ Guild: guild.id }).catch(() => { })
                                if (data) return (data.Toggle == null || data.Toggle == undefined) ? data.Toggle : data.Toggle;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await WelcomeDB.findOne({ Guild: guild.id }).catch(() => { })
                                if (!newData) newData = false;
                                data.Toggle = newData;
                                await data.save()

                            },

                        },
                        {
                            optionId: "welch",
                            optionName: "Welcome Channel",
                            optionDescription: "Set or reset the server's Welcome Channel",
                            optionType: DBD.formTypes.channelsSelect(false, channelTypes = [ChannelType.GuildText]),
                            getActualSet: async ({ guild }) => {
                                let data = await WelcomeDB.findOne({ Guild: guild.id }).catch(() => { })
                                if (data) return data.Channel || []
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await WelcomeDB.findOne({ guild: guild.id }).catch(() => { })

                                if (!newData) {
                                    if (!data.Text) { newData = null }
                                    else return
                                }

                                if (!data) {
                                    data = new WelcomeDB({
                                        Guild: guild.id,
                                        Channel: newData

                                    })
                                    await data.save()
                                } else {

                                    data.Channel = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "welmes",
                            optionName: "Welcome message",
                            optionSubTitle: "Set or reset the server's Welcome Message",
                            optionDescription: "<u>Replacements:</u><br><details><summary><b>{member}</b></summary>User.tag</details><details><summary><b>{guildName}</b></summary>Guild name</details><details><summary><b>{memberCreated}</b></summary>Account created date</details><details><summary><b>{memberCount}</b></summary>Server member count</details><details><summary><b>{--}</b></summary>New line</details>",
                            optionType: DBD.formTypes.textarea("", "1", "4096", false),
                            getActualSet: async ({ guild }) => {
                                let data = await WelcomeDB.findOne({ Guild: guild.id }).catch(() => { })
                                if (data)
                                    return data.Text || []

                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await WelcomeDB.findOne({ guild: guild.id }).catch(() => { })

                                if (!newData) {

                                    data = new WelcomeDB({
                                        Guild: guild.id,
                                        Text: `Welcome In {guildName} {member}!{--}Member created: {memberCreated}{--}MemberCount: {memberCount}`

                                    })
                                }

                                if (!data) {
                                    data = new WelcomeDB({
                                        Guild: guild.id,
                                        Text: newData

                                    })
                                    await data.save()
                                } else {

                                    data.Text = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "welroles",
                            optionName: "Welcome roles",
                            optionSubTitle: "Set or reset the welcome roles",
                            optionDescription: "select the roles u want to set as welcome roles",
                            optionType: DBD.formTypes.rolesMultiSelect(false, true),
                            getActualSet: async ({ guild }) => {
                                let data = await WelcomeDB.findOne({ Guild: guild.id }).catch(() => { })
                                return data?.Roles || [];

                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await WelcomeDB.findOne({ guild: guild.id }).catch(() => { })

                                if (!newData) return

                                if (!data) {

                                    data = new WelcomeDB({
                                        Guild: guild.id,
                                        Roles: newData

                                    })
                                    data.save()
                                } else {

                                    data.Roles = newData
                                    await data.save()
                                }
                            },
                        }

                    ]
                },
                {
                    categoryId: "verify",
                    categoryName: "Verify system",
                    categoryImageURL: '/img/verify.png',
                    categoryDescription: "Setup the verify message.",
                    categoryOptionsList: [
                        {
                            optionId: "verifymessage",
                            optionName: "Verify Message",
                            optionSubTitle: "",
                            optionDescription: "Set or reset the Message",
                            optionType: DBD.formTypes.input("", "1", "4096", false),
                            getActualSet: async ({ guild }) => {
                                let data = await verifyDB.findOne({ Guild: guild.id }).catch(() => { })
                                if (data) return data.Text || []
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await verifyDB.findOne({ guild: guild.id }).catch(() => { })

                                if (!newData) newData = "Please klick the button bellow to verify";

                                if (!data) {
                                    data = new verifyDB({
                                        Guild: guild.id,
                                        Text: newData,

                                    })
                                    await data.save()
                                } else {

                                    data.Text = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "verifyrole",
                            optionName: "Verify Role",
                            optionSubTitle: "",
                            optionDescription: "Set or reset the VerifyRole",
                            optionType: DBD.formTypes.rolesSelect(false),
                            getActualSet: async ({ guild }) => {
                                let data = await verifyDB.findOne({ Guild: guild.id }).catch(() => { })
                                if (data) return data.Role || [];
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await verifyDB.findOne({ guild: guild.id }).catch(() => { })

                                if (!newData) return

                                if (!data) {
                                    data = new verifyDB({
                                        Guild: guild.id,
                                        Role: newData

                                    })
                                    await data.save()
                                } else {

                                    data.Role = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "verifychann",
                            optionName: "Verify Channel",
                            optionDescription: "Where do i need to send the verify embed?<br>Please insert first the message and role before you select the channel. Otherwise it won't send.",
                            optionType: DBD.formTypes.channelsSelect(false, channelTypes = [ChannelType.GuildText]),
                            getActualSet: async ({ guild }) => {
                                let data = await verifyDB.findOne({ Guild: guild.id }).catch(() => { })
                                if (data) return data.Channel || [];
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await verifyDB.findOne({ guild: guild.id }).catch(() => { })


                                if (!data) return;
                                if (data) {
                                    const chann = client.channels.cache.find(channel => channel.id === `${newData}`)
                                    chann.bulkDelete(1)
                                    const name = 'Maindroid';
                                    const serverIcon = `https://cdn.discordapp.com/avatars/1004140110012481658/30fc55aac4a75063ac1b5bfc87e91c62.webp?size=40`

                                    chann.send({
                                        embeds: [
                                            new EmbedBuilder()
                                                .setAuthor({ name: `${name}`, iconURL: `${serverIcon}` })
                                                .setTitle('Hey!')
                                                .setDescription(data.Text || `Please klick the button bellow to verify`)
                                                .setColor("Random")
                                                .setFooter({ text: 'Verifysystem' })
                                        ], components: [
                                            new ActionRowBuilder().addComponents(
                                                new ButtonBuilder()
                                                    .setCustomId('verify')
                                                    .setLabel("Verify")
                                                    .setEmoji("✅")
                                                    .setStyle(ButtonStyle.Secondary)
                                            )



                                        ]
                                    })
                                }

                            },

                        },

                    ]
                },
                {
                    categoryId: "messagelogsystem",
                    categoryName: "Message log System",
                    categoryImageURL: "/img/mess.png",
                    categoryDescription: "Setup the message logger.",
                    categoryOptionsList: [
                        {
                            optionId: "mess",
                            optionName: "Toggle on/of",
                            optionDescription: "",
                            optionSubDescription: "Deleted messages",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    first: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await messLogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.MessageDelete == null || data.MessageDelete == undefined) ? data.MessageDelete : data.MessageDelete;

                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await messLogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new messLogs({
                                        GuildId: guild.id,
                                        MessageDelete: newData

                                    })
                                    await data.save()
                                } else {

                                    data.MessageDelete = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "mess",
                            optionName: "",
                            optionDescription: "",
                            optionSubDescription: "Updated messages",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    startNewSection: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await messLogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.MessageUpdate == null || data.MessageUpdate == undefined) ? data.MessageUpdate : data.MessageUpdate;

                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await messLogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new generallogs({
                                        Guildid: guild.id,
                                        MessageUpdate: newData

                                    })
                                    await data.save()
                                } else {

                                    data.MessageUpdate = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "mess",
                            optionName: "",
                            optionDescription: "",
                            optionSubDescription: "Snipe last deleted message",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    last: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await messLogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.MessageSniper == null || data.MessageSniper == undefined) ? data.MessageSniper : data.MessageSniper;

                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await messLogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new generallogs({
                                        Guildid: guild.id,
                                        MessageSniper: newData

                                    })
                                    await data.save()
                                } else {

                                    data.MessageSniper = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "messlog",
                            optionName: "Message Logger Channel",
                            optionDescription: "Set or reset the message log Channel",
                            optionType: DBD.formTypes.channelsSelect(false, channelTypes = [ChannelType.GuildText]),
                            getActualSet: async ({ guild }) => {
                                let data = await messLogChannel.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return data.Channel || []
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await messLogChannel.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) {
                                    if (!data.Channel) { newData = null }
                                    else return
                                }

                                if (!data) {
                                    data = new messLogChannel({
                                        GuildId: guild.id,
                                        Channel: newData

                                    })
                                    await data.save()
                                } else {

                                    data.Channel = newData
                                    await data.save()
                                }
                            },

                        },

                    ]
                },
                {
                    categoryId: "moderationlogsys",
                    categoryName: "Mod log System",
                    categoryImageURL: "/img/mess.png",
                    categoryDescription: "Setup the Moderation logger.",
                    categoryOptionsList: [
                        {
                            optionId: "ban",
                            optionName: "Toggle on/off",
                            optionSubDescription: "Ban",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    first: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.Ban == null || data.Ban == undefined) ? data.Ban : data.Ban;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new messLogs({
                                        GuildId: guild.id,
                                        Ban: newData

                                    })
                                    await data.save()
                                } else {

                                    data.Ban = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "kick",
                            optionName: "",
                            optionSubDescription: "Kick",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    startNewSection: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.Kick == null || data.Kick == undefined) ? data.Kick : data.Kick;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new messLogs({
                                        GuildId: guild.id,
                                        Kick: newData

                                    })
                                    await data.save()
                                } else {

                                    data.Kick = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "timeout",
                            optionName: "",
                            optionSubDescription: "Time-Out",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    startNewSection: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.TimeOut == null || data.TimeOut == undefined) ? data.TimeOut : data.TimeOut;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new messLogs({
                                        GuildId: guild.id,
                                        TimeOut: newData

                                    })
                                    await data.save()
                                } else {

                                    data.TimeOut = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "warnsystem",
                            optionName: "",
                            optionSubDescription: "Warn",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    last: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.Warn == null || data.Warn == undefined) ? data.Warn : data.Warn;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new messLogs({
                                        GuildId: guild.id,
                                        Warn: newData

                                    })
                                    await data.save()
                                } else {

                                    data.Warn = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "modlog",
                            optionName: "Moderation Logger Channel",
                            optionDescription: "Set or reset the Moderation log Channel",
                            optionType: DBD.formTypes.channelsSelect(false, channelTypes = [ChannelType.GuildText]),
                            getActualSet: async ({ guild }) => {
                                let data = await logschannel.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return data.MChannel || []
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await logschannel.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) {
                                    if (!data.Channel) { newData = null }
                                    else return
                                }

                                if (!data) {
                                    data = new logschannel({
                                        GuildId: guild.id,
                                        MChannel: newData

                                    })
                                    await data.save()
                                } else {

                                    data.MChannel = newData
                                    await data.save()
                                }
                            },

                        },

                    ]
                },
                {
                    categoryId: "logsystem",
                    categoryImageURL: "/img/mess.png",
                    categoryName: "Server log System",
                    categoryDescription: "Setup the server logger.",
                    categoryOptionsList: [
                        {
                            optionId: "memrole",
                            optionName: "Toggle on/of server log",
                            optionSubDescription: "Member Role",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    first: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.MemberRole == null || data.MemberRole == undefined) ? data.MemberRole : data.MemberRole;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new generallogs({
                                        GuildId: guild.id,
                                        MemberRole: newData,
                                        Ban: false,
                                        Kick: false,
                                        TimeOut: false,
                                        MessageUpdate: false,
                                        MessageDelete: false
                                    })
                                    await data.save()
                                } else {

                                    data.MemberRole = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "memnick",
                            optionName: "",
                            optionSubDescription: "Member Nickname",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    startNewSection: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.MemberNick == null || data.MemberNick == undefined) ? data.MemberNick : data.MemberNick;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new generallogs({
                                        Guildid: guild.id,
                                        MemberNick: newData

                                    })
                                    await data.save()
                                } else {

                                    data.MemberNick = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "channeltopic",
                            optionName: "",
                            optionSubDescription: "Channel Topic",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    startNewSection: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.ChannelTopic == null || data.ChannelTopic == undefined) ? data.ChannelTopic : data.ChannelTopic;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new generallogs({
                                        Guildid: guild.id,
                                        ChannelTopic: newData

                                    })
                                    await data.save()
                                } else {

                                    data.ChannelTopic = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "rolstatus",
                            optionName: "",
                            optionSubDescription: "Role Status",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    startNewSection: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.RoleStatus == null || data.RoleStatus == undefined) ? data.RoleStatus : data.RoleStatus;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new generallogs({
                                        Guildid: guild.id,
                                        RoleStatus: newData

                                    })
                                    await data.save()
                                } else {

                                    data.RoleStatus = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "channstatus",
                            optionName: "",
                            optionSubDescription: "Channel Status",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    startNewSection: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.ChannelStatus == null || data.ChannelStatus == undefined) ? data.ChannelStatus : data.ChannelStatus;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new generallogs({
                                        Guildid: guild.id,
                                        ChannelStatus: newData

                                    })
                                    await data.save()
                                } else {

                                    data.ChannelStatus = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "emojistatus",
                            optionName: "",
                            optionSubDescription: "Emoji Status",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    startNewSection: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.EmojiStatus == null || data.EmojiStatus == undefined) ? data.EmojiStatus : data.EmojiStatus;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new generallogs({
                                        Guildid: guild.id,
                                        EmojiStatus: newData

                                    })
                                    await data.save()
                                } else {

                                    data.EmojiStatus = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "memban",
                            optionName: "",
                            optionSubDescription: "Member Ban Status",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    startNewSection: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.MemberBan == null || data.MemberBan == undefined) ? data.MemberBan : data.MemberBan;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new generallogs({
                                        Guildid: guild.id,
                                        MemberBan: newData

                                    })
                                    await data.save()
                                } else {

                                    data.MemberBan = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "voicest",
                            optionName: "",
                            optionSubDescription: "Voicestatus",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    startNewSection: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.Voicestats == null || data.Voicestats == undefined) ? data.Voicestats : data.MemberBoost;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new generallogs({
                                        Guildid: guild.id,
                                        Voicestats: newData

                                    })
                                    await data.save()
                                } else {

                                    data.Voicestats = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "membst",
                            optionName: "",
                            optionSubDescription: "Member Boost",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    last: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return (data.MemberBoost == null || data.MemberBoost == undefined) ? data.MemberBoost : data.MemberBoost;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await generallogs.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new generallogs({
                                        Guildid: guild.id,
                                        MemberBoost: newData

                                    })
                                    await data.save()
                                } else {

                                    data.MemberBoost = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "gench",
                            optionName: "Server Logger Channel",
                            optionDescription: "Set or reset the server log Channel",
                            optionType: DBD.formTypes.channelsSelect(false, channelTypes = [ChannelType.GuildText]),
                            getActualSet: async ({ guild }) => {
                                let data = await logschannel.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return data.Channel || []
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await logschannel.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) {
                                    if (!data.Channel) { newData = null }
                                    else return
                                }

                                if (!data) {
                                    data = new logschannel({
                                        GuildId: guild.id,
                                        Channel: newData

                                    })
                                    await data.save()
                                } else {

                                    data.Channel = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "boostch",
                            optionName: "Server boost Channel",
                            optionDescription: "Set or reset the server boost Channel",
                            optionType: DBD.formTypes.channelsSelect(false, channelTypes = [ChannelType.GuildText]),

                            getActualSet: async ({ guild }) => {
                                let data = await logschannel.findOne({ GuildId: guild.id }).catch(() => { })
                                if (data) return data.boostChannel || []
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await logschannel.findOne({ GuildId: guild.id }).catch(() => { })

                                if (!newData) {
                                    if (!data.boostChannel) { newData = null }
                                    else return
                                }

                                if (!data) {
                                    data = new logschannel({
                                        GuildId: guild.id,
                                        boostChannel: newData

                                    })
                                    await data.save()
                                } else {

                                    data.boostChannel = newData
                                    await data.save()
                                }
                            },

                        },


                    ]
                },
                {
                    categoryId: "levelsystem",
                    categoryName: "Level System",
                    categoryImageURL: "/img/level-logo.png",
                    categoryDescription: 'Setup the level system.',
                    categoryOptionsList: [
                        {
                            optionId: "levelstatus",
                            optionName: "LevelSystem",
                            optionDescription: "Enable/Disable",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                minimalbutton: {
                                    minimalbutton: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await LvlDB.findOne({ Guild: guild.id }).catch(() => { })
                                if (data) return (data.Status == null || data.Status == undefined) ? DEFAULT_STATE : data.Status;
                            },

                            setNew: async ({ guild, newData }) => {
                                let data = await LvlDB.findOne({ Guild: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new LvlDB({
                                        Guild: guild.id,
                                        Status: newData,
                                        Roles: [],

                                    })
                                    await data.save()
                                } else {

                                    data.Status = newData
                                    await data.save()
                                }
                            },
                        },
                        {
                            optionId: "levelChannel",
                            optionName: "LevelUp Channel",
                            optionDescription: "Set or reset levelUp Channel",
                            optionType: DBD.formTypes.channelsSelect(false, channelTypes = [ChannelType.GuildText]),
                            getActualSet: async ({ guild }) => {
                                let data = await LvlDB.findOne({ Guild: guild.id }).catch(() => { })
                                if (data) return data.Channel || [];
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await LvlDB.findOne({ Guild: guild.id }).catch(() => { })

                                if (!data) return

                                if (data) {
                                    data.Channel = newData;
                                    await data.save()
                                }
                            }

                        },
                        {
                            optionId: "levelupmess",
                            optionName: "LevelUp message",
                            optionSubTitle: "Set or reset the server's LevelUp Message",
                            optionDescription: "<u>Replacements:</u><br><details><summary><b>{Member}</b></summary>User.tag</details><details><summary><b>{Level}</b></summary>Level of User</details><details><summary><b>{XP}</b></summary>Xp of User</details><details><summary><b>{--}</b></summary>New line</details>",
                            optionType: DBD.formTypes.input("", "1", "4096", false),
                            getActualSet: async ({ guild }) => {
                                let data = await LvlDB.findOne({ Guild: guild.id }).catch(() => { })
                                if (data)
                                    return data.Text || [];

                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await LvlDB.findOne({ guild: guild.id }).catch(() => { })

                                if (!newData) {
                                    newData = `{Member}, you are one level up! :tada:{--}Level:{Level}{--}XP:{XP}`
                                    data.Text = newData
                                    await data.save()
                                }

                                if (!data) return
                                if (data) {
                                    data.Text = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "levelxp",
                            optionName: "XP to gain",
                            optionSubTitle: "Set or reset the server's XP to gain.",
                            optionDescription: "",
                            optionType: DBD.formTypes.input("", "1", "10", false),
                            getActualSet: async ({ guild }) => {
                                let data = await LvlDB.findOne({ Guild: guild.id }).catch(() => { })
                                if (data)
                                    return data.XPToGet || [];

                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await LvlDB.findOne({ guild: guild.id }).catch(() => { })

                                if (!newData) {
                                    newData = `99`
                                    data.XPToGet = newData
                                    await data.save()
                                }

                                if (!data) return
                                if (data) {
                                    data.XPToGet = newData
                                    await data.save()
                                }
                            },

                        },

                    ],
                },
                {
                    categoryId: "countgame",
                    categoryName: "Counting Game",
                    categoryImageURL: "/img/plus1.webp",
                    categoryDescription: 'Setup the counting game.',
                    categoryOptionsList: [
                        {
                            optionId: "counststatus",
                            optionName: "Status of the countgame",
                            optionDescription: "Enable/Disable",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                minimalbutton: {
                                    minimalbutton: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let data = await countGStatus.findOne({ Guild: guild.id }).catch(() => { })
                                if (data) return (data.Status == null || data.Status == undefined) ? DEFAULT_STATE : data.Status;
                            },

                            setNew: async ({ guild, newData }) => {
                                let data = await countGStatus.findOne({ Guild: guild.id }).catch(() => { })

                                if (!newData) newdata = false

                                if (!data) {
                                    data = new countGStatus({
                                        Guild: guild.id,
                                        Status: newData

                                    })
                                    await data.save()
                                } else {

                                    data.Status = newData
                                    await data.save()
                                }
                            },
                        },
                        {
                            optionId: "countchann",
                            optionName: "Countgame channel",
                            optionDescription: "Set or reset Countgame Channel",
                            optionType: DBD.formTypes.channelsSelect(false, channelTypes = [ChannelType.GuildText]),
                            getActualSet: async ({ guild }) => {
                                let data = await countGStatus.findOne({ Guild: guild.id }).catch(() => { })
                                if (data) return data.Channel || [];
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await countGStatus.findOne({ Guild: guild.id }).catch(() => { })

                                if (!data) return

                                if (data) {
                                    data.Channel = newData;
                                    await data.save()
                                }
                            }

                        },
                        {
                            optionId: "count",
                            optionName: "Actual count",
                            optionSubTitle: "Set or reset the count",
                            optionDescription: "",
                            optionType: DBD.formTypes.input("", "1", "", false),
                            getActualSet: async ({ guild }) => {
                                let data = await countGStats.findOne({ Guild: guild.id }).catch(() => { })
                                if (data)
                                    return data.Count - 1 || [];

                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await countGStats.findOne({ Guild: guild.id }).catch(() => { })

                                if (!newData) return

                                if (!data) return

                                if (data) {
                                    const { EmbedBuilder } = require('discord.js')
                                    const Chann = await countGStatus.findOne({ Guild: guild.id })
                                    if (!Chann) return
                                    const channel = client.channels.cache.get(Chann.Channel)
                                    data.Count = newData
                                    await data.save()
                                    if (data.Count > data.TopCount) {
                                        data.TopCount = data.Count - 1
                                        await data.save()
                                    }


                                    channel.send({
                                        embeds: [
                                            new EmbedBuilder()
                                                .setDescription(`Someone of the team changed the count.\nCount is on: \`${data.Count - 1}\`\nNext count: \`${data.Count}\``)

                                        ]
                                    })


                                }
                            },

                        },
                        {
                            optionId: "wrongcount",
                            optionName: "Wrong Count message",
                            optionSubTitle: "Set or reset the Wrong count Message",
                            optionDescription: "<u>Replacements:</u><br><details><summary><b>{Member}</b></summary>User.tag</details><details><summary><b>{Count}</b></summary>Actual count</details><details><summary><b>{NextCount}</b></summary>Next count</details><details><summary><b>{--}</b></summary>New line</details>",
                            optionType: DBD.formTypes.input("", "1", "4096", false),
                            getActualSet: async ({ guild }) => {
                                let data = await countGStatus.findOne({ Guild: guild.id }).catch(() => { })
                                if (data)
                                    return data.Wrongcount || [];

                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await countGStatus.findOne({ Guild: guild.id }).catch(() => { })

                                if (!newData) {
                                    newData = `That was not the next count {Member}... Start over!{--}Last count:{Count}{--}Next count: 1`
                                    data.Wrongcount = newData
                                    await data.save()
                                }

                                if (!data) return
                                if (data) {
                                    data.Wrongcount = newData
                                    await data.save()
                                }
                            },

                        },
                        {
                            optionId: "wrongmember",
                            optionName: "Wrong member message",
                            optionSubTitle: "Set or reset the message if the same member count",
                            optionDescription: "<u>Replacements:</u><br><details><summary><b>{Member}</b></summary>User.tag</details><details><summary><b>{Count}</b></summary>Actual count</details><details><summary><b>{NextCount}</b></summary>Next count</details><details><summary><b>{--}</b></summary>New line</details>",
                            optionType: DBD.formTypes.input("", "1", "4096", false),
                            getActualSet: async ({ guild }) => {
                                let data = await countGStatus.findOne({ Guild: guild.id }).catch(() => { })
                                if (data)
                                    return data.WrongMember || [];

                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await countGStatus.findOne({ Guild: guild.id }).catch(() => { })

                                if (!newData) {
                                    newData = `It was not your turn {Member}... Start over!{--}Last count:{Count}{--}Next count: {NextCount}`
                                    data.WrongMember = newData
                                    await data.save()
                                }

                                if (!data) return
                                if (data) {
                                    data.WrongMember = newData
                                    await data.save()
                                }
                            },

                        },


                    ],
                },
                {
                    categoryId: "staff",
                    categoryName: "Staff",
                    categoryImageURL: "/img/staff.png",
                    categoryDescription: "Setup staff roles.",
                    categoryOptionsList: [
                        {
                            optionId: "staffroles",
                            optionName: "Staff roles",
                            optionSubTitle: "Set or reset the Staff roles",
                            optionDescription: "select the roles u want to set as Staff roles",
                            optionType: DBD.formTypes.rolesMultiSelect(false, false),
                            getActualSet: async ({ guild }) => {
                                let data = await StaffRoles.findOne({ Guild: guild.id }).catch(() => { })
                                return data?.SRoles || [];

                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await StaffRoles.findOne({ Guild: guild.id }).catch(() => { })
                                console.log(newData)

                                if (!newData) return
                                if (!data) {

                                    data = new StaffRoles({
                                        Guild: guild.id,
                                        SRoles: newData
                                    })
                                    await data.save()
                                } else {
                                    data.SRoles = newData
                                    await data.save()
                                }
                            },
                        }

                    ]
                },
                {
                    categoryId: "ticketSys",
                    categoryName: "Ticket System",
                    categoryImageURL: "/img/ticket.png",
                    categoryDescription: "Setup the Ticket System.",
                    categoryOptionsList: [
                        {
                            optionId: "ticketStatus",
                            optionName: "Status of the ticketSystem",
                            optionDescription: "Enable/Disable",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                minimalbutton: {
                                    minimalbutton: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (ticket) return (ticket.Status == null || ticket.Status == undefined) ? DEFAULT_STATE : ticket.Status;
                            },
                            setNew: async ({ guild, newData }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (!newData) newdata = false

                                if (!ticket) {
                                    ticket = new ticketSys({
                                        Guild: guild.id,
                                        Status: newData,
                                    })
                                    await ticket.save()
                                } else {
                                    ticket.Status = newData
                                    await ticket.save()
                                }
                            },
                        },
                        {
                            optionId: "generalticket",
                            optionName: "Ticket types",
                            optionSubDescription: "General",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    first: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (ticket) return (ticket.General == null || ticket.General == undefined) ? ticket.General : ticket.General;
                            },
                            setNew: async ({ guild, newData }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (!newData) newdata = false

                                if (!ticket) {
                                    ticket = new ticketSys({
                                        Guild: guild.id,
                                        General: newData,
                                    })
                                    await ticket.save()
                                } else {
                                    ticket.General = newData
                                    await ticket.save()
                                }
                            },
                        },
                        {
                            optionId: "complaintTicket",
                            optionName: "",
                            optionSubDescription: "complaint",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    startNewSection: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (ticket) return (ticket.Complaint == null || ticket.Complaint == undefined) ? ticket.Complaint : ticket.Complaint;
                            },
                            setNew: async ({ guild, newData }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (!newData) newdata = false

                                if (!ticket) {
                                    ticket = new ticketSys({
                                        Guild: guild.id,
                                        Complaint: newData,
                                    })
                                    await ticket.save()
                                } else {
                                    ticket.Complaint = newData
                                    await ticket.save()
                                }
                            },
                        },
                        {
                            optionId: "give_AwayTicket",
                            optionName: "",
                            optionSubDescription: "Give_Away",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                startNewSection: {
                                    last: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (ticket) return (ticket.Give_Away == null || ticket.Give_Away == undefined) ? ticket.Give_Away : ticket.Give_Away;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (!newData) newdata = false

                                if (!data) {
                                    data = new ticketSys({
                                        Guild: guild.id,
                                        Give_Away: newData,
                                    })
                                    await data.save()
                                } else {
                                    data.Give_Away = newData
                                    await data.save()
                                }
                            },
                        },
                        {
                            optionId: "ticketColor",
                            optionName: "Color",
                            optionDescription: "Choose a color for the embed",
                            optionType: DBD.formTypes.select({ "Green": "Green", "Red": "Red", "Blue": "Blue", "Purple": "Purple", "Pink": "Pink", "White": "White", "None": "None" }, false, false),
                            getActualSet: async ({ guild }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (ticket) return ticket.Color;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })

                                if (!newData) newdata = "#2F3136"

                                if (!data) {
                                    data = new ticketSys({
                                        Guild: guild.id,
                                        Color: newData,
                                    })
                                    await data.save()
                                } else {
                                    data.Color = newData
                                    await data.save()
                                }
                            },
                        },
                        {
                            optionId: "ticketTitle",
                            optionName: "Title",
                            optionDescription: "Typ a title for the embed between: 1/256 characters",
                            optionType: DBD.formTypes.input("", "1", "256", false),

                            getActualSet: async ({ guild }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (ticket) return ticket.Title;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (!newData) newdata = "Ticket system"
                                if (newData.length > 256) return newData = "Ticket system"

                                if (!data) {
                                    data = new ticketSys({
                                        Guild: guild.id,
                                        Title: newData,
                                    })
                                    await data.save()
                                } else {
                                    data.Title = newData
                                    await data.save()
                                }
                            },
                        },
                        {
                            optionId: "ticketDescription",
                            optionName: "Description",
                            optionDescription: "Typ a description for the embed between: 1/4096 characters<br><u>Replacement:</u><br><details><summary><b>{--}</b></summary>Enter</details>",
                            optionType: DBD.formTypes.input("", "1", "4096", false),

                            getActualSet: async ({ guild }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (ticket) return ticket.Description;
                            },
                            setNew: async ({ guild, newData }) => {
                                let data = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (!newData) newdata = "Create a ticket by reacting with the buttons bellow\n\nWe will help you when we can!"
                                if (newData.length > 4096) return newData = "Create a ticket by reacting with the buttons bellow\n\nWe will help you when we can!"

                                const replacements = {
                                    '{--}': "\n"
                                };
                                const pattern = new RegExp(Object.keys(replacements).join('|'), 'g');
                                const text = newData.replace(pattern, key => replacements[key])

                                if (!data) {
                                    data = new ticketSys({
                                        Guild: guild.id,
                                        Description: text,
                                    })
                                    await data.save()
                                } else {
                                    data.Description = text
                                    await data.save()
                                }
                            },
                        },
                        {
                            optionId: "ticketlogtoggle",
                            optionName: "Log Channel",
                            optionSubDescription: "Toggle Log channel on/of",
                            optionType: DBD.formTypes.switch(false, false),
                            themeOptions: {
                                startNewSection: {
                                    first: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (ticket) return (ticket.LogToggle == null || ticket.LogToggle == undefined) ? ticket.LogToggle : ticket.LogToggle;

                            },
                            setNew: async ({ guild, newData }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (!newData) return
                                ticket.LogToggle = newData
                                await ticket.save()

                            },
                        },
                        {
                            optionId: "ticketlogchannel",
                            optionName: "",
                            optionDescription: "The channel you want to send the log actions to.",
                            optionType: DBD.formTypes.channelsSelect(false, channelTypes = [ChannelType.GuildText]),
                            themeOptions: {
                                startNewSection: {
                                    last: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (ticket) return ticket.LogChannel || []

                            },
                            setNew: async ({ guild, newData }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (!newData) return
                                ticket.LogChannel = newData
                                await ticket.save()

                            },
                        },
                        {
                            optionId: "ticketEmbedToSend",
                            optionName: "Channel",
                            optionDescription: "The channel you want to send the embed(first fill the rest before you can send the embed!)",
                            optionType: DBD.formTypes.channelsSelect(false, channelTypes = [ChannelType.GuildText]),
                            getActualSet: async () => {

                            },
                            setNew: async ({ guild, newData }) => {
                                if (!newData) return
                                const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js')
                                let Data = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (!Data) return
                                const chann = client.channels.cache.get(newData)
                                if (Data.General === true && Data.Complaint === true && Data.Give_Away === true) {
                                    chann.send({
                                        embeds: [new EmbedBuilder().setTitle(Data.Title).setColor(Data.Color).setDescription(Data.Description)], components: [
                                            new ActionRowBuilder().addComponents(
                                                new ButtonBuilder()
                                                    .setCustomId('General_ticket')
                                                    .setLabel("General")
                                                    .setEmoji("🎫")
                                                    .setStyle(ButtonStyle.Primary)
                                            ).addComponents(
                                                new ButtonBuilder()
                                                    .setCustomId('Complaint_ticket')
                                                    .setLabel("Complaint")
                                                    .setEmoji("🎫")
                                                    .setStyle(ButtonStyle.Danger)
                                            ).addComponents(
                                                new ButtonBuilder()
                                                    .setCustomId('Give_away_ticket')
                                                    .setLabel("Give_away")
                                                    .setEmoji("🎫")
                                                    .setStyle(ButtonStyle.Secondary)
                                            )
                                        ]
                                    })
                                } else if (Data.General === true && Data.Complaint == true) {
                                    chann.send({
                                        embeds: [new EmbedBuilder().setTitle(Data.Title).setColor(Data.Color).setDescription(Data.Description)], components: [
                                            new ActionRowBuilder().addComponents(
                                                new ButtonBuilder()
                                                    .setCustomId('General_ticket')
                                                    .setLabel("General")
                                                    .setEmoji("🎫")
                                                    .setStyle(ButtonStyle.Primary)
                                            ).addComponents(
                                                new ButtonBuilder()
                                                    .setCustomId('Complaint_ticket')
                                                    .setLabel("Complaint")
                                                    .setEmoji("🎫")
                                                    .setStyle(ButtonStyle.Danger)
                                            )
                                        ]
                                    })
                                } else if (Data.General === true && Data.Give_Away == true) {
                                    chann.send({
                                        embeds: [new EmbedBuilder().setTitle(Data.Title).setColor(Data.Color).setDescription(Data.Description)], components: [
                                            new ActionRowBuilder().addComponents(
                                                new ButtonBuilder()
                                                    .setCustomId('General_ticket')
                                                    .setLabel("General")
                                                    .setEmoji("🎫")
                                                    .setStyle(ButtonStyle.Primary)
                                            ).addComponents(
                                                new ButtonBuilder()
                                                    .setCustomId('Give_away_ticket')
                                                    .setLabel("Give_away")
                                                    .setEmoji("🎫")
                                                    .setStyle(ButtonStyle.Secondary)
                                            )
                                        ]
                                    })
                                } else if (Data.Complaint === true && Data.Give_Away == true) {
                                    chann.send({
                                        embeds: [new EmbedBuilder().setTitle(Data.Title).setColor(Data.Color).setDescription(Data.Description)], components: [
                                            new ActionRowBuilder().addComponents(
                                                new ButtonBuilder()
                                                    .setCustomId('Complaint_ticket')
                                                    .setLabel("Complaint")
                                                    .setEmoji("🎫")
                                                    .setStyle(ButtonStyle.Danger)
                                            ).addComponents(
                                                new ButtonBuilder()
                                                    .setCustomId('Give_away_ticket')
                                                    .setLabel("Give_away")
                                                    .setEmoji("🎫")
                                                    .setStyle(ButtonStyle.Secondary)
                                            )
                                        ]
                                    })
                                } else if (Data.General === true) {
                                    chann.send({
                                        embeds: [new EmbedBuilder().setTitle(Data.Title).setColor(Data.Color).setDescription(Data.Description)], components: [
                                            new ActionRowBuilder().addComponents(
                                                new ButtonBuilder()
                                                    .setCustomId('General_ticket')
                                                    .setLabel("General")
                                                    .setEmoji("🎫")
                                                    .setStyle(ButtonStyle.Primary)
                                            )
                                        ]
                                    })
                                } else if (Data.Complaint === true) {
                                    chann.send({
                                        embeds: [new EmbedBuilder().setTitle(Data.Title).setColor(Data.Color).setDescription(Data.Description)], components: [
                                            new ActionRowBuilder().addComponents(
                                                new ButtonBuilder()
                                                    .setCustomId('Complaint_ticket')
                                                    .setLabel("Complaint")
                                                    .setEmoji("🎫")
                                                    .setStyle(ButtonStyle.Danger)
                                            )
                                        ]
                                    })
                                } else if (Data.Give_Away === true) {
                                    chann.send({
                                        embeds: [new EmbedBuilder().setTitle(Data.Title).setColor(Data.Color).setDescription(Data.Description)], components: [
                                            new ActionRowBuilder().addComponents(
                                                new ButtonBuilder()
                                                    .setCustomId('Give_away_ticket')
                                                    .setLabel("Give_away")
                                                    .setEmoji("🎫")
                                                    .setStyle(ButtonStyle.Secondary)
                                            )
                                        ]
                                    })
                                }

                            }

                        },
                        {
                            optionId: "ticketctoggle",
                            optionName: "Tickets in Category",
                            optionDescription: "Do you want to place the ticket Channels in a category? <br>Leave blank if you don't want to.",
                            optionType: DBD.formTypes.input("Place here your Category ID", false),
                            getActualSet: async ({ guild }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (ticket) return ticket.TicketCID || []

                            },
                            setNew: async ({ guild, newData }) => {
                                let ticket = await ticketSys.findOne({ Guild: guild.id }).catch(() => { })
                                if (!newData) newData = "No"
                                ticket.TicketCID = newData
                                await ticket.save()

                            },
                        },
                        {
                            optionId: "ticketinsightgeneral",
                            optionName: "Ticket insight generals",
                            optionDescription: "Which Rolls do you want to show the Generale tickets.",
                            optionType: DBD.formTypes.rolesMultiSelect(false, true),
                            getActualSet: async ({ guild }) => {
                                let ticket = await ticketSys.findOne({ guild: guild.id }).catch(() => { })
                                return ticket?.GenRoles || []
                            },
                            setNew: async ({ guild, newData }) => {
                                if (!newData) return
                                let ticket = await ticketSys.findOne({ guild: guild.id }).catch(() => { })
                                ticket.GenRoles = newData
                                await ticket.save()

                            },
                        },
                        {
                            optionId: "ticketinsightcomplaint",
                            optionName: "Ticket insight Complaints",
                            optionDescription: "Which Rolls do you want to show the Complaint tickets.",
                            optionType: DBD.formTypes.rolesMultiSelect(false, true),
                            getActualSet: async ({ guild }) => {
                                let ticket = await ticketSys.findOne({ guild: guild.id }).catch(() => { })
                                return ticket?.ComRoles || []
                            },
                            setNew: async ({ guild, newData }) => {
                                if (!newData) return
                                let ticket = await ticketSys.findOne({ guild: guild.id }).catch(() => { })
                                ticket.ComRoles = newData
                                await ticket.save()

                            },
                        },
                        {
                            optionId: "ticketinsightgive-away",
                            optionName: "Ticket insight Give-Aways",
                            optionDescription: "Which Rolls do you want to show the Give-Away tickets.",
                            optionType: DBD.formTypes.rolesMultiSelect(false, true),
                            getActualSet: async ({ guild }) => {
                                let ticket = await ticketSys.findOne({ guild: guild.id }).catch(() => { })
                                return ticket?.GivRoles || []
                            },
                            setNew: async ({ guild, newData }) => {
                                if (!newData) return
                                let ticket = await ticketSys.findOne({ guild: guild.id }).catch(() => { })
                                ticket.GivRoles = newData
                                await ticket.save()

                            },
                        },


                    ]
                },
                {
                    categoryId: "applysystem",
                    categoryName: "Apply System",
                    categoryImageURL: "/img/staff.png",
                    categoryDescription: "Setup the Apply System.",
                    categoryOptionsList: [
                        {
                            optionId: "applystatus",
                            optionName: "Status of the ApplySystem",
                            optionDescription: "Enable/Disable",
                            optionType: DBD.formTypes.switch(false),
                            themeOptions: {
                                minimalbutton: {
                                    minimalbutton: true
                                }
                            },
                            getActualSet: async ({ guild }) => {
                                let apply = await applySys.findOne({ guildID: guild.id }).catch(() => { });
                                if (apply) return (apply.appToggle == null || apply.appToggle === undefined) ? DEFAULT_STATE : apply.appToggle;
                            },
                            setNew: async ({ guild, newData }) => {
                                let apply = await applySys.findOne({ guildID: guild.id }).catch(() => { });
                                if (!newData) newData = false;

                                if (!apply) {
                                    apply = new applySys({
                                        guildID: guild.id,
                                        appToggle: newData
                                    })
                                    await apply.save()
                                } else {
                                    apply.appToggle = newData
                                    await apply.save()
                                }
                            },
                        },
                        {
                            optionId: "applychannel",
                            optionName: "Apply logChannel",
                            optionDescription: "The channel you want to send the answers to.",
                            optionType: DBD.formTypes.channelsSelect(false, channelTypes = [ChannelType.GuildText]),
                            getActualSet: async ({ guild }) => {
                                let apply = await applySys.findOne({ guildID: guild.id }).catch(() => { });
                                if (apply) return apply.channel || []
                            },
                            setNew: async ({ guild, newData }) => {
                                let apply = await applySys.findOne({ guildID: guild.id }).catch(() => { });
                                if (!newData) return;
                                apply.channel = newData;
                                await apply.save()
                            }

                        },
                        {
                            optionId: "applyfunction",
                            optionName: "Apply function",
                            optionDescription: "The function for the apply system.",
                            optionType: DBD.formTypes.input("", "1", "", false),
                            getActualSet: async ({ guild }) => {
                                let apply = await applySys.findOne({ guildID: guild.id }).catch(() => { });
                                if (apply) return apply.ApplyFunction || [];
                            },
                            setNew: async ({ guild, newData }) => {
                                let apply = await applySys.findOne({ guildID: guild.id }).catch(() => { });
                                if (!newData) return;
                                if (!apply) return;
                                if (apply) {
                                    apply.ApplyFunction = newData;
                                    await apply.save();
                                }
                            }
                        },
                        {
                            optionId: "applyquestions",
                            optionName: "Apply questions",
                            optionDescription: "The questions for the apply seperate with enter.",
                            optionType: DBD.formTypes.textarea("", "1", "", false),
                            getActualSet: async ({ guild }) => {
                                let apply = await applySys.findOne({ guildID: guild.id }).catch(() => { });
                                if (!apply) return []
                                let mappedQuestions = apply.questions.map(
                                    (q) => `${q}`
                                ).join("\n");
                                if (apply) return mappedQuestions || [];

                            },
                            setNew: async ({ guild, newData }) => {
                                let apply = await applySys.findOne({ guildID: guild.id }).catch(() => { });
                                if (!newData) return;
                                if (!apply) return;
                                let split = newData.split('\n')
                                if (apply) {
                                    apply.questions = split;
                                    await apply.save();
                                }
                            }
                        },
                        {
                            optionId: "applyroles",
                            optionName: "Apply Roles",
                            optionDescription: "The roles for the apply.",
                            optionType: DBD.formTypes.rolesMultiSelect(false, true),
                            getActualSet: async ({ guild }) => {
                                let apply = await applySys.findOne({ guildID: guild.id }).catch(() => { });
                                if (apply) return apply?.add_role || [];
                            },
                            setNew: async ({ guild, newData }) => {
                                let apply = await applySys.findOne({ guildID: guild.id }).catch(() => { });
                                if (!newData) return;
                                if (!apply) return;

                                if (apply) {
                                    apply.add_role = newData;
                                    await apply.save();
                                }
                            }
                        },
                    ]
                }]
        });
        Dashboard.DBDEvents.on('userLoggedIn', (data) => {
            console.log(data)
        });
        Dashboard.init();
    }
};

function CommandPush(filteredArray, CategoryArray) {
    filteredArray.forEach(obj => {
        let cmdObject = {
            commandName: obj.name,
            commandUsage: "/" + obj.name,
            commandDescription: obj.description,
        }

        CategoryArray.push(cmdObject)

    })
}