mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 20:24:03 +00:00
feat(bot): refactor /setup and add /bind command
- Simplify /setup message: remove chat ID, use emojis, compact layout - Remove 'Bind' buttons from /setup - Add /bind command for binding existing topics - Remove old binding mode with 10-min timeout - Update i18n translations for en and ru
This commit is contained in:
@@ -14,6 +14,7 @@ export const enBotTranslations: BotTranslationCatalog = {
|
||||
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',
|
||||
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',
|
||||
@@ -54,25 +55,19 @@ export const enBotTranslations: BotTranslationCatalog = {
|
||||
`You are already an active member. Open the mini app to view ${displayName}.`,
|
||||
joinRequestSent: (householdName) =>
|
||||
`Join request sent for ${householdName}. Wait for a household admin to confirm you.`,
|
||||
setupSummary: ({ householdName, telegramChatId, created }) =>
|
||||
[
|
||||
`Household ${created ? 'created' : 'already registered'}: ${householdName}`,
|
||||
`Chat ID: ${telegramChatId}`,
|
||||
'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} topic`,
|
||||
setupTopicBindButton: (role) => `Bind ${role} topic`,
|
||||
setupSummary: ({ householdName, created }) =>
|
||||
`${created ? '✅' : 'ℹ️'} ${householdName} is ${created ? 'ready' : 'already registered'}!`,
|
||||
setupTopicsHeading: (configured, total) => `Topics: ${configured}/${total} configured`,
|
||||
setupTopicBound: (role) => `✅ ${role}`,
|
||||
setupTopicMissing: (role) => `⚪ ${role}`,
|
||||
setupTopicCreateButton: (role) => `+ ${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.`,
|
||||
setupTopicBindPending: '',
|
||||
setupTopicBindCancelled: 'Topic binding mode cleared.',
|
||||
setupTopicBindNotAvailable: 'That topic-binding action is no longer available.',
|
||||
setupTopicBindRoleName: (role) => {
|
||||
@@ -135,7 +130,12 @@ 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.`
|
||||
`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.'
|
||||
},
|
||||
anonymousFeedback: {
|
||||
title: 'Anonymous household note',
|
||||
|
||||
@@ -14,6 +14,7 @@ export const ruBotTranslations: BotTranslationCatalog = {
|
||||
bind_feedback_topic: 'Назначить текущий топик для анонимных сообщений',
|
||||
bind_reminders_topic: 'Назначить текущий топик для напоминаний',
|
||||
bind_payments_topic: 'Назначить текущий топик для оплат',
|
||||
bind: 'Привязать текущий топик к роли дома',
|
||||
join_link: 'Получить ссылку для приглашения новых участников',
|
||||
payment_add: 'Подтвердить оплату аренды или коммуналки',
|
||||
pending_members: 'Показать ожидающие заявки на вступление',
|
||||
@@ -56,25 +57,19 @@ export const ruBotTranslations: BotTranslationCatalog = {
|
||||
`Вы уже активный участник. Откройте мини-приложение, чтобы увидеть профиль ${displayName}.`,
|
||||
joinRequestSent: (householdName) =>
|
||||
`Заявка на вступление в ${householdName} отправлена. Дождитесь подтверждения от админа дома.`,
|
||||
setupSummary: ({ householdName, telegramChatId, created }) =>
|
||||
[
|
||||
`${created ? 'Дом создан' : 'Дом уже подключён'}: ${householdName}`,
|
||||
`ID чата: ${telegramChatId}`,
|
||||
'Используйте кнопки ниже, чтобы завершить настройку топиков. Для уже существующего топика нажмите «Привязать», затем отправьте любое сообщение внутри этого топика.',
|
||||
'Участники должны открыть чат с ботом по кнопке ниже и подтвердить заявку на вступление.'
|
||||
].join('\n'),
|
||||
setupTopicsHeading: 'Настройка топиков:',
|
||||
setupTopicBound: (role, topic) => `- ${role}: привязан к ${topic}`,
|
||||
setupTopicMissing: (role) => `- ${role}: не настроен`,
|
||||
setupTopicCreateButton: (role) => `Создать топик для ${role}`,
|
||||
setupTopicBindButton: (role) => `Привязать топик для ${role}`,
|
||||
setupSummary: ({ householdName, created }) =>
|
||||
`${created ? '✅' : 'ℹ️'} ${householdName} ${created ? 'готов' : 'уже подключён'}!`,
|
||||
setupTopicsHeading: (configured, total) => `Топики: ${configured}/${total} настроено`,
|
||||
setupTopicBound: (role) => `✅ ${role}`,
|
||||
setupTopicMissing: (role) => `⚪ ${role}`,
|
||||
setupTopicCreateButton: (role) => `+ ${role}`,
|
||||
setupTopicBindButton: (role) => `Привязать ${role}`,
|
||||
setupTopicCreateFailed:
|
||||
'Не удалось создать этот топик. Проверьте права бота и включённые форум-топики в группе.',
|
||||
setupTopicCreateForbidden:
|
||||
'Мне нужны права на управление топиками в этой группе, чтобы создать его автоматически.',
|
||||
setupTopicCreated: (role, topicName) => `Топик ${role} создан и привязан: ${topicName}.`,
|
||||
setupTopicBindPending: (role) =>
|
||||
`Режим привязки включён для ${role}. Откройте нужный топик и отправьте там любое сообщение в течение 10 минут.`,
|
||||
setupTopicBindPending: '',
|
||||
setupTopicBindCancelled: 'Режим привязки топика очищен.',
|
||||
setupTopicBindNotAvailable: 'Это действие привязки топика уже недоступно.',
|
||||
setupTopicBindRoleName: (role) => {
|
||||
@@ -137,7 +132,12 @@ export const ruBotTranslations: BotTranslationCatalog = {
|
||||
useJoinLinkInGroup: 'Используйте /join_link внутри группы дома.',
|
||||
joinLinkUnavailable: 'Не удалось сгенерировать ссылку для вступления.',
|
||||
joinLinkReady: (link, householdName) =>
|
||||
`Поделитесь этой ссылкой, чтобы пригласить участников в ${householdName}:\n\n${link}\n\nЛюбой, у кого есть эта ссылка, может подать заявку на вступление.`
|
||||
`Поделитесь этой ссылкой, чтобы пригласить участников в ${householdName}:\n\n${link}\n\nЛюбой, у кого есть эта ссылка, может подать заявку на вступление.`,
|
||||
useBindInTopic: 'Используйте /bind внутри топика, чтобы привязать его к роли.',
|
||||
topicAlreadyBound: (role) => `Этот топик уже привязан как ${role}.`,
|
||||
bindSelectRole: 'Привязать этот топик как:',
|
||||
topicBoundSuccess: (role, householdName) => `Привязан как ${role} для ${householdName}.`,
|
||||
allRolesConfigured: 'Все роли топиков уже настроены.'
|
||||
},
|
||||
anonymousFeedback: {
|
||||
title: 'Анонимное сообщение по дому',
|
||||
|
||||
@@ -7,6 +7,7 @@ export type TelegramCommandName =
|
||||
| 'cancel'
|
||||
| 'setup'
|
||||
| 'unsetup'
|
||||
| 'bind'
|
||||
| 'bind_chat_topic'
|
||||
| 'bind_purchase_topic'
|
||||
| 'bind_feedback_topic'
|
||||
@@ -29,6 +30,7 @@ export interface BotCommandDescriptions {
|
||||
bind_feedback_topic: string
|
||||
bind_reminders_topic: string
|
||||
bind_payments_topic: string
|
||||
bind: string
|
||||
join_link: string
|
||||
payment_add: string
|
||||
pending_members: string
|
||||
@@ -76,20 +78,16 @@ export interface BotTranslationCatalog {
|
||||
joinLinkInvalidOrExpired: string
|
||||
alreadyActiveMember: (displayName: string) => string
|
||||
joinRequestSent: (householdName: string) => string
|
||||
setupSummary: (params: {
|
||||
householdName: string
|
||||
telegramChatId: string
|
||||
created: boolean
|
||||
}) => string
|
||||
setupTopicsHeading: string
|
||||
setupTopicBound: (role: string, topic: string) => string
|
||||
setupSummary: (params: { householdName: string; created: boolean }) => string
|
||||
setupTopicsHeading: (configured: number, total: number) => string
|
||||
setupTopicBound: (role: 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
|
||||
setupTopicBindPending: string
|
||||
setupTopicBindCancelled: string
|
||||
setupTopicBindNotAvailable: string
|
||||
setupTopicBindRoleName: (
|
||||
@@ -123,6 +121,11 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user