""" Converts smileys in a text to their Unicode character representations. """ import prof EMOTICON_UNICODE_DICT = {':)': '😃', ':(': 'â˜šī¸', ':D': '😃', ':O': '😲', ';)': '😉', ':-)': '😊', ':-D': '😁', ':-(': '😞', ';-)': '😜', '<3': 'â¤ī¸', ':P': '😛', ':|': '😐', ':/': '😕', ':*': '😘', ':]': '😃', ':[': 'đŸ˜ĸ', ':-|': '😐', ':\\': '😕', ':3': 'đŸ˜ē', 'O:)': '😇', '>:(': '😠', ':poop:': '💩', ':fire:': 'đŸ”Ĩ', ':heart:': 'â¤ī¸', ':thumbsup:': '👍', ':star:': '⭐', ':beer:': 'đŸē', ':pizza:': '🍕', ':sunglasses:': '😎', ':ok_hand:': '👌', ':heart_eyes:': '😍'} def replace_emoticons(text, emoticon_dict): for emoticon, unicode_char in emoticon_dict.items(): text = text.replace(emoticon, unicode_char) return text def convert_emoticons(input_str): return replace_emoticons(input_str, EMOTICON_UNICODE_DICT) def prof_pre_chat_message_display(barejid, resource, message): return convert_emoticons(message) def prof_pre_room_message_display(barejid, nick, message): return convert_emoticons(message) def prof_pre_priv_message_display(barejid, nick, message): return convert_emoticons(message)