new Haruka( options )

Description
The Haruka class.
Parameters
Name Type Description
options HarukaOptions Haruka’s options.
Details

2.0.0

2.0.0

MindfulMinun

Members


prefix :String

Description
Haruka's function prefix, such as `-h`. It musn't contain any whitespace.
Details
String

functions :Array.<HarukaFn>

Description
A collection of functions, meant to be added via `Haruka::add('function', fn)`
Details
Array.<HarukaFn>

specials :Array.<HarukaFn>

Description
A collection of special functions, meant to be added via `Haruka::add('special', fn)`
Details
Array.<HarukaFn>

Methods


try( msg ) → {*}

Description
Haruka will attempt to reply to the given Discord message if it starts with the prefix. If it can't find one, it will call the `default` function passed during instantiation.
Parameters
Name Type Description
msg Message The discord.js Discord message
Returns
The return value of the handler function or `undefined` if the message was sent by a bot or doesn't start with the prefix.
Details

2.0.0

0.1.0

MindfulMinun


add( type, fn ) → {Haruka}

Description
Adds a function to Haruka. This function will be called if a message's content matches its RegExp
Parameters
Name Type Description
type String An enumerated string, either "function" or "special"
fn HarukaFn A Haruka message handler function.
Returns
The Haruka object with the function added to it.
Details

2.0.0

Sep 23, 2018 - 2.0.0

MindfulMinun