Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Depends on how it's written. It is quite possible that he responds to commands sequentially, ignoring those that are no longer relevant and one of the commands jams him.
Try to log everything, display everything that may be suspicious.
I advise you to read about webhook or bot.poling
Your
problem will be solved by the linebot.polling(none_stop=True)
check today's date, if it's 1 day more than the date you pass it's yesterday, if it == current date it's today. What's so difficult?
Use the library humanize
: https://pypi.org/project/humanize/
In [1]: import humanize
In [2]: import datetime as dt
In [3]: humanize.naturalday(dt.datetime.now() - dt.timedelta(days=1))
Out[3]: 'yesterday'
In [4]: humanize.naturalday(dt.datetime.now() + dt.timedelta(days=1))
Out[4]: 'tomorrow'
In [5]: humanize.naturalday(dt.datetime.now())
Out[5]: 'today'
In [6]: humanize.i18n.activate("ru_RU")
Out[6]: <gettext.GNUTranslations at 0x5a35478>
In [7]: humanize.naturalday(dt.datetime.now() - dt.timedelta(days=1))
Out[7]: 'вчера'
In [8]: humanize.naturalday(dt.datetime.now() + dt.timedelta(days=1))
Out[8]: 'завтра'
In [9]: humanize.naturalday(dt.datetime.now())
Out[9]: 'сегодня'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question