aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Renard 2019-12-17 13:22:28 -0300
committerLibravatar Renard 2019-12-17 13:24:12 -0300
commitfafe75697d39dc0077259d546da30fb665480ed9 (patch)
treee8bf787cfe72de04bfd0010b8c8d4c553a39f542
parentb370dffd5bc9067c455bd54f71d5822bcca3627c (diff)
downloadweabot-fafe75697d39dc0077259d546da30fb665480ed9.tar.gz
weabot-fafe75697d39dc0077259d546da30fb665480ed9.tar.xz
weabot-fafe75697d39dc0077259d546da30fb665480ed9.zip
Revert "Fix: Discord hook"
This reverts commit 9db17362f4acfaffc46eb2a9821e2de57db53b6b.
-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()