string type
This commit is contained in:
parent
c6deb3764c
commit
e2aac258a7
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "commandparser",
|
"name": "commandparser",
|
||||||
"version": "1.0.21",
|
"version": "1.0.22",
|
||||||
"description": "Parser meant to parse commands and their options for discord bots",
|
"description": "Parser meant to parse commands and their options for discord bots",
|
||||||
"main": "build/index.js",
|
"main": "build/index.js",
|
||||||
"author": "Navy.gif",
|
"author": "Navy.gif",
|
||||||
|
@ -101,6 +101,20 @@ class CommandOption implements ICommandOption {
|
|||||||
return { value: member, removed: this.rawValue };
|
return { value: member, removed: this.rawValue };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected STRING() {
|
||||||
|
if (this._aliased) return { value: this.rawValue?.join(' ') || '', removed: [] };
|
||||||
|
if(!this.rawValue) return { error: true };
|
||||||
|
if (this.choices.length) {
|
||||||
|
const found = this.choices.find((c) => {
|
||||||
|
const choice = c as string;
|
||||||
|
return choice.toLowerCase() === this.rawValue?.join(' ').toLowerCase();
|
||||||
|
});
|
||||||
|
if (found) return { value: found, removed: this._rawValue };
|
||||||
|
return { error: true };
|
||||||
|
}
|
||||||
|
return { value: this._rawValue, removed: this._rawValue };
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export { CommandOption };
|
export { CommandOption };
|
||||||
|
Loading…
Reference in New Issue
Block a user