Code Monkey home page Code Monkey logo

Comments (6)

Eleirbag89 avatar Eleirbag89 commented on May 21, 2024 2

Well, there are many ways.
Let's say you have 2 different keyboards, one shows the options A and B and the other one Back and C.
We call the first keyboard ONE and the second TWO.
So when you send the keyboard ONE you write 1 on the database. You send other stuff to the user and finally send the keyboard TWO. Now you write TWO on the database. When the user click Back, check the db, you'll find TWO and you know that the keyboard to show from TWO is ONE.
Pseudo:

if (user_choosed_button() == "Back") {
      $prev_key = take_previuos_keyboard_from_db();
      if ($prev_key == "TWO") {
               sendKeyboardONE();
      }
      if ($prev_key == "THREE") {
               sendKeyboardTWO();
      }
}

It's simple but a little messy if you have a lot of different keyboards to show, but it's a starting point.

from telegrambotphp.

Eleirbag89 avatar Eleirbag89 commented on May 21, 2024

You need someway ti store the state of a chat, like a database.
Everytime you send a new keyboard, you write it down on the db and when you receive a "back button press" check on the db what the current keyboard is and send the previous one (updating the db accordingly).

from telegrambotphp.

moeinrahimi avatar moeinrahimi commented on May 21, 2024

ok thank you for your guidance , just something else : i don't know what part
of the data need to use in database

On May 28 2016, at 11:52 am, Gabriele Grillo <[email protected]>
wrote:

You need someway ti store the state of a chat, like a database.
Everytime you send a new keyboard, you write it down on the db and when you
receive a "back button press" check on the db what the current keyboard is and
send the previous one (updating the db accordingly).


You are receiving this because you authored the thread.
Reply to this email directly, [view it on GitHub](https://github.com/Eleirbag8
9/TelegramBotPHP/issues/14#issuecomment-222294832), or [mute the
thread](https://github.com/notifications/unsubscribe
/ANFGUJhL2yc_xVcPBAnE5582dORjXM2Fks5qF-
06gaJpZM4IpAen).![](https://github.com/notifications/beacon/ANFGUOhdmjU-
Eo2C1GCIx2bamBvwBgh2ks5qF-06gaJpZM4IpAen.gif)

from telegrambotphp.

Amir199 avatar Amir199 commented on May 21, 2024

can you write a source code ? :(
i need it ...

from telegrambotphp.

Eleirbag89 avatar Eleirbag89 commented on May 21, 2024

It's not a function of the Telegram's Bot API, so I'll not write a source code :-)

from telegrambotphp.

dade80vr avatar dade80vr commented on May 21, 2024

Hi @Eleirbag89 .
What do you mean with when you receive a "back button press" ??
Thanks

from telegrambotphp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.