summaryrefslogtreecommitdiffstats
path: root/taulubot.py
diff options
context:
space:
mode:
Diffstat (limited to 'taulubot.py')
-rw-r--r--taulubot.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/taulubot.py b/taulubot.py
index cc52c77..88a6d90 100644
--- a/taulubot.py
+++ b/taulubot.py
@@ -1,4 +1,5 @@
import sys
+import random
import time
from pprint import pprint
import telepot
@@ -11,10 +12,12 @@ import logging
logging.basicConfig(format='%(asctime)s %(message)s')
taulu_im = Image.open("taulu.png")
+golden_im = Image.open("golden.png")
img_size = (640, 640)
START_TIME = calendar.timegm(time.gmtime())
taulu_im.thumbnail(img_size, Image.ANTIALIAS)
+golden_im.thumbnail(img_size, Image.ANTIALIAS)
def run_taulu(chat_id, user_id):
@@ -46,7 +49,13 @@ def run_taulu(chat_id, user_id):
logging.warning("Opening image for editing...")
im = Image.open(filepath)
im.thumbnail(img_size, Image.ANTIALIAS)
- im.paste(taulu_im, (0, 0), taulu_im)
+
+ # every 100th image has golden borders :)
+ if random.randrange(1, 100) == 1:
+ im.paste(golden_im, (0, 0), golden_im)
+ bot.sendMessage(chat_id, "Onneksi olkoon! Kultainen taulu ilmestyy vain kerran tuhannessa vuodessa!")
+ else:
+ im.paste(taulu_im, (0, 0), taulu_im)
logging.warning("Saving image...")
im.save(finalpath)