def send_photo(user_id, attachments, random_id=0):
group.method('messages.send',
{"user_id": user_id ,"attachment": attachments, "random_id": random_id})
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW:
for item in event.object.message["attachments"]:
if item['type'] == 'photo':
id=event.object.user_id
domain=event.object.domain
img=item["photo"]["sizes"][0]["url"]
upload=vk_api.VkUpload(group)
photo=upload.photo_messages("img.jpg")
photo_id=photo[0]["id"]
owner_id=photo[0]["owner_id"]
access_key=photo[0]["access_key"]
sp=f"photo{photo_id}_{owner_id}_{access_key}"
send_photo(id, sp)
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module>
start(fakepyfile,mainpyfile)
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
exec(open(mainpyfile).read(), __main__.__dict__)
File "<string>", line 36, in <module>
File "<string>", line 18, in send_photo
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/vk_api/vk_api.py", line 697, in method
raise error
vk_api.exceptions.ApiError: [100] One of the parameters specified was missing or invalid: you should specify peer_id, user_id, domain, chat_id or user_ids params