Exemplo n.º 1
0
def text_request(message):
    db = Db(db_dir)
    user_id = message.from_user.id
    text = message.text.split()
    if text:
        for word in text:
            word = word.lower()
            if db.get_word_by_user(user_id, word):
                db.add_word(user_id, word)
            else:
                db.new_word(user_id, word)
Exemplo n.º 2
0
def text_request(message):
    db = Db(db_dir)
    user_id = message.from_user.id
    text = message.text.split()
    if text:
        for word in text:
            word = word.lower()
            if db.get_word_by_user(user_id, word):
                db.add_word(user_id, word)
            else:
                db.new_word(user_id, word)
Exemplo n.º 3
0
def text_request(message):
    db = Db(db_dir)
    user_id = message.from_user.id
    text = re.sub(r'(http.+?\s)|(http.+$)', r' ', message.text)
    text = re.sub(r'[_+-.,!@#$%^&*();/|<>"\']', r' ', text).split()
    if text:
        for word in text:
            word = word.lower()
            if db.get_word_by_user(user_id, word):
                db.add_word(user_id, word)
            else:
                db.new_word(user_id, word)