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.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/hommaexceli_py/telegram_client.py b/hommaexceli_py/telegram_client.py
index 0c7fcf2..108f525 100644
--- a/hommaexceli_py/telegram_client.py
+++ b/hommaexceli_py/telegram_client.py
@@ -4,6 +4,7 @@ import sys
from os import getenv
from telegram.ext import Updater, CommandHandler, Job
from telegram import Update
+from sheets_client import authenticate_and_fetch_sheets_data
chats_mem_cache = set()
@@ -19,7 +20,9 @@ def _signal_handler(sig, frame):
def _callback_alarm(context):
- context.bot.send_message(chat_id=context.job.context, text="Alarm")
+ rows = authenticate_and_fetch_sheets_data()
+ message = "\n".join(map(str, rows))
+ context.bot.send_message(chat_id=context.job.context, text=message)
def _callback_timer(update: Update, context):
@@ -29,7 +32,7 @@ def _callback_timer(update: Update, context):
chats_mem_cache.add(update.message.chat_id)
context.job_queue.run_repeating(
_callback_alarm,
- datetime.timedelta(seconds=1),
+ datetime.timedelta(seconds=10),
context=update.message.chat_id,
)