Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

316
Views
Cannot cast InputPeerChat to any kind of InputChannel

I have created a bot using Telegraf. I want that when a user sends a message, the bot will send him the previous message. So I want to take the previous post on id with Gram JS but throws this error

enter image description here

here is my code:

   bot.on("message", async (ctx) => {
    const { text, message_id } = ctx.message;
    const userId = ctx.from.id;

    const replyToMessage = await client.invoke(
      new Api.channels.GetMessages({
        channel: `${ctx.chat.id}`,
        id: [message_id - 1],
      })
    );

    console.log(1234, replyToMessage);

    ctx.reply(replyToMessage);
  });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!