diff --git a/apps/bot/locales/ru.ftl b/apps/bot/locales/ru.ftl index ebae537..1c93b98 100644 --- a/apps/bot/locales/ru.ftl +++ b/apps/bot/locales/ru.ftl @@ -45,6 +45,8 @@ commands-list = Откройте приложение кнопкой "Открыть", чтобы отредактировать свой профиль или создать запись support = { -support-contact } +documents = + .description = Документы # Кнопки btn-add-contact = 👤 Добавить контакт @@ -53,6 +55,7 @@ btn-pro = 👑 Pro доступ btn-subscribe = 👑 Приобрести Pro btn-pro-info = ℹ️ Мой Pro доступ btn-open-app = 📱 Открыть приложение +btn-documents = 📋 Документы btn-back = ◀️ Назад @@ -67,6 +70,9 @@ share-contact-agreement = (Пункт 4.5 Политики конфиденциальности) payment-agreement = Совершая оплату, вы соглашаетесь с Публичной офертой +agreement-links = + Публичная оферта + Политика конфиденциальности # Приветственные сообщения diff --git a/apps/bot/src/bot/features/documents.ts b/apps/bot/src/bot/features/documents.ts new file mode 100644 index 0000000..e660ca5 --- /dev/null +++ b/apps/bot/src/bot/features/documents.ts @@ -0,0 +1,12 @@ +import { handleDocuments } from '../handlers/documents'; +import { type Context } from '@/bot/context'; +import { logHandle } from '@/bot/helpers/logging'; +import { Composer } from 'grammy'; + +const composer = new Composer(); + +const feature = composer.chatType('private'); + +feature.command('documents', logHandle('command-documents'), handleDocuments); + +export { composer as documents }; diff --git a/apps/bot/src/bot/features/index.ts b/apps/bot/src/bot/features/index.ts index 8d8908e..b909d3c 100644 --- a/apps/bot/src/bot/features/index.ts +++ b/apps/bot/src/bot/features/index.ts @@ -1,4 +1,5 @@ export * from './add-contact'; +export * from './documents'; export * from './help'; export * from './pro'; export * from './registration'; diff --git a/apps/bot/src/bot/handlers/documents.ts b/apps/bot/src/bot/handlers/documents.ts new file mode 100644 index 0000000..df3f756 --- /dev/null +++ b/apps/bot/src/bot/handlers/documents.ts @@ -0,0 +1,18 @@ +import { type Context } from '@/bot/context'; +import { env } from '@/config/env'; +import { KEYBOARD_REMOVE } from '@/config/keyboards'; + +async function handler(ctx: Context) { + await ctx.reply( + ctx.t('agreement-links', { + offerUrl: env.OFFER_URL, + privacyUrl: env.PRIVACY_URL, + }), + { + ...KEYBOARD_REMOVE, + parse_mode: 'HTML', + }, + ); +} + +export { handler as handleDocuments }; diff --git a/apps/bot/src/bot/handlers/index.ts b/apps/bot/src/bot/handlers/index.ts index 64abb56..ca3db4b 100644 --- a/apps/bot/src/bot/handlers/index.ts +++ b/apps/bot/src/bot/handlers/index.ts @@ -1,4 +1,5 @@ export * from './add-contact'; +export * from './documents'; export * from './pro'; export * from './share-bot'; export * from './subscription'; diff --git a/apps/bot/src/bot/settings/commands.ts b/apps/bot/src/bot/settings/commands.ts index 08a8473..8fd1638 100644 --- a/apps/bot/src/bot/settings/commands.ts +++ b/apps/bot/src/bot/settings/commands.ts @@ -5,7 +5,15 @@ import { type LanguageCode } from '@grammyjs/types'; import { type Api, type Bot, type RawApi } from 'grammy'; export async function setCommands({ api }: Bot>) { - const commands = createCommands(['start', 'addcontact', 'sharebot', 'help', 'subscribe', 'pro']); + const commands = createCommands([ + 'start', + 'addcontact', + 'sharebot', + 'help', + 'subscribe', + 'pro', + 'documents', + ]); for (const command of commands) { addLocalizations(command); diff --git a/apps/bot/src/config/keyboards.ts b/apps/bot/src/config/keyboards.ts index 18bca4d..a1277c7 100644 --- a/apps/bot/src/config/keyboards.ts +++ b/apps/bot/src/config/keyboards.ts @@ -1,6 +1,12 @@ import { env } from './env'; import { type Context } from '@/bot/context'; -import { handleAddContact, handlePro, handleShareBot, handleSubscribe } from '@/bot/handlers'; +import { + handleAddContact, + handleDocuments, + handlePro, + handleShareBot, + handleSubscribe, +} from '@/bot/handlers'; import { Menu } from '@grammyjs/menu'; import { type InlineKeyboardMarkup, @@ -50,6 +56,8 @@ export const mainMenu = new Menu('main-menu', { autoAnswer: true }) .row() .text((ctx) => ctx.t('btn-share-bot'), handleShareBot) .row() + .text((ctx) => ctx.t('btn-documents'), handleDocuments) + .row() .url( (ctx) => ctx.t('btn-open-app'), () => {