""" script for regularly sending updates on shares and news based on user interval """ __author__ = "Florian Kellermann, Linus Eickhoff" __date__ = "05.04.2022" __version__ = "0.0.1" __license__ = "None" from shares.share_fetcher import get_share_price import time from bot import bot import sys ''' * * * * * code ┬ ┬ ┬ ┬ ┬ │ │ │ │ │ │ │ │ │ └──── weekday (0->Monday, 7->Sunday) │ │ │ └────── Month (1-12) │ │ └──────── Day (1-31) │ └────────── Hour (0-23) └──────────── Minute (0-59) example 0 8 * * * -> daily update at 8am ''' user_ids = [] user_crontab = [] def main_loop(): """ main loop for regularly sending updates :raises: none :rtype: none """ current_time = time.ctime() send_to_user(current_time) def send_to_user(pText, pUser_id = 1770205310): """ Send message to user :type pText: string :param pText: Text to send to user :type pUser_id: int :param pUser_id: user to send to. per default me (Florian Kellermann) :raises: none :rtype: none """ bot.send_message(chat_id=pUser_id, text=pText) if __name__ == "__main__": print('This script shall not be run directly. Starting main_loop for debugging purposes.') try: main_loop() sys.exit(-1) except KeyboardInterrupt: print("Ending") sys.exit(-1)