diff --git a/CWeChatRobot/GetChatRoomMembers.cpp b/CWeChatRobot/GetChatRoomMembers.cpp new file mode 100644 index 0000000000000000000000000000000000000000..77002c29d25c4c04b10e42b157afbbf22fc57377 --- /dev/null +++ b/CWeChatRobot/GetChatRoomMembers.cpp @@ -0,0 +1,55 @@ +#include "pch.h" + +struct ChatRoomInfoStruct { + DWORD members; + DWORD length; +}; + +SAFEARRAY* GetChatRoomMembers(wchar_t* chatroomid) { + if (!hProcess) + return NULL; + DWORD WeChatRobotBase = GetWeChatRobotBase(); + DWORD dwId = 0; + DWORD dwWriteSize = 0; + DWORD dwHandle = 0; + HRESULT hr = S_OK; + ChatRoomInfoStruct chatroominfo = { 0 }; + LPVOID chatroomidaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE); + if (!chatroomidaddr || !WeChatRobotBase) { + return NULL; + } + else { + WriteProcessMemory(hProcess, chatroomidaddr, chatroomid, wcslen(chatroomid) * 2 + 2, &dwWriteSize); + } + + DWORD GetChatRoomMembersRemoteAddr = WeChatRobotBase + GetChatRoomMembersRemoteOffset; + HANDLE hThread = ::CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)GetChatRoomMembersRemoteAddr, (LPVOID)chatroomidaddr, 0, &dwId); + if (hThread) { + WaitForSingleObject(hThread, INFINITE); + GetExitCodeThread(hThread, &dwHandle); + } + else { + return NULL; + } + if (!dwHandle) + return NULL; + ReadProcessMemory(hProcess,(LPCVOID)dwHandle,&chatroominfo,sizeof(ChatRoomInfoStruct),0); + wchar_t* members = new wchar_t[chatroominfo.length + 1]; + ZeroMemory(members, (chatroominfo.length + 1) * 2); + ReadProcessMemory(hProcess, (LPCVOID)chatroominfo.members, members, chatroominfo.length * 2, 0); + cout << members << endl; + SAFEARRAYBOUND rgsaBound[2] = { {2,0},{2,0} }; + SAFEARRAY* psaValue = SafeArrayCreate(VT_VARIANT, 2, rgsaBound); + long keyIndex[2] = { 0,0 }; + keyIndex[0] = 0; keyIndex[1] = 0; + hr = SafeArrayPutElement(psaValue, keyIndex, &(_variant_t)L"chatroomid"); + keyIndex[0] = 0; keyIndex[1] = 1; + hr = SafeArrayPutElement(psaValue, keyIndex, &(_variant_t)chatroomid); + keyIndex[0] = 1; keyIndex[1] = 0; + hr = SafeArrayPutElement(psaValue, keyIndex, &(_variant_t)L"members"); + keyIndex[0] = 1; keyIndex[1] = 1; + hr = SafeArrayPutElement(psaValue, keyIndex, &(_variant_t)members); + delete[] members; + members = NULL; + return psaValue; +} \ No newline at end of file diff --git a/CWeChatRobot/GetChatRoomMembers.h b/CWeChatRobot/GetChatRoomMembers.h new file mode 100644 index 0000000000000000000000000000000000000000..0088ef6a8677435a957975bdc0caf14b86686ef2 --- /dev/null +++ b/CWeChatRobot/GetChatRoomMembers.h @@ -0,0 +1,3 @@ +#pragma once +#include +SAFEARRAY* GetChatRoomMembers(wchar_t* chatroomid); \ No newline at end of file diff --git a/CWeChatRobot/WeChatRobot.cpp b/CWeChatRobot/WeChatRobot.cpp index 1963146a97b6dfe507a2a1dc46aeaca810636b21..8d45c81c378981148c08ba32f3ffbd09743b6e33 100644 --- a/CWeChatRobot/WeChatRobot.cpp +++ b/CWeChatRobot/WeChatRobot.cpp @@ -186,4 +186,16 @@ STDMETHODIMP CWeChatRobot::CReceiveMessage(VARIANT* __result) { STDMETHODIMP CWeChatRobot::CStopReceiveMessage(int* __result) { *__result = StopReceiveMessage(); return S_OK; +} + +/* +* 参数1:群聊ID +* 参数2:预返回的值,调用时无需提供 +*/ +STDMETHODIMP CWeChatRobot::CGetChatRoomMembers(BSTR chatroomid,VARIANT* __result) { + VARIANT vsaValue; + vsaValue.vt = VT_ARRAY | VT_VARIANT; + V_ARRAY(&vsaValue) = GetChatRoomMembers(chatroomid); + *__result = vsaValue; + return S_OK; } \ No newline at end of file diff --git a/CWeChatRobot/WeChatRobot.h b/CWeChatRobot/WeChatRobot.h index 522700c99c41dce737984bc34ea2b08b43e15cd0..2c21482c950471f1d658d0b286c2bd5ccd394041 100644 --- a/CWeChatRobot/WeChatRobot.h +++ b/CWeChatRobot/WeChatRobot.h @@ -70,6 +70,7 @@ public: STDMETHODIMP CStartReceiveMessage(int* __result); STDMETHODIMP CReceiveMessage(VARIANT* __result); STDMETHODIMP CStopReceiveMessage(int* __result); + STDMETHODIMP CGetChatRoomMembers(BSTR chatroomid, VARIANT* __result); }; OBJECT_ENTRY_AUTO(__uuidof(WeChatRobot), CWeChatRobot) diff --git a/CWeChatRobot/WeChatRobotCOM.idl b/CWeChatRobot/WeChatRobotCOM.idl index 1553c5423d730051d350a22b3885a63789d29ca4..81a0d38033eeacd9c55997d56da6f2b4046c3400 100644 --- a/CWeChatRobot/WeChatRobotCOM.idl +++ b/CWeChatRobot/WeChatRobotCOM.idl @@ -35,6 +35,7 @@ interface IWeChatRobot : IDispatch [id(17)] HRESULT CReceiveMessage([out, retval] VARIANT* __result); [id(18)] HRESULT CStopReceiveMessage([out, retval] int* __result); [id(19)] HRESULT CSendAtText([in] BSTR chatroomid, [in] BSTR wxid, [in] BSTR wxmsg, [out, retval] int* __result); + [id(20)] HRESULT CGetChatRoomMembers([in] BSTR chatroomid, [out, retval] VARIANT* __result); }; [ uuid(721abb35-141a-4aa2-94f2-762e2833fa6c), diff --git a/CWeChatRobot/WeChatRobotCOM.vcxproj b/CWeChatRobot/WeChatRobotCOM.vcxproj index 87571f9e3f129fb133dce94437733502633aa96a..eb889c9e5c2a621ddbced1205c477701dbf5b553 100644 --- a/CWeChatRobot/WeChatRobotCOM.vcxproj +++ b/CWeChatRobot/WeChatRobotCOM.vcxproj @@ -214,6 +214,7 @@ + @@ -235,6 +236,7 @@ + Create diff --git a/CWeChatRobot/WeChatRobotCOM.vcxproj.filters b/CWeChatRobot/WeChatRobotCOM.vcxproj.filters index 72d2c4f5574c7a789963636b35e402735d7b9fb6..2fc93e0d6928590f37bdeec40356d5bcdc0f3804 100644 --- a/CWeChatRobot/WeChatRobotCOM.vcxproj.filters +++ b/CWeChatRobot/WeChatRobotCOM.vcxproj.filters @@ -59,6 +59,12 @@ {ee92dda5-7326-49ad-a09b-b339eedbb518} + + {2f19dd43-78d1-4a4b-8aad-fb047f4274e6} + + + {dce4ab67-7d14-41b1-8e89-cbf9a8315a3a} + @@ -121,6 +127,9 @@ 发送消息\发送艾特 + + 群相关\获取群成员 + @@ -174,6 +183,9 @@ 发送消息\发送艾特 + + 群相关\获取群成员 + diff --git a/CWeChatRobot/WeChatRobotCOM_i.h b/CWeChatRobot/WeChatRobotCOM_i.h index 1654cf203f325776b35cb39ec47ad282a0928e85..d6d76b3eef30b9d08e5679a8403a22e3c57dc23d 100644 --- a/CWeChatRobot/WeChatRobotCOM_i.h +++ b/CWeChatRobot/WeChatRobotCOM_i.h @@ -163,6 +163,10 @@ EXTERN_C const IID IID_IWeChatRobot; /* [in] */ BSTR wxmsg, /* [retval][out] */ int *__result) = 0; + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CGetChatRoomMembers( + /* [in] */ BSTR chatroomid, + /* [retval][out] */ VARIANT *__result) = 0; + }; @@ -315,6 +319,11 @@ EXTERN_C const IID IID_IWeChatRobot; /* [in] */ BSTR wxmsg, /* [retval][out] */ int *__result); + /* [id] */ HRESULT ( STDMETHODCALLTYPE *CGetChatRoomMembers )( + IWeChatRobot * This, + /* [in] */ BSTR chatroomid, + /* [retval][out] */ VARIANT *__result); + END_INTERFACE } IWeChatRobotVtbl; @@ -408,6 +417,9 @@ EXTERN_C const IID IID_IWeChatRobot; #define IWeChatRobot_CSendAtText(This,chatroomid,wxid,wxmsg,__result) \ ( (This)->lpVtbl -> CSendAtText(This,chatroomid,wxid,wxmsg,__result) ) +#define IWeChatRobot_CGetChatRoomMembers(This,chatroomid,__result) \ + ( (This)->lpVtbl -> CGetChatRoomMembers(This,chatroomid,__result) ) + #endif /* COBJMACROS */ diff --git a/CWeChatRobot/WeChatRobotCOM_p.c b/CWeChatRobot/WeChatRobotCOM_p.c index c4a64457908e77e123ba2974d99be3598dbb6965..fe360ce5a9ec07467431ccc31bf13b07fe2a43a8 100644 --- a/CWeChatRobot/WeChatRobotCOM_p.c +++ b/CWeChatRobot/WeChatRobotCOM_p.c @@ -49,7 +49,7 @@ #include "WeChatRobotCOM_i.h" #define TYPE_FORMAT_STRING_SIZE 1221 -#define PROC_FORMAT_STRING_SIZE 793 +#define PROC_FORMAT_STRING_SIZE 835 #define EXPR_FORMAT_STRING_SIZE 1 #define TRANSMIT_AS_TABLE_SIZE 0 #define WIRE_MARSHAL_TABLE_SIZE 2 @@ -798,6 +798,42 @@ static const WeChatRobotCOM_MIDL_PROC_FORMAT_STRING WeChatRobotCOM__MIDL_ProcFor /* 790 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ + /* Procedure CGetChatRoomMembers */ + +/* 792 */ 0x33, /* FC_AUTO_HANDLE */ + 0x6c, /* Old Flags: object, Oi2 */ +/* 794 */ NdrFcLong( 0x0 ), /* 0 */ +/* 798 */ NdrFcShort( 0x1a ), /* 26 */ +/* 800 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ +/* 802 */ NdrFcShort( 0x0 ), /* 0 */ +/* 804 */ NdrFcShort( 0x8 ), /* 8 */ +/* 806 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */ + 0x3, /* 3 */ +/* 808 */ 0x8, /* 8 */ + 0x47, /* Ext Flags: new corr desc, clt corr check, srv corr check, has range on conformance */ +/* 810 */ NdrFcShort( 0x1 ), /* 1 */ +/* 812 */ NdrFcShort( 0x1 ), /* 1 */ +/* 814 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter chatroomid */ + +/* 816 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ +/* 818 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ +/* 820 */ NdrFcShort( 0x2a ), /* Type Offset=42 */ + + /* Parameter __result */ + +/* 822 */ NdrFcShort( 0x4113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=16 */ +/* 824 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ +/* 826 */ NdrFcShort( 0x4ac ), /* Type Offset=1196 */ + + /* Return value */ + +/* 828 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 830 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ +/* 832 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + 0x0 } }; @@ -1649,7 +1685,8 @@ static const unsigned short IWeChatRobot_FormatStringOffsetTable[] = 630, 666, 702, - 738 + 738, + 792 }; static const MIDL_STUBLESS_PROXY_INFO IWeChatRobot_ProxyInfo = @@ -1673,7 +1710,7 @@ static const MIDL_SERVER_INFO IWeChatRobot_ServerInfo = 0, 0, 0}; -CINTERFACE_PROXY_VTABLE(26) _IWeChatRobotProxyVtbl = +CINTERFACE_PROXY_VTABLE(27) _IWeChatRobotProxyVtbl = { &IWeChatRobot_ProxyInfo, &IID_IWeChatRobot, @@ -1702,7 +1739,8 @@ CINTERFACE_PROXY_VTABLE(26) _IWeChatRobotProxyVtbl = (void *) (INT_PTR) -1 /* IWeChatRobot::CStartReceiveMessage */ , (void *) (INT_PTR) -1 /* IWeChatRobot::CReceiveMessage */ , (void *) (INT_PTR) -1 /* IWeChatRobot::CStopReceiveMessage */ , - (void *) (INT_PTR) -1 /* IWeChatRobot::CSendAtText */ + (void *) (INT_PTR) -1 /* IWeChatRobot::CSendAtText */ , + (void *) (INT_PTR) -1 /* IWeChatRobot::CGetChatRoomMembers */ }; @@ -1730,6 +1768,7 @@ static const PRPC_STUB_FUNCTION IWeChatRobot_table[] = NdrStubCall2, NdrStubCall2, NdrStubCall2, + NdrStubCall2, NdrStubCall2 }; @@ -1737,7 +1776,7 @@ CInterfaceStubVtbl _IWeChatRobotStubVtbl = { &IID_IWeChatRobot, &IWeChatRobot_ServerInfo, - 26, + 27, &IWeChatRobot_table[-3], CStdStubBuffer_DELEGATING_METHODS }; diff --git a/CWeChatRobot/pch.cpp b/CWeChatRobot/pch.cpp index 28a0d70574aa2aa19736456e3bd11f1c4bae9508..3ea5e91557279e47ff187388766e020234490c68 100644 --- a/CWeChatRobot/pch.cpp +++ b/CWeChatRobot/pch.cpp @@ -29,6 +29,8 @@ DWORD UnHookReceiveMessageRemoteOffset = 0x0; DWORD GetHeadMessageRemoteOffset = 0x0; DWORD PopHeadMessageRemoteOffset = 0x0; +DWORD GetChatRoomMembersRemoteOffset = 0x0; + wstring SelfInfoString = L""; HANDLE hProcess = NULL; @@ -134,6 +136,9 @@ void GetProcOffset(wchar_t* workPath) { DWORD PopHeadMessageRemoteAddr = (DWORD)GetProcAddress(hd, PopHeadMessageRemote); PopHeadMessageRemoteOffset = PopHeadMessageRemoteAddr - WeChatBase; + DWORD GetChatRoomMembersRemoteAddr = (DWORD)GetProcAddress(hd, GetChatRoomMembersRemote); + GetChatRoomMembersRemoteOffset = GetChatRoomMembersRemoteAddr - WeChatBase; + FreeLibrary(hd); delete[] dllpath; dllpath = NULL; diff --git a/CWeChatRobot/robotdata.h b/CWeChatRobot/robotdata.h index 9c09e31bcb0a33c4654cb29291772a3ef391f0a0..bd0bd5b817ff9a192e46618d522e883ec0f20a31 100644 --- a/CWeChatRobot/robotdata.h +++ b/CWeChatRobot/robotdata.h @@ -11,6 +11,7 @@ #include "SelfInfo.h" #include "CheckFriendStatus.h" #include "ReceiveMessage.h" +#include "GetChatRoomMembers.h" extern HANDLE hProcess; extern DWORD SendImageOffset; @@ -40,6 +41,8 @@ extern DWORD UnHookReceiveMessageRemoteOffset; extern DWORD GetHeadMessageRemoteOffset; extern DWORD PopHeadMessageRemoteOffset; +extern DWORD GetChatRoomMembersRemoteOffset; + #define dllname L"DWeChatRobot.dll" @@ -67,4 +70,6 @@ extern DWORD PopHeadMessageRemoteOffset; #define HookReceiveMessageRemote "HookReceiveMessage" #define UnHookReceiveMessageRemote "UnHookReceiveMessage" #define GetHeadMessageRemote "GetHeadMessage" -#define PopHeadMessageRemote "PopHeadMessage" \ No newline at end of file +#define PopHeadMessageRemote "PopHeadMessage" + +#define GetChatRoomMembersRemote "GetChatRoomMembersRemote" \ No newline at end of file diff --git a/DWeChatRobot/DWeChatRobot.vcxproj b/DWeChatRobot/DWeChatRobot.vcxproj index a1430fb147cb017f53260995992c1122e2c41e93..12ef5304aee0039b263d0fe4054db8d7575e52e2 100644 --- a/DWeChatRobot/DWeChatRobot.vcxproj +++ b/DWeChatRobot/DWeChatRobot.vcxproj @@ -157,6 +157,7 @@ + @@ -173,6 +174,7 @@ + Create Create diff --git a/DWeChatRobot/DWeChatRobot.vcxproj.filters b/DWeChatRobot/DWeChatRobot.vcxproj.filters index 14aa8088f3ef57bd1b1f7add39f8e5f4cd56a5ba..0079cf59713888e516fb0445a4c02f07b6b90be5 100644 --- a/DWeChatRobot/DWeChatRobot.vcxproj.filters +++ b/DWeChatRobot/DWeChatRobot.vcxproj.filters @@ -58,6 +58,12 @@ {15310114-64cf-4426-a4ef-3c889824d2de} + + {5bb967a4-4dc2-4b95-a3da-2795edc30b1b} + + + {fabe98aa-4f28-4bc6-b368-68808145a135} + @@ -102,6 +108,9 @@ 发送消息\发送艾特 + + 群相关\获取群成员 + @@ -146,5 +155,8 @@ 发送消息\发送艾特 + + 群相关\获取群成员 + \ No newline at end of file diff --git a/DWeChatRobot/GetChatRoomMembers.h b/DWeChatRobot/GetChatRoomMembers.h new file mode 100644 index 0000000000000000000000000000000000000000..341ac29ff7fcb96c18c2d2a8bd3c6b9fc02c4f6b --- /dev/null +++ b/DWeChatRobot/GetChatRoomMembers.h @@ -0,0 +1,5 @@ +#pragma once +#include + +BOOL __stdcall GetChatRoomMembers(wchar_t* chatroomid); +extern "C" __declspec(dllexport) DWORD GetChatRoomMembersRemote(LPVOID lparameter); \ No newline at end of file diff --git a/DWeChatRobot/GetChatRoomMemebers.cpp b/DWeChatRobot/GetChatRoomMemebers.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9f9fbb87081038e9c978f9ab87d78f9414ec61bb --- /dev/null +++ b/DWeChatRobot/GetChatRoomMemebers.cpp @@ -0,0 +1,79 @@ +#include "pch.h" + +#define GetChatRoomMembersCall1Offset 0x6246BBB0 - 0x61E20000 +#define GetChatRoomMembersCall2Offset 0x61EDF550 - 0x61E20000 +#define GetChatRoomMembersCall3Offset 0x622046D0 - 0x61E20000 +#define DeleteGetChatRoomMembersCacheCallOffset 0x6246BDD0 - 0x61E20000 + +struct ChatRoomInfoStruct { + wchar_t* members = NULL; + DWORD length = 0; +}; + +ChatRoomInfoStruct chatroominfo = { 0 }; + +DWORD GetChatRoomMembersRemote(LPVOID lparameter) { + wchar_t* chatroomid = (WCHAR*)lparameter; + if (chatroominfo.members != NULL) { + delete[] chatroominfo.members; + chatroominfo.members = NULL; + chatroominfo.length = 0; + } + if (GetChatRoomMembers(chatroomid)) { +#ifdef _DEBUG + wcout << chatroominfo.members << endl; +#endif + return (DWORD)&chatroominfo.members; + } + else { + return 0; + } + return 0; +} + +BOOL __stdcall GetChatRoomMembers(wchar_t* chatroomid) { + DWORD WeChatWinBase = GetWeChatWinBase(); + DWORD GetChatRoomMembersCall1 = WeChatWinBase + GetChatRoomMembersCall1Offset; + DWORD GetChatRoomMembersCall2 = WeChatWinBase + GetChatRoomMembersCall2Offset; + DWORD GetChatRoomMembersCall3 = WeChatWinBase + GetChatRoomMembersCall3Offset; + DWORD DeleteGetChatRoomMembersCacheCall = WeChatWinBase + DeleteGetChatRoomMembersCacheCallOffset; + + WxBaseStruct wsChatRoomId(chatroomid); + char buffer[0x1B0] = { 0 }; + DWORD isSuccess = 0x0; + DWORD DataAddr = 0x0; + + __asm { + pushad; + pushfd; + lea ecx, buffer; + mov DataAddr, ecx; + call GetChatRoomMembersCall1; + call GetChatRoomMembersCall2; + lea eax, buffer; + push eax; + lea edi, wsChatRoomId; + push edi; + call GetChatRoomMembersCall3; + mov isSuccess, eax; + popfd; + popad; + } + if (isSuccess) { + char* members = (char*)(*(DWORD*)(DataAddr + 0x1C)); + wchar_t* wmembers = new wchar_t[strlen(members) + 1]; + ZeroMemory(wmembers, (strlen(members) + 1) * 2); + MultiByteToWideChar(CP_ACP,0,members,-1,wmembers, strlen(members) + 1); + chatroominfo.members = wmembers; + chatroominfo.length = wcslen(wmembers); + } + __asm { + pushad; + pushfd; + lea ecx, buffer; + call DeleteGetChatRoomMembersCacheCall; + popfd; + popad; + } + return isSuccess; +} \ No newline at end of file diff --git a/DWeChatRobot/dllmain.cpp b/DWeChatRobot/dllmain.cpp index 6cc07724230e31f412ddff8755369536e061f760..7c204a3ddd336c7a68eace069bfbc48be7459994 100644 --- a/DWeChatRobot/dllmain.cpp +++ b/DWeChatRobot/dllmain.cpp @@ -21,6 +21,7 @@ BOOL APIENTRY DllMain( HMODULE hModule, printf("SendArticle 0x%08X\n", (DWORD)SendArticle); printf("SendCard 0x%08X\n", (DWORD)SendCard); printf("CheckFriendStatus 0x%08X\n", (DWORD)CheckFriendStatus); + printf("GetChatRoomMembers 0x%08X\n", (DWORD)GetChatRoomMembers); #endif break; } diff --git a/DWeChatRobot/pch.h b/DWeChatRobot/pch.h index 2e58b3ec888b29654804c4f838878d25db7a1ed0..589ca7da350b7c5a2f37c427c1cc0ae6060eaf1a 100644 --- a/DWeChatRobot/pch.h +++ b/DWeChatRobot/pch.h @@ -23,6 +23,7 @@ #include "LogMsgInfo.h" #include "ReceiveMessage.h" #include "SendAtText.h" +#include "GetChatRoomMembers.h" #endif //PCH_H using namespace std; diff --git a/Release/CWeChatRobot.exe b/Release/CWeChatRobot.exe index cef5ebd3b2f2cc5a4cc5b70ace326526161878ff..6727cb3fde7985fd03dc005270c072c1277e6fed 100644 Binary files a/Release/CWeChatRobot.exe and b/Release/CWeChatRobot.exe differ diff --git a/Release/DWeChatRobot.dll b/Release/DWeChatRobot.dll index bb7378dd257795c2b0a983cc9dc51df4847a99c3..80def5e233de89ddcf79c25c0f4a8f4a1527cf6c 100644 Binary files a/Release/DWeChatRobot.dll and b/Release/DWeChatRobot.dll differ diff --git a/wxRobot.py b/wxRobot.py index 15f846012e5d9d6ca5c176cc3ef3b283f34a7804..e45e0c60c87f9bbf3625586aa45e05d9492f4597 100644 --- a/wxRobot.py +++ b/wxRobot.py @@ -134,6 +134,18 @@ class WeChatRobot(): userinfo = self.robot.CGetWxUserInfo(wxid).replace('\n','\\n') return ast.literal_eval(userinfo) + def GetChatRoomMembers(self,chatroomid): + info = dict(self.robot.CGetChatRoomMembers(chatroomid)) + if not info: + return None + members = info['members'].split('^G') + data = self.GetWxUserInfo(chatroomid) + data['members'] = [] + for member in members: + memberinfo = self.GetWxUserInfo(member) + data['members'].append(memberinfo) + return data + def CheckFriendStatusInit(self): return self.robot.CCheckFriendStatusInit() @@ -246,7 +258,7 @@ def test_ReceiveMessage(): wx.StartReceiveMessage(CallBackFunc = ReceiveMessageCallBack) try: while True: - pass + time.sleep(1) except KeyboardInterrupt: pass wx.StopService()