Answer the question
In order to leave comments, you need to log in
Is it possible to make a function be called when a button is pressed in VK?
Is it possible to make a function be called when a button is pressed in VK?
keyboard.add_button(label='1', color=VkKeyboardColor.SECONDARY)
Answer the question
In order to leave comments, you need to log in
If I'm not mistaken, then the button in VK cannot call the function, it only sends an SMS with the text that is written in it, this is done to speed up the work
. And the function can already be performed when you read the text of the SMS and compare it with the function
For example: You have in the chat the button with the text TextText, when you press it, the text will be sent to the chat: TestText, then the bot receives the text of the sent SMS and, through the condition, will call the function
def Test():
print("Вы нажали кнопку: TestText")
if body == "TestText":
Test()
#body - переменная где хранится текст считаной из чата смс
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question