feat(bot): restore /bind command and improve /setup welcoming experience

This commit is contained in:
2026-03-15 01:17:22 +04:00
parent b2e1e0f213
commit f4e5a49621
6 changed files with 137 additions and 345 deletions

View File

@@ -9,12 +9,7 @@ export const enBotTranslations: BotTranslationCatalog = {
cancel: 'Cancel the current prompt',
setup: 'Register this group as a household',
unsetup: 'Reset topic setup for this group',
bind_chat_topic: 'Bind the current topic for casual conversation',
bind_purchase_topic: 'Bind the current topic as purchases',
bind_feedback_topic: 'Bind the current topic as feedback',
bind_reminders_topic: 'Bind the current topic as reminders',
bind_payments_topic: 'Bind the current topic as payments',
bind: 'Bind current topic to a household role',
bind: 'Bind current topic to a specific role',
join_link: 'Get a shareable link for new members to join',
payment_add: 'Record your rent or utilities payment',
pending_members: 'List pending household join requests',
@@ -56,12 +51,19 @@ export const enBotTranslations: BotTranslationCatalog = {
joinRequestSent: (householdName) =>
`Join request sent for ${householdName}. Wait for a household admin to confirm you.`,
setupSummary: ({ householdName, created }) =>
`${created ? '' : ''} ${householdName} is ${created ? 'ready' : 'already registered'}!`,
setupTopicsHeading: (configured, total) => `Topics: ${configured}/${total} configured`,
`${created ? '' : ''} Welcome! ${householdName} is ${created ? 'successfully registered' : 'already active'} and ready to help.`,
setupTopicsHeading: (configured, total) =>
`Let's configure your household topics to get started (${configured}/${total}):`,
setupTopicBound: (role) => `${role}`,
setupTopicMissing: (role) => `${role}`,
setupTopicCreateButton: (role) => `+ ${role}`,
setupTopicCreateButton: (role) => `Setup ${role}`,
setupTopicBindButton: (role) => `Bind ${role}`,
useBindInTopic: 'Run /bind inside a topic to link it to a role.',
topicAlreadyBound: (role) => `This topic is already linked to ${role}.`,
bindSelectRole: 'Link this topic to:',
topicBoundSuccess: (role, householdName) =>
`Successfully linked as ${role} for ${householdName}.`,
allRolesConfigured: 'All topic roles are already configured.',
setupTopicCreateFailed:
'I could not create that topic. Check bot admin permissions and forum settings.',
setupTopicCreateForbidden:
@@ -73,15 +75,15 @@ export const enBotTranslations: BotTranslationCatalog = {
setupTopicBindRoleName: (role) => {
switch (role) {
case 'chat':
return 'chat'
return 'Discussions'
case 'purchase':
return 'purchases'
return 'Purchases'
case 'feedback':
return 'feedback'
return 'Feedback'
case 'reminders':
return 'reminders'
return 'Reminders'
case 'payments':
return 'payments'
return 'Payments'
}
},
setupTopicSuggestedName: (role) => {
@@ -101,23 +103,8 @@ export const enBotTranslations: BotTranslationCatalog = {
onlyTelegramAdminsUnsetup: 'Only Telegram group admins can run /unsetup.',
useUnsetupInGroup: 'Use /unsetup inside the household group.',
unsetupComplete: (householdName) =>
`Setup state reset for ${householdName}. Run /setup again to bind topics from scratch.`,
`Setup state reset for ${householdName}. Run /setup again to configure topics from scratch.`,
unsetupNoop: 'Nothing to reset for this group yet. Run /setup when you are ready.',
useBindChatTopicInGroup: 'Use /bind_chat_topic inside the household group topic.',
chatTopicSaved: (householdName, threadId) =>
`Chat topic saved for ${householdName} (thread ${threadId}).`,
useBindPurchaseTopicInGroup: 'Use /bind_purchase_topic inside the household group topic.',
purchaseTopicSaved: (householdName, threadId) =>
`Purchase topic saved for ${householdName} (thread ${threadId}).`,
useBindFeedbackTopicInGroup: 'Use /bind_feedback_topic inside the household group topic.',
feedbackTopicSaved: (householdName, threadId) =>
`Feedback topic saved for ${householdName} (thread ${threadId}).`,
useBindRemindersTopicInGroup: 'Use /bind_reminders_topic inside the household group topic.',
remindersTopicSaved: (householdName, threadId) =>
`Reminders topic saved for ${householdName} (thread ${threadId}).`,
useBindPaymentsTopicInGroup: 'Use /bind_payments_topic inside the household group topic.',
paymentsTopicSaved: (householdName, threadId) =>
`Payments topic saved for ${householdName} (thread ${threadId}).`,
usePendingMembersInGroup: 'Use /pending_members inside the household group.',
useApproveMemberInGroup: 'Use /approve_member inside the household group.',
approveMemberUsage: 'Usage: /approve_member <telegram_user_id>',
@@ -130,12 +117,7 @@ export const enBotTranslations: BotTranslationCatalog = {
useJoinLinkInGroup: 'Use /join_link inside the household group.',
joinLinkUnavailable: 'Could not generate join link.',
joinLinkReady: (link, householdName) =>
`Join link for ${householdName}:\n${link}\n\nAnyone with this link can join the household. Share it carefully.`,
useBindInTopic: 'Use /bind inside a topic to bind it to a role.',
topicAlreadyBound: (role) => `This topic is already bound as ${role}.`,
bindSelectRole: 'Bind this topic as:',
topicBoundSuccess: (role, householdName) => `Bound as ${role} for ${householdName}.`,
allRolesConfigured: 'All topic roles are already configured.'
`Join link for ${householdName}:\n${link}\n\nAnyone with this link can join the household. Share it carefully.`
},
anonymousFeedback: {
title: 'Anonymous household note',
@@ -147,7 +129,7 @@ export const enBotTranslations: BotTranslationCatalog = {
multipleHouseholds:
'You belong to multiple households. Open the target household from its group until household selection is added.',
feedbackTopicMissing:
'Anonymous feedback is not configured for your household yet. Ask an admin to run /bind_feedback_topic.',
'Anonymous feedback is not configured for your household yet. Ask an admin to run /setup and create a feedback topic.',
duplicate: 'This anonymous feedback message was already processed.',
delivered: 'Anonymous feedback delivered.',
savedButPostFailed: 'Anonymous feedback was saved, but posting failed. Try again later.',
@@ -325,7 +307,7 @@ export const enBotTranslations: BotTranslationCatalog = {
},
payments: {
topicMissing:
'Payments topic is not configured for this household yet. Ask an admin to run /bind_payments_topic.',
'Payments topic is not configured for this household yet. Ask an admin to run /setup and create a payments topic.',
balanceReply: (kind) =>
kind === 'rent' ? 'Current rent payment guidance:' : 'Current utilities payment guidance:',
proposal: (kind, amount, currency) =>

View File

@@ -9,12 +9,7 @@ export const ruBotTranslations: BotTranslationCatalog = {
cancel: 'Отменить текущий ввод',
setup: 'Подключить эту группу как дом',
unsetup: 'Сбросить настройку топиков для этой группы',
bind_chat_topic: 'Назначить текущий топик для разговоров',
bind_purchase_topic: 'Назначить текущий топик для покупок',
bind_feedback_topic: 'Назначить текущий топик для анонимных сообщений',
bind_reminders_topic: 'Назначить текущий топик для напоминаний',
bind_payments_topic: 'Назначить текущий топик для оплат',
bind: 'Привязать текущий топик к роли дома',
bind: 'Привязать текущий топик к конкретной роли',
join_link: 'Получить ссылку для приглашения новых участников',
payment_add: 'Подтвердить оплату аренды или коммуналки',
pending_members: 'Показать ожидающие заявки на вступление',
@@ -58,12 +53,19 @@ export const ruBotTranslations: BotTranslationCatalog = {
joinRequestSent: (householdName) =>
`Заявка на вступление в ${householdName} отправлена. Дождитесь подтверждения от админа дома.`,
setupSummary: ({ householdName, created }) =>
`${created ? '' : ''} ${householdName} ${created ? 'готов' : 'уже подключён'}!`,
setupTopicsHeading: (configured, total) => `Топики: ${configured}/${total} настроено`,
`${created ? '' : ''} Добро пожаловать! Дом ${householdName} ${created ? 'успешно зарегистрирован' : 'уже активен'} и готов к работе.`,
setupTopicsHeading: (configured, total) =>
`Давайте настроим топики для вашего дома (${configured}/${total}):`,
setupTopicBound: (role) => `${role}`,
setupTopicMissing: (role) => `${role}`,
setupTopicCreateButton: (role) => `+ ${role}`,
setupTopicCreateButton: (role) => `Настроить ${role}`,
setupTopicBindButton: (role) => `Привязать ${role}`,
useBindInTopic: 'Используйте /bind внутри топика, чтобы привязать его к роли.',
topicAlreadyBound: (role) => `Этот топик уже привязан к роли «${role}».`,
bindSelectRole: 'Привязать этот топик к:',
topicBoundSuccess: (role, householdName) =>
`Топик успешно привязан как «${role}» для ${householdName}.`,
allRolesConfigured: 'Все роли топиков уже настроены.',
setupTopicCreateFailed:
'Не удалось создать этот топик. Проверьте права бота и включённые форум-топики в группе.',
setupTopicCreateForbidden:
@@ -75,15 +77,15 @@ export const ruBotTranslations: BotTranslationCatalog = {
setupTopicBindRoleName: (role) => {
switch (role) {
case 'chat':
return 'разговоров'
return 'Общение'
case 'purchase':
return 'покупки'
return 'Покупки'
case 'feedback':
return 'обратной связи'
return 'Фидбек'
case 'reminders':
return 'напоминаний'
return 'Напоминания'
case 'payments':
return 'оплат'
return 'Оплаты'
}
},
setupTopicSuggestedName: (role) => {
@@ -103,23 +105,8 @@ export const ruBotTranslations: BotTranslationCatalog = {
onlyTelegramAdminsUnsetup: 'Только админы Telegram-группы могут запускать /unsetup.',
useUnsetupInGroup: 'Используйте /unsetup внутри группы дома.',
unsetupComplete: (householdName) =>
`Состояние настройки для ${householdName} сброшено. Запустите /setup ещё раз, чтобы заново привязать топики.`,
`Состояние настройки для ${householdName} сброшено. Запустите /setup ещё раз, чтобы заново настроить топики.`,
unsetupNoop: 'Для этой группы пока нечего сбрасывать. Когда будете готовы, запустите /setup.',
useBindChatTopicInGroup: 'Используйте /bind_chat_topic внутри топика группы дома.',
chatTopicSaved: (householdName, threadId) =>
`Топик для разговоров сохранён для ${householdName} (тред ${threadId}).`,
useBindPurchaseTopicInGroup: 'Используйте /bind_purchase_topic внутри топика группы дома.',
purchaseTopicSaved: (householdName, threadId) =>
`Топик покупок сохранён для ${householdName} (тред ${threadId}).`,
useBindFeedbackTopicInGroup: 'Используйте /bind_feedback_topic внутри топика группы дома.',
feedbackTopicSaved: (householdName, threadId) =>
`Топик обратной связи сохранён для ${householdName} (тред ${threadId}).`,
useBindRemindersTopicInGroup: 'Используйте /bind_reminders_topic внутри топика группы дома.',
remindersTopicSaved: (householdName, threadId) =>
`Топик напоминаний сохранён для ${householdName} (тред ${threadId}).`,
useBindPaymentsTopicInGroup: 'Используйте /bind_payments_topic внутри топика группы дома.',
paymentsTopicSaved: (householdName, threadId) =>
`Топик оплат сохранён для ${householdName} (тред ${threadId}).`,
usePendingMembersInGroup: 'Используйте /pending_members внутри группы дома.',
useApproveMemberInGroup: 'Используйте /approve_member внутри группы дома.',
approveMemberUsage: 'Использование: /approve_member <telegram_user_id>',
@@ -132,12 +119,7 @@ export const ruBotTranslations: BotTranslationCatalog = {
useJoinLinkInGroup: 'Используйте /join_link внутри группы дома.',
joinLinkUnavailable: 'Не удалось сгенерировать ссылку для вступления.',
joinLinkReady: (link, householdName) =>
`Поделитесь этой ссылкой, чтобы пригласить участников в ${householdName}:\n\n${link}\n\nЛюбой, у кого есть эта ссылка, может подать заявку на вступление.`,
useBindInTopic: 'Используйте /bind внутри топика, чтобы привязать его к роли.',
topicAlreadyBound: (role) => `Этот топик уже привязан как ${role}.`,
bindSelectRole: 'Привязать этот топик как:',
topicBoundSuccess: (role, householdName) => `Привязан как ${role} для ${householdName}.`,
allRolesConfigured: 'Все роли топиков уже настроены.'
`Поделитесь этой ссылкой, чтобы пригласить участников в ${householdName}:\n\n${link}\n\nЛюбой, у кого есть эта ссылка, может подать заявку на вступление.`
},
anonymousFeedback: {
title: 'Анонимное сообщение по дому',
@@ -149,7 +131,7 @@ export const ruBotTranslations: BotTranslationCatalog = {
multipleHouseholds:
'Вы состоите в нескольких домах. Откройте нужный дом из его группы, пока выбор дома ещё не добавлен.',
feedbackTopicMissing:
'Для вашего дома ещё не настроен анонимный топик. Попросите админа выполнить /bind_feedback_topic.',
'Для вашего дома ещё не настроен анонимный топик. Попросите админа выполнить /setup и создать топик для обратной связи.',
duplicate: 'Это анонимное сообщение уже было обработано.',
delivered: 'Анонимное сообщение отправлено.',
savedButPostFailed:
@@ -329,7 +311,7 @@ export const ruBotTranslations: BotTranslationCatalog = {
},
payments: {
topicMissing:
'Для этого дома ещё не настроен топик оплат. Попросите админа выполнить /bind_payments_topic.',
'Для этого дома ещё не настроен топик оплат. Попросите админа выполнить /setup и создать топик для оплат.',
balanceReply: (kind) =>
kind === 'rent' ? 'Текущая сводка по аренде:' : 'Текущая сводка по коммуналке:',
proposal: (kind, amount, currency) =>

View File

@@ -8,11 +8,6 @@ export type TelegramCommandName =
| 'setup'
| 'unsetup'
| 'bind'
| 'bind_chat_topic'
| 'bind_purchase_topic'
| 'bind_feedback_topic'
| 'bind_reminders_topic'
| 'bind_payments_topic'
| 'join_link'
| 'payment_add'
| 'pending_members'
@@ -25,11 +20,6 @@ export interface BotCommandDescriptions {
cancel: string
setup: string
unsetup: string
bind_chat_topic: string
bind_purchase_topic: string
bind_feedback_topic: string
bind_reminders_topic: string
bind_payments_topic: string
bind: string
join_link: string
payment_add: string
@@ -100,16 +90,11 @@ export interface BotTranslationCatalog {
useUnsetupInGroup: string
unsetupComplete: (householdName: string) => string
unsetupNoop: string
useBindChatTopicInGroup: string
chatTopicSaved: (householdName: string, threadId: string) => string
useBindPurchaseTopicInGroup: string
purchaseTopicSaved: (householdName: string, threadId: string) => string
useBindFeedbackTopicInGroup: string
feedbackTopicSaved: (householdName: string, threadId: string) => string
useBindRemindersTopicInGroup: string
remindersTopicSaved: (householdName: string, threadId: string) => string
useBindPaymentsTopicInGroup: string
paymentsTopicSaved: (householdName: string, threadId: string) => string
useBindInTopic: string
topicAlreadyBound: (role: string) => string
bindSelectRole: string
topicBoundSuccess: (role: string, householdName: string) => string
allRolesConfigured: string
usePendingMembersInGroup: string
useApproveMemberInGroup: string
approveMemberUsage: string
@@ -121,11 +106,6 @@ export interface BotTranslationCatalog {
useJoinLinkInGroup: string
joinLinkUnavailable: string
joinLinkReady: (link: string, householdName: string) => string
useBindInTopic: string
topicAlreadyBound: (role: string) => string
bindSelectRole: string
topicBoundSuccess: (role: string, householdName: string) => string
allRolesConfigured: string
}
anonymousFeedback: {
title: string