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

334
Visualizações
Using a Telegram Bot, can a user trigger another user session of the bot?

I have a big problem. I'm looking like a day to find a solution.

I created a Telegram Bot with the user sessions.

I need a user from his session to be able to update another user's session.

I have already tried to use a sendMessage from the session of the first user which goes to send a message to the session of the second user. But I can't handle this message because, as I've seen, the bot.on() method only handle the message from the user, not from himself.

Any idea?

UPDATE 1: Ok I think I have to give you more information.

There are 2 users. The 2nd user has a button. With the click of this button I want to run some logic on the session of the first user. At the moment with the click of the button I'm sending a msg in the session of the first user, but I can't trigger any logic.

Here the method inside the command triggered by clicking the button of the 2nd user:

bot.command('leave', async (ctx: MyContext)=>{
  try{
    await ServiceHelper.updateSession(ctx.session.chatId!, "");
    await ctx.api.sendMessage(ctx.session.chatId!, "The user left the conversation 🧐", {reply_markup:{resize_keyboard: true, one_time_keyboard: true, keyboard: MenuChat.chatLeftMenu.build()} });
    ctx.session={
      ...ctx.session,
      chatId: "",
      step: "startMenu"
    }
    await MsgHandlerStart.managerStart(ctx);
  }
  catch(error){
    await ctx.answerCallbackQuery({text: ctx.i18n.t("answer-callback.wrong-command")});      
  }
});
about 4 years ago · Juan Pablo Isaza
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