feat(bot): add conversational DM assistant flow

This commit is contained in:
2026-03-11 01:41:58 +04:00
parent a63c702037
commit 714d2a985d
15 changed files with 1560 additions and 8 deletions

View File

@@ -112,6 +112,32 @@ export const enBotTranslations: BotTranslationCatalog = {
hour: (count) => `${count} hour${count === 1 ? '' : 's'}`,
minute: (count) => `${count} minute${count === 1 ? '' : 's'}`
},
assistant: {
unavailable: 'The assistant is temporarily unavailable. Try again in a moment.',
noHousehold:
'I can help after your Telegram account is linked to a household. Open the household group and complete the join flow first.',
multipleHouseholds:
'You belong to multiple households. Open the target household from its group until direct household selection is added.',
rateLimited: (retryDelay) => `Assistant rate limit reached. Try again ${retryDelay}.`,
retryInLessThanMinute: 'in less than a minute',
retryIn: (parts) => `in ${parts}`,
hour: (count) => `${count} hour${count === 1 ? '' : 's'}`,
minute: (count) => `${count} minute${count === 1 ? '' : 's'}`,
paymentProposal: (kind, amount, currency) =>
`I can record this ${kind === 'rent' ? 'rent' : 'utilities'} payment: ${amount} ${currency}. Confirm or cancel below.`,
paymentClarification:
'I can help record that payment, but I need a clearer message. Mention whether it was rent or utilities, and include the amount if you did not pay the full current balance.',
paymentUnsupportedCurrency:
'I can only auto-confirm payment proposals in the current household billing currency for now. Use /payment_add if you need a different currency.',
paymentNoBalance: 'There is no payable balance to confirm for that payment type right now.',
paymentConfirmButton: 'Confirm payment',
paymentCancelButton: 'Cancel',
paymentConfirmed: (kind, amount, currency) =>
`Recorded ${kind === 'rent' ? 'rent' : 'utilities'} payment: ${amount} ${currency}`,
paymentCancelled: 'Payment proposal cancelled.',
paymentAlreadyHandled: 'That payment proposal was already handled.',
paymentUnavailable: 'That payment proposal is no longer available.'
},
finance: {
useInGroup: 'Use this command inside a household group.',
householdNotConfigured: 'Household is not configured for this chat yet. Run /setup first.',

View File

@@ -115,6 +115,32 @@ export const ruBotTranslations: BotTranslationCatalog = {
hour: (count) => `${count} ${count === 1 ? 'час' : count < 5 ? 'часа' : 'часов'}`,
minute: (count) => `${count} ${count === 1 ? 'минуту' : count < 5 ? 'минуты' : 'минут'}`
},
assistant: {
unavailable: 'Ассистент сейчас недоступен. Попробуйте ещё раз чуть позже.',
noHousehold:
'Я смогу помочь после того, как ваш Telegram-профиль будет привязан к дому. Сначала откройте группу дома и завершите вступление.',
multipleHouseholds:
'Вы состоите в нескольких домах. Откройте нужный дом из его группы, пока прямой выбор дома ещё не добавлен.',
rateLimited: (retryDelay) => `Лимит сообщений ассистенту исчерпан. Попробуйте ${retryDelay}.`,
retryInLessThanMinute: 'меньше чем через минуту',
retryIn: (parts) => `через ${parts}`,
hour: (count) => `${count} ${count === 1 ? 'час' : count < 5 ? 'часа' : 'часов'}`,
minute: (count) => `${count} ${count === 1 ? 'минуту' : count < 5 ? 'минуты' : 'минут'}`,
paymentProposal: (kind, amount, currency) =>
`Я могу записать эту оплату ${kind === 'rent' ? 'аренды' : 'коммуналки'}: ${amount} ${currency}. Подтвердите или отмените ниже.`,
paymentClarification:
'Я могу помочь записать эту оплату, но сообщение нужно уточнить. Укажите, это аренда или коммуналка, и добавьте сумму, если вы оплатили не весь текущий остаток.',
paymentUnsupportedCurrency:
'Пока я могу автоматически подтверждать оплаты только в текущей валюте дома. Для другой валюты используйте /payment_add.',
paymentNoBalance: 'Сейчас для этого типа оплаты нет суммы к подтверждению.',
paymentConfirmButton: 'Подтвердить оплату',
paymentCancelButton: 'Отменить',
paymentConfirmed: (kind, amount, currency) =>
`Оплата ${kind === 'rent' ? 'аренды' : 'коммуналки'} сохранена: ${amount} ${currency}`,
paymentCancelled: 'Предложение оплаты отменено.',
paymentAlreadyHandled: 'Это предложение оплаты уже было обработано.',
paymentUnavailable: 'Это предложение оплаты уже недоступно.'
},
finance: {
useInGroup: 'Используйте эту команду внутри группы дома.',
householdNotConfigured: 'Для этого чата дом ещё не настроен. Сначала выполните /setup.',

View File

@@ -120,6 +120,26 @@ export interface BotTranslationCatalog {
hour: (count: number) => string
minute: (count: number) => string
}
assistant: {
unavailable: string
noHousehold: string
multipleHouseholds: string
rateLimited: (retryDelay: string) => string
retryInLessThanMinute: string
retryIn: (parts: string) => string
hour: (count: number) => string
minute: (count: number) => string
paymentProposal: (kind: 'rent' | 'utilities', amount: string, currency: string) => string
paymentClarification: string
paymentUnsupportedCurrency: string
paymentNoBalance: string
paymentConfirmButton: string
paymentCancelButton: string
paymentConfirmed: (kind: 'rent' | 'utilities', amount: string, currency: string) => string
paymentCancelled: string
paymentAlreadyHandled: string
paymentUnavailable: string
}
finance: {
useInGroup: string
householdNotConfigured: string