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-10-29 08:40:00 +00:00
intro = [ " Whatup " , " What is up " , " What the fuck is up " , " What in the fuck is up " , " Yo " ]
insults = [ " fart sacks " , " dick lips " , " shit stains " , " chodes " , " dipshits " , " dick nipples " , " turd burglars " , " shit birds " , " meat sticks " , " meat puppets " ]
2020-10-29 07:57:08 +00:00
def post_discord_webhook ( post ) :
wallet = wownero . Wallet ( )
post_wow_address = wallet . get_address ( account = post . account_index )
2020-10-29 17:23:47 +00:00
content = f " { choice ( intro ) } { choice ( insults ) } , new SuchWow post # { post . id } by { post . submitter } is up! Tip WOW to ` { post_wow_address } ` to show support! { url_for ( ' post.uploaded_file ' , filename = post . image_name ) } "
2020-10-29 07:57:08 +00:00
msg = { " content " : content }
discord_webhook_url = config . DISCORD_URL
r = requests . post ( discord_webhook_url , data = msg )
r . raise_for_status ( )
2020-10-29 08:42:41 +00:00
post . to_discord = True
post . save ( )
2020-10-29 08:24:55 +00:00
print ( f " Posted # { post . id } to Discord " )