feat(bot): add guided setup topic binding flow

This commit is contained in:
2026-03-11 05:20:53 +04:00
parent 60a5cd332e
commit 1b8c6e87f6
8 changed files with 1296 additions and 40 deletions

View File

@@ -53,9 +53,47 @@ export const enBotTranslations: BotTranslationCatalog = {
[
`Household ${created ? 'created' : 'already registered'}: ${householdName}`,
`Chat ID: ${telegramChatId}`,
'Next: open the purchase topic and run /bind_purchase_topic, then open the feedback topic and run /bind_feedback_topic. If you want dedicated reminders or payments topics, open them and run /bind_reminders_topic or /bind_payments_topic.',
'Use the buttons below to finish topic setup. For an existing topic, tap Bind and then send any message inside that topic.',
'Members should open the bot chat from the button below and confirm the join request there.'
].join('\n'),
setupTopicsHeading: 'Topic setup:',
setupTopicBound: (role, topic) => `- ${role}: bound to ${topic}`,
setupTopicMissing: (role) => `- ${role}: not configured`,
setupTopicCreateButton: (role) => `Create ${role}`,
setupTopicBindButton: (role) => `Bind ${role}`,
setupTopicCreateFailed:
'I could not create that topic. Check bot admin permissions and forum settings.',
setupTopicCreateForbidden:
'I need permission to manage topics in this group before I can create one automatically.',
setupTopicCreated: (role, topicName) => `${role} topic created and bound: ${topicName}.`,
setupTopicBindPending: (role) =>
`Binding mode is on for ${role}. Open the target topic and send any message there within 10 minutes.`,
setupTopicBindCancelled: 'Topic binding mode cleared.',
setupTopicBindNotAvailable: 'That topic-binding action is no longer available.',
setupTopicBindRoleName: (role) => {
switch (role) {
case 'purchase':
return 'purchases'
case 'feedback':
return 'feedback'
case 'reminders':
return 'reminders'
case 'payments':
return 'payments'
}
},
setupTopicSuggestedName: (role) => {
switch (role) {
case 'purchase':
return 'Shared purchases'
case 'feedback':
return 'Anonymous feedback'
case 'reminders':
return 'Reminders'
case 'payments':
return 'Payments'
}
},
useBindPurchaseTopicInGroup: 'Use /bind_purchase_topic inside the household group topic.',
purchaseTopicSaved: (householdName, threadId) =>
`Purchase topic saved for ${householdName} (thread ${threadId}).`,

View File

@@ -55,9 +55,47 @@ export const ruBotTranslations: BotTranslationCatalog = {
[
`${created ? 'Дом создан' : 'Дом уже подключён'}: ${householdName}`,
`ID чата: ${telegramChatId}`,
'Дальше: откройте топик покупок и выполните /bind_purchase_topic, затем откройте топик обратной связи и выполните /bind_feedback_topic. Если хотите отдельные топики для напоминаний или оплат, откройте их и выполните /bind_reminders_topic или /bind_payments_topic.',
'Используйте кнопки ниже, чтобы завершить настройку топиков. Для уже существующего топика нажмите «Привязать», затем отправьте любое сообщение внутри этого топика.',
'Участники должны открыть чат с ботом по кнопке ниже и подтвердить заявку на вступление.'
].join('\n'),
setupTopicsHeading: 'Настройка топиков:',
setupTopicBound: (role, topic) => `- ${role}: привязан к ${topic}`,
setupTopicMissing: (role) => `- ${role}: не настроен`,
setupTopicCreateButton: (role) => `Создать ${role}`,
setupTopicBindButton: (role) => `Привязать ${role}`,
setupTopicCreateFailed:
'Не удалось создать этот топик. Проверьте права бота и включённые форум-топики в группе.',
setupTopicCreateForbidden:
'Мне нужны права на управление топиками в этой группе, чтобы создать его автоматически.',
setupTopicCreated: (role, topicName) => `Топик ${role} создан и привязан: ${topicName}.`,
setupTopicBindPending: (role) =>
`Режим привязки включён для ${role}. Откройте нужный топик и отправьте там любое сообщение в течение 10 минут.`,
setupTopicBindCancelled: 'Режим привязки топика очищен.',
setupTopicBindNotAvailable: 'Это действие привязки топика уже недоступно.',
setupTopicBindRoleName: (role) => {
switch (role) {
case 'purchase':
return 'покупки'
case 'feedback':
return 'обратной связи'
case 'reminders':
return 'напоминаний'
case 'payments':
return 'оплат'
}
},
setupTopicSuggestedName: (role) => {
switch (role) {
case 'purchase':
return 'Общие покупки'
case 'feedback':
return 'Анонимная обратная связь'
case 'reminders':
return 'Напоминания'
case 'payments':
return 'Оплаты'
}
},
useBindPurchaseTopicInGroup: 'Используйте /bind_purchase_topic внутри топика группы дома.',
purchaseTopicSaved: (householdName, threadId) =>
`Топик покупок сохранён для ${householdName} (тред ${threadId}).`,

View File

@@ -73,6 +73,19 @@ export interface BotTranslationCatalog {
telegramChatId: string
created: boolean
}) => string
setupTopicsHeading: string
setupTopicBound: (role: string, topic: string) => string
setupTopicMissing: (role: string) => string
setupTopicCreateButton: (role: string) => string
setupTopicBindButton: (role: string) => string
setupTopicCreateFailed: string
setupTopicCreateForbidden: string
setupTopicCreated: (role: string, topicName: string) => string
setupTopicBindPending: (role: string) => string
setupTopicBindCancelled: string
setupTopicBindNotAvailable: string
setupTopicBindRoleName: (role: 'purchase' | 'feedback' | 'reminders' | 'payments') => string
setupTopicSuggestedName: (role: 'purchase' | 'feedback' | 'reminders' | 'payments') => string
useBindPurchaseTopicInGroup: string
purchaseTopicSaved: (householdName: string, threadId: string) => string
useBindFeedbackTopicInGroup: string