fix(bot): avoid invalid group join button

This commit is contained in:
2026-03-09 04:31:41 +04:00
parent 8109163067
commit 69c6f765a6
2 changed files with 3 additions and 30 deletions

View File

@@ -52,7 +52,6 @@ export function registerHouseholdSetupCommands(options: {
bot: Bot bot: Bot
householdSetupService: HouseholdSetupService householdSetupService: HouseholdSetupService
householdOnboardingService: HouseholdOnboardingService householdOnboardingService: HouseholdOnboardingService
miniAppBaseUrl?: string
logger?: Logger logger?: Logger
}): void { }): void {
options.bot.command('start', async (ctx) => { options.bot.command('start', async (ctx) => {
@@ -161,43 +160,22 @@ export function registerHouseholdSetupCommands(options: {
const joinDeepLink = ctx.me.username const joinDeepLink = ctx.me.username
? `https://t.me/${ctx.me.username}?start=join_${encodeURIComponent(joinToken.token)}` ? `https://t.me/${ctx.me.username}?start=join_${encodeURIComponent(joinToken.token)}`
: null : null
const joinMiniAppUrl = options.miniAppBaseUrl
? (() => {
const url = new URL(options.miniAppBaseUrl)
url.searchParams.set('join', joinToken.token)
if (ctx.me.username) {
url.searchParams.set('bot', ctx.me.username)
}
return url.toString()
})()
: null
await ctx.reply( await ctx.reply(
[ [
`Household ${action}: ${result.household.householdName}`, `Household ${action}: ${result.household.householdName}`,
`Chat ID: ${result.household.telegramChatId}`, `Chat ID: ${result.household.telegramChatId}`,
'Next: open the purchase topic and run /bind_purchase_topic, then open the feedback topic and run /bind_feedback_topic.', 'Next: open the purchase topic and run /bind_purchase_topic, then open the feedback topic and run /bind_feedback_topic.',
'Members can join from the button below or from the bot link.' 'Members should open the bot chat from the button below and confirm the join request there.'
].join('\n'), ].join('\n'),
joinMiniAppUrl || joinDeepLink joinDeepLink
? { ? {
reply_markup: { reply_markup: {
inline_keyboard: [ inline_keyboard: [
[ [
...(joinMiniAppUrl
? [
{
text: 'Join household',
web_app: {
url: joinMiniAppUrl
}
}
]
: []),
...(joinDeepLink ...(joinDeepLink
? [ ? [
{ {
text: 'Open bot chat', text: 'Join household',
url: joinDeepLink url: joinDeepLink
} }
] ]

View File

@@ -130,11 +130,6 @@ if (householdConfigurationRepositoryClient) {
householdConfigurationRepositoryClient.repository householdConfigurationRepositoryClient.repository
), ),
householdOnboardingService: householdOnboardingService!, householdOnboardingService: householdOnboardingService!,
...(runtime.miniAppAllowedOrigins[0]
? {
miniAppBaseUrl: runtime.miniAppAllowedOrigins[0]
}
: {}),
logger: getLogger('household-setup') logger: getLogger('household-setup')
}) })
} else { } else {