示例#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)
示例#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)
示例#3
0
文件: bot.py 项目: Seraph90/python
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)