Answer the question
In order to leave comments, you need to log in
One of the parameters specified was missing or invalid: message is empty or invalid?
I wrote a bot for VK, but when I want to send a photo, I get the error "One of the parameters specified was missing or invalid: message is empty or invalid". Even on the decommissioned code issues.
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
vk_session = vk_api.VkApi(token = "Сам токен")
vk = vk_session.get_api()
longpoll = VkLongPoll(vk_session)
def sender(id, text):
vk.messages.send(user_id = id, message = text, random_id = 0)
def send_photo(id, url):
vk.messages.send(user_id = id, attachment = url, random_id = 0)
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW:
if event.to_me:
msg = event.text.lower()
id = event.user_id
if msg == "7":
send_photo(id, "photo593753031_457248180")
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