Bot Command Tooltip: Fix sending incorrect command

This commit is contained in:
Alexander Zinchuk 2023-03-03 16:35:29 +01:00
parent 9573e89463
commit 6ad144e292
2 changed files with 2 additions and 2 deletions

View File

@ -55,7 +55,7 @@ const BotCommandTooltip: FC<OwnProps & StateProps> = ({
const handleSelect = useCallback((botCommand: ApiBotCommand) => {
// We need an additional check because tooltip is updated with throttling
if (!botCommand.command.startsWith(getHtml())) {
if (!botCommand.command.startsWith(getHtml().slice(1))) {
return false;
}

View File

@ -39,7 +39,7 @@ export default function useBotCommandTooltip(
}
const filter = command.substring(1);
const nextFilteredBotCommands = commands.filter((c) => !filter || c.command.includes(filter));
const nextFilteredBotCommands = commands.filter((c) => !filter || c.command.startsWith(filter));
setFilteredBotCommands(
nextFilteredBotCommands?.length ? nextFilteredBotCommands : undefined,