From cb6cb9cda955d3507cb71a9e146443fb8af53136 Mon Sep 17 00:00:00 2001 From: z411 Date: Fri, 29 Mar 2019 11:06:40 -0300 Subject: Parametrizado hook de Discord. --- cgi/post.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cgi/post.py b/cgi/post.py index 2c14004..4d4c598 100644 --- a/cgi/post.py +++ b/cgi/post.py @@ -1242,19 +1242,19 @@ def discord_hook(post, url): "embeds": [{ "title": post['subject'], "description": cut_home_msg(post['message'], 30), - "url": "https://bienvenidoainternet.org" + url, + "url": "https://bienvenidoainternet.org" + url, # TODO: Parametrizar. "color": 11910504, "timestamp": datetime.datetime.utcfromtimestamp(post['timestamp']).isoformat(), "footer": { "text": board['name'] }, - "thumbnail": { "url": "https://bienvenidoainternet.org/%s/thumb/%s" % (board['dir'], post['thumb']) }, + "thumbnail": { "url": "%s%s/thumb/%s" % (Settings.HOME_URL, board['dir'], post['thumb']) }, "author": { "name": "Nuevo hilo", - "icon_url": "https://bienvenidoainternet.org/0/junk/w/shobon.gif" + "icon_url": "%s0/junk/w/shobon.gif" % Settings.HOME_URL }}] } jsondata = json.dumps(data, separators=(',',':')) opener = urllib2.build_opener() opener.addheaders = [('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0')] - response = opener.open(WEBHOOK_URL, jsondata, 6) + response = opener.open(Settings.DISCORD_HOOK_URL, jsondata, 6) the_page = response.read() -- cgit v1.2.1-18-gbd029