Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better emojis replacement #1596

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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