Answer the question
In order to leave comments, you need to log in
Why is 2 keyboard not sent in VK bot?
I make a bot, when I write start 1 the keyboard is quietly displayed with the one time parameter, but in the second, only the text is sent, while the bot does not crash, and the keyboard is not sent
sses_api = vk_se.get_api()
longpoll = VkLongPoll(vk_se)
def sender(id, text, keyboard=None):
post = {'user_id' : id, 'message' : text, 'random_id' : 0}
if keyboard != None:
post["keyboard"] = keyboard.get_keyboard()
else:
post = post
vk_se.method('messages.send', post)
def sender2(id, text, keyboard2=None):
post2 = {'user_id' : id, 'message' : text, 'random_id' : 0}
if keyboard2 != None:
post2["keyboard2"] = keyboard2.get_keyboard()
else:
post2 = post2
vk_se.method('messages.send', post2)
for event in VkLongPoll(vk_se).listen():
if event.type == VkEventType.MESSAGE_NEW and event.to_me:
id = event.user_id
msg = event.text.lower()
if msg == "начать" and "меню":
keyboard = VkKeyboard(one_time = True)
keyboard.add_button("Турниры", VkKeyboardColor.PRIMARY)
keyboard.add_line
keyboard.add_button("Мой конфиг", VkKeyboardColor.POSITIVE)
sender(id, "Здарова, нажимай на кнопочки", keyboard)
if msg == "турниры":
keyboard2 = VkKeyboard(one_time = True, inline = True)
keyboard2.add_button("Список турниров", VkKeyboardColor.SECONDARY)
keyboard2.add_line
keyboard2.add_button("Статистика игроков", VkKeyboardColor.POSITIVE)
keyboard2.add_line
keyboard2.add_button("Меню", VkKeyboardColor.NEGATIVE)
sender2(id, "Скорее регистрируйся на турнир!", keyboard2)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question