fix reset time
This commit is contained in:
parent
890b8b4493
commit
257555242e
@ -6,7 +6,7 @@ from uuid import uuid4
|
|||||||
import humanize
|
import humanize
|
||||||
import markovify
|
import markovify
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.timezone import localdate, now, make_aware
|
from django.utils.timezone import localdate, now, make_aware, localtime
|
||||||
from jsoneditor.forms import JSONEditor
|
from jsoneditor.forms import JSONEditor
|
||||||
from jsonfield import JSONField
|
from jsonfield import JSONField
|
||||||
from telegram import Update, Chat, User, InlineQueryResultArticle, InputTextMessageContent
|
from telegram import Update, Chat, User, InlineQueryResultArticle, InputTextMessageContent
|
||||||
@ -61,7 +61,7 @@ class CyberLinaBotModuleConfig(TelegramBotModuleConfig):
|
|||||||
self.message_handler(update, ctx)
|
self.message_handler(update, ctx)
|
||||||
chat = self.chats.get(chat_id=update.effective_chat.id)
|
chat = self.chats.get(chat_id=update.effective_chat.id)
|
||||||
if chat.last_run and (chat.last_run >= localdate() or
|
if chat.last_run and (chat.last_run >= localdate() or
|
||||||
chat.last_run + timedelta(1) == localdate() and now().hour < 6):
|
chat.last_run + timedelta(1) == localdate() and localtime().hour < 6):
|
||||||
humanize.i18n.activate('ru_RU')
|
humanize.i18n.activate('ru_RU')
|
||||||
time_left = make_aware(datetime.combine(chat.last_run + timedelta(1), time(6, 0))) - now()
|
time_left = make_aware(datetime.combine(chat.last_run + timedelta(1), time(6, 0))) - now()
|
||||||
return update.effective_message.reply_text(
|
return update.effective_message.reply_text(
|
||||||
|
Loading…
Reference in New Issue
Block a user