File tree Expand file tree Collapse file tree 4 files changed +17
-11
lines changed Expand file tree Collapse file tree 4 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 33# Date: 2019/6/23
44# Author: snow
55
6-
76script_name = 'EverydayWechat'
8- __version__ = '0.3.21'
7+ __author__ = 'sfyc23'
8+ __license__ = 'MIT'
9+ __version__ = '0.3.22'
910
Original file line number Diff line number Diff line change @@ -28,6 +28,6 @@ def get_caihongpi_info():
2828get_one_words = get_caihongpi_info
2929
3030if __name__ == '__main__' :
31- # ow = get_one_words()
32- # print(ow)
31+ ow = get_one_words ()
32+ print (ow )
3333 pass
Original file line number Diff line number Diff line change @@ -89,13 +89,13 @@ def _online():
8989 print ('登录成功' )
9090 return True
9191 except Exception as exception : # 登录失败的错误处理。
92- delete_cache () # 清理缓存数据
9392 sex = str (exception )
9493 if sex == "'User'" :
9594 print ('此微信号不能登录网页版微信,不能运行此项目。没有任何其它解决办法!可以换个号再试试。' )
9695 else :
9796 print (sex )
9897
98+ delete_cache () # 清理缓存数据
9999 print ('登录失败。' )
100100 return False
101101
@@ -169,6 +169,8 @@ def send_alarm_msg(key):
169169def text_reply (msg ):
170170 """ 监听用户消息,用于自动回复 """
171171 handle_friend (msg )
172+ # 下面这段代码,可以很直观打印出返回的消息的数据结构。
173+ # 把打印的数据复制到 https://www.json.cn/ 可查看详细的内容。群消息同理
172174 # import json
173175 # print(json.dumps(msg, ensure_ascii=False))
174176
Original file line number Diff line number Diff line change @@ -91,20 +91,23 @@ def handle_group_helper(msg):
9191 :param msg:
9292 :return:
9393 """
94+ uuid = msg .fromUserName # 群 uid
95+ ated_uuid = msg .actualUserName # 艾特你的用户的uuid
96+ ated_name = msg .actualNickName # 艾特你的人的群里的名称
97+ text = msg ['Text' ] # 发送到群里的消息。
98+
99+ # 自己通过手机端微信发出的消息不作处理
100+ if ated_uuid == config .get ('wechat_uuid' ):
101+ return
94102
95103 conf = config .get ('group_helper_conf' )
96104 if not conf .get ('is_open' ):
97105 return
98- text = msg ['Text' ] # 群里消息。
99106
100107 # 如果开启了 『艾特才回复』,而群用户又没有艾特你。不处理消息
101108 if conf .get ('is_at' ) and not msg .isAt :
102109 return
103110
104- uuid = msg .fromUserName # 群 uid
105- ated_uuid = msg .actualUserName # 艾特你的用户的uuid
106- ated_name = msg .actualNickName # 艾特你的人的群里的名称
107-
108111 is_all = conf .get ('is_all' , False )
109112 user_uuids = conf .get ('group_black_uuids' ) if is_all else conf .get ('group_white_uuids' )
110113 # 开启回复所有群,而用户是黑名单,不处理消息
@@ -117,7 +120,7 @@ def handle_group_helper(msg):
117120 # 去掉 at 标记
118121 text = re .sub (at_compile , '' , text )
119122
120- # 如果是帮助
123+ # 如果是帮助设置
121124 helps = re .findall (help_complie , text , re .I )
122125 if helps :
123126 retext = help_group_content .format (ated_name = ated_name )
You can’t perform that action at this time.
0 commit comments