From e029fd1172c1f9d1157137095dd26096ec26c3fb Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Sat, 16 Aug 2025 14:24:30 +0300 Subject: [PATCH] localization: add welcome message in English and Russian to enhance user interaction; ensure consistency in error messages --- apps/bot/locales/en.ftl | 5 ++++- apps/bot/locales/ru.ftl | 5 ++++- apps/bot/src/bot/features/index.ts | 1 + apps/bot/src/bot/features/welcome.ts | 13 +++++++++++++ apps/bot/src/bot/index.ts | 1 + 5 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 apps/bot/src/bot/features/welcome.ts diff --git a/apps/bot/locales/en.ftl b/apps/bot/locales/en.ftl index ceec7c4..5bd27d5 100644 --- a/apps/bot/locales/en.ftl +++ b/apps/bot/locales/en.ftl @@ -1,4 +1,7 @@ err_invalid_url = ❌ Invalid URL! Please send a valid TikTok link (e.g., https://vt.tiktok.com/...) err_invalid_download_urls = 🔍 Download links not found. The video might be deleted or unavailable err_generic = ⚠️ Something went wrong. Please try again in a few seconds -err_limit_exceeded = 🚫 Too many requests! Please wait before sending the next link \ No newline at end of file +err_limit_exceeded = 🚫 Too many requests! Please wait before sending the next link + + +msg_welcome = Welcome! I can download TikTok videos and images for you without watermark. Just send me the link (for example: https://vt.tiktok.com/...) \ No newline at end of file diff --git a/apps/bot/locales/ru.ftl b/apps/bot/locales/ru.ftl index dc49dda..ea01378 100644 --- a/apps/bot/locales/ru.ftl +++ b/apps/bot/locales/ru.ftl @@ -1,4 +1,7 @@ err_invalid_url = ❌ Неверная ссылка! Отправьте корректную ссылку TikTok (например: https://vt.tiktok.com/...) err_invalid_download_urls = 🔍 Не удалось найти ссылки для скачивания. Возможно, видео удалено или недоступно err_generic = ⚠️ Что-то пошло не так. Попробуйте еще раз через несколько секунд -err_limit_exceeded = 🚫 Слишком много запросов! Подождите немного перед следующей ссылкой \ No newline at end of file +err_limit_exceeded = 🚫 Слишком много запросов! Подождите немного перед следующей ссылкой + + +msg_welcome = Добро пожаловать! Я могу скачать для вас видео и изображения из TikTok без водяного знака. Для этого просто отправьте мне ссылку (например: https://vt.tiktok.com/...) \ No newline at end of file diff --git a/apps/bot/src/bot/features/index.ts b/apps/bot/src/bot/features/index.ts index c0a3ee9..994439c 100644 --- a/apps/bot/src/bot/features/index.ts +++ b/apps/bot/src/bot/features/index.ts @@ -1 +1,2 @@ export * from './download'; +export * from './welcome'; diff --git a/apps/bot/src/bot/features/welcome.ts b/apps/bot/src/bot/features/welcome.ts new file mode 100644 index 0000000..3f71b4f --- /dev/null +++ b/apps/bot/src/bot/features/welcome.ts @@ -0,0 +1,13 @@ +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('start', logHandle('command-start'), (ctx) => { + return ctx.reply(ctx.t('msg_welcome')); +}); + +export { composer as welcome }; diff --git a/apps/bot/src/bot/index.ts b/apps/bot/src/bot/index.ts index 23ea9fc..2e18b4e 100644 --- a/apps/bot/src/bot/index.ts +++ b/apps/bot/src/bot/index.ts @@ -53,6 +53,7 @@ export function createBot({ apiRoot, token }: Parameters_) { protectedBot.use(autoChatAction(bot.api)); protectedBot.use(hydrate()); + protectedBot.use(features.welcome); protectedBot.use(features.download); return bot;