Rename search_csv to search_database

This commit is contained in:
coolneng 2020-11-16 12:03:39 +01:00
parent 34fe64049b
commit ea1733abdc
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 4 additions and 8 deletions

View File

@ -3,8 +3,8 @@ import logging
from telethon import TelegramClient, events
from telethon.sessions import StringSession
from constants import API_HASH, API_ID, BOT_TOKEN, CSV_FILE, SESSION
from database import search_csv
from constants import API_HASH, API_ID, BOT_TOKEN, SESSION
from database import search_database
from notifier import send_mail
logging.basicConfig(
@ -29,16 +29,12 @@ async def start(event):
events.NewMessage(pattern=r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)")
)
async def identify(event):
user = search_csv(filepath=CSV_FILE, id=event.raw_text)
user = search_database(id=event.raw_text)
send_mail(recipient=user["correo_institucional"])
await event.respond(
"El usuario se ha identificado con éxito. Se ha mandado una clave alfanumérica a su correo institucional. Por favor envíe la clave para continuar con el proceso."
)
def main():
bot.run_until_disconnected()
if __name__ == "__main__":
main()
bot.run_until_disconnected()