0

I want to write a simple reminder-bot for telegram. Bot gets from user time (Hours:Minutes) and saves it. When system time equals to users remind time, bot sends message to user.

This is how i track current time:

import time

def timer():
    now = time.strftime('%X').split(':')[0:2]
    return now

The question is: How can I make my code wait till time to send message comes without using time.sleep() and checking current time each minute (uses too much memory of raspberrypi)?

N.L0rem
  • 1
  • 5

1 Answers1

0

If you use python-telegram-bot library, you can use the JobQueue to set up timed jobs.

See here for an example.

jeffffc
  • 772
  • 4
  • 13