E
E
EboLiK2021-11-18 20:20:17
Python
EboLiK, 2021-11-18 20:20:17

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

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

Invalid photo link. Who owns the photo? Group or user?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question