mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 15:54:03 +00:00
fix(bot): avoid invalid group join button
This commit is contained in:
@@ -52,7 +52,6 @@ export function registerHouseholdSetupCommands(options: {
|
||||
bot: Bot
|
||||
householdSetupService: HouseholdSetupService
|
||||
householdOnboardingService: HouseholdOnboardingService
|
||||
miniAppBaseUrl?: string
|
||||
logger?: Logger
|
||||
}): void {
|
||||
options.bot.command('start', async (ctx) => {
|
||||
@@ -161,43 +160,22 @@ export function registerHouseholdSetupCommands(options: {
|
||||
const joinDeepLink = ctx.me.username
|
||||
? `https://t.me/${ctx.me.username}?start=join_${encodeURIComponent(joinToken.token)}`
|
||||
: 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(
|
||||
[
|
||||
`Household ${action}: ${result.household.householdName}`,
|
||||
`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.',
|
||||
'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'),
|
||||
joinMiniAppUrl || joinDeepLink
|
||||
joinDeepLink
|
||||
? {
|
||||
reply_markup: {
|
||||
inline_keyboard: [
|
||||
[
|
||||
...(joinMiniAppUrl
|
||||
? [
|
||||
{
|
||||
text: 'Join household',
|
||||
web_app: {
|
||||
url: joinMiniAppUrl
|
||||
}
|
||||
}
|
||||
]
|
||||
: []),
|
||||
...(joinDeepLink
|
||||
? [
|
||||
{
|
||||
text: 'Open bot chat',
|
||||
text: 'Join household',
|
||||
url: joinDeepLink
|
||||
}
|
||||
]
|
||||
|
||||
@@ -130,11 +130,6 @@ if (householdConfigurationRepositoryClient) {
|
||||
householdConfigurationRepositoryClient.repository
|
||||
),
|
||||
householdOnboardingService: householdOnboardingService!,
|
||||
...(runtime.miniAppAllowedOrigins[0]
|
||||
? {
|
||||
miniAppBaseUrl: runtime.miniAppAllowedOrigins[0]
|
||||
}
|
||||
: {}),
|
||||
logger: getLogger('household-setup')
|
||||
})
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user