From 909ce794a8d6d4c207d5b96c0200c8bde326e8be Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Fri, 12 Feb 2021 16:24:45 +0200 Subject: Add date parsing --- hommaexceli_py/telegram_client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'hommaexceli_py/telegram_client.py') diff --git a/hommaexceli_py/telegram_client.py b/hommaexceli_py/telegram_client.py index 5e845a5..2d30b01 100644 --- a/hommaexceli_py/telegram_client.py +++ b/hommaexceli_py/telegram_client.py @@ -6,6 +6,8 @@ from os import getenv from telegram.ext import Updater, CommandHandler, Job from telegram import Update from sheets_client import authenticate_and_fetch_sheets_data +from parser import process_rows + chats_mem_cache = set() @@ -25,8 +27,11 @@ def _callback_alarm(context): logging.info(f"Authenticating and fetching data from Sheets...") rows = authenticate_and_fetch_sheets_data() + logging.info(f"Processing data...") + processed_data = process_rows(rows) + logging.info(f"Sending sheet data to chat id {chat_id}...") - message = "\n".join(map(str, rows)) + message = "\n".join(map(str, processed_data)) context.bot.send_message(chat_id=chat_id, text=message) @@ -40,6 +45,7 @@ def _callback_timer(update: Update, context): context.job_queue.run_repeating( _callback_alarm, datetime.timedelta(weeks=1), + 1, # run immediately context=chat_id, ) -- cgit v1.3