Schema(schemaopt)

Schema constructor that creates schemas for use in Komada.

new Schema(schemaopt)

Constructs our schema that we can add into.
Parameters:
Name Type Attributes Description
schema Object <optional>
An object containing key:value pairs

Members

defaults

Returns an object containing the keys mapped to their default values.

Methods

add(name, optionsopt) → {Schema}

Add function that adds a new key into the schema. Only requires that you pass a name and type for the key.
Parameters:
Name Type Attributes Description
name string The name of the key you want to add.
options Schema.Options <optional>
An object containing extra options for a key.
Returns:
Schema - Returns the schema you are creating so you can chain add calls.

Type Definitions

Options

Properties:
Name Type Description
type Schema.Types The type of key you want to add
value ? The default value to set the key to.
min number The minimum number, used for determining string length and amount for number types.
max number The maximum number, used for determining string length and amount for number types.
Array boolean A boolean indicating whether or not this key should be created and stored as an array.

Types

All of the valid key types in Komada at the present moment.
Properties:
Name Type Description
user string
channel string
textChannel string
voiceChannel string
guild string
role string
boolean string
string string
integer string
float string
url string
command string