def get_random_word_from_table(message): entry = utilities.get_random_word_from_table("data/presets.db", "devilish") result = f"{smiley['pushpin']}{entry[0]}\n" \ f"{smiley['books']}{entry[1]}\n" \ f"{smiley['speech balloon']}{entry[2]}" utilities.send_animated_message(message, result, category='meaning') find_and_send_pronunciation(message, entry[0])
def find_and_send_pronunciation(message, word): try: result = utilities.grab_pronunciation(word) except FileNotFoundError: utilities.send_animated_message(message, result_messages['wrong word'], 'wrong') else: bot.send_voice(message.from_user.id, result)
def find_pronunciation(message): word = utilities.extract_arg(message.text) try: result = utilities.grab_pronunciation(word) except FileNotFoundError: utilities.send_animated_message(message, result_messages['wrong word'], 'error') else: bot.send_voice(message.from_user.id, result)
def russian_to_english(message): word = utilities.extract_arg(message.text) result = translations.RuEn(word).translate() utilities.send_animated_message(message, result, category='meaning')
def english_to_french(message): word = utilities.extract_arg(message.text) result = translations.EnFr(word).translate() utilities.send_animated_message(message, result, category='meaning')
def define_a_word(message): word = utilities.extract_arg(message.text) result = crawlers.WordReference(word).get_all_definitions_as_string() utilities.send_animated_message(message, result, 'meaning')
def get_full_info_on_word(message): word = utilities.extract_arg(message.text) result = Find(word).get_result_as_string() utilities.send_animated_message(message, result, category='meaning')
def find_in_urban_dictionary(message): word = utilities.extract_arg(message.text) result = crawlers.UrbanDictionary(word).get_result_as_string() utilities.send_animated_message(message, result, category='meaning')
def crypto_stats(message): utilities.send_animated_message(message, crypto.check_favorites(), category='crypto')