Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

243
Visualizações
Telegraf.JS i18n - TypeError: Cannot read properties of undefined (reading 't') in WizardScene

Everything works, but in the second stage of the scene, i18n is undefined. i18n is registered, as are the scenes in the bot.

const createPostHere = new Scenes.WizardScene('createPostHere',
    async (ctx) => {
        ctx.wizard.state.post = {}
        await ctx.reply(await ctx.i18n.t('createPost.promptTitle')) << everything works
        ctx.wizard.next()
    },
    async (ctx) => {
        ctx.wizard.state.post.title = ctx.message.text
        await ctx.reply(await ctx.i18n.t('createPost.promptText')) << node crashes
        ctx.wizard.next()
    },

Everything registered

bot.use(stage.middleware());
bot.use(i18n.middleware())

I really don`t know where is the problem

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

async (ctx) => {
   await ctx.replyWithHTML(
       ctx.i18n.t('create-text')
   )

   ctx.scene.state.i18n = ctx.i18n
   ctx.wizard.next()
},

async (ctx) => {
   const { i18n } = ctx.scene.state
   await ctx.replyWithHTML(i18n.t('create-details'))

   await ctx.scene.leave()
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda