mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-20 13:11:39 +01:00
create stable command parser
This commit is contained in:
9
bot/lib/parseCommandArgs.ts
Normal file
9
bot/lib/parseCommandArgs.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { commandPrefix } from "..";
|
||||
|
||||
/** Helper function to extract arguments from commands */
|
||||
export default function parseCommandArgs(input: string) {
|
||||
const a = input.slice(commandPrefix.length);
|
||||
const sliceLength = a.startsWith('use') ? 2 : 1;
|
||||
const b = a.trim().split(' ').slice(sliceLength);
|
||||
return b;
|
||||
};
|
||||
Reference in New Issue
Block a user