mirror of https://gitlab.com/akasroua/covot
Rename search_csv to search_database
This commit is contained in:
parent
34fe64049b
commit
ea1733abdc
12
src/bot.py
12
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()
|
||||
|
|
Loading…
Reference in New Issue