Answer the question
In order to leave comments, you need to log in
Why doesn't the bot respond to buttons in a Python conversation?
Hello everyone, help. My bot does not respond to buttons only in conversations, everything is ok in PM. Here is below code
keyboard = VkKeyboard(one_time=False, inline=True)
keyboard.add_button('/reg', color=VkKeyboardColor.NEGATIVE)
keyboard.add_button('мда', color=VkKeyboardColor.POSITIVE)
if responce == "клава":
vk.messages.send(peer_id=id,random_id=0,message="panos",keyboard=keyboard.get_keyboard())
Answer the question
In order to leave comments, you need to log in
Good day, I had the same problem, I found the solution like this:
msg = event.text
msg = msg.replace('[club<b>id группы</b>|@<b>домен группы</b>] ', '')
msg = msg.replace('[club<b>id группы</b>|<b>название группы</b>] ', '')
keyboard.add_button('text', color=VkKeyboardColor.DEFAULT)
vk.messages.send(
peer_id=event.peer_id,
random_id=get_random_id(),
keyboard=keyboard.get_keyboard(),
message='text2'
)
from vk_api.utils import get_random_id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question