ext

ext

Methods

(static) argument(name, type, optional) → {ClassDecorator}

Source:

Adds an argument to the command

Example
@Hibiki.ext.argument("nyan", "user", false)
class MyCommand extends Hibiki.Command {

     public run (ctx: Hibiki.Context): Promise<any> {
         // ctx.args.nyan = given user
         ctx.send(ctx.args.nyan.username);
Parameters:
Name Type Description
name string

Argument name

type string

Argument type (user, guild, channel, role, string, number)

optional boolean

Whether the argument is optional or not

Returns:
Type
ClassDecorator

(static) command(name) → {ClassDecorator}

Source:

Sets the command name

Example
@Hibiki.ext.command("nya")
class MyCommand extends Hibiki.Command {
Parameters:
Name Type Description
name string

Command name

Returns:
Type
ClassDecorator

(static) description(…args) → {ClassDecorator}

Source:

Sets the command description

Example
@Hibiki.ext.description("nya", "nya", "nya") // nya nya nya
class MyCommand extends Hibiki.Command {
Parameters:
Name Type Attributes Description
args Array.<any> <repeatable>

Description

Returns:
Type
ClassDecorator

(static) ownerOnly() → {ClassDecorator}

Source:

Sets the command to owner only

Returns:
Type
ClassDecorator

(static) permission(name, optional, botopt) → {ClassDecorator}

Source:

Adds a required permission

Example
@Hibiki.ext.permission("manageGuild", true) // set the permission to `optional` because we don't need it
class MyCommand extends Hibiki.Command {

     public run (ctx: Hibiki.Context): Promise<any> {
         ctx.send(ctx.perms.manageGuild) // sends if the user has the permission or not
Parameters:
Name Type Attributes Description
name string

Permission name @see https://abal.moe/Eris/docs/reference

optional boolean

Sets the permission to optional

bot boolean <optional>

If the permission should be required by the bot rather than the user

Returns:
Type
ClassDecorator

(static) subcommand(Subcommand) → {ClassDecorator}

Source:

Adds a subcommand on the command

Example
@Hibiki.ext.subcommand(MySubcommand)
class MyCommand extends Hibiki.Command {
Parameters:
Name Type Description
Subcommand Command

Command class to use

Returns:
Type
ClassDecorator