mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
fix subcommand groups (#160)
This commit is contained in:
parent
0ab003f8d6
commit
9c42027676
@ -48,15 +48,15 @@ function getCommandFromContent(
|
|||||||
const command =
|
const command =
|
||||||
groupName || subcommandName
|
groupName || subcommandName
|
||||||
? (parent.options?.find(opt => {
|
? (parent.options?.find(opt => {
|
||||||
if (opt instanceof SubCommand) {
|
if (opt instanceof SubCommand) {
|
||||||
if (groupName) {
|
if (groupName) {
|
||||||
if (opt.group !== groupName) return false;
|
if (opt.group !== groupName) return false;
|
||||||
}
|
|
||||||
if (opt.group && !groupName) return false;
|
|
||||||
return subcommandName === opt.name;
|
|
||||||
}
|
}
|
||||||
return false;
|
if (opt.group && !groupName) return false;
|
||||||
}) as SubCommand)
|
return subcommandName === opt.name;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}) as SubCommand)
|
||||||
: parent;
|
: parent;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -80,7 +80,7 @@ export async function onMessageCreate(
|
|||||||
|
|
||||||
const content = message.content.slice(prefix.length).trimStart();
|
const content = message.content.slice(prefix.length).trimStart();
|
||||||
const { fullCommandName, command, parent } = getCommandFromContent(
|
const { fullCommandName, command, parent } = getCommandFromContent(
|
||||||
content.split(' ').filter(x => x),
|
content.split(' ').filter(x => x).slice(0, 3),
|
||||||
self,
|
self,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user