Browse Source

Prettier printing

main
Unbewohnte 3 years ago
parent
commit
a8e100971a
  1. 16
      vkImageSender/VkImageSender.py

16
vkImageSender/VkImageSender.py

@ -1,4 +1,4 @@
import vk_api,os,random
import vk_api,os,random, datetime
from vk_api import VkUpload
from time import sleep
@ -32,18 +32,28 @@ def sendImages(img_dir = ".", ID = 0, IS_GROUP_CHAT = False, TOKEN = ""):
upload_img = upload.photo_messages(photos = path_to_image)[0]
# each message will contain "Counter : {number_of_}"
MESSAGE = "Counter : {}".format(counter)
MESSAGE = "Counter : ┃{}┃ The next appr. at ~ ┃{}".format(counter,
datetime.datetime.now() + datetime.timedelta(seconds=4))
# sending
print("{}: Sending {}...".format(counter,filename))
print("{}: Sending {}...".format(counter,filename))
if IS_GROUP_CHAT == False:
try:
vk.messages.send(user_id = ID ,message=MESSAGE,
attachment = 'photo{}_{}'.format(upload_img['owner_id'],upload_img['id']),
random_id = 0)
except Exception as e:
print(e)
break
elif IS_GROUP_CHAT == True:
try:
vk.messages.send(chat_id = ID, message=MESSAGE,
attachment='photo{}_{}'.format(upload_img['owner_id'],upload_img['id']),
random_id = 0)
except Exception as e:
print(e)
break
counter += 1
# giving a bit of a rest to VK

Loading…
Cancel
Save