提交 bf64d9f0 编写于 作者: L ljc545w

添加群艾特消息接口

上级 9516324c
#include "pch.h"
struct SendAtTextStruct
{
DWORD chatroomid;
DWORD wxid;
DWORD wxmsg;
};
int SendAtText(wchar_t* chatroomid, wchar_t* wxid, wchar_t* wxmsg) {
if (!hProcess)
return 1;
DWORD WeChatRobotBase = GetWeChatRobotBase();
DWORD dwId = 0;
DWORD dwWriteSize = 0;
SendAtTextStruct params;
ZeroMemory(&params, sizeof(params));
LPVOID chatroomidaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
LPVOID wxidaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
LPVOID wxmsgaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
SendAtTextStruct* paramAndFunc = (SendAtTextStruct*)::VirtualAllocEx(hProcess, 0, sizeof(SendAtTextStruct), MEM_COMMIT, PAGE_READWRITE);
if (!chatroomidaddr || !wxidaddr || !wxmsgaddr || !paramAndFunc || !WeChatRobotBase) {
return 1;
}
DWORD dwTId = 0;
if (chatroomidaddr)
WriteProcessMemory(hProcess, chatroomidaddr, chatroomid, wcslen(chatroomid) * 2 + 2, &dwWriteSize);
if (wxidaddr)
WriteProcessMemory(hProcess, wxidaddr, wxid, wcslen(wxid) * 2 + 2, &dwWriteSize);
if (wxmsgaddr)
WriteProcessMemory(hProcess, wxmsgaddr, wxmsg, wcslen(wxmsg) * 2 + 2, &dwWriteSize);
params.chatroomid = (DWORD)chatroomidaddr;
params.wxid = (DWORD)wxidaddr;
params.wxmsg = (DWORD)wxmsgaddr;
if (paramAndFunc) {
if (!::WriteProcessMemory(hProcess, paramAndFunc, &params, sizeof(SendAtTextStruct), &dwTId))
{
return 1;
}
}
else {
return 1;
}
DWORD SendAtTextRemoteAddr = WeChatRobotBase + SendAtTextOffset;
HANDLE hThread = ::CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)SendAtTextRemoteAddr, (LPVOID)paramAndFunc, 0, &dwId);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
}
else {
return 1;
}
CloseHandle(hThread);
VirtualFreeEx(hProcess, chatroomidaddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, wxidaddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, wxmsgaddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, paramAndFunc, 0, MEM_RELEASE);
return 0;
}
\ No newline at end of file
#pragma once
#include<windows.h>
int SendAtText(wchar_t* chatroomid, wchar_t* wxid, wchar_t* wxmsg);
\ No newline at end of file
......@@ -31,6 +31,17 @@ STDMETHODIMP CWeChatRobot::CSendText(BSTR wxid, BSTR wxmsg, int* __result) {
return S_OK;
}
/*
* 参数1:群聊id
* 参数2:艾特的人wxid
* 参数3:文本消息内容
* 参数4:预返回的值,调用时无需提供
*/
STDMETHODIMP CWeChatRobot::CSendAtText(BSTR chatroomid, BSTR wxid, BSTR wxmsg, int* __result) {
*__result = SendAtText(chatroomid,wxid, wxmsg);
return S_OK;
}
/*
* 参数1:接收人wxid
* 参数2:图片绝对路径
......
......@@ -58,6 +58,7 @@ public:
STDMETHODIMP CSendFile(BSTR wxid, BSTR filepath, int* __result);
STDMETHODIMP CSendArticle(BSTR wxid, BSTR title, BSTR abstract, BSTR url, int* __result);
STDMETHODIMP CSendCard(BSTR receiver, BSTR sharedwxid, BSTR nickname, int* __result);
STDMETHODIMP CSendAtText(BSTR chatroomid, BSTR wxid, BSTR wxmsg, int* __result);
STDMETHODIMP CGetFriendList(VARIANT* __result);
STDMETHODIMP CGetFriendListString(BSTR* __result);
STDMETHODIMP CGetWxUserInfo(BSTR wxid, BSTR* __result);
......
......@@ -34,6 +34,7 @@ interface IWeChatRobot : IDispatch
[id(16)] HRESULT CStartReceiveMessage([out, retval] int* __result);
[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);
};
[
uuid(721abb35-141a-4aa2-94f2-762e2833fa6c),
......
......@@ -221,6 +221,7 @@
<ClInclude Include="robotdata.h" />
<ClInclude Include="SelfInfo.h" />
<ClInclude Include="SendArticle.h" />
<ClInclude Include="SendAtText.h" />
<ClInclude Include="SendCard.h" />
<ClInclude Include="SendFile.h" />
<ClInclude Include="SendImage.h" />
......@@ -244,6 +245,7 @@
<ClCompile Include="ReceiveMessage.cpp" />
<ClCompile Include="SelfInfo.cpp" />
<ClCompile Include="SendArticle.cpp" />
<ClCompile Include="SendAtText.cpp" />
<ClCompile Include="SendCard.cpp" />
<ClCompile Include="SendFile.cpp" />
<ClCompile Include="SendImage.cpp" />
......
......@@ -56,6 +56,9 @@
<Filter Include="接收消息">
<UniqueIdentifier>{9f0d63f2-46a6-4d9c-83dd-ed19792705d0}</UniqueIdentifier>
</Filter>
<Filter Include="发送消息\发送艾特">
<UniqueIdentifier>{ee92dda5-7326-49ad-a09b-b339eedbb518}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
......@@ -115,6 +118,9 @@
<ClInclude Include="ReceiveMessage.h">
<Filter>接收消息</Filter>
</ClInclude>
<ClInclude Include="SendAtText.h">
<Filter>发送消息\发送艾特</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="WeChatRobotCOM.cpp">
......@@ -165,6 +171,9 @@
<ClCompile Include="ReceiveMessage.cpp">
<Filter>接收消息</Filter>
</ClCompile>
<ClCompile Include="SendAtText.cpp">
<Filter>发送消息\发送艾特</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="WeChatRobotCOM.rc">
......
......@@ -157,6 +157,12 @@ EXTERN_C const IID IID_IWeChatRobot;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE CStopReceiveMessage(
/* [retval][out] */ int *__result) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE CSendAtText(
/* [in] */ BSTR chatroomid,
/* [in] */ BSTR wxid,
/* [in] */ BSTR wxmsg,
/* [retval][out] */ int *__result) = 0;
};
......@@ -302,6 +308,13 @@ EXTERN_C const IID IID_IWeChatRobot;
IWeChatRobot * This,
/* [retval][out] */ int *__result);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *CSendAtText )(
IWeChatRobot * This,
/* [in] */ BSTR chatroomid,
/* [in] */ BSTR wxid,
/* [in] */ BSTR wxmsg,
/* [retval][out] */ int *__result);
END_INTERFACE
} IWeChatRobotVtbl;
......@@ -392,6 +405,9 @@ EXTERN_C const IID IID_IWeChatRobot;
#define IWeChatRobot_CStopReceiveMessage(This,__result) \
( (This)->lpVtbl -> CStopReceiveMessage(This,__result) )
#define IWeChatRobot_CSendAtText(This,chatroomid,wxid,wxmsg,__result) \
( (This)->lpVtbl -> CSendAtText(This,chatroomid,wxid,wxmsg,__result) )
#endif /* COBJMACROS */
......
......@@ -49,7 +49,7 @@
#include "WeChatRobotCOM_i.h"
#define TYPE_FORMAT_STRING_SIZE 1221
#define PROC_FORMAT_STRING_SIZE 739
#define PROC_FORMAT_STRING_SIZE 793
#define EXPR_FORMAT_STRING_SIZE 1
#define TRANSMIT_AS_TABLE_SIZE 0
#define WIRE_MARSHAL_TABLE_SIZE 2
......@@ -749,6 +749,55 @@ static const WeChatRobotCOM_MIDL_PROC_FORMAT_STRING WeChatRobotCOM__MIDL_ProcFor
/* 736 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure CSendAtText */
/* 738 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 740 */ NdrFcLong( 0x0 ), /* 0 */
/* 744 */ NdrFcShort( 0x19 ), /* 25 */
/* 746 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */
/* 748 */ NdrFcShort( 0x0 ), /* 0 */
/* 750 */ NdrFcShort( 0x24 ), /* 36 */
/* 752 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */
0x5, /* 5 */
/* 754 */ 0x8, /* 8 */
0x45, /* Ext Flags: new corr desc, srv corr check, has range on conformance */
/* 756 */ NdrFcShort( 0x0 ), /* 0 */
/* 758 */ NdrFcShort( 0x1 ), /* 1 */
/* 760 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter chatroomid */
/* 762 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 764 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 766 */ NdrFcShort( 0x2a ), /* Type Offset=42 */
/* Parameter wxid */
/* 768 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 770 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 772 */ NdrFcShort( 0x2a ), /* Type Offset=42 */
/* Parameter wxmsg */
/* 774 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 776 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 778 */ NdrFcShort( 0x2a ), /* Type Offset=42 */
/* Parameter __result */
/* 780 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 782 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */
/* 784 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 786 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 788 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */
/* 790 */ 0x8, /* FC_LONG */
0x0, /* 0 */
0x0
}
};
......@@ -1599,7 +1648,8 @@ static const unsigned short IWeChatRobot_FormatStringOffsetTable[] =
594,
630,
666,
702
702,
738
};
static const MIDL_STUBLESS_PROXY_INFO IWeChatRobot_ProxyInfo =
......@@ -1623,7 +1673,7 @@ static const MIDL_SERVER_INFO IWeChatRobot_ServerInfo =
0,
0,
0};
CINTERFACE_PROXY_VTABLE(25) _IWeChatRobotProxyVtbl =
CINTERFACE_PROXY_VTABLE(26) _IWeChatRobotProxyVtbl =
{
&IWeChatRobot_ProxyInfo,
&IID_IWeChatRobot,
......@@ -1651,7 +1701,8 @@ CINTERFACE_PROXY_VTABLE(25) _IWeChatRobotProxyVtbl =
(void *) (INT_PTR) -1 /* IWeChatRobot::CGetComWorkPath */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CStartReceiveMessage */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CReceiveMessage */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CStopReceiveMessage */
(void *) (INT_PTR) -1 /* IWeChatRobot::CStopReceiveMessage */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CSendAtText */
};
......@@ -1678,6 +1729,7 @@ static const PRPC_STUB_FUNCTION IWeChatRobot_table[] =
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2
};
......@@ -1685,7 +1737,7 @@ CInterfaceStubVtbl _IWeChatRobotStubVtbl =
{
&IID_IWeChatRobot,
&IWeChatRobot_ServerInfo,
25,
26,
&IWeChatRobot_table[-3],
CStdStubBuffer_DELEGATING_METHODS
};
......
......@@ -8,6 +8,7 @@ DWORD SendTextOffset = 0x0;
DWORD SendFileOffset = 0x0;
DWORD SendArticleOffset = 0x0;
DWORD SendCardOffset = 0x0;
DWORD SendAtTextOffset = 0x0;
DWORD GetFriendListInitOffset = 0x0;
DWORD GetFriendListRemoteOffset = 0x0;
......@@ -97,6 +98,8 @@ void GetProcOffset(wchar_t* workPath) {
SendArticleOffset = SendArticleProcAddr - WeChatBase;
DWORD SendCardProcAddr = (DWORD)GetProcAddress(hd, SendCardRemote);
SendCardOffset = SendCardProcAddr - WeChatBase;
DWORD SendAtTextProcAddr = (DWORD)GetProcAddress(hd, SendAtTextRemote);
SendAtTextOffset = SendAtTextProcAddr - WeChatBase;
DWORD GetFriendListInitProcAddr = (DWORD)GetProcAddress(hd, GetFriendListInit);
GetFriendListInitOffset = GetFriendListInitProcAddr - WeChatBase;
......
......@@ -5,6 +5,7 @@
#include "SendFile.h"
#include "SendArticle.h"
#include "SendCard.h"
#include "SendAtText.h"
#include "FriendList.h"
#include "UserInfo.h"
#include "SelfInfo.h"
......@@ -17,6 +18,7 @@ extern DWORD SendTextOffset;
extern DWORD SendFileOffset;
extern DWORD SendArticleOffset;
extern DWORD SendCardOffset;
extern DWORD SendAtTextOffset;
extern DWORD GetFriendListInitOffset;
extern DWORD GetFriendListRemoteOffset;
......@@ -46,6 +48,7 @@ extern DWORD PopHeadMessageRemoteOffset;
#define SendFileRemote "SendFileRemote"
#define SendArticleRemote "SendArticleRemote"
#define SendCardRemote "SendCardRemote"
#define SendAtTextRemote "SendAtTextRemote"
#define GetFriendListInit "GetFriendListInit"
#define GetFriendListRemote "GetFriendListRemote"
......
......@@ -162,6 +162,7 @@
<ClInclude Include="ReceiveMessage.h" />
<ClInclude Include="SelfInfo.h" />
<ClInclude Include="SendArticle.h" />
<ClInclude Include="SendAtText.h" />
<ClInclude Include="SendCard.h" />
<ClInclude Include="SendFile.h" />
<ClInclude Include="SendImage.h" />
......@@ -181,6 +182,7 @@
<ClCompile Include="ReceiveMessage.cpp" />
<ClCompile Include="SelfInfo.cpp" />
<ClCompile Include="SendArticle.cpp" />
<ClCompile Include="SendAtText.cpp" />
<ClCompile Include="SendCard.cpp" />
<ClCompile Include="SendFile.cpp" />
<ClCompile Include="SendImage.cpp" />
......
......@@ -55,6 +55,9 @@
<Filter Include="接收消息">
<UniqueIdentifier>{4763248d-1490-48c0-aa63-bf3265cf8178}</UniqueIdentifier>
</Filter>
<Filter Include="发送消息\发送艾特">
<UniqueIdentifier>{15310114-64cf-4426-a4ef-3c889824d2de}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
......@@ -96,6 +99,9 @@
<ClInclude Include="ReceiveMessage.h">
<Filter>接收消息</Filter>
</ClInclude>
<ClInclude Include="SendAtText.h">
<Filter>发送消息\发送艾特</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
......@@ -137,5 +143,8 @@
<ClCompile Include="ReceiveMessage.cpp">
<Filter>接收消息</Filter>
</ClCompile>
<ClCompile Include="SendAtText.cpp">
<Filter>发送消息\发送艾特</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
#include "pch.h"
#define SendAtTextCallOffset 0x6782E7B0 - 0x67370000
#define DeleteAtTextCacheCallOffset 0x67404200 - 0x67370000
struct SendAtTextStruct
{
DWORD chatroomid;
DWORD wxid;
DWORD wxmsg;
};
struct AtUserStruct {
wchar_t* wxid;
DWORD Length;
DWORD maxLength;
DWORD fill1 = 0;
DWORD fill2 = 0;
DWORD fill3 = 0;
};
struct AtStruct {
AtUserStruct* AtUser = NULL;
DWORD addr_end1;
DWORD addr_end2;
};
void SendAtTextRemote(LPVOID lpParameter) {
SendAtTextStruct* rp = (SendAtTextStruct*)lpParameter;
wchar_t* wsChatRoomId = (WCHAR*)rp->chatroomid;
wchar_t* wsWxId = (WCHAR*)rp->wxid;
wchar_t* wsTextMsg = (WCHAR*)rp->wxmsg;
SendAtText(wsChatRoomId,wsWxId, wsTextMsg);
}
void __stdcall SendAtText(wchar_t* wsChatRoomId, wchar_t* wsWxId, wchar_t* wsTextMsg) {
wchar_t* NickName = GetUserNickNameByWxId(wsWxId);
if (!NickName)
return;
wchar_t* SendTextMsg = new wchar_t[wcslen(wsTextMsg) + wcslen(NickName) + 3];
ZeroMemory(SendTextMsg, (wcslen(wsTextMsg) + wcslen(NickName) + 3) * 2);
swprintf_s(SendTextMsg, (wcslen(wsTextMsg) + wcslen(NickName) + 2) * 2,L"@%ws %ws",NickName,wsTextMsg);
WxBaseStruct wxChatRoomId(wsChatRoomId);
WxBaseStruct wxTextMsg(SendTextMsg);
AtStruct at = { 0 };
AtUserStruct AtUser = { 0 };
AtUser.wxid = wsWxId;
AtUser.Length = wcslen(wsWxId);
AtUser.maxLength = wcslen(wsWxId) * 2;
at.AtUser = &AtUser;
at.addr_end1 = (DWORD)&AtUser.fill3;
at.addr_end2 = (DWORD)&AtUser.fill3;
wchar_t** pWxmsg = &wxTextMsg.buffer;
char buffer[0x3B0] = { 0 };
DWORD dllBaseAddress = GetWeChatWinBase();
DWORD callAddress = dllBaseAddress + SendAtTextCallOffset;
DWORD DeleteTextCacheCall = dllBaseAddress + DeleteAtTextCacheCallOffset;
__asm {
pushad;
lea eax, at;
push 0x1;
push eax;
mov edi, pWxmsg;
push edi;
lea edx, wxChatRoomId;
lea ecx, buffer;
call callAddress;
add esp, 0xC;
lea ecx, buffer;
call DeleteTextCacheCall;
popad;
}
}
\ No newline at end of file
#pragma once
#include<windows.h>
void __stdcall SendAtText(wchar_t* wxChatRoomId, wchar_t* wsWxId, wchar_t* wsTextMsg);
extern "C" __declspec(dllexport) void SendAtTextRemote(LPVOID lpParameter);
\ No newline at end of file
......@@ -130,3 +130,55 @@ BOOL __stdcall GetUserInfoByWxId(wchar_t* wxid) {
}
return isSuccess;
}
wchar_t* __stdcall GetUserNickNameByWxId(wchar_t* wxid) {
DWORD WeChatWinBase = GetWeChatWinBase();
DWORD WxGetUserInfoCall0 = WeChatWinBase + GetUserInfoCall0Offset;
DWORD WxGetUserInfoCall1 = WeChatWinBase + GetUserInfoCall1Offset;
DWORD WxGetUserInfoCall2 = WeChatWinBase + GetUserInfoCall2Offset;
DWORD WxGetUserInfoCall3 = WeChatWinBase + GetUserInfoCall3Offset;
DWORD DeleteUserInofCacheCall1 = WeChatWinBase + DeleteUserInfoCacheCall1Offset;
DWORD DeleteUserInofCacheCall2 = WeChatWinBase + DeleteUserInfoCacheCall2Offset;
char buffer[0x3FC] = { 0 };
WxBaseStruct pWxid(wxid);
DWORD address = 0;
DWORD isSuccess = 0;
__asm
{
pushad;
call WxGetUserInfoCall0;
mov edi, eax;
lea ecx, buffer;
call WxGetUserInfoCall1;
lea eax, buffer;
mov address, eax;
push eax;
sub esp, 0x14;
mov ecx, esp;
lea esi, pWxid;
push esi;
call WxGetUserInfoCall2;
mov ecx, edi;
call WxGetUserInfoCall3;
mov isSuccess, eax;
popad;
}
wchar_t* NickName = NULL;
if (isSuccess) {
DWORD length = *(DWORD*)(address + 0x6C + 0x4);
NickName = new wchar_t[length + 1];
ZeroMemory(NickName, (length + 1) * 2);
memcpy(NickName, (wchar_t*)(*(DWORD*)(address + 0x6C)), length * 2);
}
__asm {
pushad;
lea eax, buffer;
push eax;
call DeleteUserInofCacheCall1;
lea ecx, buffer;
mov esi, eax;
call DeleteUserInofCacheCall2;
popad;
}
return NickName;
}
\ No newline at end of file
......@@ -3,3 +3,4 @@
BOOL __stdcall GetUserInfoByWxId(wchar_t* wxid);
extern "C" __declspec(dllexport) DWORD GetWxUserInfoRemote(LPVOID lparamter);
extern "C" __declspec(dllexport) VOID DeleteUserInfoCacheRemote();
wchar_t* __stdcall GetUserNickNameByWxId(wchar_t* wxid);
\ No newline at end of file
......@@ -15,6 +15,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,
printf("SendImage 0x%08X\n", (DWORD)SendImage);
printf("SendText 0x%08X\n", (DWORD)SendText);
printf("SendFile 0x%08X\n", (DWORD)SendFile);
printf("SendAtText 0x%08X\n", (DWORD)SendAtText);
printf("GetFriendList 0x%08X\n", (DWORD)GetFriendList);
printf("GetUserInfoByWxId 0x%08X\n", (DWORD)GetUserInfoByWxId);
printf("SendArticle 0x%08X\n", (DWORD)SendArticle);
......
......@@ -22,6 +22,7 @@
#include "CheckFriendStatus.h"
#include "LogMsgInfo.h"
#include "ReceiveMessage.h"
#include "SendAtText.h"
#endif //PCH_H
using namespace std;
......
......@@ -36,6 +36,11 @@ class ChatSession():
def SendCard(self,sharedwxid,nickname):
return self.robot.CSendCard(self.chatwith,sharedwxid,nickname)
def SendAtText(self,wxid,msg):
if '@chatroom' not in self.chatwith:
return 1
return self.robot.CSendAtText(self.chatwith,wxid,msg)
class WeChatRobot():
......@@ -158,7 +163,7 @@ class WeChatRobot():
while self.ReceiveMessageStarted:
try:
message = dict(ThreadRobot.robot.CReceiveMessage())
if CallBackFunc:
if CallBackFunc and message:
CallBackFunc(ThreadRobot,message)
except IndexError:
message = None
......@@ -239,7 +244,11 @@ def test_ReceiveMessage():
wx = WeChatRobot()
wx.StartService()
wx.StartReceiveMessage(CallBackFunc = ReceiveMessageCallBack)
input('按Enter可退出')
try:
while True:
pass
except KeyboardInterrupt:
pass
wx.StopService()
if __name__ == '__main__':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册