public static void VkSendImageMessage(string accessToken, RMessagesData.RCmdsListCollect.RCommandsItem rCommandItem) { try { int peerId = rCommandItem.PeerId; ThreadCore.UploadingPhotos = true; var url = SiteUtils.GetMessageAttachmentUrl(accessToken); var attachment = SiteUtils.GetImageByQuery(accessToken, rCommandItem); if (attachment == null) { string message = $"Изображение по запросу {rCommandItem.Message} не найдено!"; SiteUtils.SendMessage(accessToken, rCommandItem, message); LogCore.Log(message, JsonConvert.SerializeObject(rCommandItem), EnumData.LogTypeCommand.CMessage, EnumData.LogSourceCommand.VK); return; } if (attachment.Size() == new Size(0, 0)) { LogCore.Log("Смена ключей Google", JsonConvert.SerializeObject(rCommandItem), EnumData.LogTypeCommand.CMessage, EnumData.LogSourceCommand.VK); return; } SiteUtils.MessagesSetActivity(accessToken, peerId); var photos = SiteUtils.UploadPhotoToServerAsync(url, attachment); var photoId = SiteUtils.SaveMessagePhoto(accessToken, photos); //SiteUtils.MessagesSetActivity(accessToken, peerId); SiteUtils.SendMessage(accessToken, rCommandItem, "", $"photo{photoId}"); ThreadCore.UploadingPhotos = false; LogCore.Log(rCommandItem.Message, JsonConvert.SerializeObject(rCommandItem), EnumData.LogTypeCommand.CMessage, EnumData.LogSourceCommand.VK); } catch (Exception ex) { ex.Error(); } }