Skip to content
On this page

Settings Handler

A quick and easy way to store and retrieve settings from your dashboard.


Add these lines to your code to initialize the Storage Handler.

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

    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 { Category, Option } = Handler; 
KeyvKeyv Storage Object

Configuring Settings

settings: [
    new Category()
        .setId('setup') // Sets the id of the category - must be unique
        .setName("Setup") // Name of the category
        .setDescription("Setup your bot with default settings!") // Description of the category
        .setToggleable(true) // Sets the category to be toggleable
            new Option() // Creates a new option inside the category
                .setId('lang') // Sets the id of the option - must be unique
                .setName("Language Select") // Name of the option
                .setDescription("Change bot's language easily") // Description of the option
                .setType({ "Polish": 'pl', "English": 'en', "French": 'fr' })), // The DBD form type function

            new Option()
                .setName("Join Message")
                .setDescription("Is the join message enabled?")

Fetching Data

const data = await Handler.fetch('guildID', 'optionID');
guildIDStringThe guild you want to fetch the data from
optionIDStringThe option ID you want the value for

Released under the MIT License.