bot-updates got a send to user function and will be working with crontab
This commit is contained in:
parent
e85bbacdde
commit
40d444f36c
@ -419,7 +419,7 @@ def query_text(inline_query):
|
||||
|
||||
def main_loop():
|
||||
|
||||
""" Get Information about bot status every 3 seconds
|
||||
""" Start bot
|
||||
:raises: none
|
||||
|
||||
:rtype: none
|
||||
|
@ -6,11 +6,16 @@ __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-7, Sunday is 0 or 7)
|
||||
│ │ │ │ └──── weekday (0->Monday, 7->Sunday)
|
||||
│ │ │ └────── Month (1-12)
|
||||
│ │ └──────── Day (1-31)
|
||||
│ └────────── Hour (0-23)
|
||||
@ -18,3 +23,36 @@ __license__ = "None"
|
||||
|
||||
example 0 8 * * * -> daily update at 8am
|
||||
'''
|
||||
|
||||
def main_loop():
|
||||
""" main loop for regularly sending updates
|
||||
:raises: none
|
||||
|
||||
:rtype: none
|
||||
"""
|
||||
|
||||
|
||||
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)
|
Loading…
Reference in New Issue
Block a user