Skip to content

Commit ed3b920

Browse files
committed
修复问题
1 parent 9c77f81 commit ed3b920

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

1.jpg

-3.59 KB
Binary file not shown.

wechatrobot/Api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def SendCard(self , **params) -> Dict:
2727
def SendImage(self , **params) -> Dict:
2828
return self.post(WECHAT_MSG_SEND_IMAGE , SendImageBody(**params))
2929

30-
def SendFile(**params) -> Dict:
30+
def SendFile(self , **params) -> Dict:
3131
return self.post(WECHAT_MSG_SEND_FILE , SendFileBody(**params))
3232

3333
def SendArticle(**params) -> Dict:

wechatrobot/Modles.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ class SendCardBody(Body):
9393
nickname : str
9494

9595
class SendImageBody(Body):
96-
receiver : str
97-
img_path : str
96+
receiver : str
97+
img_path : str
9898

9999
class SendFileBody(Body):
100-
receiver : str
101-
file_path : str
100+
receiver : str
101+
file_path : str
102102

103103
class SendArticleBody(Body):
104104
wxid : str

wechatrobot/WeChatRobot.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313
Bus = EventBus()
1414

15-
# BASE_PATH = '''C:\\users\\user\My Documents\WeChat Files\\'''
16-
1715
class WeChatRobot:
16+
BASE_PATH = "C:\\users\\user\\My Documents\\WeChat Files"
17+
1818
def __init__(self , ip : str = "0.0.0.0" , port : int = 23456):
1919
self.ip = ip
2020
self.port = port
@@ -32,8 +32,8 @@ def deco(func: Callable) -> Callable:
3232
def run(self , main_thread : bool = True):
3333
#StartHook
3434
self.StartMsgHook(port = self.port)
35-
self.StartImageHook(save_path = "C:\\users\\user\\My Documents\\WeChat Files")
36-
self.StartVoiceHook(save_path = "C:\\users\\user\\My Documents\\WeChat Files")
35+
self.StartImageHook(save_path = self.BASE_PATH)
36+
self.StartVoiceHook(save_path = self.BASE_PATH)
3737

3838
class ReceiveMsgSocketServer(socketserver.BaseRequestHandler):
3939
def __init__(self, *args, **kwargs):
@@ -75,8 +75,8 @@ def receive_callback(self , msg):
7575
Bus.emit("self_msg", msg)
7676
elif "chatroom" in msg["sender"]:
7777
Bus.emit("group_msg", msg)
78-
elif "gh_" in msg["sender"]:
79-
Bus.emit("public_msg", msg)
78+
# elif "gh_" in msg["sender"]:
79+
# Bus.emit("public_msg", msg)
8080
else:
8181
Bus.emit("friend_msg", msg)
8282

@@ -115,5 +115,8 @@ def handle(self):
115115
logging.error(e)
116116
return None
117117

118+
def get_base_path(self):
119+
return self.BASE_PATH
120+
118121
def __getattr__(self , item : str):
119122
return self.api.exec_command(item)

0 commit comments

Comments
 (0)