Example #1
0
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])
Example #2
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)
Example #3
0
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)
Example #4
0
def russian_to_english(message):
    word = utilities.extract_arg(message.text)
    result = translations.RuEn(word).translate()
    utilities.send_animated_message(message, result, category='meaning')
Example #5
0
def english_to_french(message):
    word = utilities.extract_arg(message.text)
    result = translations.EnFr(word).translate()
    utilities.send_animated_message(message, result, category='meaning')
Example #6
0
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')
Example #7
0
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')
Example #8
0
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')
Example #9
0
def crypto_stats(message):
    utilities.send_animated_message(message,
                                    crypto.check_favorites(),
                                    category='crypto')