fds
This commit is contained in:
parent
ba0aa55665
commit
a1156f9ea4
2 changed files with 21 additions and 11 deletions
|
@ -57,4 +57,10 @@ def send_discord_message(message):
|
||||||
headers = {"Authorization": f"Bot {BOT_TOKEN}"}
|
headers = {"Authorization": f"Bot {BOT_TOKEN}"}
|
||||||
data={"content": message}
|
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/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)
|
|
@ -5,7 +5,7 @@ from files.helpers.wrappers import *
|
||||||
from files.helpers.sanitize import *
|
from files.helpers.sanitize import *
|
||||||
from files.helpers.filters import *
|
from files.helpers.filters import *
|
||||||
from files.helpers.alerts 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.const import *
|
||||||
from files.helpers.slots import *
|
from files.helpers.slots import *
|
||||||
from files.classes import *
|
from files.classes import *
|
||||||
|
@ -88,16 +88,17 @@ def publish(pid, v):
|
||||||
if post.club and not user.paid_dues: continue
|
if post.club and not user.paid_dues: continue
|
||||||
add_notif(cid, user.id)
|
add_notif(cid, user.id)
|
||||||
|
|
||||||
|
g.db.commit()
|
||||||
|
|
||||||
cache.delete_memoized(frontlist)
|
cache.delete_memoized(frontlist)
|
||||||
cache.delete_memoized(User.userpagelisting)
|
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)
|
send_discord_message(post.permalink)
|
||||||
cache.delete_memoized(changeloglist)
|
cache.delete_memoized(changeloglist)
|
||||||
|
|
||||||
g.db.commit()
|
|
||||||
|
|
||||||
return redirect(post.permalink)
|
return redirect(post.permalink)
|
||||||
|
|
||||||
@app.get("/submit")
|
@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()
|
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)
|
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:
|
if v.id == PIZZASHILL_ID:
|
||||||
for uid in PIZZA_VOTERS:
|
for uid in PIZZA_VOTERS:
|
||||||
autovote = Vote(user_id=uid, submission_id=post.id, vote_type=1)
|
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()
|
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
|
if request.headers.get("Authorization"): return post.json
|
||||||
else:
|
else:
|
||||||
post.voted = 1
|
post.voted = 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue