diff --git a/mojo-rtm/mojo-rtm.py b/mojo-rtm/mojo-rtm.py index 2b3da53..f04469b 100644 --- a/mojo-rtm/mojo-rtm.py +++ b/mojo-rtm/mojo-rtm.py @@ -19,6 +19,19 @@ def parse_direct_mention(message_text): return (matches.group(1), matches.group(2).strip()) if matches else (None, None) +async def zalgo_ify(text): + ''' Takes some normal text and zalgo-ifies it ''' + # "Combining Diacritical Marks" Unicode block. + combining_chars = [chr(n) for n in range(768, 878)] + + zalgo_text = '' + + for char in text: + combining_char = random.choice(combining_chars) + zalgo_text += f'{char}{combining_char}' + + return zalgo_text + def reactable_string(text): """ Return regex objects matching interesting strings @@ -81,6 +94,8 @@ def handle_messages(**payload): with open("/shared/state.log", "r") as json_File: for line in json_File: response.append(json.loads(line)) + elif "zalgo" in is_command[1]: + zalgo_ify(is_command[1]) elif "pence" in is_command[1]: response = "mother wouldn't want me to say that" else: