2020-10-29 07:57:08 +00:00
|
|
|
import requests
|
2020-10-29 17:15:16 +00:00
|
|
|
from flask import url_for
|
2020-10-29 08:24:55 +00:00
|
|
|
from random import choice
|
2020-10-29 07:57:08 +00:00
|
|
|
from suchwow import config
|
2020-10-29 08:24:55 +00:00
|
|
|
from suchwow import wownero
|
2020-10-29 07:57:08 +00:00
|
|
|
|
|
|
|
|
2020-12-04 19:12:09 +00:00
|
|
|
intro = ["Whatup", "What is up", "What the fuck is up", "What in the fuck is up", "Yo", "Sup", "What's the haps"]
|
|
|
|
insults = ["fart sacks", "dick lips", "shit stains", "chodes", "dipshits", "dick nipples", "turd burglars", "shit birds", "meat sticks", "meat puppets", "turkey necks", "dick nibblers", "shit lips"]
|
2020-10-29 07:57:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
def post_discord_webhook(post):
|
2020-12-14 06:28:23 +00:00
|
|
|
try:
|
|
|
|
wallet = wownero.Wallet()
|
|
|
|
post_wow_address = wallet.get_address(account=post.account_index)
|
2020-12-29 21:33:30 +00:00
|
|
|
content = f"{choice(intro)} {choice(insults)}, new SuchWow post #{post.id} by {post.submitter} is up! {url_for('post.read', id=post.id, _external=True)}"
|
2020-12-14 06:28:23 +00:00
|
|
|
msg = {"content": content}
|
|
|
|
discord_webhook_url = config.DISCORD_URL
|
|
|
|
r = requests.post(discord_webhook_url, data=msg)
|
|
|
|
r.raise_for_status()
|
|
|
|
post.to_discord = True
|
|
|
|
post.save()
|
|
|
|
return True
|
|
|
|
except:
|
|
|
|
return False
|