Answer the question
In order to leave comments, you need to log in
How to implement a message queue?
When writing a bot, I ran into a problem: I can’t figure out how to implement a message queue. Briefly, after registering the questionnaire, the administrator is sent this very questionnaire and buttons for it "to approve", "reject". In the database, in a separate line, the userid of the user who registered is recorded:
cur.execute(
f'''UPDATE users SET userid = {message.from_user.id} WHERE username = "admin"'''
)
cur.execute(
f'''SELECT userid FROM users WHERE username = "admin"''')
userid = cur.fetchone()[0]
await bot.send_message(userid, "Ваша анкета одобрена!")
Answer the question
In order to leave comments, you need to log in
Store in the database all applications in general, immediately enter them. Just add a "considered" boolean and an "approved" boolean (both false by default). When the admin gets to the consideration of applications, he receives applications where "considered" == false, and after consideration it becomes true, and "approved" will either remain false or become true.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question