localization: update error message keys in English and Russian for consistency; adjust bot response logic to use new keys

This commit is contained in:
vchikalkin 2025-08-16 14:02:45 +03:00
parent f92616ce11
commit 162f4d0f85
4 changed files with 12 additions and 12 deletions

View File

@ -1,4 +1,4 @@
invalid_url = ❌ Invalid URL! Please send a valid TikTok link (e.g., https://vt.tiktok.com/...) err_invalid_url = ❌ Invalid URL! Please send a valid TikTok link (e.g., https://vt.tiktok.com/...)
invalid_download_urls = 🔍 Download links not found. The video might be deleted or unavailable err_invalid_download_urls = 🔍 Download links not found. The video might be deleted or unavailable
generic = ⚠️ Something went wrong. Please try again in a few seconds err_generic = ⚠️ Something went wrong. Please try again in a few seconds
limit_exceeded = 🚫 Too many requests! Please wait before sending the next link err_limit_exceeded = 🚫 Too many requests! Please wait before sending the next link

View File

@ -1,4 +1,4 @@
invalid_url = ❌ Неверная ссылка! Отправьте корректную ссылку TikTok (например: https://vt.tiktok.com/...) err_invalid_url = ❌ Неверная ссылка! Отправьте корректную ссылку TikTok (например: https://vt.tiktok.com/...)
invalid_download_urls = 🔍 Не удалось найти ссылки для скачивания. Возможно, видео удалено или недоступно err_invalid_download_urls = 🔍 Не удалось найти ссылки для скачивания. Возможно, видео удалено или недоступно
generic = ⚠️ Что-то пошло не так. Попробуйте еще раз через несколько секунд err_generic = ⚠️ Что-то пошло не так. Попробуйте еще раз через несколько секунд
limit_exceeded = 🚫 Слишком много запросов! Подождите немного перед следующей ссылкой err_limit_exceeded = 🚫 Слишком много запросов! Подождите немного перед следующей ссылкой

View File

@ -17,7 +17,7 @@ feature.on('message:text', logHandle('download-message'), async (context) => {
const url = context.message.text.trim(); const url = context.message.text.trim();
if (!validateTikTokUrl(url)) { if (!validateTikTokUrl(url)) {
return context.reply(context.t('invalid_url')); return context.reply(context.t('err_invalid_url'));
} }
const cachedFileId = await redis.get(url); const cachedFileId = await redis.get(url);
@ -34,7 +34,7 @@ feature.on('message:text', logHandle('download-message'), async (context) => {
const imagesUrls = result?.images; const imagesUrls = result?.images;
if (!videoUrl && !imagesUrls?.length) { if (!videoUrl && !imagesUrls?.length) {
return context.reply(context.t('invalid_download_urls')); return context.reply(context.t('err_invalid_download_urls'));
} }
if (result?.type === 'video' && videoUrl) { if (result?.type === 'video' && videoUrl) {
@ -50,7 +50,7 @@ feature.on('message:text', logHandle('download-message'), async (context) => {
} }
} catch (error) { } catch (error) {
context.logger.error(error); context.logger.error(error);
return context.reply(context.t('generic')); return context.reply(context.t('err_generic'));
} }
}); });

View File

@ -34,7 +34,7 @@ export function createBot({ apiRoot, token }: Parameters_) {
}, },
limit: 1, limit: 1,
onLimitExceeded: async (ctx) => { onLimitExceeded: async (ctx) => {
await ctx.reply(ctx.t('limit_exceeded')); await ctx.reply(ctx.t('err_limit_exceeded'));
}, },
storageClient: redis, storageClient: redis,
timeFrame: env.RATE_LIMIT, timeFrame: env.RATE_LIMIT,