diff --git a/files/helpers/const.py b/files/helpers/const.py index 99e12aea5..6a4f0a2d7 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -813,16 +813,11 @@ NOTIFIED_USERS = { FORTUNE_REPLIES = ('Your fortune: Allah Wills It','Your fortune: Inshallah, Only Good Things Shall Come To Pass','Your fortune: Allah Smiles At You This Day','Your fortune: Your Bussy Is In For A Blasting','Your fortune: You Will Be Propositioned By A High-Tier Twink','Your fortune: Repent, You Have Displeased Allah And His Vengeance Is Nigh','Your fortune: Reply Hazy, Try Again','Your fortune: lmao you just lost 100 coins','Your fortune: Yikes 😬','Your fortune: You Will Be Blessed With Many Black Bulls','Your fortune: NEETmax, The Day Is Lost If You Venture Outside','Your fortune: A Taste Of Jannah Awaits You Today','Your fortune: Watch Your Back','Your fortune: Outlook good','Your fortune: Godly Luck','Your fortune: Good Luck','Your fortune: Bad Luck','Your fortune: Good news will come to you by mail','Your fortune: Very Bad Luck','Your fortune: キタ━━━━━━(゚∀゚)━━━━━━ !!!!','Your fortune: Better not tell you now','Your fortune: You will meet a dark handsome stranger','Your fortune: ( ´_ゝ`)フーン','Your fortune: Excellent Luck','Your fortune: Average Luck') -EIGHTBALL_REPLIES = [('It is certain.', 0), ('It is decidedly so.', 0), ('Without a doubt.', 0), - ('Yes definitely.', 0), ('You may rely on it.', 0), ('As I see it, yes.', 0), - ('Most likely.', 0), ('Outlook good.', 0), ('Yes.', 0), ('Signs point to yes.', 0), - ('Reply hazy, try again.', 1), ('Ask again later.', 1), ('Better not tell you now.', 1), - ('Cannot predict now.', 1), ('Concentrate and ask again.', 1), ('Don’t count on it.', 2), - ('My reply is no.', 2), ('My sources say no.', 2), ('Outlook not so good.', 2), ('Very doubtful.', 2),] -EIGHTBALL_COLORS = ['#7FEC11', '#E7890C', '#FD4D32'] - FACTCHECK_REPLIES = ('Factcheck: This claim has been confirmed as correct by experts. ','Factcheck: This claim has been classified as misogynistic.','Factcheck: This claim is currently being debunked.','Factcheck: This claim is 100% true.','Factcheck: This claim hurts trans lives.','Factcheck: [REDACTED].','Factcheck: This claim is both true and false.','Factcheck: You really believe that shit? Lmao dumbass nigga 🤣','Factcheck: None of this is real.','Factcheck: Yes.','Factcheck: This claim has not been approved by experts.','Factcheck: This claim is a gross exageration of reality.','Factcheck: WARNING! THIS CLAIM HAS BEEN CLASSIFIED AS DANGEROUS. PLEASE REMAIN STILL, AN AGENT WILL COME TO MEET YOU SHORTLY.') +EIGHTBALL_REPLIES = ('The 8-Ball Says: It is certain.', 'The 8-Ball Says: It is decidedly so.', 'The 8-Ball Says: Without a doubt.', 'The 8-Ball Says: Yes definitely.', 'The 8-Ball Says: You may rely on it.', 'The 8-Ball Says: As I see it, yes.', 'The 8-Ball Says: Most likely.', 'The 8-Ball Says: Outlook good.', 'The 8-Ball Says: Yes.', 'The 8-Ball Says: Signs point to yes.', 'The 8-Ball Says: Reply hazy, try again.', 'The 8-Ball Says: Ask again later.', 'The 8-Ball Says: Better not tell you now.', 'The 8-Ball Says: Cannot predict now.', 'The 8-Ball Says: Concentrate and ask again.', 'The 8-Ball Says: Don’t count on it.', 'The 8-Ball Says: My reply is no.', 'The 8-Ball Says: My sources say no.', 'The 8-Ball Says: Outlook not so good.', 'The 8-Ball Says: Very doubtful.') + + if SITE_NAME == 'rDrama': patron = 'Paypig' else: patron = 'Patron' diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 44a2cbbae..67a1991e0 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -1,5 +1,6 @@ import re from .const import * +from random import choice if SITE_NAME == 'PCM': valid_username_chars = 'a-zA-Z0-9_\-А-я' @@ -127,4 +128,16 @@ def torture_ap(body, username): lines[i] = torture_regex.sub(rf'\1@{username} ', lines[i]) lines[i] = torture_regex2.sub(rf'\1@{username} is ', lines[i]) - return ''.join(lines) \ No newline at end of file + return ''.join(lines) + + +commands = { + "fortune": FORTUNE_REPLIES, + "factcheck": FACTCHECK_REPLIES, + "8ball": EIGHTBALL_REPLIES +} + +command_regex = re.compile("(\s|\n)#(fortune|factcheck|8ball)", flags=re.A|re.I) + +def command_regex_matcher(match, upper=False): + return match.group(1) + choice(commands[match.group(2).lower()]) \ No newline at end of file diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index a63fb6da3..64bad0f2a 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -201,6 +201,8 @@ def sanitize(sanitized, edit=False): sanitized = link_fix_regex.sub(r'\1https://\2', sanitized) + sanitized = command_regex.sub(command_regex_matcher, sanitized) + sanitized = markdown(sanitized) sanitized = strikethrough_regex.sub(r'\1\2', sanitized) @@ -302,25 +304,10 @@ def sanitize(sanitized, edit=False): marsey.count += 1 g.db.add(marsey) - if '#fortune' in sanitized: - sanitized = sanitized.replace('#fortune', '') - sanitized += '\n\n

' + choice(FORTUNE_REPLIES) + '

' - - if '#8ball' in sanitized: - (b8txt, b8knd) = choice(EIGHTBALL_REPLIES) - b8color = EIGHTBALL_COLORS[b8knd] - sanitized = sanitized.replace('#8ball', '') - sanitized += '\n\n

The 8-Ball Says: %s

' % (b8color, b8txt) - - if '#factcheck' in sanitized: - sanitized = sanitized.replace('#factcheck', '') - sanitized += '\n\n

' + choice(FACTCHECK_REPLIES) + '

' - sanitized = sanitized.replace('

', '') sanitized = utm_regex.sub('', sanitized) sanitized = utm_regex2.sub('', sanitized) - sanitized = sanitized.replace('','').replace('','') css_sanitizer = CSSSanitizer(allowed_css_properties=allowed_styles) diff --git a/snappy_rDrama.txt b/snappy_rDrama.txt index 69743d3c2..66a7eb6cc 100644 --- a/snappy_rDrama.txt +++ b/snappy_rDrama.txt @@ -3799,6 +3799,8 @@ This is your fate. This is what you chose. There is no turning back. You are the {[para]} #fortune {[para]} +#8ball +{[para]} ![](/images/16532150566811156.webp) {[para]} ![](/images/16532153390139759.webp)