Enhance Russian localization and add document handling features

- Updated the Russian localization file to include new entries for privacy policy and public offer documents, improving user access to important information.
- Added 'documents' command to the bot's command list, allowing users to easily access document-related features.
- Integrated document handling in the main menu and handlers, enhancing user experience and navigation within the bot.
This commit is contained in:
vchikalkin 2025-10-07 19:12:28 +03:00
parent 8eb2ed8ad7
commit 6d0711c471
7 changed files with 56 additions and 2 deletions

View File

@ -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 <a href='{ $privacyUrl }'>Политики конфиденциальности</a>)</i>
payment-agreement =
Совершая оплату, вы соглашаетесь с <a href='{ $offerUrl }'>Публичной офертой</a>
agreement-links =
<a href='{ $offerUrl }'>Публичная оферта</a>
<a href='{ $privacyUrl }'>Политика конфиденциальности</a>
# Приветственные сообщения

View File

@ -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<Context>();
const feature = composer.chatType('private');
feature.command('documents', logHandle('command-documents'), handleDocuments);
export { composer as documents };

View File

@ -1,4 +1,5 @@
export * from './add-contact';
export * from './documents';
export * from './help';
export * from './pro';
export * from './registration';

View File

@ -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 };

View File

@ -1,4 +1,5 @@
export * from './add-contact';
export * from './documents';
export * from './pro';
export * from './share-bot';
export * from './subscription';

View File

@ -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<Context, Api<RawApi>>) {
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);

View File

@ -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<Context>('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'),
() => {