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

246
Views
Couldn`t display callback buttons (Telegraf lib.) using forEach method

My task is to add callback buttons for each element of array which i get from MySql table.

let select = `SELECT Bike_num FROM rent.Bike_Status_num where Last_Station = 1 and B_Status = 'OK';`
  con.query(select, function (err, result) {
    if (err) {
      console.log(err);
      return err;
    } else {
      let replyButtons = [];
      let bikes_free = result;
      ctx.reply('Chose bicycle',
      Markup.inlineKeyboard([
        [Markup.button.callback(`${bikes_free[0].Bike_num}`, `${bikes_free[0].Bike_num}`),
        Markup.button.callback(`${bikes_free[1].Bike_num}`, `${bikes_free[1].Bike_num}`),
        Markup.button.callback(`${bikes_free[2].Bike_num}`, `${bikes_free[2].Bike_num}`),
        Markup.button.callback(`${bikes_free[3].Bike_num}`, `${bikes_free[3].Bike_num}`)],
        [Markup.button.callback(`${bikes_free[4].Bike_num}`, `${bikes_free[4].Bike_num}`),
        Markup.button.callback(`${bikes_free[5].Bike_num}`, `${bikes_free[5].Bike_num}`),
        Markup.button.callback(`${bikes_free[6].Bike_num}`, `${bikes_free[6].Bike_num}`),
        Markup.button.callback(`${bikes_free[7].Bike_num}`, `${bikes_free[7].Bike_num}`)]
      ]))

I don`t know how to display this buttons using forEach method or any other convenient method. Tried 2 ways, but got an errors.

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!