aboutsummaryrefslogtreecommitdiffstats
path: root/hommaexceli_py/telegram_client.py
diff options
context:
space:
mode:
Diffstat (limited to 'hommaexceli_py/telegram_client.py')
-rw-r--r--hommaexceli_py/telegram_client.py8
1 files changed, 7 insertions, 1 deletions
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,
)