Skip to content

Commit

Permalink
Updated interfaces on Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ccjmk authored Mar 18, 2022
1 parent be14c3d commit 7e48359
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,32 @@ Receives a Command to register; the command is only registered if it passes inte

```ts
interface Command {
name: string;
name: string; // must be lowercase
namespace: string; // unused for now but mandatory
description?: string;
schema: string;
schema: string; // must start with name, followed by argument names prefixed with '$'
args: Argument[];
allow?: () => boolean;
handler: (...params: any) => any;
}
interface Argument {
name: string;
name: string; // 'string'|'number'|'boolean'|'raw' names are reserved
type: ARGUMENT_TYPES;
suggestions?: (...params: any) => Suggestion[];
}
enum ARGUMENT_TYPES {
'string', // accepts spaces ONLY IF you write the next between quotes.
'number', // accepts numbers with decimals. It's just parseFloat(arg), so be tame with the decimals. Consider yourself warned!
'boolean', // accepts 'true', 'on', 'false', 'off'
'raw', // returns the whole remaining input string. If used with other arguments this MUST BE LAST.
}
interface Suggestion {
content: string; // what is shown on the suggestion
icon?: string; // icon is a font-awesome class name, takes precedence over img
img?: string;
bold?: boolean; // not implemented yet
italics?: boolean; // not implemented yet
}
```

### helpers.hasRole (role)
Expand Down

0 comments on commit 7e48359

Please sign in to comment.