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():