From de47c992fa95fda64d8742231895ca89ec0d33c5 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 29 Apr 2023 23:27:45 +0200 Subject: [PATCH] remove !wordle since nobody uses it (only 2 ppl used it last 30 days in rdrama and WPD) --- files/assets/js/comments_v.js | 4 --- files/classes/comment.py | 24 -------------- files/helpers/actions.py | 8 ----- files/helpers/config/const.py | 3 -- files/helpers/treasure.py | 47 +++++++++++++-------------- files/routes/comments.py | 42 ++---------------------- files/routes/groups.py | 2 +- files/templates/comments.html | 4 --- files/templates/formatting.html | 11 ------- migrations/20230429-remove-wordle.sql | 1 + schema.sql | 2 -- 11 files changed, 27 insertions(+), 121 deletions(-) create mode 100644 migrations/20230429-remove-wordle.sql diff --git a/files/assets/js/comments_v.js b/files/assets/js/comments_v.js index 0a10318c2..57962c66b 100644 --- a/files/assets/js/comments_v.js +++ b/files/assets/js/comments_v.js @@ -325,7 +325,3 @@ function handle_action(type, cid, thing) { } xhr.send(form) } - -function wordle(t) { - handle_action('wordle', t.dataset.cid, t.previousElementSibling.value) -} diff --git a/files/classes/comment.py b/files/classes/comment.py index e964bbae9..acc1afd3d 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -134,7 +134,6 @@ class Comment(Base): body_html = Column(String) body_ts = Column(TSVECTOR(), server_default=FetchedValue()) ban_reason = Column(String) - wordle_result = Column(String) treasure_amount = Column(String) slots_result = Column(String) blackjack_result = Column(String) @@ -390,8 +389,6 @@ class Comment(Base): if self.author.shadowbanned: return True - if (self.wordle_result) and (not self.body or len(self.body_html) <= 100) and 9 > self.level > 1: return True - if v and v.filter_words and self.body and any(x in self.body for x in v.filter_words): return True return False @@ -408,27 +405,6 @@ class Comment(Base): def active_flags(self, v): return len(self.filtered_flags(v)) - @lazy - def wordle_html(self, v): - if not self.wordle_result: return '' - - split_wordle_result = self.wordle_result.split('_') - wordle_guesses = split_wordle_result[0] - wordle_status = split_wordle_result[1] - wordle_answer = split_wordle_result[2] - - body = f"{wordle_guesses}" - - if wordle_status == 'active' and v and v.id == self.author_id: - body += f'''''' - elif wordle_status == 'won': - body += "Correct!" - elif wordle_status == 'lost': - body += f"Lost. The answer was: {wordle_answer}" - - body += '' - return body - @property @lazy def blackjack_html(self): diff --git a/files/helpers/actions.py b/files/helpers/actions.py index b0e6f040c..195976803 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -411,7 +411,6 @@ def execute_antispam_duplicate_comment_check(v:User, body_html:str): if v.id in ANTISPAM_BYPASS_IDS or v.admin_level: return if v.age >= NOTIFICATION_SPAM_AGE_THRESHOLD: return if len(body_html) < 16: return - if body_html == '!wordle': return # wordle compare_time = int(time.time()) - 60 * 60 * 24 count = g.db.query(Comment.id).filter(Comment.body_html == body_html, Comment.created_utc >= compare_time).count() @@ -519,13 +518,6 @@ def execute_lawlz_actions(v:User, p:Submission): g.db.add(ma_3) -def execute_wordle(c:Comment, body:str): - if not FEATURES['WORDLE']: return - if not "!wordle" in body: return - answer = random.choice(WORDLE_LIST) - c.wordle_result = f'_active_{answer}' - - def process_poll_options(v:User, target:Union[Submission, Comment]): patterns = [(poll_regex, 0), (choice_regex, 1)] diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index bc836ba30..ad7604149 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -515,7 +515,6 @@ FEATURES = { 'HATS': True, 'HOUSES': False, 'GAMBLING': True, - 'WORDLE': True, 'USERS_PROFILE_BANNER': True, 'USERS_PROFILE_BODYTEXT': True, 'USERS_PROFILE_SONG': True, @@ -947,8 +946,6 @@ discounts = { CF_HEADERS = {"Authorization": f"Bearer {CF_KEY}", "Content-Type": "application/json"} -WORDLE_LIST = ('aaron','about','above','abuse','acids','acres','actor','acute','adams','added','admin','admit','adopt','adult','after','again','agent','aging','agree','ahead','aimed','alarm','album','alert','alias','alice','alien','align','alike','alive','allah','allan','allen','allow','alloy','alone','along','alpha','alter','amber','amend','amino','among','angel','anger','angle','angry','anime','annex','annie','apart','apple','apply','april','areas','arena','argue','arise','armed','armor','array','arrow','aruba','ascii','asian','aside','asked','asset','atlas','audio','audit','autos','avoid','award','aware','awful','babes','bacon','badge','badly','baker','balls','bands','banks','barry','based','bases','basic','basin','basis','batch','baths','beach','beads','beans','bears','beast','beats','began','begin','begun','being','belle','belly','below','belts','bench','berry','betty','bible','bikes','bills','billy','bingo','birds','birth','bitch','black','blade','blair','blake','blame','blank','blast','blend','bless','blind','blink','block','blogs','blond','blood','bloom','blues','board','boats','bobby','bonds','bones','bonus','boobs','books','boost','booth','boots','booty','bored','bound','boxed','boxes','brain','brake','brand','brass','brave','bread','break','breed','brian','brick','bride','brief','bring','broad','broke','brook','brown','bruce','brush','bryan','bucks','buddy','build','built','bunch','bunny','burke','burns','burst','buses','busty','butts','buyer','bytes','cabin','cable','cache','cakes','calif','calls','camel','camps','canal','candy','canon','cards','carey','cargo','carlo','carol','carry','cases','casey','casio','catch','cause','cedar','cells','cents','chain','chair','chaos','charm','chart','chase','cheap','cheat','check','chess','chest','chevy','chick','chief','child','chile','china','chips','choir','chose','chris','chuck','cindy','cisco','cited','civic','civil','claim','clara','clark','class','clean','clear','clerk','click','cliff','climb','clips','clock','clone','close','cloth','cloud','clubs','coach','coast','cocks','codes','cohen','coins','colin','colon','color','combo','comes','comic','condo','congo','const','coral','corps','costa','costs','could','count','court','cover','crack','craft','craig','craps','crash','crazy','cream','creek','crest','crime','crops','cross','crowd','crown','crude','cubic','curve','cyber','cycle','czech','daddy','daily','dairy','daisy','dance','danny','dated','dates','david','davis','deals','dealt','death','debug','debut','decor','delay','delhi','delta','dense','depot','depth','derby','derek','devel','devil','devon','diana','diane','diary','dicke','dicks','diego','diffs','digit','dildo','dirty','disco','discs','disks','dodge','doing','dolls','donna','donor','doors','doubt','dover','dozen','draft','drain','rDrama','drawn','draws','dream','dress','dried','drill','drink','drive','drops','drove','drugs','drums','drunk','dryer','dubai','dutch','dying','dylan','eagle','early','earth','ebony','ebook','eddie','edgar','edges','egypt','eight','elder','elect','elite','ellen','ellis','elvis','emacs','email','emily','empty','ended','endif','enemy','enjoy','enter','entry','epson','equal','error','essay','essex','euros','evans','event','every','exact','exams','excel','exist','extra','faced','faces','facts','fails','fairy','faith','falls','false','fancy','fares','farms','fatal','fatty','fault','favor','fears','feeds','feels','fence','ferry','fever','fewer','fiber','fibre','field','fifth','fifty','fight','filed','files','filme','films','final','finds','fired','fires','firms','first','fixed','fixes','flags','flame','flash','fleet','flesh','float','flood','floor','flour','flows','floyd','fluid','flush','flyer','focal','focus','folks','fonts','foods','force','forge','forms','forth','forty','forum','found','frame','frank','fraud','fresh','front','frost','fruit','fully','funds','funky','funny','fuzzy','gains','games','gamma','gates','gauge','genes','genre','ghana','ghost','giant','gifts','girls','given','gives','glass','glenn','globe','glory','gnome','goals','going','gonna','goods','gotta','grace','grade','grain','grams','grand','grant','graph','grass','grave','great','greek','green','grill','gross','group','grove','grown','grows','guard','guess','guest','guide','guild','hairy','haiti','hands','handy','happy','harry','haven','hayes','heads','heard','heart','heath','heavy','helen','hello','helps','hence','henry','herbs','highs','hills','hindu','hints','hired','hobby','holds','holes','holly','homes','honda','honey','honor','hoped','hopes','horny','horse','hosts','hotel','hours','house','human','humor','icons','idaho','ideal','ideas','image','inbox','index','india','indie','inner','input','intel','inter','intro','iraqi','irish','isaac','islam','issue','italy','items','ivory','jacob','james','jamie','janet','japan','jason','jeans','jenny','jerry','jesse','jesus','jewel','jimmy','johns','joins','joint','jokes','jones','joyce','judge','juice','julia','julie','karen','karma','kathy','katie','keeps','keith','kelly','kenny','kenya','kerry','kevin','kills','kinda','kinds','kings','kitty','klein','knife','knock','known','knows','kodak','korea','label','labor','laden','lakes','lamps','lance','lands','lanes','lanka','large','larry','laser','later','latex','latin','laugh','laura','layer','leads','learn','lease','least','leave','leeds','legal','lemon','leone','level','lewis','lexus','light','liked','likes','limit','linda','lined','lines','links','linux','lions','lists','lived','liver','lives','lloyd','loads','loans','lobby','local','locks','lodge','logan','logic','login','logos','looks','loops','loose','lopez','lotus','louis','loved','lover','loves','lower','lucas','lucia','lucky','lunch','lycos','lying','lyric','macro','magic','mails','maine','major','maker','makes','males','malta','mambo','manga','manor','maple','march','marco','mardi','maria','marie','mario','marks','mason','match','maybe','mayor','mazda','meals','means','meant','medal','media','meets','menus','mercy','merge','merit','merry','metal','meter','metro','meyer','miami','micro','might','milan','miles','milfs','mills','minds','mines','minor','minus','mixed','mixer','model','modem','modes','money','monte','month','moore','moral','moses','motel','motor','mount','mouse','mouth','moved','moves','movie','mpegs','msgid','multi','music','myers','nails','naked','named','names','nancy','nasty','naval','needs','nepal','nerve','never','newer','newly','niger','night','nikon','noble','nodes','noise','nokia','north','noted','notes','notre','novel','nurse','nylon','oasis','occur','ocean','offer','often','older','olive','omaha','omega','onion','opens','opera','orbit','order','organ','oscar','other','ought','outer','owned','owner','oxide','ozone','packs','pages','paint','pairs','panel','panic','pants','paper','papua','paris','parks','parts','party','pasta','paste','patch','paths','patio','paxil','peace','pearl','peers','penis','penny','perry','perth','peter','phase','phone','photo','phpbb','piano','picks','piece','pills','pilot','pipes','pitch','pixel','pizza','place','plain','plane','plans','plant','plate','plays','plaza','plots','poems','point','poker','polar','polls','pools','porno','ports','posts','pound','power','press','price','pride','prime','print','prior','prize','probe','promo','proof','proud','prove','proxy','pulse','pumps','punch','puppy','purse','pussy','qatar','queen','query','quest','queue','quick','quiet','quilt','quite','quote','races','racks','radar','radio','raise','rally','ralph','ranch','randy','range','ranks','rapid','rated','rates','ratio','reach','reads','ready','realm','rebel','refer','rehab','relax','relay','remix','renew','reply','reset','retro','rhode','rider','rides','ridge','right','rings','risks','river','roads','robin','robot','rocks','rocky','roger','roles','rolls','roman','rooms','roots','roses','rouge','rough','round','route','rover','royal','rugby','ruled','rules','rural','safer','sagem','saint','salad','salem','sales','sally','salon','samba','samoa','sandy','santa','sanyo','sarah','satin','sauce','saudi','saved','saver','saves','sbjct','scale','scary','scene','scoop','scope','score','scott','scout','screw','scuba','seats','seeds','seeks','seems','sells','sends','sense','serum','serve','setup','seven','shade','shaft','shake','shall','shame','shape','share','shark','sharp','sheep','sheer','sheet','shelf','shell','shift','shine','ships','shirt','shock','shoes','shoot','shops','shore','short','shots','shown','shows','sides','sight','sigma','signs','silly','simon','since','singh','sites','sixth','sized','sizes','skill','skins','skirt','skype','slave','sleep','slide','slope','slots','sluts','small','smart','smell','smile','smith','smoke','snake','socks','solar','solid','solve','songs','sonic','sorry','sorts','souls','sound','south','space','spain','spank','sparc','spare','speak','specs','speed','spell','spend','spent','sperm','spice','spies','spine','split','spoke','sport','spots','spray','squad','stack','staff','stage','stamp','stand','stars','start','state','stats','stays','steal','steam','steel','steps','steve','stick','still','stock','stone','stood','stops','store','storm','story','strap','strip','stuck','study','stuff','style','sucks','sudan','sugar','suite','suits','sunny','super','surge','susan','sweet','swift','swing','swiss','sword','syria','table','tahoe','taken','takes','tales','talks','tamil','tampa','tanks','tapes','tasks','taste','taxes','teach','teams','tears','teddy','teens','teeth','tells','terms','terry','tests','texas','texts','thank','thats','theft','their','theme','there','these','thick','thing','think','third','thong','those','three','throw','thumb','tiger','tight','tiles','timer','times','tions','tired','tires','title','today','token','tokyo','tommy','toner','tones','tools','tooth','topic','total','touch','tough','tours','tower','towns','toxic','trace','track','tract','tracy','trade','trail','train','trans','trash','treat','trees','trend','trial','tribe','trick','tried','tries','trips','trout','truck','truly','trunk','trust','truth','tubes','tulsa','tumor','tuner','tunes','turbo','turns','tvcom','twice','twiki','twins','twist','tyler','types','ultra','uncle','under','union','units','unity','until','upper','upset','urban','usage','users','using','usual','utils','valid','value','valve','vault','vegas','venue','verde','verse','video','views','villa','vinyl','viral','virus','visit','vista','vital','vocal','voice','volvo','voted','votes','vsnet','wages','wagon','wales','walks','walls','wanna','wants','waste','watch','water','watts','waves','wayne','weeks','weird','wells','welsh','wendy','whale','whats','wheat','wheel','where','which','while','white','whole','whore','whose','wider','width','wiley','winds','wines','wings','wired','wires','witch','wives','woman','women','woods','words','works','world','worry','worse','worst','worth','would','wound','wrist','write','wrong','wrote','xanax','xerox','xhtml','yacht','yahoo','yards','years','yeast','yemen','yield','young','yours','youth','yukon','zones','gypsy','etika','funko','abort','gabby','soros','twink','biden','janny','chapo','4chan','tariq','tweet','trump','bussy','sneed','chink','nigga','wigga','caulk','putin','negus','gussy','soren') - ADMIGGER_THREADS = {SIDEBAR_THREAD, BANNER_THREAD, BADGE_THREAD, SNAPPY_THREAD} proxies = {"http":PROXY_URL,"https":PROXY_URL} diff --git a/files/helpers/treasure.py b/files/helpers/treasure.py index 856e01622..043f13987 100644 --- a/files/helpers/treasure.py +++ b/files/helpers/treasure.py @@ -15,32 +15,31 @@ def check_for_treasure(from_comment, in_text): if not FEATURES['GAMBLING']: return - if '!wordle' not in in_text: - seed = randint(1, 1000) - is_special = seed == 1000 - is_standard = seed >= 990 - amount = 0 + seed = randint(1, 1000) + is_special = seed == 1000 + is_standard = seed >= 990 + amount = 0 - if is_special: - amount = randint(special_min, special_max) - elif is_standard: - amount = randint(standard_min, standard_max) - if randint(1, 100) > 90: - if amount > user.coins: amount = user.coins - amount = -amount + if is_special: + amount = randint(special_min, special_max) + elif is_standard: + amount = randint(standard_min, standard_max) + if randint(1, 100) > 90: + if amount > user.coins: amount = user.coins + amount = -amount - if amount != 0: - if amount > 0: - active_lottery = get_active_lottery() - lottery_tickets_seed = randint(1, 100) - lottery_tickets_instead = lottery_tickets_seed <= lotterizer_rate + if amount != 0: + if amount > 0: + active_lottery = get_active_lottery() + lottery_tickets_seed = randint(1, 100) + lottery_tickets_instead = lottery_tickets_seed <= lotterizer_rate - if active_lottery and lottery_tickets_instead: - ticket_count = floor(amount / LOTTERY_TICKET_COST) - grant_lottery_tickets_to_user(user, ticket_count) - from_comment.treasure_amount = f'l{ticket_count}' - return + if active_lottery and lottery_tickets_instead: + ticket_count = floor(amount / LOTTERY_TICKET_COST) + grant_lottery_tickets_to_user(user, ticket_count) + from_comment.treasure_amount = f'l{ticket_count}' + return - user.pay_account('coins', amount) - from_comment.treasure_amount = str(amount) + user.pay_account('coins', amount) + from_comment.treasure_amount = str(amount) diff --git a/files/routes/comments.py b/files/routes/comments.py index 62371f434..69e42b98d 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -22,8 +22,6 @@ from files.routes.routehelpers import execute_shadowban_viewers_and_voters from files.routes.wrappers import * from files.__main__ import app, cache, limiter -WORDLE_COLOR_MAPPINGS = {-1: "🟥", 0: "🟨", 1: "🟩"} - @app.get("/comment/") @app.get("/post///") @app.get("/h//comment/") @@ -239,7 +237,7 @@ def comment(v:User): body_html = sanitize(body_for_sanitize, limit_pings=5, count_emojis=not v.marsify) - if post_target.id not in ADMIGGER_THREADS and '!wordle' not in body.lower() and not (v.agendaposter and v.agendaposter_phrase in body.lower()): + if post_target.id not in ADMIGGER_THREADS and not (v.agendaposter and v.agendaposter_phrase in body.lower()): existing = g.db.query(Comment.id).filter( Comment.author_id == v.id, Comment.deleted_utc == 0, @@ -372,13 +370,11 @@ def comment(v:User): c.voted = 1 check_for_treasure(c, body) - execute_wordle(c, body) check_slots_command(c, v, v) # Increment post count iff not self-reply and not a spammy comment game # Essentially a measure to make comment counts reflect "real" content - if (posting_to_submission and not rts - and not c.wordle_result and not c.slots_result): + if (posting_to_submission and not rts and not c.slots_result): post_target.comment_count += 1 g.db.add(post_target) @@ -547,40 +543,6 @@ def diff_words(answer, guess): return diffs -@app.post("/wordle/") -@limiter.limit('1/second', scope=rpath) -@limiter.limit('1/second', scope=rpath, key_func=get_ID) -@limiter.limit(DEFAULT_RATELIMIT) -@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID) -@auth_required -def handle_wordle_action(cid, v): - comment = get_comment(cid) - - if v.id != comment.author_id: - abort(403) - - guesses, status, answer = comment.wordle_result.split("_") - count = len(guesses.split(" -> ")) - - try: guess = request.values.get("thing").strip().lower() - except: abort(400) - - if len(guess) != 5: abort(400, "Not a valid guess!") - - if status == "active": - guesses += "".join(cg + WORDLE_COLOR_MAPPINGS[diff] for cg, diff in zip(guess, diff_words(answer, guess))) - - if (guess == answer): status = "won" - elif (count == 6): status = "lost" - else: guesses += ' -> ' - - comment.wordle_result = f'{guesses}_{status}_{answer}' - - g.db.add(comment) - - return {"response" : comment.wordle_html(v)} - - @app.post("/toggle_comment_nsfw/") @feature_required('NSFW_MARKING') @limiter.limit('1/second', scope=rpath) diff --git a/files/routes/groups.py b/files/routes/groups.py index 22fcd2c8b..c1d22bf96 100644 --- a/files/routes/groups.py +++ b/files/routes/groups.py @@ -26,7 +26,7 @@ def create_group(v): if not name: abort(400) name = name.strip().lower() - if name.startswith('slots') or name.startswith('wordle') or name.startswith('remindme'): + if name.startswith('slots') or name.startswith('remindme'): return redirect(f"/ping_groups?error=You can't make a group with that name!") if not valid_sub_regex.fullmatch(name): diff --git a/files/templates/comments.html b/files/templates/comments.html index 16f89b221..bfd519b6b 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -233,10 +233,6 @@ {% if c.blackjack_result %} {{c.blackjack_html | safe}} {% endif %} - - {% if c.wordle_result %} - {{c.wordle_html(v) | safe}} - {% endif %} {% if c.active_flags(v) %}
diff --git a/files/templates/formatting.html b/files/templates/formatting.html index 430899b21..9d1901113 100644 --- a/files/templates/formatting.html +++ b/files/templates/formatting.html @@ -233,17 +233,6 @@ Text 2 !biofoids !biofoids - {% if FEATURES['WORDLE'] %} - - Play Wordle
- - * Works only in comments. - - - !wordle - !wordle - - {% endif %}
diff --git a/migrations/20230429-remove-wordle.sql b/migrations/20230429-remove-wordle.sql new file mode 100644 index 000000000..a49d2a2f3 --- /dev/null +++ b/migrations/20230429-remove-wordle.sql @@ -0,0 +1 @@ +alter table comments drop column wordle_result; diff --git a/schema.sql b/schema.sql index a8611828f..07cd0c8bf 100644 --- a/schema.sql +++ b/schema.sql @@ -392,7 +392,6 @@ CREATE TABLE public.comments ( slots_result character varying(36), blackjack_result character varying(860), treasure_amount character varying(10), - wordle_result character varying(115), body_ts tsvector GENERATED ALWAYS AS (to_tsvector('english'::regconfig, (body)::text)) STORED, casino_game_id integer, chuddedfor character varying(50), @@ -2896,4 +2895,3 @@ ALTER TABLE ONLY public.comments -- -- PostgreSQL database dump complete -- -