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

222
Views
edit message sent in last step in wizard | telegraf-js

How can I edit the message sent in the getMessage function at sendToAdmin function?

  • telegraf-js v4.4.1
  • typescript
async function getMessage(ctx: Context) {
  // message
  await ctx.editMessageText("text");

  return (<any>ctx).wizard.next();
}

async function sendToAdmin(ctx: Context) {
    
  // edit here

  return (<any>ctx).wizard.leave();
}

const superWizard = new Scenes.WizardScene(
  getMessage,
  sendToAdmin
);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can use Context.wizard.state


const bot = new Telegraf(process.env.TOKEN);

async function getMessage(ctx: Context) {

  // message have message id
  const message = await ctx.editMessageText("text");

  // send message id to wizard
  // for use in next step
  (<any>ctx).wizard.state.message = { message: message.message_id };

  return (<any>ctx).wizard.next();
}

async function sendToAdmin(ctx: Context) {
    
  // use here
  const lastMessageID = (<any>ctx).wizard.state.message.message;

  // edit last message
  bit.telegram.editMessageText(ctx.from.id, lastMessageID, "EDIT_TEXT")

  return (<any>ctx).wizard.leave();
}
about 4 years ago · Juan Pablo Isaza Report
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!