feat(bot): implement conversation flow for start command

add conversation handler for start command with name input and welcome message
update locales for new conversation flow
add @grammyjs/conversations dependency
This commit is contained in:
Yuu Ottosoka
2025-07-12 17:15:32 +03:00
parent df8bfa049f
commit 0ceba57012
10 changed files with 57 additions and 4 deletions

View File

@@ -0,0 +1,23 @@
import { Conversation, createConversation } from '@grammyjs/conversations';
import { BotContext } from '../types';
import { ConversationSlug } from './consts';
async function enterConversation(conversation: Conversation, ctx: BotContext) {
const askNameText = await conversation.external((ctx: BotContext) =>
ctx.t('start-ask-name')
);
await ctx.reply(askNameText);
const { message } = await conversation.waitFor('message:text');
const welcomeText = await conversation.external((ctx: BotContext) =>
ctx.t('start-welcome', { user: message.text })
);
await ctx.reply(welcomeText);
}
export const startConversation = createConversation(
enterConversation,
ConversationSlug.START
);