Skip to content

Commit

Permalink
🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles-Hello committed Sep 9, 2023
1 parent b7985c7 commit 34e35cc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ log_days = 10
# 文件缓存天数,为0则不清理缓存,每天凌晨清理
cache_days = 3


#push_plus通知
push_plus_token = ""

15 changes: 8 additions & 7 deletions wechatbot_client/action_manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ class ApiManager:
file_base_url: str
"""文件base url"""

def __init__(self) -> None:
def __init__(self,config) -> None:
self.com_api = ComWechatApi()
self.file_manager = None

def init(self, file_manager: FileManager, config: Config) -> None:
self.config = config
def init(self, file_manager: FileManager) -> None:
"""
初始化com
"""
self.file_manager = file_manager
self.file_base_url = f"http://{config.host}:{config.port}/get_file/"
self.file_base_url = f"http://{self.config.host}:{self.config.port}/get_file/"
# 初始化com组件
log("DEBUG", "<y>初始化com组件...</y>")
if not self.com_api.init():
Expand Down Expand Up @@ -90,7 +90,7 @@ def init(self, file_manager: FileManager, config: Config) -> None:
log("SUCCESS", "<g>登录完成...</g>")


def push(self,config: Config):
def push(self):
headers = {
'Accept': '*/*',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
Expand All @@ -99,7 +99,7 @@ def push(self,config: Config):
'Content-Type': 'application/json;charset=UTF-8',
}
json_data = {
'token': config.push_plus_token,
'token': self.config.push_plus_token,
'title': '微信登录',
'content': '快去登录!!',
'template': 'html',
Expand All @@ -115,14 +115,15 @@ def wait_for_login(self) -> bool:
等待登录
"""
count =0
self.push()
while True:
try:
if self.com_api.is_wechat_login():
return True
time.sleep(1)
count += count
if count % 300 == 0:
self.push(Config)
self.push()
except KeyboardInterrupt:
return False

Expand Down
4 changes: 2 additions & 2 deletions wechatbot_client/wechat/wechat.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ def __init__(self, config: Config) -> None:
super().__init__(config)
self.self_id = None
self.message_handler = None
self.action_manager = ActionManager()
self.action_manager = ActionManager(config=config)
self.file_manager = FileManager()

def init(self) -> None:
"""
初始化wechat管理端
"""
self.action_manager.init(self.file_manager, self.config)
self.action_manager.init(self.file_manager)

log("DEBUG", "<y>开始获取wxid...</y>")
info = self.action_manager.get_info()
Expand Down
4 changes: 2 additions & 2 deletions 备忘录.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


git tag -a v0.0.6 -m "新增删除文件逻辑"
git push origin v0.0.6
git tag -a v0.0.8 -m "新增微信登录推送,修复对接nonebot2图片"
git push origin v0.0.8



0 comments on commit 34e35cc

Please sign in to comment.