S
S
Sergei Gurdjiyan2017-10-25 09:28:38
Database design
Sergei Gurdjiyan, 2017-10-25 09:28:38

How to properly design a database for a Telegram bot?

I am writing a bot for telegram.
There is a user table and a chat table.
The bot sends a message to the chat, namely a list of entries and a link to each + inline "previous" and "next" buttons. Those. kind of pagination.
Accordingly, the task has become to remember and write down the necessary information in the callback of these buttons.
For example /posts_1_9999999, where
/postsis the name of the team,
1is the page number of the displayed posts from the paginator,
9999999is the id of the message.
Only 2 options come to mind:
1. A table with messages that have a callback (id, state, parameters ...)
2. A field in the chat table, in which json will be constantly written and updated, containing all messages that have a callback, and the required settings.
Are there other options for solving this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey S., 2017-10-25
@mrKorg

For example /posts_1_9999999, where
/posts is the command name,
1 is the page number of the displayed posts from the paginator,
9999999 is the message id.

So you yourself answered your own question, write all the information in the button itself =)
that is, something like this:
I think the idea is clear (the maximum seems to be 64 characters)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question