Skip to content

Commit

Permalink
better emojis replacement (#1596)
Browse files Browse the repository at this point in the history
  • Loading branch information
Saratii authored Nov 23, 2024
1 parent bab1a8b commit e186bfe
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bot/exts/fun/uwu.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@
"^^;;",
]

EMOJI_REPLACE = {
":neutral_face:": ":cat:",
":cry:": ":crying_cat_face:",
":heart_eyes:": ":heart_eyes_cat:",
":joy:": ":joy_cat:",
":kissing:": ":kissing_cat:",
":angry:": ":pouting_cat:",
":scream:": ":scream_cat:",
":laughing:": ":smile_cat:",
":grinning:": ":smiley_cat:",
":smirk:": ":smirk_cat:",
":pleading_face:": ":pleading_face::point_right::point_left:"
}
REGEX_WORD_REPLACE = re.compile(r"(?<!w)[lr](?!w)")

REGEX_PUNCTUATION = re.compile(r"[.!?\r\n\t]")
Expand Down Expand Up @@ -143,6 +156,12 @@ def _ext_emoji_replace(self, input_string: str) -> str:
# Return original if no replacement
return input_string

def _uwu_emojis(self, input_string: str) -> str:
"""Replaces certain emojis with better emojis."""
for old, new in EMOJI_REPLACE.items():
input_string = input_string.replace(old, new)
return input_string

def _uwuify(self, input_string: str, *, stutter_strength: float = 0.2, emoji_strength: float = 0.1) -> str:
"""Takes a string and returns an uwuified version of it."""
input_string = input_string.lower()
Expand All @@ -152,6 +171,7 @@ def _uwuify(self, input_string: str, *, stutter_strength: float = 0.2, emoji_str
input_string = self._stutter(stutter_strength, input_string)
input_string = self._emoji(emoji_strength, input_string)
input_string = self._ext_emoji_replace(input_string)
input_string = self._emoji_replace(input_string)
return input_string

@commands.command(name="uwu", aliases=("uwuwize", "uwuify",))
Expand Down

0 comments on commit e186bfe

Please sign in to comment.