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

274
Visualizações
reply from group chat (telegram bot - support) (NODE JS)

help please, I am writing a telegram bot for feedback, at the moment it works in a private chat (i.e. the user writes to the bot - I answer reply the bot via reply and the user receives SMS from the bot), but does not work in the group chat( in a group I can see the user's messages, but I can't reply to the user through reply). it is necessary that any user from the group can reply to the user's message

 const bot = new Telegraf(token, {});

let replyText = {
    'helloAdmin': '...',
    'helloUser': '...',
    'replyWrong': '....'
};
let isAdmin = userId => {
    return userId === admin;
};
let forwardToAdmin = ctx => {
    if (isAdmin(ctx.message.from.id)) {
        ctx.reply(replyText.replyWrong);
    } else {
        ctx.forwardMessage(admin, ctx.from.id, ctx.message.id);
    }
};
bot.start(ctx => {
    ctx.reply(isAdmin(ctx.message.from.id)
        ? replyText.helloAdmin
        : replyText.helloUser);
});

bot.on('message', ctx => {
    if (ctx.message.reply_to_message && ctx.message.reply_to_message.forward_from && isAdmin(ctx.message.from.id)) {
        ctx.telegram.sendCopy(ctx.message.reply_to_message.forward_from.id, ctx.message);
    } else {
        forwardToAdmin(ctx);
    }
});
bot.launch();
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

there is a getChatAdministrators method (https://core.telegram.org/bots/api#getchatadministrators), I guess you can use it to get Admins of the group and check if one of them is replied. In that case forward it back to user

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