Home Manual Reference Source Repository
import CommandBuilder from 'discord-graf/src/commands/builder.js'
public class | source

CommandBuilder

Builds commands with a fluent API

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

bot: Bot

public
public

Method Summary

Public Methods
public

Sets the command's hasPermission method

public

Sets the command information.

public

Registers the command to the bot

public

run(fn: function, extras: *[]): CommandBuilder

Sets the command's run method

Public Constructors

public constructor(bot: Bot, info: CommandInfo, funcs: CommandBuilderFunctions) source

Params:

NameTypeAttributeDescription
bot Bot

The bot the command is for

info CommandInfo
  • optional

The command info

funcs CommandBuilderFunctions
  • optional

The command functions to set

Public Members

public bot: Bot source

public command: Command source

public commandInfo: CommandInfo source

Public Methods

public hasPermission(fn: function, extras: *[]): CommandBuilder source

Sets the command's hasPermission method

Params:

NameTypeAttributeDescription
fn function

The function to use

extras *[]
  • optional
  • default: []

Extra values to pass to the function

Return:

CommandBuilder

This builder

public info(info: CommandInfo): CommandBuilder source

Sets the command information. This must be used before any other method if info was not provided to the constructor.

Params:

NameTypeAttributeDescription
info CommandInfo

The command info

Return:

CommandBuilder

This builder

public register(): Command source

Registers the command to the bot

Return:

Command

The command that was registered

public run(fn: function, extras: *[]): CommandBuilder source

Sets the command's run method

Params:

NameTypeAttributeDescription
fn function

The function to use

extras *[]
  • optional
  • default: []

Extra values to pass to the function

Return:

CommandBuilder

This builder