fix: register /cancel as a proper command
Previously /cancel was intercepted inside the 'unknown' branch, and the
comparison used the command WITHOUT the leading slash while parseCommand
returns it WITH one ('/cancel') — the check never matched, so /cancel
always fell through to the unknown-command reply, even with a pending
ask/approval.
Now a first-class command (menu included): closes the TG-side
answer/approval channel when one is pending, otherwise reports that
nothing is awaiting a reply.
This commit is contained in:
@@ -73,6 +73,7 @@ export type ParsedCommand =
|
||||
| { type: 'stop'; text: string }
|
||||
| { type: 'mission'; text: string }
|
||||
| { type: 'new'; text: string }
|
||||
| { type: 'cancel'; text: string }
|
||||
| { type: 'unknown'; command: string; text: string }
|
||||
| { type: 'plain'; text: string }
|
||||
|
||||
@@ -107,6 +108,8 @@ export function parseCommand(text: string): ParsedCommand {
|
||||
case '/new':
|
||||
case '/create':
|
||||
return { type: 'new', text }
|
||||
case '/cancel':
|
||||
return { type: 'cancel', text }
|
||||
default:
|
||||
return { type: 'unknown', command, text }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user