remotes/1693045480750635534/spooky-22
Aevann1 2022-04-17 16:59:18 +02:00
parent 782c58e8c0
commit 7c18a97d56
2 changed files with 21 additions and 11 deletions

View File

@ -57,4 +57,10 @@ def send_discord_message(message):
headers = {"Authorization": f"Bot {BOT_TOKEN}"}
data={"content": message}
requests.post("https://discordapp.com/api/channels/924485611715452940/messages", headers=headers, data=data, timeout=5)
requests.post("https://discordapp.com/api/channels/924486091795484732/messages", headers=headers, data=data, timeout=5)
requests.post("https://discordapp.com/api/channels/924486091795484732/messages", headers=headers, data=data, timeout=5)
def send_cringetopia_message(message):
headers = {"Authorization": f"Bot {BOT_TOKEN}"}
data={"content": message}
requests.post("https://discordapp.com/api/channels/965264044531527740/messages", headers=headers, data=data, timeout=5)

View File

@ -5,7 +5,7 @@ from files.helpers.wrappers import *
from files.helpers.sanitize import *
from files.helpers.filters import *
from files.helpers.alerts import *
from files.helpers.discord import send_discord_message
from files.helpers.discord import send_discord_message, send_cringetopia_message
from files.helpers.const import *
from files.helpers.slots import *
from files.classes import *
@ -88,16 +88,17 @@ def publish(pid, v):
if post.club and not user.paid_dues: continue
add_notif(cid, user.id)
g.db.commit()
cache.delete_memoized(frontlist)
cache.delete_memoized(User.userpagelisting)
if v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()):
if SITE == 'cringetopia.org':
send_cringetopia_message(post.permalink)
elif v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()):
send_discord_message(post.permalink)
cache.delete_memoized(changeloglist)
g.db.commit()
return redirect(post.permalink)
@app.get("/submit")
@ -1375,12 +1376,6 @@ def submit_post(v, sub=None):
v.post_count = g.db.query(Submission.id).filter_by(author_id=v.id, is_banned=False, deleted_utc=0).count()
g.db.add(v)
cache.delete_memoized(frontlist)
cache.delete_memoized(User.userpagelisting)
if v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()) and not post.private:
send_discord_message(post.permalink)
cache.delete_memoized(changeloglist)
if v.id == PIZZASHILL_ID:
for uid in PIZZA_VOTERS:
autovote = Vote(user_id=uid, submission_id=post.id, vote_type=1)
@ -1393,6 +1388,15 @@ def submit_post(v, sub=None):
g.db.commit()
cache.delete_memoized(frontlist)
cache.delete_memoized(User.userpagelisting)
if SITE == 'cringetopia.org':
send_cringetopia_message(post.permalink)
elif v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()) and not post.private:
send_discord_message(post.permalink)
cache.delete_memoized(changeloglist)
if request.headers.get("Authorization"): return post.json
else:
post.voted = 1