( input: string, submitState: ReplSubmitState, commands: Command[], isCommandEnabled: (command: Command) => boolean, )
| 110 | } |
| 111 | |
| 112 | function findMatchingSubmitCommand( |
| 113 | input: string, |
| 114 | submitState: ReplSubmitState, |
| 115 | commands: Command[], |
| 116 | isCommandEnabled: (command: Command) => boolean, |
| 117 | ): Command | undefined { |
| 118 | const submittedCommandName = submitState.isSlashCommand |
| 119 | ? input.trim().slice(1).split(/\s/)[0] |
| 120 | : undefined |
| 121 | |
| 122 | return submittedCommandName |
| 123 | ? commands.find( |
| 124 | command => |
| 125 | isCommandEnabled(command) && |
| 126 | (command.name === submittedCommandName || |
| 127 | command.aliases?.includes(submittedCommandName) || |
| 128 | getCommandName(command) === submittedCommandName), |
| 129 | ) |
| 130 | : undefined |
| 131 | } |
| 132 | |
| 133 | export async function dispatchReplSubmit( |
| 134 | { |
no test coverage detected