Closed semklim closed 2 months ago
What I do wrong?
What error do you see?
Btw my guess is that you have to flip the order of the lines
const { message } = await conversation.wait();
await conversation.run(i18n.middleware()); // or await conversation.run(i18n); **doesn't work**
but this is a guess and more info would be very helpful.
Sorry, it was my mistake. I need to be more attentive. Thank you for help. While I was trying to figure out how to explain my problem, I found the error.
greeting.ts
Main mistake, i try to check if plugin is work in wrong place.
import { Context, MyConversation } from "../context.js";
import { i18n } from "../i18n.js";
export async function greeting(conversation: MyConversation, ctx: Context) {
await ctx.reply("Привіт! Як тебе звати?");
const { message } = await conversation.wait();
// await conversation.run(i18n.middleware()); // or await conversation.run(i18n); **doesn't work**
await conversation.run(i18n); // actually work
if (!message) {
await ctx.reply("Привіт! Як тебе звати? " + ctx.t('welcome')); // <-- try to check if plugin is work in wrong place
} else {
return ctx.reply(`Ласкаво просимо до чату, ${message.text}!`);
}
}
Example from doc:
What I do:
greeting.ts
What I do wrong?