L
L
Lavrenty Fedotov2017-02-08 19:38:41
Python
Lavrenty Fedotov, 2017-02-08 19:38:41

How to send messages from Telegram Bot at a given time?

Is it possible to send notifications from a Telegram bot at a given time? I saw in the weather bot, for example, that this is implemented
How to do this in python?
Tried https://github.com/dbader/schedule
and

import datetime
import time
report = 'test'
time_now = datetime.datetime.now().time()
report_hour = 17
report_minute = 20
while time_now.hour != report_hour and time_now.minute != report_minute:
    time_now = datetime.datetime.now().time()
    time.sleep(0.5)
else:
    print report

But doesn't work. And when scheduled, the bot does not start at all.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nllm, 2017-02-08
@nllm

run by cron.
There were many similar questions, look at toster.ru

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question