From bd6feec9784126a24dbfa328113c4e926f2af814 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 22 Sep 2023 19:22:36 +0300 Subject: [PATCH] do this https://rdrama.net/h/chudrama/post/206086/-/5036401#context --- files/helpers/sanitize.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index f97298d45..454ab915b 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -260,6 +260,15 @@ def find_all_emote_endings(word): is_non_ending_found = True + if word.endswith('random'): + kind = word.split('random')[0].title() + if kind == 'Donkeykong': kind = 'Donkey Kong' + elif kind == 'Marseyflag': kind = 'Marsey Flags' + elif kind == 'Marseyalphabet': kind = 'Marsey Alphabet' + + if kind in EMOJI_KINDS: + word = g.db.query(Emoji.name).filter_by(kind=kind).order_by(func.random()).first()[0] + return endings, word @@ -282,16 +291,6 @@ def render_emoji(html, regexp, golden, emojis_used, b=False, is_title=False): old = emoji emoji = emoji.replace('!','').replace('#','') - if emoji.endswith('random'): - kind = emoji.split('random')[0].title() - if kind == 'Donkeykong': kind = 'Donkey Kong' - elif kind == 'Marseyflag': kind = 'Marsey Flags' - elif kind == 'Marseyalphabet': kind = 'Marsey Alphabet' - - if kind in EMOJI_KINDS: - emoji = g.db.query(Emoji.name).filter_by(kind=kind).order_by(func.random()).first()[0] - - emoji_partial_pat = ':{0}:' emoji_partial = ':{0}:' emoji_html = None