K
K
kakakumba2021-11-23 20:30:12
Python
kakakumba, 2021-11-23 20:30:12

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


Sopstna the code itself, I can not understand at all what the problem is.
Although I don’t think at all that this is somehow related to the code, because a couple of days ago everything was fine, but now the problem just appeared out of nowhere.

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())


UPD: Most likely, the matter is in the code itself and you just need to optimize the code, as I understand it.
I'm sure I'm not the only one so "very smart" and the question, as it were, will always be relevant

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-11-23
@SoreMix

The problem is "this too" longpoll = VkLongPoll(vk_session,'и это тоже'). There should be a delay time of type int, but what you have there is not clear

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question