Files
tg-bot-template/apps/bot/src/conversations/start.conversation.ts
Yuu Ottosoka 0ceba57012 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
2025-07-12 17:15:32 +03:00

24 lines
710 B
TypeScript

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
);