This repository has been archived by the owner on Sep 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsg_filtrada.py
40 lines (31 loc) · 1.49 KB
/
msg_filtrada.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import time
from sqlalchemy.orm import sessionmaker
from telegram import ParseMode
from telegram.ext import run_async
import db
Session = sessionmaker(bind=db.gen_engine(db.get_database_url()))
msg = '''
Agradecemos pelo seu feedback! Entraremos em contato em qualquer circunstância. Muito obrigado mais uma vez por utilizar o serviço!
Caso deseje entrar em contato, fique a vontade para mandar a mensagem que quiser. Estaremos conferindo cada uma.'''
@run_async
def main(bot, update):
telegram_id = update['message']['chat']['id']
texto = str(update['message']['text']).lower()
session = Session()
admin = session.query(db.Admins).filter_by(user_id=telegram_id).first()
if not admin:
session.add(db.Chat(telegram_id, texto, time.strftime("%d/%m/%Y %H:%M:%S", time.localtime())))
session.commit()
session.close()
bot.send_message(chat_id=telegram_id, text=msg, parse_mode=ParseMode.HTML)
@run_async
def unknown(bot, update):
telegram_id = update['message']['chat']['id']
texto = str(update['message']['text']).lower()
session = Session()
admin = session.query(db.Admins).filter_by(user_id=telegram_id).first()
if not admin:
session.add(db.Chat(telegram_id, texto, time.strftime("%d/%m/%Y %H:%M:%S", time.localtime())))
session.commit()
session.close()
bot.send_message(chat_id=telegram_id, text='Olá! Esse serviço foi descontinuado! Não é possível mais, por meio deste, obter suas informações.', parse_mode=ParseMode.HTML)