Skip to content
On this page

Create Form Type

Form Types is something you will need in the settings for the Dashboard class. This is the method that defines what type of data will be presented.

Select

js
DBD.formTypes.select(list, disabled)
ArgumentType
listObjectArray presented as follows: { displayName: valueReturned, displayName2: valueReturned2 }
disabledBooleanBoolean check for if the select should be disabled or not.

Data required for getActualSet function

String, valueReturned value for option actual set.

Data returned

String, valueReturned value for option selected.


Multiple Select

js
DBD.formTypes.multiSelect(list, disabled, required),
ArgumentType
listObjectArray presented as follows: { displayName: valueReturned, displayName2: valueReturned2 }
disabledBooleanBoolean check for if the select should be disabled or not.
requiredBooleanBoolean check for if the select should be required or not.

Data required for getActualSet function

Array, list of valueReturned to be selected.

Important: If any, return empty Array - no null or undefined.

Data returned

Array, list of selected valueReturned values | or an empty Array.


Input

js
DBD.formTypes.input(placeholder, min, max, disabled, required),
ArgumentType
placeholderStringInput placeholder.
minNumberMinimum length.
maxNumberMaximum length.
disabledBooleanBoolean check for if the input should be disabled or not.
requiredBooleanBoolean check for if the input should be required or not.

Data required for getActualSet function

String, value to be displayed.

Data returned

String, value set | or null.


Textarea

js
DBD.formTypes.textarea(placeholder, min, max, disabled, required),
ArgumentType
placeholderStringTextarea placeholder.
minNumberMinimum length.
maxNumberMaximum length.
disabledBooleanBoolean check for if the textarea should be disabled or not.
requiredBooleanBoolean check for if the textarea should be required or not.

Data required for getActualSet function

String, value to be displayed.

Data returned

String, value set | or null.


Color Select

js
DBD.formTypes.colorSelect(defaultState, disabled),
ArgumentType
defaultStateStringDefault state HEX color.
disabledBooleanBoolean check for if the color select should be disabled or not.

Data required for getActualSet function

String, actual set HEX color.

Data returned

String, new HEX color.

Embed Builder

js
DBD.formTypes.embedBuilder(defaultSettings),
ArgumentType
defaultSettingsObject{ username: string, avatarURL: string, defaultJson: {EMBED_BUILDER_Interface} }

Embed Builder Interface

js
interface EmbedBuilder {
    content: string,
    embed: {
        title?: string,
        description?: string,
        color?: string | number,
        timestamp?: any,
        url?: string,
        author?: {
            name?: string,
            url?: string,
            icon_url?: string
        },
        thumbnail?: {
            url?: string
        },
        image?: {
            url?: string
        },
        footer?: {
            text?: string,
            icon_url?: string
        },
        fields?: [ EmbedBuilderField ],
    }
}

interface EmbedBuilderField {
    name?: string,
    value?: string,
    inline?: boolean
}

Simple Embed Builder Example

js
{
  username: null,
  avatarURL: null,
  defaultJson: {
        content: "Did you know that if you don't know something, you don't know it? This riddle was solved by me. Don't thank me.",
        embed: {
            timestamp: new Date().toISOString(),
            url: "https://discord.com",
            description: "There was a boar, everyone liked a boar. One day the boar ate my dinner and escaped through the chimney. I haven't seen a boar since then.",
            author: {
                name: "Assistants Center",
                url: "https://assistantscenter.com",
                icon_url: "https://media.discordapp.net/attachments/911644960590270484/934513385402413076/ac_fixed.png"
            },
            image: {
                url: "https://unsplash.it/380/200"
            },
            footer: {
                text: "Crated with Discord-Dashboard",
                icon_url: "https://cdn.discordapp.com/emojis/870635912437047336.png"
            },
            fields: [
                {
                    name: "Hello",
                    value: "Hi, Assistants Center loves you <:ac_love:806492057996230676>"
                },
                {
                    name: "Do you know that",
                    value: "You can use custom emojis there, even from server where bot isn't :Kekwlaugh:",
                    inline: false
                },
            ]
        }
    }
}

Spacer

Usage is kinda different for this one. You don't need to define getActualSet, etc. Just define an option as:

js
{
    optionType: 'spacer',
    title: string,
    description: string
}
ArgumentType
titleStringTitle string for spacer. You can use HTML there.
descriptionStringDescription string for spacer. You can use HTML there.

Switch

js
DBD.formTypes.switch(disabled),
ArgumentType
disabledBooleanBoolean check for if the switch should be disabled or not.

Data required for getActualSet function

Boolean, to be turned on or not.

Important:

Please note that if(saved.state) will return false if data is not set. If you want to default state to be true, use this:

js
getActualSet: ({guild,user}) => {
    return (SAVED_STATE == null || SAVED_STATE == undefined) ? DEFAULT_STATE : SAVED_STATE;
}

Data returned

Boolean, true if turned on - false if turned off.


Checkbox

js
DBD.formTypes.checkbox(disabled),
ArgumentType
disabledBooleanBoolean check for if the checkbox should be disabled or not.

Data required for getActualSet function

Boolean, to be checked or not.

Important:

Please note that if(saved.state) will return false if data is not set. If you want to default state to be true, use this:

js
getActualSet: ({guild,user}) => {
    return (SAVED_STATE == null || SAVED_STATE == undefined) ? DEFAULT_STATE : SAVED_STATE;
}

Data returned

Boolean, true if ckecked - false if unchecked.


Channels Select

js
DBD.formTypes.channelsSelect(disabled, channelTypes = ['GUILD_TEXT'], hideNSW, onlyNSFW, hideNoAccess),
ArgumentType
disabledBooleanBoolean check for if the channels select should be disabled or not.
channelTypesArrayAn Array (!) of types of channels to be included in the channels select.
hideNSFWBooleanHide channels that are marked as nsfw
onlyNSFWBooleanOnly Show channels that are marked as nsfw
hideNoAccessBooleanHide channels the user and bot do not have access to

Data required for getActualSet function

String, channel ID.

Data returned

String, channel ID | or null.


Channels Multi Select

js
DBD.formTypes.channelsMultiSelect(disabled, required, channelTypes = ['GUILD_TEXT'], hideNSW, onlyNSFW, hideNoAccess),
ArgumentType
disabledBooleanBoolean check for if the multiple channels select should be disabled or not.
requiredBooleanBoolean check for if the multiple channels select should be required or not.
channelTypesArrayAn Array (!) of types of channels to be included in the multiple channels select.
hideNSFWBooleanHide channels that are marked as nsfw
onlyNSFWBooleanOnly Show channels that are marked as nsfw
hideNoAccessBooleanHide channels the user and bot do not have access to

Data required for getActualSet function

Array of Strings (Channels IDs) | or an empty Array.

Data returned

Array of Strings (Channels IDs) | or an empty Array.


Roles Select

js
DBD.formTypes.rolesSelect(disabled, includeBots, hideHigherRoles),
ArgumentType
disabledBooleanBoolean check for if the roles select should be disabled or not.
includeBotsBooleanBoolean include bot roles.
hideHigherRolesBooleanHide roles that are positioned higher than the users and bots highest role

Data required for getActualSet function

String, role ID.

Data returned

String, role ID | or null.


Roles Multi Select

js
DBD.formTypes.rolesMultiSelect(disabled, required, includeBots, hideHigherRoles),
ArgumentType
disabledBooleanBoolean check for if the multiple roles select should be disabled or not.
requiredBooleanBoolean check for if the multiple roles select should be required or not.
includeBotsBooleanBoolean include bot roles.
hideHigherRolesBooleanHide roles that are positioned higher than the users and bots highest role

Data required for getActualSet function

Array of Strings (Roles IDs) | or an empty Array.

Data returned

Array of Strings (Roles IDs) | or an empty Array.

Released under the MIT License.