aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cgi/post.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/cgi/post.py b/cgi/post.py
index fed173b..8937054 100644
--- a/cgi/post.py
+++ b/cgi/post.py
@@ -1238,25 +1238,26 @@ def discord_hook(post, url):
board = Settings._.BOARD
- WEBHOOK_URL = "https://discordapp.com/api/webhooks/561189208258248714/srj4woM3d87kRODV2Kn-EXoZcvjQW_NR7tGTepDNlyxWwX6gtKtVCq-rUa0D0jjAGi-4"
+ WEBHOOK_URL = "https://discordapp.com/api/webhooks/428025764974166018/msYu1-R3JRnG-cxrhAu3J7LbIPvzpBlJwbW5PFe5VEQaxVzjros9CXOpjZDahUE42Jgn"
- data = {
+ data = {"content": "",
+ "ts": post['timestamp'],
"embeds": [{
"title": post['subject'],
- "description": "```%s```" % cut_home_msg(post['message'], 30),
- "url": "https://bienvenidoainternet.org" + url,
+ "description": cut_home_msg(post['message'], 30),
+ "url": "https://bienvenidoainternet.org" + url, # TODO: Parametrizar.
"color": 11910504,
"timestamp": datetime.datetime.utcfromtimestamp(post['timestamp']).isoformat(),
- "footer": {"text": "/%s/ - %s" % (board['dir'], board['name'])},
+ "footer": { "text": board['name'] },
"thumbnail": { "url": "%s%s/thumb/%s" % (Settings.HOME_URL, board['dir'], post['thumb']) },
"author": {
"name": "Nuevo hilo",
- "icon_url": "https://bienvenidoainternet.org/favicon.ico"
+ "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'), ('Content-type', 'application/json')]
+ opener.addheaders = [('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0')]
response = opener.open(Settings.DISCORD_HOOK_URL, jsondata, 6)
the_page = response.read()