Util
Static Member Summary
Static Public Members | ||
public static get |
Useful pattern constants |
Static Method Summary
Static Public Methods | ||
public static |
disambiguation(items: Object[], label: string, property: string): string Build a disambiguation list - useful for telling a user to be more specific when finding partial matches from a command |
|
public static |
Convert spaces to non-breaking spaces |
|
public static |
Paginate an array of items |
|
public static |
Search for matches in a list of items |
|
public static |
Splits a string using specified characters into multiple strings of a maximum length |
|
public static |
Build a command usage string |
Static Public Methods
public static disambiguation(items: Object[], label: string, property: string): string source
Build a disambiguation list - useful for telling a user to be more specific when finding partial matches from a command
public static nbsp(text: string): string source
Convert spaces to non-breaking spaces
Params:
Name | Type | Attribute | Description |
text | string | The text to convert |
public static paginate(items: Object[], page: number, pageLength: number): Object source
Paginate an array of items
Return:
Object | The resulting paginated object |
public static search(items: Object[], searchString: string, options: Object): Object[] source
Search for matches in a list of items
Params:
Name | Type | Attribute | Description |
items | Object[] | An array of items to search in |
|
searchString | string | The string to search for |
|
options | Object | An options object |
|
options.property | string |
|
The property on items to search against |
options.searchInexact | boolean |
|
Whether or not to search for inexact matches |
options.searchExact | boolean |
|
Whether or not to search for exact matches (will narrow down inexact matches if applicable) |
options.useStartsWith | boolean |
|
Whether or not to search inexact by checking to see if the item starts with the search string rather than contains |
public static split(text: string, maxLength: number, splitOn: string): string[] source
Splits a string using specified characters into multiple strings of a maximum length
public static usage(command: string, server: Server, onlyMention: boolean): string source
Build a command usage string
Params:
Name | Type | Attribute | Description |
command | string | The short command string (ex. "roll d20") |
|
server | Server |
|
The Discord.js Server instance of the server to use the prefix of |
onlyMention | boolean |
|
Whether or not the usage string should only show the mention form |