From ea1733abdc280f5768b8ac7e757166c27f1e9f68 Mon Sep 17 00:00:00 2001 From: coolneng Date: Mon, 16 Nov 2020 12:03:39 +0100 Subject: [PATCH] Rename search_csv to search_database --- src/bot.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/bot.py b/src/bot.py index 2ccb6b4..5f63f8e 100644 --- a/src/bot.py +++ b/src/bot.py @@ -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()