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

426
Visualizações
Telegraf: can't use extra

Simple usage works fine:

const { Telegraf } = require('telegraf');
const bot = new Telegraf(tgBotToken);
bot.telegram.sendMessage(tgChatId, "My message");

But if I want to use HTML in my message, I need to require telegraf/extra

const { Telegraf } = require('telegraf');
const tgExtra = require('telegraf/extra');

But I get an error:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './extra' is not defined by "exports" in C:\MyProject\node_modules\telegraf\package.json

Telegraf was installed via npm install telegraf. Running npm install telegraf/extra leads to trying to install non-existing package.

Is there any trick of installing something extra for... extra?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

If you are using Telegraf V4 . As there changelog says , Extra has been entirely removed in V4 .

Extra is removed entirely, see #1076.
You can now just specify any options directly, without having to create an Extra instance before

over 4 years ago · Santiago Trujillo Relatório

0

In Telegraf V4, the Extra now is inside if the 'telegraf'.

Example:

const { Telegraf, Markup } = require('telegraf');

const bot = new Telegraf(tgBotToken);
bot.on('message', async ctx => {
    ctx.replyWithHTML(tgChatId, "My message", Markup.button.url('Button Name', 'https://you.url'));
})
over 4 years ago · Santiago Trujillo 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