wangkun %!s(int64=2) %!d(string=hai) anos
pai
achega
fc7bb5c745
Modificáronse 2 ficheiros con 9 adicións e 6 borrados
  1. 3 1
      main/demo.py
  2. 6 5
      main/run_bot.py

+ 3 - 1
main/demo.py

@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 # @Author: wangkun
 # @Time: 2022/8/10
+import datetime
 from main.feishu_lib import Feishu
 
 
@@ -15,4 +16,5 @@ class Demo:
 
 
 if __name__ == "__main__":
-    Demo.demo1()
+    # Demo.demo1()
+    print((24-datetime.datetime.now().hour)*3600)

+ 6 - 5
main/run_bot.py

@@ -209,7 +209,8 @@ class Bot:
         # 已下载表,超过 24 小时无新视频入库报警
         duration = 3600 * 24
         while True:
-            if 21 > datetime.datetime.now().hour >= 10:
+            # if 21 > datetime.datetime.now().hour >= 10:
+            if datetime.datetime.now().hour == 10:
 
                 Common.logger("bot").info("监控看一看已下载表")
                 Bot.robot_download_sheet("bot", "kanyikan", duration)
@@ -229,15 +230,15 @@ class Bot:
                 Common.logger("bot").info("监控公众号已下载表")
                 Bot.robot_download_sheet("bot", "gzh", duration)
 
-                # Common.logger("bot").info("监控音乐相册已下载表")
-                # Bot.robot_download_sheet("bot", "music_album", duration)
+                Common.logger("bot").info("监控音乐相册已下载表")
+                Bot.robot_download_sheet("bot", "music_album", duration)
 
                 # Common.logger("bot").info("监控微群视频已下载表")
                 # Bot.robot_download_sheet("bot", "weiqun", duration)
 
                 Common.del_logs("bot")
-                Common.logger("bot").info("休眠 6 小时")
-                time.sleep(3600 * 6)
+                Common.logger("bot").info("休眠{}小时", 24-3600*datetime.datetime.now().hour)
+                time.sleep(3600 * (24-3600*datetime.datetime.now().hour))
             else:
                 pass
                 # Common.logger("bot").info("今日监控完毕\n")