diff --git a/modules/games/joke.py b/modules/games/joke.py index 74d1432..68be00f 100644 --- a/modules/games/joke.py +++ b/modules/games/joke.py @@ -1,10 +1,7 @@ from dadjokes import Dadjoke # pip install dadjokes from modules.log import * - - -def sendWithEmoji(message): - # this will take a string of text and replace any word or phrase that is in the word list with the corresponding emoji +def tableOfContents(): wordToEmojiMap = { 'love': 'โค๏ธ', 'heart': 'โค๏ธ', 'happy': '๐Ÿ˜Š', 'smile': '๐Ÿ˜Š', 'sad': '๐Ÿ˜ข', 'angry': '๐Ÿ˜ ', 'mad': '๐Ÿ˜ ', 'cry': '๐Ÿ˜ข', 'laugh': '๐Ÿ˜‚', 'funny': '๐Ÿ˜‚', 'cool': '๐Ÿ˜Ž', 'joy': '๐Ÿ˜‚', 'kiss': '๐Ÿ˜˜', 'hug': '๐Ÿค—', 'wink': '๐Ÿ˜‰', 'grin': '๐Ÿ˜', 'bored': '๐Ÿ˜', 'tired': '๐Ÿ˜ด', 'sleepy': '๐Ÿ˜ด', 'shocked': '๐Ÿ˜ฒ', 'surprised': '๐Ÿ˜ฒ', @@ -53,16 +50,52 @@ def sendWithEmoji(message): 'school': '๐Ÿซ', 'department store': '๐Ÿฌ', 'factory': '๐Ÿญ', 'japanese castle': '๐Ÿฏ', 'castle': '๐Ÿฐ', 'wedding': '๐Ÿ’’', 'tokyo tower': '๐Ÿ—ผ', 'statue of liberty': '๐Ÿ—ฝ', 'church': 'โ›ช', 'mosque': '๐Ÿ•Œ', 'hindu temple': '๐Ÿ›•', 'synagogue': '๐Ÿ•', 'shinto shrine': 'โ›ฉ๏ธ', 'kaaba': '๐Ÿ•‹', 'fountain': 'โ›ฒ', 'tent': 'โ›บ', 'foggy': '๐ŸŒ', 'night with stars': '๐ŸŒƒ', 'sunrise over mountains': '๐ŸŒ„', 'sunrise': '๐ŸŒ…', 'cityscape at dusk': '๐ŸŒ†', 'sunset': '๐ŸŒ‡', 'cityscape': '๐Ÿ™๏ธ', 'bridge at night': '๐ŸŒ‰', 'hot springs': 'โ™จ๏ธ', 'carousel horse': '๐ŸŽ ', 'ferris wheel': '๐ŸŽก', 'roller coaster': '๐ŸŽข', 'barber pole': '๐Ÿ’ˆ', - 'circus tent': '๐ŸŽช', 'locomotive': '๐Ÿš‚', 'arm': '๐Ÿ’ช', 'leg': '๐Ÿฆต' - } + 'robot': '๐Ÿค–', 'alien': '๐Ÿ‘ฝ', 'ghost': '๐Ÿ‘ป', 'skull': '๐Ÿ’€', 'pumpkin': '๐ŸŽƒ', 'clown': '๐Ÿคก', 'wizard': '๐Ÿง™', 'elf': '๐Ÿง', 'fairy': '๐Ÿงš', 'mermaid': '๐Ÿงœ', 'vampire': '๐Ÿง›', + 'zombie': '๐ŸงŸ', 'genie': '๐Ÿงž', 'superhero': '๐Ÿฆธ', 'supervillain': '๐Ÿฆน', 'mage': '๐Ÿง™', 'knight': '๐Ÿ›ก๏ธ', 'ninja': '๐Ÿฅท', 'pirate': '๐Ÿดโ€โ˜ ๏ธ', 'angel': '๐Ÿ‘ผ', 'devil': '๐Ÿ˜ˆ', 'dragon': '๐Ÿ‰', + 'unicorn': '๐Ÿฆ„', 'phoenix': '๐Ÿฆ…', 'griffin': '๐Ÿฆ…', 'centaur': '๐ŸŽ', 'minotaur': '๐Ÿ‚', 'cyclops': '๐Ÿ‘๏ธ', 'medusa': '๐Ÿ', 'sphinx': '๐Ÿฆ', 'kraken': '๐Ÿฆ‘', 'yeti': 'โ„๏ธ', 'sasquatch': '๐Ÿฆง', + 'loch ness monster': '๐Ÿฆ•', 'chupacabra': '๐Ÿ', 'banshee': '๐Ÿ‘ป', 'golem': '๐Ÿ—ฟ', 'djinn': '๐Ÿงž', 'basilisk': '๐Ÿ', 'hydra': '๐Ÿ‰', 'cerberus': '๐Ÿถ', 'chimera': '๐Ÿ', 'manticore': '๐Ÿฆ', 'wyvern': '๐Ÿ‰', + 'pegasus': '๐Ÿฆ„', 'hippogriff': '๐Ÿฆ…', 'kelpie': '๐ŸŽ', 'selkie': '๐Ÿฆญ', 'kitsune': '๐ŸฆŠ', 'tanuki': '๐Ÿฆ', 'tengu': '๐Ÿฆ…', 'oni': '๐Ÿ‘น', 'yokai': '๐Ÿ‘ป', 'kappa': '๐Ÿข', 'yurei': '๐Ÿ‘ป', + 'kami': '๐Ÿ‘ผ', 'shinigami': '๐Ÿ’€', 'bakemono': '๐Ÿ‘น', 'tsukumogami': '๐Ÿงธ', 'noppera-bo': '๐Ÿ‘ค', 'rokurokubi': '๐Ÿง›', 'yuki-onna': 'โ„๏ธ', 'jorogumo': '๐Ÿ•ท๏ธ', 'nue': '๐Ÿ', 'ubume': '๐Ÿ‘ผ', 'tengu': '๐Ÿฆ…' + 'mermaid': '๐Ÿงœ', 'vampire': '๐Ÿง›', 'zombie': '๐ŸงŸ', 'genie': '๐Ÿงž', 'superhero': '๐Ÿฆธ', 'supervillain': '๐Ÿฆน', 'mage': '๐Ÿง™', 'knight': '๐Ÿ›ก๏ธ', 'ninja': '๐Ÿฅท', 'pirate': '๐Ÿดโ€โ˜ ๏ธ', 'angel': '๐Ÿ‘ผ', 'devil': '๐Ÿ˜ˆ', 'dragon': '๐Ÿ‰', + 'unicorn': '๐Ÿฆ„', 'phoenix': '๐Ÿฆ…', 'griffin': '๐Ÿฆ…', 'centaur': '๐ŸŽ', 'minotaur': '๐Ÿ‚', 'cyclops': '๐Ÿ‘๏ธ', 'medusa': '๐Ÿ', 'sphinx': '๐Ÿฆ', 'kraken': '๐Ÿฆ‘', 'yeti': 'โ„๏ธ', 'sasquatch': '๐Ÿฆง', + 'loch ness monster': '๐Ÿฆ•', 'chupacabra': '๐Ÿ', 'banshee': '๐Ÿ‘ป', 'golem': '๐Ÿ—ฟ', 'djinn': '๐Ÿงž', 'basilisk': '๐Ÿ', 'hydra': '๐Ÿ‰', 'cerberus': '๐Ÿถ', 'chimera': '๐Ÿ', 'manticore': '๐Ÿฆ', 'wyvern': '๐Ÿ‰', + 'pegasus': '๐Ÿฆ„', 'hippogriff': '๐Ÿฆ…', 'kelpie': '๐ŸŽ', 'selkie': '๐Ÿฆญ', 'kitsune': '๐ŸฆŠ', 'tanuki': '๐Ÿฆ', 'tengu': '๐Ÿฆ…', 'oni': '๐Ÿ‘น', 'yokai': '๐Ÿ‘ป', 'kappa': '๐Ÿข', 'yurei': '๐Ÿ‘ป', + 'kami': '๐Ÿ‘ผ', 'shinigami': '๐Ÿ’€', 'bakemono': '๐Ÿ‘น', 'tsukumogami': '๐Ÿงธ', 'noppera-bo': '๐Ÿ‘ค', 'rokurokubi': '๐Ÿง›', 'yuki-onna': 'โ„๏ธ', 'jorogumo': '๐Ÿ•ท๏ธ', 'nue': '๐Ÿ', 'ubume': '๐Ÿ‘ผ', 'tengu': '๐Ÿฆ…', + 'phoenix': '๐Ÿฆ…', 'griffin': '๐Ÿฆ…', 'centaur': '๐ŸŽ', 'minotaur': '๐Ÿ‚', 'cyclops': '๐Ÿ‘๏ธ', 'medusa': '๐Ÿ', 'sphinx': '๐Ÿฆ', 'kraken': '๐Ÿฆ‘', 'yeti': 'โ„๏ธ', 'sasquatch': '๐Ÿฆง', 'loch ness monster': '๐Ÿฆ•', + 'chupacabra': '๐Ÿ', 'banshee': '๐Ÿ‘ป', 'golem': '๐Ÿ—ฟ', 'djinn': '๐Ÿงž', 'basilisk': '๐Ÿ', 'hydra': '๐Ÿ‰', 'cerberus': '๐Ÿถ', 'chimera': '๐Ÿ', 'manticore': '๐Ÿฆ', 'wyvern': '๐Ÿ‰', 'pegasus': '๐Ÿฆ„', + 'hippogriff': '๐Ÿฆ…', 'kelpie': '๐ŸŽ', 'selkie': '๐Ÿฆญ', 'kitsune': '๐ŸฆŠ', 'tanuki': '๐Ÿฆ', 'tengu': '๐Ÿฆ…', 'oni': '๐Ÿ‘น', 'yokai': '๐Ÿ‘ป', 'kappa': '๐Ÿข', 'yurei': '๐Ÿ‘ป', 'kami': '๐Ÿ‘ผ', + 'shinigami': '๐Ÿ’€', 'bakemono': '๐Ÿ‘น', 'tsukumogami': '๐Ÿงธ', 'noppera-bo': '๐Ÿ‘ค', 'rokurokubi': '๐Ÿง›', 'yuki-onna': 'โ„๏ธ', 'jorogumo': '๐Ÿ•ท๏ธ', 'nue': '๐Ÿ', 'ubume': '๐Ÿ‘ผ', 'tengu': '๐Ÿฆ…' + 'atom': 'โš›๏ธ', 'dna': '๐Ÿงฌ', 'microscope': '๐Ÿ”ฌ', 'telescope': '๐Ÿ”ญ', 'rocket': '๐Ÿš€', 'satellite': '๐Ÿ›ฐ๏ธ', 'robot': '๐Ÿค–', 'alien': '๐Ÿ‘ฝ', 'spaceship': '๐Ÿ›ธ', 'planet': '๐Ÿช', + 'black hole': '๐Ÿ•ณ๏ธ', 'galaxy': '๐ŸŒŒ', 'comet': 'โ˜„๏ธ', 'star': 'โญ', 'constellation': '๐ŸŒ ', 'lightning': 'โšก', 'magnet': '๐Ÿงฒ', 'battery': '๐Ÿ”‹', 'computer': '๐Ÿ’ป', 'keyboard': 'โŒจ๏ธ', + 'mouse': '๐Ÿ–ฑ๏ธ', 'printer': '๐Ÿ–จ๏ธ', 'floppy disk': '๐Ÿ’พ', 'cd': '๐Ÿ’ฟ', 'dvd': '๐Ÿ“€', 'smartphone': '๐Ÿ“ฑ', 'tablet': '๐Ÿ“ฒ', 'watch': 'โŒš', 'camera': '๐Ÿ“ท', 'video camera': '๐Ÿ“น', + 'projector': '๐Ÿ“ฝ๏ธ', 'radio': '๐Ÿ“ป', 'television': '๐Ÿ“บ', 'satellite dish': '๐Ÿ“ก', 'game controller': '๐ŸŽฎ', 'joystick': '๐Ÿ•น๏ธ', 'vr headset': '๐Ÿ•ถ๏ธ', 'headphones': '๐ŸŽง', 'speaker': '๐Ÿ”Š', + 'light bulb': '๐Ÿ’ก', 'flashlight': '๐Ÿ”ฆ', 'circuit': '๐Ÿ”Œ', 'chip': '๐Ÿ’ป', 'server': '๐Ÿ–ฅ๏ธ', 'database': '๐Ÿ’พ', 'cloud': 'โ˜๏ธ', 'network': '๐ŸŒ', 'code': '๐Ÿ’ป', 'bug': '๐Ÿ›', + 'virus': '๐Ÿฆ ', 'bacteria': '๐Ÿฆ ', 'lab coat': '๐Ÿฅผ', 'safety goggles': '๐Ÿฅฝ', 'test tube': '๐Ÿงช', 'petri dish': '๐Ÿงซ', 'beaker': '๐Ÿงช', 'bunsen burner': '๐Ÿ”ฅ', 'graduated cylinder': '๐Ÿงช', + 'pipette': '๐Ÿงช', 'scalpel': '๐Ÿ”ช', 'syringe': '๐Ÿ’‰', 'pill': '๐Ÿ’Š', 'stethoscope': '๐Ÿฉบ', 'thermometer': '๐ŸŒก๏ธ', 'x-ray': '๐Ÿฉป', 'dna': '๐Ÿงฌ', 'brain': '๐Ÿง ', 'heart': 'โค๏ธ', + 'lung': '๐Ÿซ', 'bone': '๐Ÿฆด', 'muscle': '๐Ÿ’ช', 'robot arm': '๐Ÿฆพ', 'robot leg': '๐Ÿฆฟ', 'prosthetic arm': '๐Ÿฆพ', 'prosthetic leg': '๐Ÿฆฟ', 'wheelchair': '๐Ÿฆฝ', 'crutch': '๐Ÿฆฏ', 'hearing aid': '๐Ÿฆป', + 'glasses': '๐Ÿ‘“', 'magnifying glass': '๐Ÿ”', 'telescope': '๐Ÿ”ญ', 'microscope': '๐Ÿ”ฌ', 'satellite': '๐Ÿ›ฐ๏ธ', 'rocket': '๐Ÿš€', 'spaceship': '๐Ÿ›ธ', 'planet': '๐Ÿช', 'star': 'โญ', 'constellation': '๐ŸŒ ', + 'galaxy': '๐ŸŒŒ', 'black hole': '๐Ÿ•ณ๏ธ', 'comet': 'โ˜„๏ธ', 'lightning': 'โšก', 'magnet': '๐Ÿงฒ', 'battery': '๐Ÿ”‹', 'computer': '๐Ÿ’ป', 'keyboard': 'โŒจ๏ธ', 'mouse': '๐Ÿ–ฑ๏ธ', 'printer': '๐Ÿ–จ๏ธ', + 'floppy disk': '๐Ÿ’พ', 'cd': '๐Ÿ’ฟ', 'dvd': '๐Ÿ“€', 'smartphone': '๐Ÿ“ฑ', 'tablet': '๐Ÿ“ฒ', 'watch': 'โŒš', 'camera': '๐Ÿ“ท', 'video camera': '๐Ÿ“น', 'projector': '๐Ÿ“ฝ๏ธ', 'radio': '๐Ÿ“ป', + 'television': '๐Ÿ“บ', 'satellite dish': '๐Ÿ“ก', 'game controller': '๐ŸŽฎ', 'joystick': '๐Ÿ•น๏ธ', 'vr headset': '๐Ÿ•ถ๏ธ', 'headphones': '๐ŸŽง', 'speaker': '๐Ÿ”Š', 'light bulb': '๐Ÿ’ก', 'flashlight': '๐Ÿ”ฆ', + 'circuit': '๐Ÿ”Œ', 'chip': '๐Ÿ’ป', 'server': '๐Ÿ–ฅ๏ธ', 'database': '๐Ÿ’พ', 'cloud': 'โ˜๏ธ', 'network': '๐ŸŒ', 'code': '๐Ÿ’ป', 'bug': '๐Ÿ›', 'virus': '๐Ÿฆ ', 'bacteria': '๐Ÿฆ ', + 'lab coat': '๐Ÿฅผ', 'safety goggles': '๐Ÿฅฝ', 'test tube': '๐Ÿงช', 'petri dish': '๐Ÿงซ', 'beaker': '๐Ÿงช', 'bunsen burner': '๐Ÿ”ฅ', 'graduated cylinder': '๐Ÿงช', 'pipette': '๐Ÿงช', 'scalpel': '๐Ÿ”ช', + 'syringe': '๐Ÿ’‰', 'pill': '๐Ÿ’Š', 'stethoscope': '๐Ÿฉบ', 'thermometer': '๐ŸŒก๏ธ', 'x-ray': '๐Ÿฉป', 'dna': '๐Ÿงฌ', 'brain': '๐Ÿง ', 'heart': 'โค๏ธ', 'lung': '๐Ÿซ', 'bone': '๐Ÿฆด', + 'muscle': '๐Ÿ’ช', 'robot arm': '๐Ÿฆพ', 'robot leg': '๐Ÿฆฟ', 'prosthetic arm': '๐Ÿฆพ', 'prosthetic leg': '๐Ÿฆฟ', 'wheelchair': '๐Ÿฆฝ', 'crutch': '๐Ÿฆฏ', 'hearing aid': '๐Ÿฆป', 'glasses': '๐Ÿ‘“', + 'magnifying glass': '๐Ÿ”', 'circus tent': '๐ŸŽช', 'locomotive': '๐Ÿš‚', 'arm': '๐Ÿ’ช', 'leg': '๐Ÿฆต' + } + return wordToEmojiMap + +def sendWithEmoji(message): + # this will take a string of text and replace any word or phrase that is in the word list with the corresponding emoji + wordToEmojiMap = tableOfContents() # type format to clean it up - words = message.lower().split() + words = message.split() i = 0 while i < len(words): for phrase in sorted(wordToEmojiMap.keys(), key=len, reverse=True): phrase_words = phrase.split() # Strip punctuation from the words - stripped_words = [word.strip('.,!?') for word in words[i:i+len(phrase_words)]] + stripped_words = [word.lower().strip('.,!?') for word in words[i:i+len(phrase_words)]] if stripped_words == phrase_words: logger.debug(f"System: Replaced the phrase '{phrase}' with '{wordToEmojiMap[phrase]}'") words[i:i+len(phrase_words)] = [wordToEmojiMap[phrase]]