From 12e65a8bbc51a1bb2c9eb27ad0153f0d7766f0f0 Mon Sep 17 00:00:00 2001 From: dan63047 Date: Fri, 22 May 2020 23:17:00 +0300 Subject: [PATCH] !midnight little update --- dan63047bot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dan63047bot.py b/dan63047bot.py index c9ea4c3..3389df4 100644 --- a/dan63047bot.py +++ b/dan63047bot.py @@ -144,8 +144,12 @@ class VkBot: B = random.randint(0, 255) random_color_image = Image.new("RGB", (512, 512), (R, G, B)) random_color_image.save("randomcolor.jpg") - what_send = vk_api.upload.VkUpload(vk).photo_messages("randomcolor.jpg", peer_id=self._CHAT_ID) - image = "photo" + str(what_send[0]['owner_id']) + "_" + str(what_send[0]['id']) + try: + what_send = vk_api.upload.VkUpload(vk).photo_messages("randomcolor.jpg", peer_id=self._CHAT_ID) + image = "photo" + str(what_send[0]['owner_id']) + "_" + str(what_send[0]['id']) + except Exception as e: + midnight_output += "Не удалось загрузить картинку с цветом" + log(True, f"Проблема с отправкой картинки цвета: {str(e)}") midnight_output += "Цвет дня в формате HEX: #%02x%02x%02x" % (R, G, B) self.send(midnight_output, image)