Answer the question
In order to leave comments, you need to log in
I do not understand what is wrong | Vk.api timeout=self.wait + 10 | What's wrong?
I'm trying to write the most common bot on vk.api without any functionality, the python gives me a funny error
Traceback (most recent call last):
File "F:\Bruh\Site\Bruh\BotMGL.py", line 23, in <module>
for event in longpoll.listen():
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\vk_api\longpoll.py", line 619, in listen
for event in self.check():
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\vk_api\longpoll.py", line 558, in check
timeout=self.wait + 10
TypeError: can only concatenate str (not "int") to str
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
from vk_api.keyboard import VkKeyboard
from vk_api.keyboard import VkKeyboardColor
token = 'не скажу'
vk_session = vk_api.VkApi(token=token)
longpoll = VkLongPoll(vk_session,'и это тоже')
vk = vk_session.get_api()
keyboard = VkKeyboard()
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW and event.to_me and event.text:
if event.text == 'Начать':
keyboard.add_button(label="Кнопка 1",color=VkKeyboardColor.POSITIVE)
keyboard.add_line()
keyboard.add_button(label="Кнопка 2", color=VkKeyboardColor.PRIMARY)
keyboard.add_button(label="Кнопка 3", color=VkKeyboardColor.SECONDARY)
vk.messages.send(
user_id=event.obj.from_id,
random_id=event.random_id,
message='Выберите то, что вы хотите сделать',
keyboard=keyboard.get_keyboard())
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