From c61db51d650cf0c16c0512096ebbbbb683c83125 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 19 Jan 2017 20:56:37 +0100 Subject: [PATCH] b --- bot.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/bot.py b/bot.py index 2be360c0..4251946b 100644 --- a/bot.py +++ b/bot.py @@ -472,16 +472,17 @@ def lolfree(): def getrygimage(): # Ricevi il link alla tua immagine del profilo Royal Games. print("@" + username + ": /getrygimage") - if len(cmd[1]) > 2: - telegram.sendmessage("Puoi mettere solo due lettere.") - else: - directory = "/var/www/html/rygimages/{}.png" - infile = b" image/svg+xml %s " % cmd[1] - outfile = open(directory.format(cmd[1]), "wb") - cairosvg.svg2png(bytestring=infile, write_to=outfile) - telegram.sendmessage("[Scarica](http://royal.steffo.me/rygimages/{}.png)" - " la tua immagine del profilo Royal Games!".format(cmd[1]), - sentin, source) + if len(cmd) > 1: + if len(cmd[1]) > 2: + telegram.sendmessage("Puoi mettere solo due lettere.") + else: + directory = "/var/www/html/rygimages/{}.png" + infile = b" image/svg+xml %s " % cmd[1].encode() + outfile = open(directory.format(cmd[1]), "wb") + cairosvg.svg2png(bytestring=infile, write_to=outfile) + telegram.sendmessage("[Scarica](http://royal.steffo.me/rygimages/{}.png)" + " la tua immagine del profilo Royal Games!".format(cmd[1]), + sentin, source) def ciaospaggia():