P
P
p1ugg2020-07-16 21:57:13
Python
p1ugg, 2020-07-16 21:57:13

Why doesn't the attachment function work?

Here is the actual code:

if msg == 'Рандом фото':
            vk.messages.send(
                chat_id = event.chat_id,
                attachment = "photo585191239_457239077",
                random_id = 0,
            )

In general, when they write "Random photo", the bot does not display anything, it does not display errors, the page is open, the album is open. Works for other teams

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2020-07-17
@moonz

1) To display the response from the api, you need to save and output the response,
like this:

response = vk.messages.send( chat_id = event.chat_id, attachment = "photo585191239_457239077", random_id = 0,)
print(response)

2) random_id must be different, that's why it is random
import random
random_id = random.randrange(1, 10000)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question