Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
honey05917
ComWeChatRobot
提交
254e8228
C
ComWeChatRobot
项目概览
honey05917
/
ComWeChatRobot
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ComWeChatRobot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
254e8228
编写于
4月 13, 2022
作者:
L
ljc545w
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新群艾特接口,可同时艾特多人
上级
c85c3a8b
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
161 addition
and
48 deletion
+161
-48
CWeChatRobot/SendAtText.cpp
CWeChatRobot/SendAtText.cpp
+75
-0
CWeChatRobot/SendAtText.h
CWeChatRobot/SendAtText.h
+2
-1
CWeChatRobot/WeChatRobot.cpp
CWeChatRobot/WeChatRobot.cpp
+9
-2
CWeChatRobot/WeChatRobot.h
CWeChatRobot/WeChatRobot.h
+1
-1
CWeChatRobot/WeChatRobotCOM.idl
CWeChatRobot/WeChatRobotCOM.idl
+1
-1
CWeChatRobot/WeChatRobotCOM_i.h
CWeChatRobot/WeChatRobotCOM_i.h
+2
-2
CWeChatRobot/WeChatRobotCOM_p.c
CWeChatRobot/WeChatRobotCOM_p.c
+15
-3
DWeChatRobot/SendAtText.cpp
DWeChatRobot/SendAtText.cpp
+37
-29
DWeChatRobot/SendAtText.h
DWeChatRobot/SendAtText.h
+1
-1
DWeChatRobot/pch.h
DWeChatRobot/pch.h
+3
-3
Release/CWeChatRobot.exe
Release/CWeChatRobot.exe
+0
-0
Release/DWeChatRobot.dll
Release/DWeChatRobot.dll
+0
-0
wxRobot.py
wxRobot.py
+15
-5
未找到文件。
CWeChatRobot/SendAtText.cpp
浏览文件 @
254e8228
...
...
@@ -5,6 +5,7 @@ struct SendAtTextStruct
DWORD
chatroomid
;
DWORD
wxid
;
DWORD
wxmsg
;
DWORD
length
;
};
int
SendAtText
(
wchar_t
*
chatroomid
,
wchar_t
*
wxid
,
wchar_t
*
wxmsg
)
{
...
...
@@ -36,6 +37,7 @@ int SendAtText(wchar_t* chatroomid, wchar_t* wxid, wchar_t* wxmsg) {
params
.
chatroomid
=
(
DWORD
)
chatroomidaddr
;
params
.
wxid
=
(
DWORD
)
wxidaddr
;
params
.
wxmsg
=
(
DWORD
)
wxmsgaddr
;
params
.
length
=
1
;
if
(
paramAndFunc
)
{
if
(
!::
WriteProcessMemory
(
hProcess
,
paramAndFunc
,
&
params
,
sizeof
(
SendAtTextStruct
),
&
dwTId
))
...
...
@@ -61,4 +63,77 @@ int SendAtText(wchar_t* chatroomid, wchar_t* wxid, wchar_t* wxmsg) {
VirtualFreeEx
(
hProcess
,
wxmsgaddr
,
0
,
MEM_RELEASE
);
VirtualFreeEx
(
hProcess
,
paramAndFunc
,
0
,
MEM_RELEASE
);
return
0
;
}
BOOL
SendAtText
(
wchar_t
*
chatroomid
,
SAFEARRAY
*
psaValue
,
wchar_t
*
wxmsg
)
{
if
(
!
hProcess
)
return
1
;
VARIANT
rgvar
;
rgvar
.
vt
=
VT_BSTR
;
HRESULT
hr
=
S_OK
;
long
lLbound
=
psaValue
->
rgsabound
->
lLbound
;
long
cElements
=
psaValue
->
rgsabound
->
cElements
;
if
(
cElements
==
1
)
{
VariantInit
(
&
rgvar
);
long
pIndex
=
0
;
hr
=
SafeArrayGetElement
(
psaValue
,
&
pIndex
,
&
rgvar
);
return
SendAtText
(
chatroomid
,
rgvar
.
bstrVal
,
wxmsg
);
}
vector
<
void
*>
wxidptrs
;
DWORD
dwWriteSize
=
0
;
DWORD
dwTId
=
0
;
DWORD
dwId
=
0
;
DWORD
WeChatRobotBase
=
GetWeChatRobotBase
();
SendAtTextStruct
params
=
{
0
};
LPVOID
chatroomidaddr
=
VirtualAllocEx
(
hProcess
,
NULL
,
1
,
MEM_COMMIT
,
PAGE_READWRITE
);
LPVOID
wxidptrsaddr
=
VirtualAllocEx
(
hProcess
,
NULL
,
sizeof
(
void
*
)
*
cElements
,
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
||
!
wxidptrsaddr
||
!
wxmsgaddr
||
!
paramAndFunc
||
!
WeChatRobotBase
)
{
return
1
;
}
for
(
long
i
=
lLbound
;
i
<
lLbound
+
cElements
;
i
++
)
{
VariantInit
(
&
rgvar
);
hr
=
SafeArrayGetElement
(
psaValue
,
&
i
,
&
rgvar
);
LPVOID
wxidaddr
=
VirtualAllocEx
(
hProcess
,
NULL
,
1
,
MEM_COMMIT
,
PAGE_READWRITE
);
if
(
wxidaddr
)
{
WriteProcessMemory
(
hProcess
,
wxidaddr
,
rgvar
.
bstrVal
,
wcslen
(
rgvar
.
bstrVal
)
*
2
+
2
,
&
dwWriteSize
);
wxidptrs
.
push_back
(
wxidaddr
);
}
}
if
(
chatroomidaddr
)
WriteProcessMemory
(
hProcess
,
chatroomidaddr
,
chatroomid
,
wcslen
(
chatroomid
)
*
2
+
2
,
&
dwWriteSize
);
if
(
wxidptrsaddr
)
WriteProcessMemory
(
hProcess
,
wxidptrsaddr
,
&
wxidptrs
[
0
],
wxidptrs
.
size
()
*
sizeof
(
void
*
),
&
dwWriteSize
);
if
(
wxmsgaddr
)
WriteProcessMemory
(
hProcess
,
wxmsgaddr
,
wxmsg
,
wcslen
(
wxmsg
)
*
2
+
2
,
&
dwWriteSize
);
params
.
chatroomid
=
(
DWORD
)
chatroomidaddr
;
params
.
wxid
=
(
DWORD
)
wxidptrsaddr
;
params
.
wxmsg
=
(
DWORD
)
wxmsgaddr
;
params
.
length
=
wxidptrs
.
size
();
if
(
paramAndFunc
)
{
WriteProcessMemory
(
hProcess
,
paramAndFunc
,
&
params
,
sizeof
(
SendAtTextStruct
),
&
dwTId
);
}
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
);
for
(
unsigned
int
i
=
0
;
i
<
wxidptrs
.
size
();
i
++
)
{
VirtualFreeEx
(
hProcess
,
wxidptrs
[
i
],
0
,
MEM_RELEASE
);
}
VirtualFreeEx
(
hProcess
,
chatroomidaddr
,
0
,
MEM_RELEASE
);
VirtualFreeEx
(
hProcess
,
wxmsgaddr
,
0
,
MEM_RELEASE
);
VirtualFreeEx
(
hProcess
,
wxidptrsaddr
,
0
,
MEM_RELEASE
);
VirtualFreeEx
(
hProcess
,
paramAndFunc
,
0
,
MEM_RELEASE
);
return
0
;
}
\ No newline at end of file
CWeChatRobot/SendAtText.h
浏览文件 @
254e8228
#pragma once
#include<windows.h>
int
SendAtText
(
wchar_t
*
chatroomid
,
wchar_t
*
wxid
,
wchar_t
*
wxmsg
);
\ No newline at end of file
int
SendAtText
(
wchar_t
*
chatroomid
,
wchar_t
*
wxid
,
wchar_t
*
wxmsg
);
int
SendAtText
(
wchar_t
*
chatroomid
,
SAFEARRAY
*
wxid
,
wchar_t
*
wxmsg
);
\ No newline at end of file
CWeChatRobot/WeChatRobot.cpp
浏览文件 @
254e8228
...
...
@@ -37,8 +37,15 @@ STDMETHODIMP CWeChatRobot::CSendText(BSTR wxid, BSTR wxmsg, int* __result) {
* 参数3:文本消息内容
* 参数4:预返回的值,调用时无需提供
*/
STDMETHODIMP
CWeChatRobot
::
CSendAtText
(
BSTR
chatroomid
,
BSTR
wxid
,
BSTR
wxmsg
,
int
*
__result
)
{
*
__result
=
SendAtText
(
chatroomid
,
wxid
,
wxmsg
);
STDMETHODIMP
CWeChatRobot
::
CSendAtText
(
BSTR
chatroomid
,
VARIANT
*
wxid
,
BSTR
wxmsg
,
int
*
__result
)
{
*
__result
=
0
;
if
(
wxid
->
vt
==
VT_BSTR
)
{
*
__result
=
SendAtText
(
chatroomid
,
wxid
->
bstrVal
,
wxmsg
);
}
else
if
(
wxid
->
vt
==
(
VT_ARRAY
|
VT_VARIANT
))
{
SAFEARRAY
*
psaValue
=
wxid
->
parray
;
*
__result
=
SendAtText
(
chatroomid
,
psaValue
,
wxmsg
);
}
return
S_OK
;
}
...
...
CWeChatRobot/WeChatRobot.h
浏览文件 @
254e8228
...
...
@@ -58,7 +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
CSendAtText
(
BSTR
chatroomid
,
VARIANT
*
wxid
,
BSTR
wxmsg
,
int
*
__result
);
STDMETHODIMP
CGetFriendList
(
VARIANT
*
__result
);
STDMETHODIMP
CGetFriendListString
(
BSTR
*
__result
);
STDMETHODIMP
CGetWxUserInfo
(
BSTR
wxid
,
BSTR
*
__result
);
...
...
CWeChatRobot/WeChatRobotCOM.idl
浏览文件 @
254e8228
...
...
@@ -34,7 +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
)
;
[
id
(
19
)
]
HRESULT
CSendAtText
(
[
in
]
BSTR
chatroomid
,
[
in
]
VARIANT
*
wxid
,
[
in
]
BSTR
wxmsg
,
[
out
,
retval
]
int
*
__result
)
;
[
id
(
20
)
]
HRESULT
CGetChatRoomMembers
(
[
in
]
BSTR
chatroomid
,
[
out
,
retval
]
VARIANT
*
__result
)
;
}
;
[
...
...
CWeChatRobot/WeChatRobotCOM_i.h
浏览文件 @
254e8228
...
...
@@ -159,7 +159,7 @@ EXTERN_C const IID IID_IWeChatRobot;
virtual
/* [id] */
HRESULT
STDMETHODCALLTYPE
CSendAtText
(
/* [in] */
BSTR
chatroomid
,
/* [in] */
BSTR
wxid
,
/* [in] */
VARIANT
*
wxid
,
/* [in] */
BSTR
wxmsg
,
/* [retval][out] */
int
*
__result
)
=
0
;
...
...
@@ -315,7 +315,7 @@ EXTERN_C const IID IID_IWeChatRobot;
/* [id] */
HRESULT
(
STDMETHODCALLTYPE
*
CSendAtText
)(
IWeChatRobot
*
This
,
/* [in] */
BSTR
chatroomid
,
/* [in] */
BSTR
wxid
,
/* [in] */
VARIANT
*
wxid
,
/* [in] */
BSTR
wxmsg
,
/* [retval][out] */
int
*
__result
);
...
...
CWeChatRobot/WeChatRobotCOM_p.c
浏览文件 @
254e8228
...
...
@@ -48,7 +48,7 @@
#include "WeChatRobotCOM_i.h"
#define TYPE_FORMAT_STRING_SIZE 12
21
#define TYPE_FORMAT_STRING_SIZE 12
39
#define PROC_FORMAT_STRING_SIZE 835
#define EXPR_FORMAT_STRING_SIZE 1
#define TRANSMIT_AS_TABLE_SIZE 0
...
...
@@ -774,9 +774,9 @@ static const WeChatRobotCOM_MIDL_PROC_FORMAT_STRING WeChatRobotCOM__MIDL_ProcFor
/* Parameter wxid */
/* 768 */
NdrFcShort
(
0x
8b
),
/* Flags: must size, must free, in, by val
, */
/* 768 */
NdrFcShort
(
0x
10b
),
/* Flags: must size, must free, in, simple ref
, */
/* 770 */
NdrFcShort
(
0x8
),
/* x86 Stack size/offset = 8 */
/* 772 */
NdrFcShort
(
0x
2a
),
/* Type Offset=42
*/
/* 772 */
NdrFcShort
(
0x
4cc
),
/* Type Offset=1228
*/
/* Parameter wxmsg */
...
...
@@ -1624,6 +1624,18 @@ static const WeChatRobotCOM_MIDL_TYPE_FORMAT_STRING WeChatRobotCOM__MIDL_TypeFor
/* 1214 */
NdrFcShort
(
0x4
),
/* 4 */
/* 1216 */
NdrFcShort
(
0x0
),
/* 0 */
/* 1218 */
NdrFcShort
(
0xfcb4
),
/* Offset= -844 (374) */
/* 1220 */
0x11
,
0x0
,
/* FC_RP */
/* 1222 */
NdrFcShort
(
0x6
),
/* Offset= 6 (1228) */
/* 1224 */
0x12
,
0x0
,
/* FC_UP */
/* 1226 */
NdrFcShort
(
0xffce
),
/* Offset= -50 (1176) */
/* 1228 */
0xb4
,
/* FC_USER_MARSHAL */
0x83
,
/* 131 */
/* 1230 */
NdrFcShort
(
0x1
),
/* 1 */
/* 1232 */
NdrFcShort
(
0x10
),
/* 16 */
/* 1234 */
NdrFcShort
(
0x0
),
/* 0 */
/* 1236 */
NdrFcShort
(
0xfff4
),
/* Offset= -12 (1224) */
0x0
}
...
...
DWeChatRobot/SendAtText.cpp
浏览文件 @
254e8228
...
...
@@ -8,19 +8,11 @@ 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
;
DWORD
length
;
};
struct
AtStruct
{
AtUserStruct
*
AtUser
=
NULL
;
DWORD
AtUser
;
DWORD
addr_end1
;
DWORD
addr_end2
;
};
...
...
@@ -28,29 +20,45 @@ struct AtStruct {
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
);
if
(
rp
->
length
==
0
)
return
;
else
if
(
rp
->
length
==
1
)
SendAtText
(
wsChatRoomId
,
(
DWORD
*
)
&
rp
->
wxid
,
wsTextMsg
,
rp
->
length
);
else
SendAtText
(
wsChatRoomId
,
(
DWORD
*
)
rp
->
wxid
,
wsTextMsg
,
rp
->
length
);
}
void
__stdcall
SendAtText
(
wchar_t
*
wsChatRoomId
,
wchar_t
*
wsWxId
,
wchar_t
*
wsTextMsg
)
{
wchar_t
*
NickName
=
GetUserNickNameByWxId
(
wsWxId
);
if
(
!
NickName
)
void
__stdcall
SendAtText
(
wchar_t
*
wsChatRoomId
,
DWORD
wsWxId
[],
wchar_t
*
wsTextMsg
,
int
length
)
{
WxString
*
AtUsers
=
new
WxString
[
length
+
1
];
wstring
AtMessage
=
L""
;
int
querySuccess
=
0
;
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
wchar_t
*
nickname
=
NULL
;
if
(
!
lstrcmpW
((
wchar_t
*
)
wsWxId
[
i
],
(
wchar_t
*
)
L"notify@all"
))
{
nickname
=
(
wchar_t
*
)
L""
;
}
else
nickname
=
GetUserNickNameByWxId
((
wchar_t
*
)
wsWxId
[
i
]);
if
(
!
nickname
)
continue
;
WxString
temp
=
{
0
};
temp
.
buffer
=
(
wchar_t
*
)
wsWxId
[
i
];
temp
.
length
=
wcslen
((
wchar_t
*
)
wsWxId
[
i
]);
temp
.
maxLength
=
wcslen
((
wchar_t
*
)
wsWxId
[
i
])
*
2
;
memcpy
(
&
AtUsers
[
querySuccess
],
&
temp
,
sizeof
(
WxString
));
AtMessage
=
AtMessage
+
L"@"
+
nickname
+
L" "
;
querySuccess
++
;
}
AtMessage
+=
wsTextMsg
;
if
(
!
querySuccess
)
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
);
WxBaseStruct
wxTextMsg
(
(
wchar_t
*
)
AtMessage
.
c_str
()
);
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
;
at
.
AtUser
=
(
DWORD
)
AtUsers
;
at
.
addr_end1
=
(
DWORD
)
&
AtUsers
[
querySuccess
];
at
.
addr_end2
=
(
DWORD
)
&
AtUsers
[
querySuccess
];
wchar_t
**
pWxmsg
=
&
wxTextMsg
.
buffer
;
char
buffer
[
0x3B0
]
=
{
0
};
...
...
@@ -60,7 +68,6 @@ void __stdcall SendAtText(wchar_t* wsChatRoomId, wchar_t* wsWxId, wchar_t* wsTex
DWORD
DeleteTextCacheCall
=
dllBaseAddress
+
DeleteAtTextCacheCallOffset
;
__asm
{
pushad
;
lea
eax
,
at
;
push
0x1
;
push
eax
;
...
...
@@ -72,6 +79,7 @@ void __stdcall SendAtText(wchar_t* wsChatRoomId, wchar_t* wsWxId, wchar_t* wsTex
add
esp
,
0xC
;
lea
ecx
,
buffer
;
call
DeleteTextCacheCall
;
popad
;
}
delete
[]
AtUsers
;
AtUsers
=
NULL
;
}
\ No newline at end of file
DWeChatRobot/SendAtText.h
浏览文件 @
254e8228
#pragma once
#include<windows.h>
void
__stdcall
SendAtText
(
wchar_t
*
w
xChatRoomId
,
wchar_t
*
wsWxId
,
wchar_t
*
wsTextMsg
);
void
__stdcall
SendAtText
(
wchar_t
*
w
sChatRoomId
,
DWORD
wsWxId
[],
wchar_t
*
wsTextMsg
,
int
length
);
extern
"C"
__declspec
(
dllexport
)
void
SendAtTextRemote
(
LPVOID
lpParameter
);
\ No newline at end of file
DWeChatRobot/pch.h
浏览文件 @
254e8228
...
...
@@ -48,9 +48,9 @@ struct WxBaseStruct
struct
WxString
{
wchar_t
*
buffer
;
DWORD
length
;
DWORD
maxLength
;
wchar_t
*
buffer
=
NULL
;
DWORD
length
=
0
;
DWORD
maxLength
=
0
;
DWORD
fill1
=
0
;
DWORD
fill2
=
0
;
};
...
...
Release/CWeChatRobot.exe
浏览文件 @
254e8228
无法预览此类型文件
Release/DWeChatRobot.dll
浏览文件 @
254e8228
无法预览此类型文件
wxRobot.py
浏览文件 @
254e8228
...
...
@@ -36,7 +36,7 @@ class ChatSession():
def
SendCard
(
self
,
sharedwxid
,
nickname
):
return
self
.
robot
.
CSendCard
(
self
.
chatwith
,
sharedwxid
,
nickname
)
def
SendAtText
(
self
,
wxid
,
msg
):
def
SendAtText
(
self
,
wxid
:
list
or
str
or
tuple
,
msg
):
if
'@chatroom'
not
in
self
.
chatwith
:
return
1
return
self
.
robot
.
CSendAtText
(
self
.
chatwith
,
wxid
,
msg
)
...
...
@@ -204,11 +204,21 @@ class WeChatRobot():
def
ReceiveMessageCallBack
(
robot
,
message
):
if
message
[
'type'
]
==
1
and
message
[
'sender'
]
!=
'filehelper'
:
robot
.
robot
.
CSendText
(
'filehelper'
,
message
[
'message'
])
if
message
[
'sender'
]
!=
'filehelper'
:
wxSender
=
robot
.
GetWxUserInfo
(
message
[
'sender'
])
sender
=
wxSender
[
'wxNickName'
]
if
wxSender
[
'wxNickName'
]
!=
'null'
else
message
[
'sender'
]
wxSender
=
robot
.
GetWxUserInfo
(
message
[
'sender'
])
sender
=
wxSender
[
'wxNickName'
]
if
wxSender
[
'wxNickName'
]
!=
'null'
else
message
[
'sender'
]
if
'@chatroom'
in
message
[
'sender'
]:
wxUser
=
robot
.
GetWxUserInfo
(
message
[
'wxid'
])
print
(
"来自 {} {}"
.
format
(
sender
,
wxUser
[
'wxNickName'
]))
else
:
print
(
"来自 {}"
.
format
(
sender
))
print
(
message
)
if
message
[
'type'
]
==
1
:
print
(
message
[
'message'
])
elif
message
[
'type'
]
==
3
:
print
(
message
[
'filepath'
])
elif
message
[
'type'
]
==
49
:
print
(
message
[
'message'
])
else
:
print
(
message
[
'type'
],
message
[
'message'
])
def
test_SendText
():
import
os
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录