Skip to content

Argument Types

Arthur Neuman edited this page Jul 26, 2020 · 1 revision

Argument types

Arguments are an essential part of commands. They can be typed to make the use of them easier for the developer

Current available types

Type Description
string Default regular string type
number The supplied string from the Discord message is parsed into a number. If it's not a valid number, the user is given an input error
user Part of a user's name or their mention is turned into an Eris.User instance
channel Part of a channel's name or its mention is turned into an Eris.Channel instance

Argument types are supplied like so

new Command({
  name: 'add',
  desc: 'Add two numbers',
  options: {
    args: [{ name: 'first', type: 'number', mand: true }, { name: 'second', type: 'number', mand: true }]
  },
  action: ({ args: [first, second] }) => first + second
})
  • These argument types also work for replacer arguments

Components


tui.jsdoc-template (Fork)

Clone this wiki locally