diff --git a/bot.py b/bot.py index 300c7275..2be360c0 100644 --- a/bot.py +++ b/bot.py @@ -11,6 +11,7 @@ import discord import subprocess import sm.steammatch as steammatch import db +import cairosvg # Elenco di username dei membri della RYG royalgames = json.loads(filemanager.readfile("db.json")) @@ -471,9 +472,16 @@ def lolfree(): def getrygimage(): # Ricevi il link alla tua immagine del profilo Royal Games. print("@" + username + ": /getrygimage") - telegram.sendmessage("[Scarica](https://dl.dropboxusercontent.com/u/23313381/Logo/Personali/{tag}.png)" - " la tua immagine del profilo Royal Games!".format(tag=royalgames[username.lower()]['icon']), - sentin, source) + 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) def ciaospaggia():