mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 22:34:03 +00:00
fix(bot): support text cancellation of reminder drafts
This commit is contained in:
@@ -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 ||
|
||||
|
||||
Reference in New Issue
Block a user