suchwow/suchwow/discord.py

26 lines
1 KiB
Python
Raw Normal View History

2020-10-29 07:57:08 +00:00
import requests
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
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):
try:
wallet = wownero.Wallet()
post_wow_address = wallet.get_address(account=post.account_index)
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)}"
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