forked from ljc545w/ComWeChatRobot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwxRobot.py
1206 lines (971 loc) · 29.8 KB
/
wxRobot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 24 16:19:48 2022
@author: ljc545w
"""
# Before use,execute `CWeChatRobot.exe /regserver` in cmd by admin user
import os
import ctypes
import json
import base64
import ctypes.wintypes
import socketserver
import threading
# need `pip install comtypes`
import comtypes.client
from comtypes.client import GetEvents
from comtypes.client import PumpEvents
class _WeChatRobotClient:
_instance = None
@classmethod
def instance(cls) -> '_WeChatRobotClient':
if not cls._instance:
cls._instance = cls()
return cls._instance
def __init__(self):
self.robot = comtypes.client.CreateObject("WeChatRobot.CWeChatRobot")
self.event = comtypes.client.CreateObject("WeChatRobot.RobotEvent")
self.com_pid = self.robot.CStopRobotService(0)
@classmethod
def __del__(cls):
import psutil
if cls._instance is not None:
try:
com_process = psutil.Process(cls._instance.com_pid)
com_process.kill()
except psutil.NoSuchProcess:
pass
cls._instance = None
class WeChatEventSink:
"""
接收消息的默认回调,可以自定义,并将实例化对象作为StartReceiveMsgByEvent参数
自定义的类需要包含以下所有成员
"""
def OnGetMessageEvent(self, msg):
msg = json.loads(msg)
msg['extrainfo'] = base64.b64decode(msg['extrainfo'])
print(msg)
class ReceiveMsgBaseServer(socketserver.BaseRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def handle(self):
conn = self.request
comtypes.CoInitialize()
while True:
try:
ptr_data = b""
while True:
data = conn.recv(1024)
ptr_data += data
if len(data) == 0 or data[-1] == 0xA:
break
msg = json.loads(ptr_data.decode('utf-8'))
ReceiveMsgBaseServer.msg_callback(msg)
except OSError:
break
except json.JSONDecodeError:
pass
conn.sendall("200 OK".encode())
conn.close()
comtypes.CoUninitialize()
@staticmethod
def msg_callback(msg):
msg['extrainfo'] = base64.b64decode(msg['extrainfo'])
# 主线程中已经注入,此处禁止调用StartService和StopService
robot = comtypes.client.CreateObject("WeChatRobot.CWeChatRobot")
event = comtypes.client.CreateObject("WeChatRobot.RobotEvent")
wx = WeChatRobot(msg['pid'], robot, event)
userinfo = wx.GetWxUserInfo(msg['wxid'])
msg['alias'] = userinfo['wxNumber']
if msg['isSendMsg'] == 0:
if '@chatroom' in msg['sender']:
chatroom_info = wx.GetWxUserInfo(msg['sender'])
msg['chatroom_name'] = chatroom_info['wxNickName']
msg['nickname'] = wx.GetChatRoomMemberNickname(msg['sender'], msg['wxid'])
else:
msg['nickname'] = userinfo['wxNickName']
# TODO: 在这里写额外的消息处理逻辑
print(msg)
robot.Release()
event.Release()
class ChatSession:
def __init__(self, pid, robot, wxid):
self.pid = pid
self.robot = robot
self.chat_with = wxid
def SendText(self, msg):
return self.robot.CSendText(self.pid, self.chat_with, msg)
def SendImage(self, img_path):
return self.robot.CSendImage(self.pid, self.chat_with, img_path)
def SendFile(self, filepath):
return self.robot.CSendFile(self.pid, self.chat_with, filepath)
def SendMp4(self, mp4path):
return self.robot.CSendImage(self.pid, self.chat_with, mp4path)
def SendArticle(self, title, abstract, url, img_path=None):
return self.robot.CSendArticle(self.pid, self.chat_with, title, abstract, url, img_path)
def SendCard(self, shared_wxid, nickname):
return self.robot.CSendCard(self.pid, self.chat_with, shared_wxid, nickname)
def SendAtText(self, wxid: list or str or tuple, msg, auto_nickname=True):
if '@chatroom' not in self.chat_with:
return 1
return self.robot.CSendAtText(self.pid, self.chat_with, wxid, msg, auto_nickname)
def SendAppMsg(self, appid):
return self.robot.CSendAppMsg(self.pid, self.chat_with, appid)
class WeChatRobot:
def __init__(self, pid: int = 0, robot=None, event=None):
self.pid = pid
self.robot = robot or _WeChatRobotClient.instance().robot
self.event = event or _WeChatRobotClient.instance().event
self.AddressBook = []
def StartService(self) -> int:
"""
注入DLL到微信以启动服务
Returns
-------
int
0成功,非0失败.
"""
status = self.robot.CStartRobotService(self.pid)
return status
def IsWxLogin(self) -> int:
"""
获取微信登录状态
Returns
-------
bool
微信登录状态.
"""
return self.robot.CIsWxLogin(self.pid)
def SendText(self, receiver: str, msg: str) -> int:
"""
发送文本消息
Parameters
----------
receiver : str
消息接收者wxid.
msg : str
消息内容.
Returns
-------
int
0成功,非0失败.
"""
return self.robot.CSendText(self.pid, receiver, msg)
def SendImage(self, receiver: str, img_path: str) -> int:
"""
发送图片消息
Parameters
----------
receiver : str
消息接收者wxid.
img_path : str
图片绝对路径.
Returns
-------
int
0成功,非0失败.
"""
return self.robot.CSendImage(self.pid, receiver, img_path)
def SendFile(self, receiver: str, filepath: str) -> int:
"""
发送文件
Parameters
----------
receiver : str
消息接收者wxid.
filepath : str
文件绝对路径.
Returns
-------
int
0成功,非0失败.
"""
return self.robot.CSendFile(self.pid, receiver, filepath)
def SendArticle(self, receiver: str, title: str, abstract: str, url: str, img_path: str or None = None) -> int:
"""
发送XML文章
Parameters
----------
receiver : str
消息接收者wxid.
title : str
消息卡片标题.
abstract : str
消息卡片摘要.
url : str
文章链接.
img_path : str or None, optional
消息卡片显示的图片绝对路径,不需要可以不指定. The default is None.
Returns
-------
int
0成功,非0失败.
"""
return self.robot.CSendArticle(self.pid, receiver, title, abstract, url, img_path)
def SendCard(self, receiver: str, shared_wxid: str, nickname: str) -> int:
"""
发送名片
Parameters
----------
receiver : str
消息接收者wxid.
shared_wxid : str
被分享人wxid.
nickname : str
名片显示的昵称.
Returns
-------
int
0成功,非0失败.
"""
return self.robot.CSendCard(self.pid, receiver, shared_wxid, nickname)
def SendAtText(self, chatroom_id: str, at_users: list or str or tuple, msg: str, auto_nickname: bool = True) -> int:
"""
发送群艾特消息,艾特所有人可以将AtUsers设置为`notify@all`
无目标群管理权限请勿使用艾特所有人
Parameters
----------
chatroom_id : str
群聊ID.
at_users : list or str or tuple
被艾特的人列表.
msg : str
消息内容.
auto_nickname : bool, optional
是否自动填充被艾特人昵称. 默认自动填充.
Returns
-------
int
0成功,非0失败.
"""
if '@chatroom' not in chatroom_id:
return 1
return self.robot.CSendAtText(self.pid, chatroom_id, at_users, msg, auto_nickname)
def GetSelfInfo(self) -> dict:
"""
获取个人信息
Returns
-------
dict
调用成功返回个人信息,否则返回空字典.
"""
self_info = self.robot.CGetSelfInfo(self.pid)
return json.loads(self_info)
def StopService(self) -> int:
"""
停止服务,会将DLL从微信进程中卸载
Returns
-------
int
COM进程pid.
"""
com_pid = self.robot.CStopRobotService(self.pid)
return com_pid
def GetAddressBook(self) -> list:
"""
获取联系人列表
Returns
-------
list
调用成功返回通讯录列表,调用失败返回空列表.
"""
try:
friend_tuple = self.robot.CGetFriendList(self.pid)
self.AddressBook = [dict(i) for i in list(friend_tuple)]
except IndexError:
self.AddressBook = []
return self.AddressBook
def GetFriendList(self) -> list:
"""
从通讯录列表中筛选出好友列表
Returns
-------
list
好友列表.
"""
if not self.AddressBook:
self.GetAddressBook()
friend_list = []
for item in self.AddressBook:
if 'wxid_' == item['wxid'][0:5]:
friend_list.append(item)
return friend_list
def GetChatRoomList(self) -> list:
"""
从通讯录列表中筛选出群聊列表
Returns
-------
list
群聊列表.
"""
if not self.AddressBook:
self.GetAddressBook()
chatroom_list = []
for item in self.AddressBook:
if '@chatroom' in item['wxid']:
chatroom_list.append(item)
return chatroom_list
def GetOfficialAccountList(self) -> list:
"""
从通讯录列表中筛选出公众号列表
Returns
-------
list
公众号列表.
"""
if not self.AddressBook:
self.GetAddressBook()
official_account_list = []
for item in self.AddressBook:
if 'wxid_' != item['wxid'][0:5] and '@chatroom' not in item['wxid']:
official_account_list.append(item)
return official_account_list
def GetFriendByWxRemark(self, remark: str) -> dict or None:
"""
通过备注搜索联系人
Parameters
----------
remark : str
好友备注.
Returns
-------
dict or None
搜索到返回联系人信息,否则返回None.
"""
if not self.AddressBook:
self.GetAddressBook()
for item in self.AddressBook:
if item['wxRemark'] == remark:
return item
return None
def GetFriendByWxNumber(self, wx_number: str) -> dict or None:
"""
通过微信号搜索联系人
Parameters
----------
wx_number : str
联系人微信号.
Returns
-------
dict or None
搜索到返回联系人信息,否则返回None.
"""
if not self.AddressBook:
self.GetAddressBook()
for item in self.AddressBook:
if item['wxNumber'] == wx_number:
return item
return None
def GetFriendByWxNickName(self, nickname: str) -> dict or None:
"""
通过昵称搜索联系人
Parameters
----------
nickname : str
联系人昵称.
Returns
-------
dict or None
搜索到返回联系人信息,否则返回None.
"""
if not self.AddressBook:
self.GetAddressBook()
for item in self.AddressBook:
if item['wxNickName'] == nickname:
return item
return None
def GetChatSession(self, wxid: str) -> 'ChatSession':
"""
创建一个会话,没太大用处
Parameters
----------
wxid : str
联系人wxid.
Returns
-------
'ChatSession'
返回ChatSession类.
"""
return ChatSession(self.pid, self.robot, wxid)
def GetWxUserInfo(self, wxid: str) -> dict:
"""
通过wxid查询联系人信息
Parameters
----------
wxid : str
联系人wxid.
Returns
-------
dict
联系人信息.
"""
userinfo = self.robot.CGetWxUserInfo(self.pid, wxid)
return json.loads(userinfo)
def GetChatRoomMembers(self, chatroom_id: str) -> dict or None:
"""
获取群成员信息
Parameters
----------
chatroom_id : str
群聊id.
Returns
-------
dict or None
获取成功返回群成员信息,失败返回None.
"""
info = dict(self.robot.CGetChatRoomMembers(self.pid, chatroom_id))
if not info:
return None
members = info['members'].split('^G')
data = self.GetWxUserInfo(chatroom_id)
data['members'] = []
for member in members:
member_info = self.GetWxUserInfo(member)
data['members'].append(member_info)
return data
def CheckFriendStatus(self, wxid: str) -> int:
"""
获取好友状态码
Parameters
----------
wxid : str
好友wxid.
Returns
-------
int
0x0: 'Unknown',
0xB0:'被删除',
0xB1:'是好友',
0xB2:'已拉黑',
0xB5:'被拉黑',
"""
return self.robot.CCheckFriendStatus(self.pid, wxid)
# 接收消息的函数
def StartReceiveMessage(self, port: int = 10808) -> int:
"""
启动接收消息Hook
Parameters
----------
port : int
socket的监听端口号.如果要使用连接点回调,则将端口号设置为0.
Returns
-------
int
启动成功返回0,失败返回非0值.
"""
status = self.robot.CStartReceiveMessage(self.pid, port)
return status
def StopReceiveMessage(self) -> int:
"""
停止接收消息Hook
Returns
-------
int
成功返回0,失败返回非0值.
"""
status = self.robot.CStopReceiveMessage(self.pid)
return status
def GetDbHandles(self) -> dict:
"""
获取数据库句柄和表信息
Returns
-------
dict
数据库句柄和表信息.
"""
tables_tuple = self.robot.CGetDbHandles(self.pid)
tables = [dict(i) for i in tables_tuple]
dbs = {}
for table in tables:
dbname = table['dbname']
if dbname not in dbs.keys():
dbs[dbname] = {'Handle': table['Handle'], 'tables': []}
dbs[dbname]['tables'].append(
{'name': table['name'], 'tbl_name': table['tbl_name'],
'root_page': table['rootpage'], 'sql': table['sql']}
)
return dbs
def ExecuteSQL(self, handle: int, sql: str) -> list:
"""
执行SQL
Parameters
----------
handle : int
数据库句柄.
sql : str
SQL.
Returns
-------
list
查询结果.
"""
result = self.robot.CExecuteSQL(self.pid, handle, sql)
if len(result) == 0:
return []
query_list = []
keys = list(result[0])
for item in result[1:]:
query_dict = {}
for key, value in zip(keys, item):
query_dict[key] = value if not isinstance(value, tuple) else bytes(value)
query_list.append(query_dict)
return query_list
def BackupSQLiteDB(self, handle: int, filepath: str) -> int:
"""
备份数据库
Parameters
----------
handle : int
数据库句柄.
filepath : int
备份文件保存位置.
Returns
-------
int
成功返回0,失败返回非0值.
"""
filepath = filepath.replace('/', '\\')
save_path = filepath.replace(filepath.split('\\')[-1], '')
if not os.path.exists(save_path):
os.makedirs(save_path)
return self.robot.CBackupSQLiteDB(self.pid, handle, filepath)
def VerifyFriendApply(self, v3: str, v4: str) -> int:
"""
通过好友请求
Parameters
----------
v3 : str
v3数据(encryptUserName).
v4 : str
v4数据(ticket).
Returns
-------
int
成功返回0,失败返回非0值..
"""
return self.robot.CVerifyFriendApply(self.pid, v3, v4)
def AddFriendByWxid(self, wxid: str, message: str or None) -> int:
"""
wxid加好友
Parameters
----------
wxid : str
要添加的wxid.
message : str or None
验证信息.
Returns
-------
int
请求发送成功返回0,失败返回非0值.
"""
return self.robot.CAddFriendByWxid(self.pid, wxid, message)
def AddFriendByV3(self, v3: str, message: str or None, add_type: int = 0x6) -> int:
"""
v3数据加好友
Parameters
----------
v3 : str
v3数据(encryptUserName).
message : str or None
验证信息.
add_type : int
添加方式(来源).手机号: 0xF;微信号: 0x3;QQ号: 0x1;朋友验证消息: 0x6.
Returns
-------
int
请求发送成功返回0,失败返回非0值.
"""
return self.robot.CAddFriendByV3(self.pid, v3, message, add_type)
def GetWeChatVer(self) -> str:
"""
获取微信版本号
Returns
-------
str
微信版本号.
"""
return self.robot.CGetWeChatVer()
def GetUserInfoByNet(self, keyword: str) -> dict or None:
"""
网络查询用户信息
Parameters
----------
keyword : str
查询关键字,可以是微信号、手机号、QQ号.
Returns
-------
dict or None
查询成功返回用户信息,查询失败返回None.
"""
userinfo = self.robot.CSearchContactByNet(self.pid, keyword)
if userinfo:
return dict(userinfo)
return None
def AddBrandContact(self, public_id: str) -> int:
"""
关注公众号
Parameters
----------
public_id : str
公众号id.
Returns
-------
int
请求成功返回0,失败返回非0值.
"""
return self.robot.CAddBrandContact(self.pid, public_id)
def ChangeWeChatVer(self, version: str) -> int:
"""
自定义微信版本号,一定程度上防止自动更新
Parameters
----------
version : str
版本号,类似`3.7.0.26`
Returns
-------
int
成功返回0,失败返回非0值.
"""
return self.robot.CChangeWeChatVer(self.pid, version)
def HookImageMsg(self, save_path: str) -> int:
"""
开始Hook未加密图片
Parameters
----------
save_path : str
图片保存路径(绝对路径).
Returns
-------
int
成功返回0,失败返回非0值.
"""
return self.robot.CHookImageMsg(self.pid, save_path)
def UnHookImageMsg(self) -> int:
"""
取消Hook未加密图片
Returns
-------
int
成功返回0,失败返回非0值.
"""
return self.robot.CUnHookImageMsg(self.pid)
def HookVoiceMsg(self, save_path: str) -> int:
"""
开始Hook语音消息
Parameters
----------
save_path : str
语音保存路径(绝对路径).
Returns
-------
int
成功返回0,失败返回非0值.
"""
return self.robot.CHookVoiceMsg(self.pid, save_path)
def UnHookVoiceMsg(self) -> int:
"""
取消Hook语音消息
Returns
-------
int
成功返回0,失败返回非0值.
"""
return self.robot.CUnHookVoiceMsg(self.pid)
def DeleteUser(self, wxid: str) -> int:
"""
删除好友
Parameters
----------
wxid : str
被删除好友wxid.
Returns
-------
int
成功返回0,失败返回非0值.
"""
return self.robot.CDeleteUser(self.pid, wxid)
def SendAppMsg(self, wxid: str, appid: str) -> int:
"""
发送小程序
Parameters
----------
wxid : str
消息接收者wxid.
appid : str
小程序id (在xml中是username,不是appid).
Returns
-------
int
成功返回0,失败返回非0值.
"""
return self.robot.CSendAppMsg(self.pid, wxid, appid)
def EditRemark(self, wxid: str, remark: str or None) -> int:
"""
修改好友或群聊备注
Parameters
----------
wxid : str
wxid或chatroom_id.
remark : str or None
要修改的备注.
Returns
-------
int
成功返回0,失败返回非0值.
"""
return self.robot.CEditRemark(self.pid, wxid, remark)
def SetChatRoomName(self, chatroom_id: str, name: str) -> int:
"""
修改群名称.请确认具有相关权限再调用。
Parameters
----------
chatroom_id : str
群聊id.
name : str
要修改为的群名称.
Returns
-------
int
成功返回0,失败返回非0值.
"""
return self.robot.CSetChatRoomName(self.pid, chatroom_id, name)
def SetChatRoomAnnouncement(self, chatroom_id: str, announcement: str or None) -> int:
"""
设置群公告.请确认具有相关权限再调用。
Parameters
----------
chatroom_id : str
群聊id.
announcement : str or None
公告内容.
Returns
-------
int
成功返回0,失败返回非0值.
"""
return self.robot.CSetChatRoomAnnouncement(self.pid, chatroom_id, announcement)
def SetChatRoomSelfNickname(self, chatroom_id: str, nickname: str) -> int:
"""
设置群内个人昵称
Parameters
----------
chatroom_id : str
群聊id.
nickname : str
要修改为的昵称.
Returns
-------
int
成功返回0,失败返回非0值.
"""
return self.robot.CSetChatRoomSelfNickname(self.pid, chatroom_id, nickname)
def GetChatRoomMemberNickname(self, chatroom_id: str, wxid: str) -> str:
"""
获取群成员昵称
Parameters
----------
chatroom_id : str
群聊id.
wxid : str
群成员wxid.
Returns
-------
str
成功返回群成员昵称,失败返回空字符串.
"""
return self.robot.CGetChatRoomMemberNickname(self.pid, chatroom_id, wxid)
def DelChatRoomMember(self, chatroom_id: str, wxid_list: str or list or tuple) -> int:
"""
删除群成员.请确认具有相关权限再调用。
Parameters
----------
chatroom_id : str
群聊id.
wxid_list : str or list or tuple
要删除的成员wxid或wxid列表.
Returns
-------
int
成功返回0,失败返回非0值.
"""
return self.robot.CDelChatRoomMember(self.pid, chatroom_id, wxid_list)
def AddChatRoomMember(self, chatroom_id: str, wxid_list: str or list or tuple) -> int:
"""
添加群成员.请确认具有相关权限再调用。
Parameters
----------
chatroom_id : str
群聊id.
wxid_list : str or list or tuple
要添加的成员wxid或wxid列表.
Returns
-------
int