localization
This commit is contained in:
@@ -2,6 +2,7 @@ import TelegramBot, { Message, InlineKeyboardMarkup } from 'node-telegram-bot-ap
|
||||
import { ProfileService } from '../services/profileService';
|
||||
import { MatchingService } from '../services/matchingService';
|
||||
import { Profile } from '../models/Profile';
|
||||
import { getUserTranslation } from '../services/localizationService';
|
||||
|
||||
export class CommandHandlers {
|
||||
private bot: TelegramBot;
|
||||
@@ -104,15 +105,18 @@ export class CommandHandlers {
|
||||
const profile = await this.profileService.getProfileByTelegramId(userId);
|
||||
|
||||
if (!profile) {
|
||||
const createProfileText = await getUserTranslation(userId, 'profile.create');
|
||||
const noProfileText = await getUserTranslation(userId, 'profile.noProfile');
|
||||
|
||||
const keyboard: InlineKeyboardMarkup = {
|
||||
inline_keyboard: [
|
||||
[{ text: '🚀 Создать профиль', callback_data: 'create_profile' }]
|
||||
[{ text: createProfileText, callback_data: 'create_profile' }]
|
||||
]
|
||||
};
|
||||
|
||||
await this.bot.sendMessage(
|
||||
msg.chat.id,
|
||||
'❌ У вас пока нет профиля.\nСоздайте его для начала использования бота!',
|
||||
noProfileText,
|
||||
{ reply_markup: keyboard }
|
||||
);
|
||||
return;
|
||||
@@ -129,9 +133,11 @@ export class CommandHandlers {
|
||||
const profile = await this.profileService.getProfileByTelegramId(userId);
|
||||
|
||||
if (!profile) {
|
||||
const createFirstText = await getUserTranslation(userId, 'profile.createFirst');
|
||||
|
||||
await this.bot.sendMessage(
|
||||
msg.chat.id,
|
||||
'❌ Сначала создайте профиль!\nИспользуйте команду /start'
|
||||
createFirstText
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user