fix(command): broke when user sent just prefix
This commit is contained in:
parent
844a408c74
commit
d0f48f601a
2 changed files with 4 additions and 2 deletions
|
@ -503,12 +503,13 @@ export const parseCommand = (
|
|||
client: CommandClient,
|
||||
msg: Message,
|
||||
prefix: string
|
||||
): ParsedCommand => {
|
||||
): ParsedCommand | undefined => {
|
||||
let content = msg.content.slice(prefix.length)
|
||||
if (client.spacesAfterPrefix === true) content = content.trim()
|
||||
const args = parse(content)._.map((e) => e.toString())
|
||||
|
||||
const name = args.shift() as string
|
||||
const name = args.shift()
|
||||
if (name === undefined) return
|
||||
const argString = content.slice(name.length).trim()
|
||||
|
||||
return {
|
||||
|
|
|
@ -187,6 +187,7 @@ export class CommandClient extends Client implements CommandClientOptions {
|
|||
prefix = usedPrefix
|
||||
|
||||
const parsed = parseCommand(this, msg, prefix)
|
||||
if (parsed === undefined) return
|
||||
const command = this.commands.fetch(parsed)
|
||||
|
||||
if (command === undefined) return
|
||||
|
|
Loading…
Reference in a new issue