From f76e2cd683f87c066cc11c1db550e62132742501 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 19 Jan 2017 20:52:53 +0100 Subject: [PATCH] New ryg image generator --- bot.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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():