MarseyWorld/files/routes/awards.py

682 lines
23 KiB
Python
Raw Normal View History

import string
[DO NOT MERGE] import detanglation (#442) * move Base definition to files.classes.__init__.py * fix ImportError * move userpage listing to users.py * don't import the app from classes * consts: set default values to avoid crashes consts: warn if the secret key is the default config value * card view: sneed (user db schema) * cloudflare: use DEFAULT_CONFIG_VALUE * const: set default values * decouple media.py from __main__ * pass database to avoid imports * import cleanup and import request not in const, but in the requests mega import * move asset_submissions site check to __init__ * asset submissions feature flag * flag * g.is_tor * don't import request where it's not needed * i think this is fine * mail: move to own routes and helper * wrappers * required wrappers move * unfuck wrappers a bit * move snappy quotes and marseys to stateful consts * marsify * :pepodrool: * fix missing import * import cache * ...and settings.py * and static.py * static needs cache * route * lmao all of the jinja shit was in feeds.py amazing * classes should only import what they need from flask * import Response * hdjbjdhbhjf * ... * dfdfdfdf * make get a non-required import * isort imports (mostly) * but actually * configs * reload config on import * fgfgfgfg * config * config * initialize snappy and test * cookie of doom debug * edfjnkf * xikscdfd * debug config * set session cookie domain, i think this fixes the can't login bug * sdfbgnhvfdsghbnjfbdvvfghnn * hrsfxgf * dump the entire config on a request * kyskyskyskyskyskyskyskyskys * duifhdskfjdfd * dfdfdfdfdfdfdfdfdfdfdfdf * dfdfdfdf * imoprt all of the consts beacuse fuck it * 😭 * dfdfdfdfdfdfsdasdf * print the entire session * rffdfdfjkfksj * fgbhffh * not the secret keys * minor bug fixes * be helpful in the warning * gfgfgfg * move warning lower * isort main imports (i hope this doesn't fuck something up) * test * session cookie domain redux * dfdfdfd * try only importing Flask * formkeys fix * y * :pepodrool: * route helper * remove before flight * dfdfdfdfdf * isort classes * isort helpers * move check_for_alts to routehelpers and also sort imports and get rid of unused ones * that previous commit but actkally * readd the cache in a dozen places they were implicitly imported * use g.is_tor instead of request.headers. bla bla bla * upgrade streamers to their own route file * get rid of unused imports in __main__ * fgfgf * don't pull in the entire ORM where we don't need it * features * explicit imports for the get helper * explicit imports for the get helper redux * testing allroutes * remove unused import * decouple flask from classes * syntax fix also remember these have side fx for some reason (why?) * move side effects out of the class * posts * testing on devrama * settings * reloading * settingssdsdsds * streamer features * site settings * testing settings on devrama * import * fix modlog * remove debug stuff * revert commit 67275b21ab6e2f2520819e84d10bfc1c746a15b6 * archiveorg to _archiveorg * skhudkfkjfd * fix cron for PCM * fix bugs that snekky wants me to * Fix call to realbody passing db, standardize kwarg * test * import check_for_alts from the right place * cloudflare * testing on devrama * fix cron i think * shadow properly * tasks * Remove print which will surely be annoying in prod. * v and create new session * use files.classes * make errors import little and fix rare 500 in /allow_nsfw * Revert "use files.classes" This reverts commit 98c10b876cf86ce058b7fb955cf1ec0bfb9996c6. * pass v to media functions rather than using g * fix * dfdfdfdfd * cleanup, py type checking is dumb so don't use it where it causes issues * Fix some merge bugs, add DEFAULT_RATELIMIT to main. * Fix imports on sqlalchemy expressions. * `from random import random` is an error. * Fix replies db param. * errors: fix missing import * fix rare 500: only send to GIFT_NOTIF_ID if it exists, and send them the right text * Fix signup formkey. * fix 2 500s * propagate db to submissions * fix replies * dfdfdfdf * Fix verifiedcolor. * is_manual * can't use getters outside of an app context * don't attempt to do gumroad on sites where it's not enabled * don't attempt to do gumraod on sites's where it's unnecessary * Revert "don't attempt to do gumroad on sites where it's not enabled" This reverts commit 6f8a6331878655492dfaf1907b27f8be513c14d3. * fix 500 * validate media type Co-authored-by: TLSM <duolsm@outlook.com>
2022-11-15 09:19:08 +00:00
from copy import deepcopy
from flask import g, request
from sqlalchemy import func
from files.classes.award import AwardRelationship
from files.classes.userblock import UserBlock
from files.helpers.actions import *
2022-09-19 17:10:52 +00:00
from files.helpers.alerts import *
from files.helpers.config.const import *
from files.helpers.slurs_and_profanities import censor_slurs_profanities
2023-09-28 23:58:09 +00:00
from files.helpers.config.awards import *
[DO NOT MERGE] import detanglation (#442) * move Base definition to files.classes.__init__.py * fix ImportError * move userpage listing to users.py * don't import the app from classes * consts: set default values to avoid crashes consts: warn if the secret key is the default config value * card view: sneed (user db schema) * cloudflare: use DEFAULT_CONFIG_VALUE * const: set default values * decouple media.py from __main__ * pass database to avoid imports * import cleanup and import request not in const, but in the requests mega import * move asset_submissions site check to __init__ * asset submissions feature flag * flag * g.is_tor * don't import request where it's not needed * i think this is fine * mail: move to own routes and helper * wrappers * required wrappers move * unfuck wrappers a bit * move snappy quotes and marseys to stateful consts * marsify * :pepodrool: * fix missing import * import cache * ...and settings.py * and static.py * static needs cache * route * lmao all of the jinja shit was in feeds.py amazing * classes should only import what they need from flask * import Response * hdjbjdhbhjf * ... * dfdfdfdf * make get a non-required import * isort imports (mostly) * but actually * configs * reload config on import * fgfgfgfg * config * config * initialize snappy and test * cookie of doom debug * edfjnkf * xikscdfd * debug config * set session cookie domain, i think this fixes the can't login bug * sdfbgnhvfdsghbnjfbdvvfghnn * hrsfxgf * dump the entire config on a request * kyskyskyskyskyskyskyskyskys * duifhdskfjdfd * dfdfdfdfdfdfdfdfdfdfdfdf * dfdfdfdf * imoprt all of the consts beacuse fuck it * 😭 * dfdfdfdfdfdfsdasdf * print the entire session * rffdfdfjkfksj * fgbhffh * not the secret keys * minor bug fixes * be helpful in the warning * gfgfgfg * move warning lower * isort main imports (i hope this doesn't fuck something up) * test * session cookie domain redux * dfdfdfd * try only importing Flask * formkeys fix * y * :pepodrool: * route helper * remove before flight * dfdfdfdfdf * isort classes * isort helpers * move check_for_alts to routehelpers and also sort imports and get rid of unused ones * that previous commit but actkally * readd the cache in a dozen places they were implicitly imported * use g.is_tor instead of request.headers. bla bla bla * upgrade streamers to their own route file * get rid of unused imports in __main__ * fgfgf * don't pull in the entire ORM where we don't need it * features * explicit imports for the get helper * explicit imports for the get helper redux * testing allroutes * remove unused import * decouple flask from classes * syntax fix also remember these have side fx for some reason (why?) * move side effects out of the class * posts * testing on devrama * settings * reloading * settingssdsdsds * streamer features * site settings * testing settings on devrama * import * fix modlog * remove debug stuff * revert commit 67275b21ab6e2f2520819e84d10bfc1c746a15b6 * archiveorg to _archiveorg * skhudkfkjfd * fix cron for PCM * fix bugs that snekky wants me to * Fix call to realbody passing db, standardize kwarg * test * import check_for_alts from the right place * cloudflare * testing on devrama * fix cron i think * shadow properly * tasks * Remove print which will surely be annoying in prod. * v and create new session * use files.classes * make errors import little and fix rare 500 in /allow_nsfw * Revert "use files.classes" This reverts commit 98c10b876cf86ce058b7fb955cf1ec0bfb9996c6. * pass v to media functions rather than using g * fix * dfdfdfdfd * cleanup, py type checking is dumb so don't use it where it causes issues * Fix some merge bugs, add DEFAULT_RATELIMIT to main. * Fix imports on sqlalchemy expressions. * `from random import random` is an error. * Fix replies db param. * errors: fix missing import * fix rare 500: only send to GIFT_NOTIF_ID if it exists, and send them the right text * Fix signup formkey. * fix 2 500s * propagate db to submissions * fix replies * dfdfdfdf * Fix verifiedcolor. * is_manual * can't use getters outside of an app context * don't attempt to do gumroad on sites where it's not enabled * don't attempt to do gumraod on sites's where it's unnecessary * Revert "don't attempt to do gumroad on sites where it's not enabled" This reverts commit 6f8a6331878655492dfaf1907b27f8be513c14d3. * fix 500 * validate media type Co-authored-by: TLSM <duolsm@outlook.com>
2022-11-15 09:19:08 +00:00
from files.helpers.get import *
2022-09-19 17:10:52 +00:00
from files.helpers.regex import *
from files.helpers.sanitize import *
from files.helpers.useractions import *
[DO NOT MERGE] import detanglation (#442) * move Base definition to files.classes.__init__.py * fix ImportError * move userpage listing to users.py * don't import the app from classes * consts: set default values to avoid crashes consts: warn if the secret key is the default config value * card view: sneed (user db schema) * cloudflare: use DEFAULT_CONFIG_VALUE * const: set default values * decouple media.py from __main__ * pass database to avoid imports * import cleanup and import request not in const, but in the requests mega import * move asset_submissions site check to __init__ * asset submissions feature flag * flag * g.is_tor * don't import request where it's not needed * i think this is fine * mail: move to own routes and helper * wrappers * required wrappers move * unfuck wrappers a bit * move snappy quotes and marseys to stateful consts * marsify * :pepodrool: * fix missing import * import cache * ...and settings.py * and static.py * static needs cache * route * lmao all of the jinja shit was in feeds.py amazing * classes should only import what they need from flask * import Response * hdjbjdhbhjf * ... * dfdfdfdf * make get a non-required import * isort imports (mostly) * but actually * configs * reload config on import * fgfgfgfg * config * config * initialize snappy and test * cookie of doom debug * edfjnkf * xikscdfd * debug config * set session cookie domain, i think this fixes the can't login bug * sdfbgnhvfdsghbnjfbdvvfghnn * hrsfxgf * dump the entire config on a request * kyskyskyskyskyskyskyskyskys * duifhdskfjdfd * dfdfdfdfdfdfdfdfdfdfdfdf * dfdfdfdf * imoprt all of the consts beacuse fuck it * 😭 * dfdfdfdfdfdfsdasdf * print the entire session * rffdfdfjkfksj * fgbhffh * not the secret keys * minor bug fixes * be helpful in the warning * gfgfgfg * move warning lower * isort main imports (i hope this doesn't fuck something up) * test * session cookie domain redux * dfdfdfd * try only importing Flask * formkeys fix * y * :pepodrool: * route helper * remove before flight * dfdfdfdfdf * isort classes * isort helpers * move check_for_alts to routehelpers and also sort imports and get rid of unused ones * that previous commit but actkally * readd the cache in a dozen places they were implicitly imported * use g.is_tor instead of request.headers. bla bla bla * upgrade streamers to their own route file * get rid of unused imports in __main__ * fgfgf * don't pull in the entire ORM where we don't need it * features * explicit imports for the get helper * explicit imports for the get helper redux * testing allroutes * remove unused import * decouple flask from classes * syntax fix also remember these have side fx for some reason (why?) * move side effects out of the class * posts * testing on devrama * settings * reloading * settingssdsdsds * streamer features * site settings * testing settings on devrama * import * fix modlog * remove debug stuff * revert commit 67275b21ab6e2f2520819e84d10bfc1c746a15b6 * archiveorg to _archiveorg * skhudkfkjfd * fix cron for PCM * fix bugs that snekky wants me to * Fix call to realbody passing db, standardize kwarg * test * import check_for_alts from the right place * cloudflare * testing on devrama * fix cron i think * shadow properly * tasks * Remove print which will surely be annoying in prod. * v and create new session * use files.classes * make errors import little and fix rare 500 in /allow_nsfw * Revert "use files.classes" This reverts commit 98c10b876cf86ce058b7fb955cf1ec0bfb9996c6. * pass v to media functions rather than using g * fix * dfdfdfdfd * cleanup, py type checking is dumb so don't use it where it causes issues * Fix some merge bugs, add DEFAULT_RATELIMIT to main. * Fix imports on sqlalchemy expressions. * `from random import random` is an error. * Fix replies db param. * errors: fix missing import * fix rare 500: only send to GIFT_NOTIF_ID if it exists, and send them the right text * Fix signup formkey. * fix 2 500s * propagate db to submissions * fix replies * dfdfdfdf * Fix verifiedcolor. * is_manual * can't use getters outside of an app context * don't attempt to do gumroad on sites where it's not enabled * don't attempt to do gumraod on sites's where it's unnecessary * Revert "don't attempt to do gumroad on sites where it's not enabled" This reverts commit 6f8a6331878655492dfaf1907b27f8be513c14d3. * fix 500 * validate media type Co-authored-by: TLSM <duolsm@outlook.com>
2022-11-15 09:19:08 +00:00
from files.routes.wrappers import *
from files.__main__ import app, cache, limiter
2022-09-19 17:10:52 +00:00
from .front import frontlist
2023-03-10 20:27:36 +00:00
@app.get("/shop")
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
2023-03-10 20:27:36 +00:00
@auth_required
2023-07-30 00:42:06 +00:00
def shop_awards(v):
2023-03-10 20:27:36 +00:00
return redirect('/shop/awards')
@app.get("/shop/awards")
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
2022-11-14 15:11:05 +00:00
@auth_required
2023-07-30 00:42:06 +00:00
def shop(v):
AWARDS = deepcopy(AWARDS_ENABLED)
2022-09-19 17:10:52 +00:00
if v.house:
AWARDS[v.house] = deepcopy(HOUSE_AWARDS[v.house])
for val in AWARDS.values(): val["owned"] = 0
2023-08-05 19:26:42 +00:00
for useraward in g.db.query(AwardRelationship).filter(AwardRelationship.user_id == v.id, AwardRelationship.post_id == None, AwardRelationship.comment_id == None):
2022-09-19 17:10:52 +00:00
if useraward.kind in AWARDS: AWARDS[useraward.kind]["owned"] += 1
for val in AWARDS.values():
val["baseprice"] = int(val["price"])
if val["kind"].endswith('Founder'):
val["baseprice"] = int(val["baseprice"] / 0.75)
2023-09-22 06:53:13 +00:00
val["price"] = int(val["price"] * v.award_discount)
2022-09-19 17:10:52 +00:00
2023-03-16 06:27:58 +00:00
sales = g.db.query(func.sum(User.coins_spent)).scalar()
2022-09-19 17:10:52 +00:00
return render_template("shop.html", awards=list(AWARDS.values()), v=v, sales=sales)
2023-10-11 17:03:42 +00:00
def buy_award(v, kind, AWARDS):
2023-10-10 16:53:46 +00:00
og_price = AWARDS[kind]["price"]
2023-09-22 06:53:13 +00:00
price = int(og_price * v.award_discount)
2022-09-19 17:10:52 +00:00
2023-10-10 16:53:46 +00:00
if kind == "grass":
currency = 'coins'
2023-10-10 16:53:46 +00:00
elif kind == "benefactor":
currency = 'marseybux'
2022-09-19 17:10:52 +00:00
else:
currency = 'combined'
2023-04-25 04:47:36 +00:00
charged = v.charge_account(currency, price)
if not charged[0]:
abort(400, "Not enough coins/marseybux!")
2022-09-19 17:10:52 +00:00
v.coins_spent += charged[1]
if v.coins_spent >= 1000000:
badge_grant(badge_id=73, user=v)
elif v.coins_spent >= 500000:
badge_grant(badge_id=72, user=v)
elif v.coins_spent >= 250000:
badge_grant(badge_id=71, user=v)
elif v.coins_spent >= 100000:
badge_grant(badge_id=70, user=v)
elif v.coins_spent >= 10000:
badge_grant(badge_id=69, user=v)
g.db.add(v)
2022-09-19 17:10:52 +00:00
2023-10-10 16:53:46 +00:00
if kind == "lootbox":
2022-09-19 17:10:52 +00:00
lootbox_items = []
for _ in range(LOOTBOX_ITEM_COUNT): # five items per lootbox
LOOTBOX_CONTENTS = [x["kind"] for x in AWARDS_ENABLED.values() if x["included_in_lootbox"]]
lb_award = random.choice(LOOTBOX_CONTENTS)
lootbox_items.append(AWARDS[lb_award]['title'])
lb_award = AwardRelationship(user_id=v.id, kind=lb_award, price_paid=price // LOOTBOX_ITEM_COUNT)
2023-03-16 06:27:58 +00:00
g.db.add(lb_award)
2022-09-19 17:10:52 +00:00
v.lootboxes_bought += 1
lootbox_msg = "You open your lootbox and receive: " + ', '.join(lootbox_items)
send_repeatable_notification(v.id, lootbox_msg)
2023-01-01 11:36:20 +00:00
2022-09-19 17:10:52 +00:00
if v.lootboxes_bought == 10:
badge_grant(badge_id=76, user=v)
elif v.lootboxes_bought == 50:
badge_grant(badge_id=77, user=v)
elif v.lootboxes_bought == 150:
badge_grant(badge_id=78, user=v)
2022-12-19 16:32:13 +00:00
return {"message": lootbox_msg}
2022-09-19 17:10:52 +00:00
else:
2023-10-10 16:53:46 +00:00
award_object = AwardRelationship(user_id=v.id, kind=kind, price_paid=price)
2023-03-16 06:27:58 +00:00
g.db.add(award_object)
2022-09-19 17:10:52 +00:00
2023-03-16 06:27:58 +00:00
g.db.add(v)
2022-09-19 17:10:52 +00:00
2022-12-13 19:51:07 +00:00
if CARP_ID and v.id != CARP_ID and og_price >= 5000:
2023-10-11 17:18:11 +00:00
award_title = AWARDS[kind]['title']
send_repeatable_notification(CARP_ID, f"@{v.username} has bought a `{award_title}` award!")
2022-09-19 17:10:52 +00:00
2023-10-10 16:53:46 +00:00
return award_object
@app.post("/buy/<kind>")
@limiter.limit('1/second', scope=rpath)
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
@limiter.limit("100/minute;200/hour;1000/day", deduct_when=lambda response: response.status_code < 400)
@limiter.limit("100/minute;200/hour;1000/day", deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
def buy(v, kind):
AWARDS = deepcopy(AWARDS_ENABLED)
if v.house:
AWARDS[v.house] = HOUSE_AWARDS[v.house]
if kind not in AWARDS: abort(400)
award_title = AWARDS[kind]['title']
2023-10-12 13:41:23 +00:00
award = buy_award(v, kind, AWARDS)
if isinstance(award, dict):
return award
2022-09-19 17:10:52 +00:00
return {"message": f"{award_title} award bought!"}
2022-09-19 17:10:52 +00:00
@app.post("/award/<thing_type>/<int:id>")
2023-02-27 05:33:45 +00:00
@limiter.limit('1/second', scope=rpath)
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
2022-09-19 17:10:52 +00:00
def award_thing(v, thing_type, id):
2022-12-19 16:32:13 +00:00
kind = request.values.get("kind", "").strip()
2023-01-01 11:36:20 +00:00
if thing_type == 'post':
thing = get_post(id)
2023-01-01 11:36:20 +00:00
else:
thing = get_comment(id)
if not thing.parent_post and not thing.wall_user_id: abort(404) # don't let users award messages
2022-09-19 17:10:52 +00:00
author = thing.author
2023-01-01 11:36:20 +00:00
AWARDS = deepcopy(AWARDS_ENABLED)
2022-09-19 17:10:52 +00:00
if v.house:
AWARDS[v.house] = HOUSE_AWARDS[v.house]
if kind not in AWARDS: abort(404, "This award doesn't exist")
2022-09-19 17:10:52 +00:00
award_title = AWARDS[kind]['title']
2023-03-16 06:27:58 +00:00
award = g.db.query(AwardRelationship).filter(
2022-09-19 17:10:52 +00:00
AwardRelationship.kind == kind,
AwardRelationship.user_id == v.id,
2023-06-07 23:26:32 +00:00
AwardRelationship.post_id == None,
2022-09-19 17:10:52 +00:00
AwardRelationship.comment_id == None
).first()
2023-10-10 16:53:46 +00:00
if not award:
2023-10-11 17:03:42 +00:00
award = buy_award(v, kind, AWARDS)
2023-10-12 13:41:23 +00:00
if isinstance(award, dict):
return award
2022-09-19 17:10:52 +00:00
2023-06-07 23:26:32 +00:00
if thing_type == 'post': award.post_id = thing.id
2022-09-19 17:10:52 +00:00
else: award.comment_id = thing.id
award.awarded_utc = int(time.time())
2023-03-16 06:27:58 +00:00
g.db.add(award)
2022-09-19 17:10:52 +00:00
2023-10-04 13:05:43 +00:00
note = request.values.get("note", "").strip()[:200]
award.note = note
2022-09-19 17:10:52 +00:00
safe_username = f"@{thing.author_name} is"
2022-09-19 17:10:52 +00:00
2023-10-02 14:50:04 +00:00
if not AWARDS[kind]['positive'] and author.immune_to_negative_awards(v):
abort(403, f"{safe_username} immune to negative awards!")
2022-09-19 17:10:52 +00:00
2023-10-11 13:50:15 +00:00
if thing_type == 'post' and thing.id == 210983:
abort(403, "You can't award this post!")
2022-09-19 17:10:52 +00:00
if kind == "benefactor" and author.id == v.id:
abort(403, "You can't use this award on yourself!")
2022-09-19 17:10:52 +00:00
if thing.ghost and not AWARDS[kind]['ghost']:
abort(403, "This kind of award can't be used on ghost posts!")
2022-09-19 17:10:52 +00:00
if v.id != author.id:
if author.deflector and v.deflector and AWARDS[kind]['deflectable']:
msg = f"@{v.username} has tried to give your [{thing_type}]({thing.shortlink}) the {award_title} Award but it was deflected on them, they also had a deflector up, so it bounced back and forth until it vaporized!"
2022-09-19 17:10:52 +00:00
send_repeatable_notification(author.id, msg)
msg = f"{safe_username} under the effect of a deflector award; your {award_title} Award has been deflected back to you but your deflector protected you, the award bounced back and forth until it vaporized!"
2022-09-19 17:10:52 +00:00
send_repeatable_notification(v.id, msg)
2023-03-16 06:27:58 +00:00
g.db.delete(award)
2022-09-19 17:10:52 +00:00
return {"message": f"{award_title} award given to {thing_type} successfully!"}
2022-09-19 17:10:52 +00:00
2022-10-30 21:27:53 +00:00
if author.deflector and AWARDS[kind]['deflectable']:
2022-09-19 17:10:52 +00:00
author = v
safe_username = f"Your award has been deflected but failed since you're"
if kind == 'shit':
awarded_coins = int(AWARDS[kind]['price'] * COSMETIC_AWARD_COIN_AWARD_PCT)
v.charge_account('coins', awarded_coins, should_check_balance=False)
thing.author.pay_account('coins', awarded_coins)
2022-11-25 23:52:39 +00:00
elif kind != 'spider':
if AWARDS[kind]['cosmetic'] and not AWARDS[kind]['included_in_lootbox']:
awarded_coins = int(AWARDS[kind]['price'] * COSMETIC_AWARD_COIN_AWARD_PCT)
else:
awarded_coins = 0
2023-10-10 15:11:32 +00:00
if awarded_coins:
if kind == 'shit':
author.charge_account('coins', awarded_coins, should_check_balance=False)
v.pay_account('coins', awarded_coins)
else:
author.pay_account('coins', awarded_coins)
2023-04-28 09:43:26 +00:00
if thing_type == 'comment':
link_text_in_notif = "your comment"
else:
link_text_in_notif = thing.title
if kind == 'marsify' and author.marsify == 1:
abort(409, f"{safe_username} already permanently marsified!")
if kind == 'spider' and author.spider == 1:
abort(409, f"{safe_username} already best friends with a spider!")
2022-09-19 17:10:52 +00:00
link = f"[this {thing_type}]({thing.shortlink})"
alter_body = not (isinstance(thing, Post) and len(thing.body) > 1000) and (not thing.author.deflector or v == thing.author)
2022-09-19 17:10:52 +00:00
if kind == "ban":
2022-12-14 20:37:47 +00:00
link = f"/{thing_type}/{thing.id}"
if thing_type == 'comment':
2023-04-28 09:43:26 +00:00
link += '#context'
link_text_in_notif = link
else:
link_text_in_notif = thing.title
2023-05-05 21:45:25 +00:00
2023-04-28 09:43:26 +00:00
ban_reason = f'1-Day ban award used by <a href="/@{v.username}">@{v.username}</a> on <a href="{link}">{link}</a>'
2022-09-19 17:10:52 +00:00
if not author.is_suspended:
2022-12-14 20:37:47 +00:00
author.ban(reason=ban_reason, days=1)
2023-04-28 09:43:26 +00:00
send_repeatable_notification(author.id, f"Your account has been banned for **a day** for [{link_text_in_notif}]({link}). It sucked and you should feel bad.")
2022-09-19 17:10:52 +00:00
elif author.unban_utc:
author.unban_utc += 86400
2022-12-14 20:37:47 +00:00
author.ban_reason = ban_reason
2023-04-28 09:43:26 +00:00
send_repeatable_notification(author.id, f"Your account has been banned for **yet another day** for [{link_text_in_notif}]({link}). Seriously man?")
2022-09-19 17:10:52 +00:00
elif kind == "unban":
2023-06-16 02:08:08 +00:00
if not author.is_suspended or not author.unban_utc:
abort(403)
2022-09-19 17:10:52 +00:00
if not author.ban_reason.startswith('1-Day ban award'):
abort(400, "You can only use unban awards to undo the effect of ban awards!")
2022-09-19 17:10:52 +00:00
if author.unban_utc - time.time() > 86400:
author.unban_utc -= 86400
send_repeatable_notification(author.id, "Your ban duration has been reduced by 1 day!")
else:
author.unban_utc = 0
2022-12-13 22:02:53 +00:00
author.is_banned = None
if not author.shadowbanned:
author.ban_reason = None
2022-09-19 17:10:52 +00:00
send_repeatable_notification(author.id, "You have been unbanned!")
elif kind == "grass":
link3 = f"/{thing_type}/{thing.id}"
if thing_type == 'comment':
link3 = f'<a href="{link3}#context">{link3}</a>'
else:
link3 = f'<a href="{link3}">{link3}</a>'
2022-09-19 17:10:52 +00:00
author.is_banned = AUTOJANNY_ID
author.ban_reason = f"grass award used by @{v.username} on {link3}"
2022-09-19 17:10:52 +00:00
author.unban_utc = int(time.time()) + 30 * 86400
send_repeatable_notification(author.id, f"@{v.username} gave you the grass award on {link} and as a result you have been banned! You must [send the admins](/contact) a timestamped picture of you touching grass/snow/sand/ass to get unbanned!")
2022-09-19 17:10:52 +00:00
elif kind == "pin":
if not FEATURES['PINS']: abort(403)
if thing.is_banned: abort(403)
2022-12-05 16:01:13 +00:00
if thing.stickied and not thing.stickied_utc:
abort(400, f"This {thing_type} is already pinned permanently!")
2022-12-05 16:01:13 +00:00
if thing_type == 'comment': add = 3600*6
else: add = 3600
if thing.stickied_utc:
thing.stickied_utc += add
2022-09-19 17:10:52 +00:00
else:
2022-12-05 16:01:13 +00:00
thing.stickied_utc = int(time.time()) + add
thing.stickied = f'{v.username}{PIN_AWARD_TEXT}'
2022-09-19 17:10:52 +00:00
cache.delete_memoized(frontlist)
elif kind == "unpin":
if not thing.stickied_utc: abort(400)
if not thing.author.deflector or v == thing.author:
if thing.author_id == LAWLZ_ID and SITE_NAME == 'rDrama': abort(403, "You can't unpin lawlzposts!")
if thing_type == 'comment':
t = thing.stickied_utc - 3600*6
else:
t = thing.stickied_utc - 3600
if time.time() > t:
thing.stickied = None
thing.stickied_utc = None
cache.delete_memoized(frontlist)
else: thing.stickied_utc = t
Add the "Misogynist" award to harass incels (#154) Whazzup? This PR is the final solution to the incel problem. There's an old indian proverb that says: "never judge a man until you've walked two moons in his mocassins". In this case, it should be: "never judge a woman until you've walked 24 hrs in her high-heels". The misogynist award is a comment-transforming award that "feminizes" comments. It does the following: - makes text pink - makes text lowercase - removes "complicated" punctuation - makes paragraphs into run-on sentences - adds stereotypical girly remarks to the beginning or end of a paragraph. For example: INPUT > What the fuck did you just fucking say about me, you little bitch? I'll have you know I graduated top of my class in the Navy Seals, and I've been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I'm the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You're fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little "clever" comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You're fucking dead, kiddo. OUTPUT > im literally screaming, what the fuck did you just fucking say about me, you little bitch? ill have you know i graduated top of my class in the navy seals, and ive been involved in numerous secret raids on al-quaeda, and i have over 300 confirmed kills, i am trained in gorilla warfare and im the top sniper in the entire us armed forces, you are nothing to me but just another target, i will wipe you the fuck out with precision the likes of which has never been seen before on this earth, mark my fucking words, you think you can get away with saying that shit to me over the internet? think again, fucker, as we speak i am contacting my secret network of spies across the usa and your ip is being traced right now so you better prepare for the storm, maggot, the storm that wipes out the pathetic little thing you call your life, youre fucking dead, kid, i can be anywhere, anytime, and i can kill you in over seven hundred ways, and thats just with my bare hands, not only am i extensively trained in unarmed combat, but i have access to the entire arsenal of the united states marine corps and i will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit, if only you could have known what unholy retribution your little clever comment was about to bring down upon you, maybe you would have held your fucking tongue, but you couldnt, you didnt, and now youre paying the price, you goddamn idiot, i will shit fury all over you and you will drown in it, youre fucking dead, kiddo It also sets the user's pfp to a random white woman. Well, psuedorandom - it's based off of the user's id, so each user will only ever have one pfp assigned to them, which I think is nifty. Finally, it changes the name of the user toa girly name. There is one small problem with the PR, which is simply that I manually added a badge for testing purposes. If you like this PR, I will submit the badge throught the proper chanels and fix it. ![image](/attachments/641c7276-ffe4-4e69-b3e9-aec9f4f94191) Co-authored-by: Chuck Sneed <sneed@formerlychucks.net> Reviewed-on: https://fsdfsd.net/rDrama/rDrama/pulls/154 Co-authored-by: HeyMoon <heymoon@noreply.fsdfsd.net> Co-committed-by: HeyMoon <heymoon@noreply.fsdfsd.net>
2023-06-21 12:36:07 +00:00
elif kind == "queen":
2023-06-23 11:07:47 +00:00
if author.chud:
abort(409, f"{safe_username} under the effect of a conflicting award: Chud award!")
2023-07-03 00:26:20 +00:00
Add the "Misogynist" award to harass incels (#154) Whazzup? This PR is the final solution to the incel problem. There's an old indian proverb that says: "never judge a man until you've walked two moons in his mocassins". In this case, it should be: "never judge a woman until you've walked 24 hrs in her high-heels". The misogynist award is a comment-transforming award that "feminizes" comments. It does the following: - makes text pink - makes text lowercase - removes "complicated" punctuation - makes paragraphs into run-on sentences - adds stereotypical girly remarks to the beginning or end of a paragraph. For example: INPUT > What the fuck did you just fucking say about me, you little bitch? I'll have you know I graduated top of my class in the Navy Seals, and I've been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I'm the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You're fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little "clever" comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You're fucking dead, kiddo. OUTPUT > im literally screaming, what the fuck did you just fucking say about me, you little bitch? ill have you know i graduated top of my class in the navy seals, and ive been involved in numerous secret raids on al-quaeda, and i have over 300 confirmed kills, i am trained in gorilla warfare and im the top sniper in the entire us armed forces, you are nothing to me but just another target, i will wipe you the fuck out with precision the likes of which has never been seen before on this earth, mark my fucking words, you think you can get away with saying that shit to me over the internet? think again, fucker, as we speak i am contacting my secret network of spies across the usa and your ip is being traced right now so you better prepare for the storm, maggot, the storm that wipes out the pathetic little thing you call your life, youre fucking dead, kid, i can be anywhere, anytime, and i can kill you in over seven hundred ways, and thats just with my bare hands, not only am i extensively trained in unarmed combat, but i have access to the entire arsenal of the united states marine corps and i will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit, if only you could have known what unholy retribution your little clever comment was about to bring down upon you, maybe you would have held your fucking tongue, but you couldnt, you didnt, and now youre paying the price, you goddamn idiot, i will shit fury all over you and you will drown in it, youre fucking dead, kiddo It also sets the user's pfp to a random white woman. Well, psuedorandom - it's based off of the user's id, so each user will only ever have one pfp assigned to them, which I think is nifty. Finally, it changes the name of the user toa girly name. There is one small problem with the PR, which is simply that I manually added a badge for testing purposes. If you like this PR, I will submit the badge throught the proper chanels and fix it. ![image](/attachments/641c7276-ffe4-4e69-b3e9-aec9f4f94191) Co-authored-by: Chuck Sneed <sneed@formerlychucks.net> Reviewed-on: https://fsdfsd.net/rDrama/rDrama/pulls/154 Co-authored-by: HeyMoon <heymoon@noreply.fsdfsd.net> Co-committed-by: HeyMoon <heymoon@noreply.fsdfsd.net>
2023-06-21 12:36:07 +00:00
if not author.queen:
characters = list(filter(str.isalpha, author.username))
if characters:
first_character = characters[0].upper()
else:
first_character = random.choice(string.ascii_letters).upper()
available_names = GIRL_NAMES[first_character]
random.shuffle(available_names)
2023-06-22 17:50:10 +00:00
broken = False
for new_name in available_names:
2023-06-22 17:29:56 +00:00
existing = get_user(new_name, graceful=True)
if not existing:
broken = True
break
if not broken:
new_name = new_name + f'-{author.id}'
Add the "Misogynist" award to harass incels (#154) Whazzup? This PR is the final solution to the incel problem. There's an old indian proverb that says: "never judge a man until you've walked two moons in his mocassins". In this case, it should be: "never judge a woman until you've walked 24 hrs in her high-heels". The misogynist award is a comment-transforming award that "feminizes" comments. It does the following: - makes text pink - makes text lowercase - removes "complicated" punctuation - makes paragraphs into run-on sentences - adds stereotypical girly remarks to the beginning or end of a paragraph. For example: INPUT > What the fuck did you just fucking say about me, you little bitch? I'll have you know I graduated top of my class in the Navy Seals, and I've been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I'm the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You're fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little "clever" comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You're fucking dead, kiddo. OUTPUT > im literally screaming, what the fuck did you just fucking say about me, you little bitch? ill have you know i graduated top of my class in the navy seals, and ive been involved in numerous secret raids on al-quaeda, and i have over 300 confirmed kills, i am trained in gorilla warfare and im the top sniper in the entire us armed forces, you are nothing to me but just another target, i will wipe you the fuck out with precision the likes of which has never been seen before on this earth, mark my fucking words, you think you can get away with saying that shit to me over the internet? think again, fucker, as we speak i am contacting my secret network of spies across the usa and your ip is being traced right now so you better prepare for the storm, maggot, the storm that wipes out the pathetic little thing you call your life, youre fucking dead, kid, i can be anywhere, anytime, and i can kill you in over seven hundred ways, and thats just with my bare hands, not only am i extensively trained in unarmed combat, but i have access to the entire arsenal of the united states marine corps and i will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit, if only you could have known what unholy retribution your little clever comment was about to bring down upon you, maybe you would have held your fucking tongue, but you couldnt, you didnt, and now youre paying the price, you goddamn idiot, i will shit fury all over you and you will drown in it, youre fucking dead, kiddo It also sets the user's pfp to a random white woman. Well, psuedorandom - it's based off of the user's id, so each user will only ever have one pfp assigned to them, which I think is nifty. Finally, it changes the name of the user toa girly name. There is one small problem with the PR, which is simply that I manually added a badge for testing purposes. If you like this PR, I will submit the badge throught the proper chanels and fix it. ![image](/attachments/641c7276-ffe4-4e69-b3e9-aec9f4f94191) Co-authored-by: Chuck Sneed <sneed@formerlychucks.net> Reviewed-on: https://fsdfsd.net/rDrama/rDrama/pulls/154 Co-authored-by: HeyMoon <heymoon@noreply.fsdfsd.net> Co-committed-by: HeyMoon <heymoon@noreply.fsdfsd.net>
2023-06-21 12:36:07 +00:00
if not author.prelock_username:
author.prelock_username = author.username
author.username = new_name
if author.queen and time.time() < author.queen: author.queen += 86400
else: author.queen = int(time.time()) + 86400
author.namechanged = author.queen
Add the "Misogynist" award to harass incels (#154) Whazzup? This PR is the final solution to the incel problem. There's an old indian proverb that says: "never judge a man until you've walked two moons in his mocassins". In this case, it should be: "never judge a woman until you've walked 24 hrs in her high-heels". The misogynist award is a comment-transforming award that "feminizes" comments. It does the following: - makes text pink - makes text lowercase - removes "complicated" punctuation - makes paragraphs into run-on sentences - adds stereotypical girly remarks to the beginning or end of a paragraph. For example: INPUT > What the fuck did you just fucking say about me, you little bitch? I'll have you know I graduated top of my class in the Navy Seals, and I've been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I'm the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You're fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little "clever" comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You're fucking dead, kiddo. OUTPUT > im literally screaming, what the fuck did you just fucking say about me, you little bitch? ill have you know i graduated top of my class in the navy seals, and ive been involved in numerous secret raids on al-quaeda, and i have over 300 confirmed kills, i am trained in gorilla warfare and im the top sniper in the entire us armed forces, you are nothing to me but just another target, i will wipe you the fuck out with precision the likes of which has never been seen before on this earth, mark my fucking words, you think you can get away with saying that shit to me over the internet? think again, fucker, as we speak i am contacting my secret network of spies across the usa and your ip is being traced right now so you better prepare for the storm, maggot, the storm that wipes out the pathetic little thing you call your life, youre fucking dead, kid, i can be anywhere, anytime, and i can kill you in over seven hundred ways, and thats just with my bare hands, not only am i extensively trained in unarmed combat, but i have access to the entire arsenal of the united states marine corps and i will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit, if only you could have known what unholy retribution your little clever comment was about to bring down upon you, maybe you would have held your fucking tongue, but you couldnt, you didnt, and now youre paying the price, you goddamn idiot, i will shit fury all over you and you will drown in it, youre fucking dead, kiddo It also sets the user's pfp to a random white woman. Well, psuedorandom - it's based off of the user's id, so each user will only ever have one pfp assigned to them, which I think is nifty. Finally, it changes the name of the user toa girly name. There is one small problem with the PR, which is simply that I manually added a badge for testing purposes. If you like this PR, I will submit the badge throught the proper chanels and fix it. ![image](/attachments/641c7276-ffe4-4e69-b3e9-aec9f4f94191) Co-authored-by: Chuck Sneed <sneed@formerlychucks.net> Reviewed-on: https://fsdfsd.net/rDrama/rDrama/pulls/154 Co-authored-by: HeyMoon <heymoon@noreply.fsdfsd.net> Co-committed-by: HeyMoon <heymoon@noreply.fsdfsd.net>
2023-06-21 12:36:07 +00:00
badge_grant(user=author, badge_id=285)
2023-07-03 00:26:20 +00:00
if alter_body:
thing.queened = True
thing.body_html = sanitize(thing.body, limit_pings=5, showmore=True, obj=thing, author=author)
if isinstance(thing, Post):
thing.title_html = filter_emojis_only(thing.title, golden=False, obj=thing, author=author)
2023-06-23 11:07:47 +00:00
elif kind == "chud":
2023-10-07 17:55:50 +00:00
if thing_type == 'post' and thing.hole == 'chudrama' \
or thing_type == 'comment' and thing.post and thing.post.hole == 'chudrama':
abort(403, "You can't give the chud award in /h/chudrama")
Add the "Misogynist" award to harass incels (#154) Whazzup? This PR is the final solution to the incel problem. There's an old indian proverb that says: "never judge a man until you've walked two moons in his mocassins". In this case, it should be: "never judge a woman until you've walked 24 hrs in her high-heels". The misogynist award is a comment-transforming award that "feminizes" comments. It does the following: - makes text pink - makes text lowercase - removes "complicated" punctuation - makes paragraphs into run-on sentences - adds stereotypical girly remarks to the beginning or end of a paragraph. For example: INPUT > What the fuck did you just fucking say about me, you little bitch? I'll have you know I graduated top of my class in the Navy Seals, and I've been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I'm the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You're fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little "clever" comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You're fucking dead, kiddo. OUTPUT > im literally screaming, what the fuck did you just fucking say about me, you little bitch? ill have you know i graduated top of my class in the navy seals, and ive been involved in numerous secret raids on al-quaeda, and i have over 300 confirmed kills, i am trained in gorilla warfare and im the top sniper in the entire us armed forces, you are nothing to me but just another target, i will wipe you the fuck out with precision the likes of which has never been seen before on this earth, mark my fucking words, you think you can get away with saying that shit to me over the internet? think again, fucker, as we speak i am contacting my secret network of spies across the usa and your ip is being traced right now so you better prepare for the storm, maggot, the storm that wipes out the pathetic little thing you call your life, youre fucking dead, kid, i can be anywhere, anytime, and i can kill you in over seven hundred ways, and thats just with my bare hands, not only am i extensively trained in unarmed combat, but i have access to the entire arsenal of the united states marine corps and i will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit, if only you could have known what unholy retribution your little clever comment was about to bring down upon you, maybe you would have held your fucking tongue, but you couldnt, you didnt, and now youre paying the price, you goddamn idiot, i will shit fury all over you and you will drown in it, youre fucking dead, kiddo It also sets the user's pfp to a random white woman. Well, psuedorandom - it's based off of the user's id, so each user will only ever have one pfp assigned to them, which I think is nifty. Finally, it changes the name of the user toa girly name. There is one small problem with the PR, which is simply that I manually added a badge for testing purposes. If you like this PR, I will submit the badge throught the proper chanels and fix it. ![image](/attachments/641c7276-ffe4-4e69-b3e9-aec9f4f94191) Co-authored-by: Chuck Sneed <sneed@formerlychucks.net> Reviewed-on: https://fsdfsd.net/rDrama/rDrama/pulls/154 Co-authored-by: HeyMoon <heymoon@noreply.fsdfsd.net> Co-committed-by: HeyMoon <heymoon@noreply.fsdfsd.net>
2023-06-21 12:36:07 +00:00
if author.queen:
abort(409, f"{safe_username} under the effect of a conflicting award: Queen award!")
Add the "Misogynist" award to harass incels (#154) Whazzup? This PR is the final solution to the incel problem. There's an old indian proverb that says: "never judge a man until you've walked two moons in his mocassins". In this case, it should be: "never judge a woman until you've walked 24 hrs in her high-heels". The misogynist award is a comment-transforming award that "feminizes" comments. It does the following: - makes text pink - makes text lowercase - removes "complicated" punctuation - makes paragraphs into run-on sentences - adds stereotypical girly remarks to the beginning or end of a paragraph. For example: INPUT > What the fuck did you just fucking say about me, you little bitch? I'll have you know I graduated top of my class in the Navy Seals, and I've been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I'm the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You're fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little "clever" comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You're fucking dead, kiddo. OUTPUT > im literally screaming, what the fuck did you just fucking say about me, you little bitch? ill have you know i graduated top of my class in the navy seals, and ive been involved in numerous secret raids on al-quaeda, and i have over 300 confirmed kills, i am trained in gorilla warfare and im the top sniper in the entire us armed forces, you are nothing to me but just another target, i will wipe you the fuck out with precision the likes of which has never been seen before on this earth, mark my fucking words, you think you can get away with saying that shit to me over the internet? think again, fucker, as we speak i am contacting my secret network of spies across the usa and your ip is being traced right now so you better prepare for the storm, maggot, the storm that wipes out the pathetic little thing you call your life, youre fucking dead, kid, i can be anywhere, anytime, and i can kill you in over seven hundred ways, and thats just with my bare hands, not only am i extensively trained in unarmed combat, but i have access to the entire arsenal of the united states marine corps and i will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit, if only you could have known what unholy retribution your little clever comment was about to bring down upon you, maybe you would have held your fucking tongue, but you couldnt, you didnt, and now youre paying the price, you goddamn idiot, i will shit fury all over you and you will drown in it, youre fucking dead, kiddo It also sets the user's pfp to a random white woman. Well, psuedorandom - it's based off of the user's id, so each user will only ever have one pfp assigned to them, which I think is nifty. Finally, it changes the name of the user toa girly name. There is one small problem with the PR, which is simply that I manually added a badge for testing purposes. If you like this PR, I will submit the badge throught the proper chanels and fix it. ![image](/attachments/641c7276-ffe4-4e69-b3e9-aec9f4f94191) Co-authored-by: Chuck Sneed <sneed@formerlychucks.net> Reviewed-on: https://fsdfsd.net/rDrama/rDrama/pulls/154 Co-authored-by: HeyMoon <heymoon@noreply.fsdfsd.net> Co-committed-by: HeyMoon <heymoon@noreply.fsdfsd.net>
2023-06-21 12:36:07 +00:00
2022-09-19 17:10:52 +00:00
if author.marseyawarded:
abort(409, f"{safe_username} under the effect of a conflicting award: Marsey award!")
2022-09-19 17:10:52 +00:00
if author.owoify:
abort(409, f"{safe_username} under the effect of a conflicting award: OwOify award!")
if author.sharpen:
2023-10-07 15:08:28 +00:00
abort(409, f"{safe_username} under the effect of a conflicting award: Sharpen award!")
2023-06-23 11:07:47 +00:00
if author.chud == 1:
abort(409, f"{safe_username} already chudded permanently!")
2023-06-23 11:07:47 +00:00
if author.chud and time.time() < author.chud: author.chud += 86400
else: author.chud = int(time.time()) + 86400
2023-01-01 11:36:20 +00:00
if not note: abort(400, "Missing phrase!")
if note not in CHUD_PHRASES:
abort(400, "Invalid phrase!")
2023-03-19 17:13:45 +00:00
2023-06-23 11:07:47 +00:00
author.chud_phrase = note.lower()
2023-03-19 17:13:45 +00:00
badge_grant(user=author, badge_id=58)
if alter_body:
thing.chudded = True
complies_with_chud(thing)
2022-09-19 17:10:52 +00:00
elif kind == "flairlock":
2023-05-20 11:09:40 +00:00
new_name = note[:100]
2022-09-19 17:10:52 +00:00
if not new_name and author.flairchanged:
author.flairchanged += 86400
else:
2023-10-05 10:39:12 +00:00
author.flair = new_name
new_name = filter_emojis_only(new_name)
new_name = censor_slurs_profanities(new_name, None)
if len(new_name) > 1000: abort(403)
2023-10-05 10:39:12 +00:00
author.flair_html = new_name
2022-09-19 17:10:52 +00:00
author.flairchanged = int(time.time()) + 86400
badge_grant(user=author, badge_id=96)
2023-05-13 04:53:14 +00:00
elif kind == "namelock":
2023-05-17 18:14:45 +00:00
new_name = note.strip().lstrip('@')
if not new_name and author.namechanged:
2023-05-13 04:53:14 +00:00
author.namechanged += 86400
else:
if not valid_username_regex.fullmatch(new_name):
abort(400, "Invalid username")
existing = get_user(new_name, graceful=True)
if existing and existing.id != author.id:
abort(400, f"@{new_name} is already taken!")
if not author.prelock_username:
author.prelock_username = author.username
2023-05-13 04:53:14 +00:00
author.username = new_name
author.namechanged = int(time.time()) + 86400
2023-05-16 00:20:55 +00:00
badge_grant(user=author, badge_id=281)
2022-09-19 17:10:52 +00:00
elif kind == "pause":
badge_grant(badge_id=68, user=author)
elif kind == "unpausable":
badge_grant(badge_id=67, user=author)
elif kind == "marsey":
2023-06-23 11:07:47 +00:00
if author.chud:
abort(409, f"{safe_username} under the effect of a conflicting award: Chud award!")
2023-03-21 21:33:43 +00:00
2022-09-19 17:10:52 +00:00
if author.marseyawarded: author.marseyawarded += 86400
else: author.marseyawarded = int(time.time()) + 86400
badge_grant(user=author, badge_id=98)
elif kind == "pizzashill":
if author.bird:
abort(409, f"{safe_username} under the effect of a conflicting award: Bird Site award!")
2022-09-19 17:10:52 +00:00
if author.longpost: author.longpost += 86400
else: author.longpost = int(time.time()) + 86400
badge_grant(user=author, badge_id=97)
elif kind == "bird":
if author.longpost:
abort(409, f"{safe_username} under the effect of a conflicting award: Pizzashill award!")
2022-09-19 17:10:52 +00:00
if author.bird: author.bird += 86400
else: author.bird = int(time.time()) + 86400
badge_grant(user=author, badge_id=95)
elif kind == "eye":
badge_grant(badge_id=83, user=author)
elif kind == "offsitementions":
badge_grant(user=author, badge_id=140)
elif kind == "alt":
badge_grant(badge_id=84, user=author)
elif kind == "unblockable":
badge_grant(badge_id=87, user=author)
2023-08-05 19:26:42 +00:00
for block in g.db.query(UserBlock).filter_by(target_id=author.id): g.db.delete(block)
2022-09-19 17:10:52 +00:00
elif kind == "progressivestack":
if not FEATURES['PINS']:
abort(403)
2022-12-04 19:30:33 +00:00
if author.progressivestack != 1:
if author.progressivestack: author.progressivestack += 21600
else: author.progressivestack = int(time.time()) + 21600
badge_grant(user=author, badge_id=94)
2022-09-19 17:10:52 +00:00
elif kind == "benefactor":
2023-02-23 13:04:33 +00:00
if not author.patron:
author.patron = 1
2022-09-19 17:10:52 +00:00
if author.patron_utc: author.patron_utc += 2629746
else: author.patron_utc = int(time.time()) + 2629746
author.pay_account('marseybux', 2000)
2022-09-19 17:10:52 +00:00
badge_grant(user=v, badge_id=103)
elif kind == "rehab":
if author.rehab: author.rehab += 86400
else: author.rehab = int(time.time()) + 86400
badge_grant(user=author, badge_id=109)
elif kind == "deflector":
if author.deflector: author.deflector += 36000
else: author.deflector = int(time.time()) + 36000
2022-09-19 17:10:52 +00:00
elif kind == "beano":
badge_grant(user=author, badge_id=128)
elif kind == "checkmark":
author.verified = "Verified"
badge_grant(user=author, badge_id=150)
2023-10-05 19:40:44 +00:00
elif kind == "pride":
badge_grant(user=author, badge_id=303)
2022-09-19 17:10:52 +00:00
elif kind == 'marsify':
2023-06-23 11:07:47 +00:00
if author.chud:
abort(409, f"{safe_username} under the effect of a conflicting award: Chud award!")
2022-09-26 06:08:54 +00:00
if not author.marsify or author.marsify != 1:
if author.marsify: author.marsify += 86400
else: author.marsify = int(time.time()) + 86400
2022-09-19 17:10:52 +00:00
badge_grant(user=author, badge_id=170)
if alter_body:
thing.body_html = sanitize(thing.body, limit_pings=5, showmore=True, obj=thing, author=author)
if isinstance(thing, Post):
thing.title_html = filter_emojis_only(thing.title, golden=False, obj=thing, author=author)
2022-09-19 17:10:52 +00:00
elif "Vampire" in kind and kind == v.house:
if author.bite: author.bite += 172800
2023-04-23 02:42:25 +00:00
else:
if author.house.startswith("Vampire"):
abort(400, f"{safe_username} already a permanent vampire!")
2023-05-05 21:45:25 +00:00
2023-04-23 02:42:25 +00:00
author.bite = int(time.time()) + 172800
author.old_house = author.house
2023-04-25 05:59:53 +00:00
author.house = "Vampire"
2022-09-19 17:10:52 +00:00
badge_grant(user=author, badge_id=168)
elif "Racist" in kind and kind == v.house:
if author.earlylife: author.earlylife += 86400
else: author.earlylife = int(time.time()) + 86400
badge_grant(user=author, badge_id=169)
elif ("Furry" in kind and kind == v.house) or kind == 'owoify':
2023-06-23 11:07:47 +00:00
if author.chud:
abort(409, f"{safe_username} under the effect of a conflicting award: Chud award!")
2022-09-19 17:10:52 +00:00
if author.owoify: author.owoify += 21600
else: author.owoify = int(time.time()) + 21600
badge_grant(user=author, badge_id=167)
if alter_body:
thing.body_html = sanitize(thing.body, limit_pings=5, showmore=True, obj=thing, author=author)
if isinstance(thing, Post):
thing.title_html = filter_emojis_only(thing.title, golden=False, obj=thing, author=author)
2023-06-26 15:05:27 +00:00
elif ("Edgy" in kind and kind == v.house) or kind == 'sharpen':
if author.chud:
abort(409, f"{safe_username} under the effect of a conflicting award: Chud award!")
2023-06-26 15:05:27 +00:00
if author.sharpen: author.sharpen += 86400
else: author.sharpen = int(time.time()) + 86400
badge_grant(user=author, badge_id=289)
if alter_body:
thing.sharpened = True
thing.body_html = sanitize(thing.body, limit_pings=5, showmore=True, obj=thing, author=author)
if isinstance(thing, Post):
thing.title_html = filter_emojis_only(thing.title, golden=False, obj=thing, author=author)
2022-10-18 03:10:40 +00:00
elif ("Femboy" in kind and kind == v.house) or kind == 'rainbow':
2022-09-19 17:10:52 +00:00
if author.rainbow: author.rainbow += 86400
else: author.rainbow = int(time.time()) + 86400
badge_grant(user=author, badge_id=171)
thing.rainbowed = True
2023-10-04 13:05:43 +00:00
elif kind == "emoji":
award.note = award.note.strip(":").lower()
emoji = g.db.query(Emoji).filter_by(name=award.note).one_or_none()
if not emoji:
abort(404, f'an Emoji with the name "{award.note}" was not found!')
2023-10-10 14:27:41 +00:00
elif IS_FISTMAS():
if kind == "grinch":
badge_grant(badge_id=91, user=author)
if v.id == author.id:
session['event_music'] = False
2023-10-04 13:05:43 +00:00
elif IS_HOMOWEEN():
2023-10-10 18:14:45 +00:00
if kind == "hallowgrinch":
2023-10-10 14:27:41 +00:00
badge_grant(badge_id=185, user=author)
if v.id == author.id:
session['event_music'] = False
elif kind == "spider":
2023-10-04 13:05:43 +00:00
if author.spider: author.spider += 86400
else: author.spider = int(time.time()) + 86400
badge_grant(user=author, badge_id=179, notify=False)
elif kind == "bite":
if author.zombie < 0:
author = v
2023-09-28 23:58:09 +00:00
if author.zombie == 0:
2023-10-04 13:05:43 +00:00
author.zombie = -1
badge_grant(user=author, badge_id=181)
award_object = AwardRelationship(user_id=author.id, kind='bite')
g.db.add(award_object)
send_repeatable_notification(author.id,
"As the zombie virus washes over your mind, you feel the urge "
"to… BITE YUMMY BRAINS :marseyzombie:<br>"
"You receive a free **Zombie Bite** award: pass it on!")
elif author.zombie > 0:
author.zombie -= 1
if author.zombie == 0:
send_repeatable_notification(author.id, "You are no longer **VAXXMAXXED**! Time for another booster!")
badge = author.has_badge(182)
if badge: g.db.delete(badge)
elif kind == "vax":
if author.zombie < 0:
author.zombie = 0
send_repeatable_notification(author.id, "You are no longer **INFECTED**! Praise Fauci!")
badge = author.has_badge(181)
2023-09-28 23:58:09 +00:00
if badge: g.db.delete(badge)
2023-10-04 13:05:43 +00:00
elif author.zombie >= 0:
author.zombie += 2
author.zombie = min(author.zombie, 10)
badge_grant(user=author, badge_id=182)
elif kind == "jumpscare":
author.jumpscare += 1
2022-12-20 01:13:34 +00:00
2023-10-10 17:27:01 +00:00
author = thing.author
2023-10-04 17:30:23 +00:00
if v.id != author.id:
if author.deflector and AWARDS[kind]['deflectable']:
msg = f"@{v.username} has tried to give your [{thing_type}]({thing.shortlink}) the {award_title} Award but it was deflected and applied to them :marseytroll:"
2023-10-12 13:39:17 +00:00
n = send_repeatable_notification(author.id, msg)
if n: n.created_utc -= 1
msg = f"{safe_username} under the effect of a deflector award; your {award_title} Award has been deflected back to you :marseytroll:"
2023-10-12 13:39:17 +00:00
n = send_repeatable_notification(v.id, msg)
if n: n.created_utc -= 1
2023-10-09 16:50:57 +00:00
elif kind not in {'spider', 'jumpscare'}:
msg = f"@{v.username} has given [{link_text_in_notif}]({thing.shortlink}) the {award_title} Award"
2023-10-04 17:30:23 +00:00
if kind == 'shit':
msg += f" and has stolen from you {awarded_coins} coins as a result"
elif awarded_coins:
msg += f" and you have received {awarded_coins} coins as a result"
msg += "!"
if kind == 'emoji':
msg += f"\n\n> :{award.note}:"
elif note:
2023-10-04 17:30:23 +00:00
note = '\n\n> '.join(note.splitlines())
if kind == "chud":
msg += f"\n\n**You now have to say this phrase in all posts and comments you make for 24 hours:**"
msg += f"\n\n> {note}"
2023-10-12 13:39:17 +00:00
n = send_repeatable_notification(author.id, msg)
if n: n.created_utc -= 1
2023-10-04 17:30:23 +00:00
2022-09-19 17:10:52 +00:00
if author.received_award_count: author.received_award_count += 1
else: author.received_award_count = 1
2023-03-16 06:27:58 +00:00
g.db.add(author)
2022-09-19 17:10:52 +00:00
2023-10-07 15:36:28 +00:00
g.db.add(thing)
if award.kind == "emoji":
emoji_behavior = request.values.get("emoji_behavior").strip()
if emoji_behavior == "horizontal":
award.kind = "emoji-hz"
return {"message": f"{award_title} award given to {thing_type} successfully!"}
Add the "Misogynist" award to harass incels (#154) Whazzup? This PR is the final solution to the incel problem. There's an old indian proverb that says: "never judge a man until you've walked two moons in his mocassins". In this case, it should be: "never judge a woman until you've walked 24 hrs in her high-heels". The misogynist award is a comment-transforming award that "feminizes" comments. It does the following: - makes text pink - makes text lowercase - removes "complicated" punctuation - makes paragraphs into run-on sentences - adds stereotypical girly remarks to the beginning or end of a paragraph. For example: INPUT > What the fuck did you just fucking say about me, you little bitch? I'll have you know I graduated top of my class in the Navy Seals, and I've been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I'm the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You're fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little "clever" comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You're fucking dead, kiddo. OUTPUT > im literally screaming, what the fuck did you just fucking say about me, you little bitch? ill have you know i graduated top of my class in the navy seals, and ive been involved in numerous secret raids on al-quaeda, and i have over 300 confirmed kills, i am trained in gorilla warfare and im the top sniper in the entire us armed forces, you are nothing to me but just another target, i will wipe you the fuck out with precision the likes of which has never been seen before on this earth, mark my fucking words, you think you can get away with saying that shit to me over the internet? think again, fucker, as we speak i am contacting my secret network of spies across the usa and your ip is being traced right now so you better prepare for the storm, maggot, the storm that wipes out the pathetic little thing you call your life, youre fucking dead, kid, i can be anywhere, anytime, and i can kill you in over seven hundred ways, and thats just with my bare hands, not only am i extensively trained in unarmed combat, but i have access to the entire arsenal of the united states marine corps and i will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit, if only you could have known what unholy retribution your little clever comment was about to bring down upon you, maybe you would have held your fucking tongue, but you couldnt, you didnt, and now youre paying the price, you goddamn idiot, i will shit fury all over you and you will drown in it, youre fucking dead, kiddo It also sets the user's pfp to a random white woman. Well, psuedorandom - it's based off of the user's id, so each user will only ever have one pfp assigned to them, which I think is nifty. Finally, it changes the name of the user toa girly name. There is one small problem with the PR, which is simply that I manually added a badge for testing purposes. If you like this PR, I will submit the badge throught the proper chanels and fix it. ![image](/attachments/641c7276-ffe4-4e69-b3e9-aec9f4f94191) Co-authored-by: Chuck Sneed <sneed@formerlychucks.net> Reviewed-on: https://fsdfsd.net/rDrama/rDrama/pulls/154 Co-authored-by: HeyMoon <heymoon@noreply.fsdfsd.net> Co-committed-by: HeyMoon <heymoon@noreply.fsdfsd.net>
2023-06-21 12:36:07 +00:00
2023-09-28 23:58:09 +00:00
@app.post("/trick-or-treat")
@limiter.limit("1/hour", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
@auth_required
def trick_or_treat(v):
if v.client:
abort(403, "Not allowed from the API")
if not IS_HOMOWEEN():
abort(403)
2023-09-28 23:58:09 +00:00
result = random.choice([0,1])
if result == 0:
message = "Trick!"
else:
choices = [x["kind"] for x in AWARDS_ENABLED.values() if x["included_in_lootbox"]]
award = random.choice(choices)
2023-09-28 23:58:09 +00:00
award_object = AwardRelationship(user_id=v.id, kind=award)
g.db.add(award_object)
award_title = AWARDS_ENABLED[award]['title']
message = f"Treat! You got a {award_title} award!"
return {"message": f"{message}", "result": f"{result}"}
@app.post("/jumpscare")
@auth_required
def execute_jumpscare(v):
if v.client:
abort(403, "Not allowed from the API")
if not IS_HOMOWEEN():
abort(403)
2023-09-28 23:58:09 +00:00
if v.jumpscare > 0:
v.jumpscare -= 1
g.db.add(v)
return {}