remotes/1693045480750635534/spooky-22
Aevann1 2021-10-23 21:40:49 +02:00
parent 4b110ee01d
commit 0ef1765c96
14 changed files with 67 additions and 49 deletions

View File

@ -7,14 +7,17 @@ from .sanitize import *
from .const import *
def send_notification(uid, text):
def send_notification(uid, text, autojanny=False):
text = text.replace('r/', 'r\/').replace('u/', 'u\/')
text_html = CustomRenderer().render(mistletoe.Document(text))
text_html = sanitize(text_html)
new_comment = Comment(author_id=NOTIFICATIONS_ACCOUNT,
if autojanny: author_id = AUTOJANNY_ACCOUNT
else: author_id = NOTIFICATIONS_ACCOUNT
new_comment = Comment(author_id=author_id,
parent_submission=None,
distinguish_level=6,
body=text,

View File

@ -95,7 +95,20 @@ Thank you."""
BASED_MSG = "@{username}'s Based Count has increased by 1. Their Based Count is now {basedcount}.\n\nPills: {pills}"
if SITE == "pcmemes.net":
if SITE == 'rdrama.net':
NOTIFICATIONS_ACCOUNT = 1046
AUTOJANNY_ACCOUNT = 2360
SNAPPY_ACCOUNT = 261
LONGPOSTBOT_ACCOUNT = 1832
ZOZBOT_ACCOUNT = 1833
AUTOPOLLER_ACCOUNT = 6176
TAX_RECEIVER_ID = 747
TAX_RATE = 0.01
PIZZA_SHILL_ID = 2424
CARP_ID = 995
LAWLZ_ID = 3833
LLM_ID = 253
elif SITE == "pcmemes.net":
BASEDBOT_ACCOUNT = 800
NOTIFICATIONS_ACCOUNT = 1046
AUTOJANNY_ACCOUNT = 1050
@ -103,13 +116,11 @@ if SITE == "pcmemes.net":
LONGPOSTBOT_ACCOUNT = 1832
ZOZBOT_ACCOUNT = 1833
AUTOPOLLER_ACCOUNT = 3369
elif SITE == 'rdrama.net':
NOTIFICATIONS_ACCOUNT = 1046
AUTOJANNY_ACCOUNT = 2360
SNAPPY_ACCOUNT = 261
LONGPOSTBOT_ACCOUNT = 1832
ZOZBOT_ACCOUNT = 1833
AUTOPOLLER_ACCOUNT = 6176
TAX_RECEIVER_ID = 1
TAX_RATE = 0
PIZZA_SHILL_ID = 0
CARP_ID = 0
LAWLZ_ID = 0
else:
NOTIFICATIONS_ACCOUNT = 1
AUTOJANNY_ACCOUNT = 2
@ -117,9 +128,11 @@ else:
LONGPOSTBOT_ACCOUNT = 4
ZOZBOT_ACCOUNT = 5
AUTOPOLLER_ACCOUNT = 6
TAX_RECEIVER_ID = 747
TAX_RATE = 0.01
TAX_RECEIVER_ID = 7
TAX_RATE = 0
PIZZA_SHILL_ID = 0
CARP_ID = 0
LAWLZ_ID = 0
PUSHER_INSTANCE_ID = '02ddcc80-b8db-42be-9022-44c546b4dce6'
PUSHER_KEY = environ.get("PUSHER_KEY", "").strip()

View File

@ -9,7 +9,7 @@ BOT_TOKEN = environ.get("DISCORD_BOT_TOKEN",'').strip()
AUTH = environ.get("DISCORD_AUTH",'').strip()
ROLES={
"shrigma": "864612849199480914",
"owner": "864612849199480914",
"admin": "879459632656048180" if environ.get("DOMAIN") == "pcmemes.net" else "846509661288267776",
"linked": "890342909390520382",
"1": "868129042346414132",

View File

@ -31,7 +31,7 @@ def truescore(v):
@limiter.limit("1/second")
@admin_level_required(6)
def revert_actions(v, username):
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,995]) or ('rama' not in request.host and 'pcm' not in request.host):
user = get_user(username)
if not user: abort(404)
@ -117,7 +117,7 @@ def club_ban(v, username):
@limiter.limit("1/second")
@admin_level_required(6)
def make_admin(v, username):
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,995]) or ('rama' not in request.host and 'pcm' not in request.host):
user = get_user(username)
if not user: abort(404)
user.admin_level = 6
@ -130,7 +130,7 @@ def make_admin(v, username):
@limiter.limit("1/second")
@admin_level_required(6)
def remove_admin(v, username):
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,995]) or ('rama' not in request.host and 'pcm' not in request.host):
user = get_user(username)
if not user: abort(404)
user.admin_level = 0
@ -143,7 +143,7 @@ def remove_admin(v, username):
@limiter.limit("1/second")
@admin_level_required(6)
def make_fake_admin(v, username):
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,995]) or ('rama' not in request.host and 'pcm' not in request.host):
user = get_user(username)
if not user: abort(404)
user.admin_level = 1
@ -156,7 +156,7 @@ def make_fake_admin(v, username):
@limiter.limit("1/second")
@admin_level_required(6)
def remove_fake_admin(v, username):
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host):
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,995]) or ('rama' not in request.host and 'pcm' not in request.host):
user = get_user(username)
if not user: abort(404)
user.admin_level = 0
@ -169,7 +169,7 @@ def remove_fake_admin(v, username):
@limiter.limit("1/day")
@admin_level_required(6)
def monthly(v):
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,995]) or ('rama' not in request.host and 'pcm' not in request.host):
if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,995]) or ('rama' not in request.host and 'pcm' not in request.host):
thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id
for u in g.db.query(User).options(lazyload('*')).filter(User.patron > 0).all():
if u.patron == 1: procoins = 2000

View File

@ -376,8 +376,8 @@ def api_comment(v):
n = Notification(comment_id=c_jannied.id, user_id=v.id)
g.db.add(n)
if v.id == 2424:
cratvote = CommentVote(user_id=747, comment_id=c.id, vote_type=1)
if v.id == PIZZA_SHILL_ID:
cratvote = CommentVote(user_id=TAX_RECEIVER_ID, comment_id=c.id, vote_type=1)
g.db.add(cratvote)
v.coins += 1
v.truecoins += 1

View File

@ -116,7 +116,7 @@ def discord_redirect(v):
if x.status_code in [201, 204]:
if v.id == 1:
if v.id in [1,7]:
add_role(v, "shrigma")
time.sleep(0.1)

View File

@ -63,7 +63,7 @@ def publish(pid, v):
for follow in v.followers:
user = get_account(follow.user_id)
send_notification(user.id, f"@{v.username} has made a new post: [{post.title}](http://{site}{post.permalink})")
send_notification(user.id, f"@{v.username} has made a new post: [{post.title}](http://{site}{post.permalink})", True)
g.db.commit()
@ -738,7 +738,7 @@ def submit_post(v):
if not new_post.private:
for follow in v.followers:
user = get_account(follow.user_id)
send_notification(user.id, f"@{v.username} has made a new post: [{title}](http://{site}{new_post.permalink})")
send_notification(user.id, f"@{v.username} has made a new post: [{title}](http://{site}{new_post.permalink})", True)
g.db.add(new_post)
g.db.flush()
@ -819,10 +819,10 @@ def submit_post(v):
g.db.add(new_post)
if "rama" in request.host:
if v.id == 995:
if v.id == CARP_ID:
if random.random() < 0.02: body = "i love you carp"
else: body = "![](https://rdrama.net/assets/images/emojis/fuckoffcarp.webp)"
elif v.id == 3833:
elif v.id == LAWLZ_ID:
if random.random() < 0.5: body = "wow, this lawlzpost sucks!"
else: body = "wow, a good lawlzpost for once!"
else: body = random.choice(snappyquotes)

View File

@ -117,7 +117,6 @@ def get_coins(v, username):
@validate_formkey
def transfer_coins(v, username):
receiver = g.db.query(User).filter_by(username=username).first()
tax_receiver = g.db.query(User).filter_by(id=TAX_RECEIVER_ID).first()
if receiver is None: return {"error": "That user doesn't exist."}, 404
@ -129,22 +128,24 @@ def transfer_coins(v, username):
if v.coins < amount: return {"error": f"You don't have enough {app.config['COINS_NAME']}"}, 400
if amount < 100: return {"error": f"You have to gift at least 100 {app.config['COINS_NAME']}."}, 400
tax = math.ceil(amount*TAX_RATE)
v.coins -= amount
receiver.coins += amount-tax
tax_receiver.coins += tax
g.db.add(receiver)
g.db.add(tax_receiver)
g.db.add(v)
transfer_message = f"🤑 [@{v.username}]({v.url}) has gifted you {amount} {app.config['COINS_NAME']}!"
send_notification(receiver.id, transfer_message)
log_message = f"[@{v.username}]({v.url}) has transferred {amount} {app.config['COINS_NAME']} to [@{receiver.username}]({receiver.url})"
send_notification(TAX_RECEIVER_ID, log_message)
g.db.add(receiver)
g.db.add(v)
if TAX_RATE and TAX_RECEIVER_ID:
tax = math.ceil(amount*TAX_RATE)
tax_receiver = g.db.query(User).filter_by(id=TAX_RECEIVER_ID).first()
tax_receiver.coins += tax
log_message = f"[@{v.username}]({v.url}) has transferred {amount} {app.config['COINS_NAME']} to [@{receiver.username}]({receiver.url})"
send_notification(TAX_RECEIVER_ID, log_message)
g.db.add(tax_receiver)
g.db.commit()
return {"message": f"{amount-tax} {app.config['COINS_NAME']} transferred!"}, 200
return {"message": f"You can't transfer {app.config['COINS_NAME']} to yourself!"}, 400
@ -423,7 +424,7 @@ def u_username(username, v=None):
if u.is_private and (not v or (v.id != u.id and v.admin_level < 3)):
if v and u.id == 253:
if v and u.id == LLM_ID:
if int(time.time()) - v.rent_utc > 600:
if request.headers.get("Authorization"): return {"error": "That userpage is private"}
else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v)
@ -516,7 +517,7 @@ def u_username_comments(username, v=None):
if u.is_private and (not v or (v.id != u.id and v.admin_level < 3)):
if v and u.id == 253:
if v and u.id == LLM_ID:
if int(time.time()) - v.rent_utc > 600:
if request.headers.get("Authorization"): return {"error": "That userpage is private"}
else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v)
@ -634,7 +635,7 @@ def unfollow_user(username, v):
target = get_user(username)
if target.id == 995: abort(403)
if target.id == CARP_ID: abort(403)
follow = g.db.query(Follow).options(lazyload('*')).filter_by(user_id=v.id, target_id=target.id).first()

View File

@ -65,7 +65,7 @@
</form>
<pre></pre>
{% if v.id in [1,995] %}
{% if 'rdrama.net' not in request.host or v.id in [1,995] %}
<div><a class="btn btn-success" href="javascript:void(0)" onclick="post_toast('/admin/monthly')">Grant Monthly Marseybux</a></div>
{% endif %}
{% endblock %}

View File

@ -278,7 +278,7 @@
{% if c.is_blocking %}<i class="fas fa-user-minus text-warning" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{% if v and v.admin_level >= 2 %}You're blocking this user, but you can see this comment because {{'it\'s pinned' if c.is_pinned else 'you\'re an admin'}}.{% else %}Comment author is banned{% endif %}"></i>{% endif %}
{% if c.is_blocked %}<i class="fas fa-user-minus text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="This user is blocking you."></i>{% endif %}
{% if c.author.verified %}<i class="fas fa-badge-check align-middle ml-1" style="color:{% if c.author.id == 541 %}#62ca56{% elif c.author.id in [30,2256] %}#ff0000{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{c.author.verified}}"></i>
{% if c.author.verified %}<i class="fas fa-badge-check align-middle ml-1" style="color:{% if 'rdrama.net' in request.host and c.author.id == 541 %}#62ca56{% elif 'rdrama.net' in request.host and c.author.id in [30,2256] %}#ff0000{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{c.author.verified}}"></i>
{% endif %}
<a class="user-name text-decoration-none" data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="focus" data-content-id="popover-{{c.id}}" href="javascript:void(0)" tabindex="0" style="color:#{{c.author.namecolor}}; font-size:12px; font-weight:bold;"><img loading="lazy" src="{{c.author.profile_url}}" class="profile-pic-25 mr-2"/><span {% if c.author.patron and not c.distinguish_level %}class="patron" style="background-color:#{{c.author.namecolor}};"{% elif c.distinguish_level and 'rama' in request.host %}class="mod"{% endif %}>{{c.author.username}}</span></a>
@ -734,7 +734,7 @@
}
.popover {
max-width: 80%;
max-width: 100%;
box-shadow: 0 1rem 3rem rgba(0, 0, 0, .175);
border-color: #dadada;
}

View File

@ -11,6 +11,7 @@
<img src="/assets/images/shop.gif" width="50%">
<h3 class="mt-4">Stir drama. Earn coins.</h3>
<h5 class="mt-4">Total sales: {{sales}} coins</h3>
<h5 class="mt-4">Dramacoins spent by you: {{v.coins_spent}} coins</h3>
</header>
{% endblock %}

View File

@ -424,7 +424,7 @@
{% if p.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
{% if p.private %}<span class="badge border-warning border-1 text-small-extra">Draft</span>{% endif %}
{% if p.active_flags %}<a class="btn btn-primary" href="javascript:void(0)" style="padding:1px 5px; font-size:10px;" onclick="document.getElementById('flaggers').classList.toggle('d-none')">{{p.active_flags}} Reports</a>{% endif %}
{% if p.author.verified %}<i class="fas fa-badge-check align-middle ml-1" style="color:{% if p.author.id == 541 %}#62ca56{% elif p.author.id in [30,2256] %}#ff0000{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{p.author.verified}}"></i>
{% if p.author.verified %}<i class="fas fa-badge-check align-middle ml-1" style="color:{% if 'rdrama.net' in request.host and p.author.id == 541 %}#62ca56{% elif 'rdrama.net' in request.host and p.author.id in [30,2256] %}#ff0000{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{p.author.verified}}"></i>
{% endif %}
<a class="user-name text-decoration-none" data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="focus" data-content-id="popover-{{p.id}}" href="javascript:void(0)" tabindex="0" style="color: #{{p.author.namecolor}}; font-weight: bold;" class="user-name"><img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-25 mr-2"/><span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.namecolor}};"{% elif p.distinguish_level and 'rama' in request.host %}class="mod"{% endif %}>{{p.author.username}}</span></a>{% if p.author.customtitle %}&nbsp;<bdi style="color: #{{p.author.titlecolor}}">&nbsp;{% if p.author.quadrant %}<img loading="lazy" height="20" src="/assets/images/PCM/quadrants/{{p.author.quadrant}}.gif">{% endif %}{{p.author.customtitle | safe}}</bdi>{% endif %}
<span data-bs-toggle="tooltip" data-bs-placement="bottom" id="timestamp">&nbsp;{{p.age_string}}</span>

View File

@ -192,7 +192,7 @@
{% if p.is_blocked %}<i class="fas fa-user-minus text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="This user is blocking you."></i>{% endif %}
{% if p.private %}<span class="badge border-warning border-1 text-small-extra">Draft</span>{% endif %}
{% if p.active_flags %}<a class="btn btn-primary" href="javascript:void(0)" style="padding:1px 5px; font-size:10px;" onclick="document.getElementById('flaggers-{{p.id}}').classList.toggle('d-none')">{{p.active_flags}} Reports</a>{% endif %}
{% if p.author.verified %}<i class="fas fa-badge-check align-middle ml-1" style="color:{% if p.author.id == 541 %}#62ca56{% elif p.author.id in [30,2256] %}#ff0000{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{p.author.verified}}"></i>
{% if p.author.verified %}<i class="fas fa-badge-check align-middle ml-1" style="color:{% if 'rdrama.net' in request.host and p.author.id == 541 %}#62ca56{% elif 'rdrama.net' in request.host and p.author.id in [30,2256] %}#ff0000{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{p.author.verified}}"></i>
{% endif %}
<a class="user-name text-decoration-none" data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="focus" data-content-id="popover-{{p.id}}" href="javascript:void(0)" tabindex="0" style="color: #{{p.author.namecolor}}; font-weight: bold;"><img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-25 mr-2"><span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.namecolor}};"{% elif p.distinguish_level and 'rama' in request.host %}class="mod"{% endif %}>{{p.author.username}}</span></a>{% if p.author.customtitle %}<bdi style="color: #{{p.author.titlecolor}}">&nbsp;&nbsp;{% if p.author.quadrant %}<img loading="lazy" height="20" src="/assets/images/PCM/quadrants/{{p.author.quadrant}}.gif">{% endif %}{{p.author.customtitle | safe}}</bdi>{% endif %}
<span data-bs-toggle="tooltip" data-bs-placement="bottom" id="timestamp-{{p.id}}">&nbsp;{{p.age_string}}</span>
@ -589,7 +589,7 @@
<style>
.popover {
max-width: 80%;
max-width: 100%;
box-shadow: 0 1rem 3rem rgba(0, 0, 0, .175);
border-color: #dadada;
}

View File

@ -117,7 +117,7 @@
<i class="fad fa-user-tag text-info align-middle ml-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Original Username: @{{u.original_username}}"></i>
</span>
{% endif %}
{% if u.verified %}<span><i class="fas fa-badge-check align-middle ml-1" style="color:{% if u.id == 541 %}#62ca56{% elif u.id in [30,2256] %}#ff0000{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{u.verified}}"></i></span>{% endif %}
{% if u.verified %}<span><i class="fas fa-badge-check align-middle ml-1" style="color:{% if 'rdrama.net' in request.host and u.id == 541 %}#62ca56{% elif 'rdrama.net' in request.host and u.id in [30,2256] %}#ff0000{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{u.verified}}"></i></span>{% endif %}
{% if u.admin_level > 1 or (u.admin_level == 1 and (not v or v.admin_level < 2)) %}
<span>
<i class="fas fa-broom text-admin align-middle ml-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Admin"></i>
@ -209,7 +209,7 @@
{% endif %}
{% endif %}
{% if 'rama' in request.host and v.id in [1,12,28,29,747,995,1480] %}
{% if 'rama' in request.host and v.id in [1,28,995] %}
<a id="admin" class="{% if u.admin_level %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/make_admin','admin','unadmin')">Make admin</a>
<a id="unadmin" class="{% if not u.admin_level %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/remove_admin','admin','unadmin')">Remove admin</a>
@ -404,7 +404,7 @@
<h5 style="color:#ff66ac;">BANNED USER{% if u.ban_reason %}: {{u.ban_reason}}{% endif %}</h5>
{% if u.unban_utc %}<h5 style="color:#ff66ac;">{{u.unban_string}}</h5>{% endif %}
{% endif %}
{% if u.verified %}<span><i class="fas fa-badge-check align-middle ml-1" style="color:{% if u.id == 541 %}#62ca56{% elif u.id in [30,2256] %}#ff0000{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{u.verified}}"></i></span>&nbsp;{% endif %}
{% if u.verified %}<span><i class="fas fa-badge-check align-middle ml-1" style="color:{% if 'rdrama.net' in request.host and u.id == 541 %}#62ca56{% elif 'rdrama.net' in request.host and u.id in [30,2256] %}#ff0000{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{u.verified}}"></i></span>&nbsp;{% endif %}
<a class="text-black"><h1 class="h5 d-inline-block" style="color: #{{u.namecolor}}"><span {% if u.patron %}class="patron" style="background-color:#{{u.namecolor}};"{% endif %}>{{u.username}}</span></h1></a>
{% if u.username != u.original_username %}
<span>
@ -491,7 +491,7 @@
{% endif %}
{% endif %}
{% if 'rama' in request.host and v.id in [1,12,28,29,747,995,1480] %}
{% if 'rama' in request.host and v.id in [1,28,995] %}
<a id="admin2" class="{% if u.admin_level %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/make_admin','admin2','unadmin2')">Make admin</a>
<a id="unadmin2" class="{% if not u.admin_level %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/remove_admin','admin2','unadmin2')">Remove admin</a>