fix(bot): support text cancellation of reminder drafts

This commit is contained in:
2026-03-24 04:20:51 +04:00
parent 782a8325ba
commit efc2e91bf6
4 changed files with 118 additions and 11 deletions

View File

@@ -77,6 +77,10 @@ function unavailableReply(locale: BotLocale): string {
: 'I cannot create reminders right now because the AI module is temporarily unavailable.'
}
function cancelledDraftReply(locale: BotLocale): string {
return locale === 'ru' ? 'Окей, тогда не напоминаю.' : 'Okay, I will drop this reminder.'
}
function localNowText(timezone: string, now = nowInstant()): string {
const local = now.toZonedDateTimeISO(timezone)
return [
@@ -833,6 +837,15 @@ export function registerAdHocNotifications(options: {
return
}
if (interpretedEdit.decision === 'cancel') {
await options.promptRepository.clearPendingAction(
ctx.chat!.id.toString(),
ctx.from!.id.toString()
)
await replyInTopic(ctx, cancelledDraftReply(reminderContext.locale))
return
}
const scheduleChanged =
interpretedEdit.resolvedLocalDate !== null ||
interpretedEdit.resolvedHour !== null ||