workday_end_handler.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:mobot 作者: JokerQyou 项目源码 文件源码
def workday_end_time(bot, update):
    bot.sendChatAction(
        chat_id=update.message.chat_id, action=ChatAction.TYPING
    )
    text_templates = (
        '{}?????????????',
        '?????{}',
        '??{}????',
        '??????{}',
        '???{}????',
        '????{}',
        '??????: {}',
    )

    now = TZ.normalize(update.message.date.replace(tzinfo=pytz.utc))
    end_time = TZ.localize(datetime(now.year, now.month, now.day, hour=18))
    duration = end_time - now

    hour = duration.seconds // 3600
    minute = (duration.seconds % 3600) // 60
    time_remaining = ' {} ??'.format(hour) if hour else ''
    time_remaining += ' {} ??'.format(minute)

    text = random.choice(text_templates).format(time_remaining)
    update.message.reply_text(text, quote=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号