Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_46011646
wechaty
提交
d713c77e
W
wechaty
项目概览
weixin_46011646
/
wechaty
与 Fork 源项目一致
Fork自
wechaty / wechaty
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
wechaty
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d713c77e
编写于
10月 11, 2016
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#41 say() works on Contact/Room, and `this` inside listener functions now
上级
197e7e1d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
104 addition
and
58 deletion
+104
-58
example/room-bot.ts
example/room-bot.ts
+13
-11
package.json
package.json
+0
-0
src/contact.ts
src/contact.ts
+18
-0
src/event-scope.ts
src/event-scope.ts
+21
-24
src/message.ts
src/message.ts
+1
-1
src/puppet-web/firer.ts
src/puppet-web/firer.ts
+4
-4
src/room.ts
src/room.ts
+21
-6
src/wechaty.ts
src/wechaty.ts
+26
-12
未找到文件。
example/room-bot.ts
浏览文件 @
d713c77e
...
@@ -83,9 +83,9 @@ bot
...
@@ -83,9 +83,9 @@ bot
* Global Event: room-join
* Global Event: room-join
*/
*/
.
on
(
'
room-join
'
,
(
room
,
invitee
,
inviter
)
=>
{
.
on
(
'
room-join
'
,
(
room
,
invitee
,
inviter
)
=>
{
log
.
info
(
'
Bot
'
,
'
room-join event:
Room %s got new member %s, invited by %s
'
log
.
info
(
'
Bot
'
,
'
EVENT: room-join -
Room %s got new member %s, invited by %s
'
,
room
.
topic
()
,
room
.
topic
()
,
invitee
.
map
,
Array
.
isArray
(
invitee
)
?
invitee
.
map
(
c
=>
c
.
name
()).
join
(
'
,
'
)
?
invitee
.
map
(
c
=>
c
.
name
()).
join
(
'
,
'
)
:
invitee
:
invitee
,
inviter
.
name
()
,
inviter
.
name
()
...
@@ -96,7 +96,7 @@ bot
...
@@ -96,7 +96,7 @@ bot
* Global Event: room-leave
* Global Event: room-leave
*/
*/
.
on
(
'
room-leave
'
,
(
room
,
leaver
)
=>
{
.
on
(
'
room-leave
'
,
(
room
,
leaver
)
=>
{
log
.
info
(
'
Bot
'
,
'
room-leave event:
Room %s lost member %s
'
log
.
info
(
'
Bot
'
,
'
EVENT: room-leave -
Room %s lost member %s
'
,
room
.
topic
()
,
room
.
topic
()
,
leaver
.
name
()
,
leaver
.
name
()
)
)
...
@@ -107,7 +107,7 @@ bot
...
@@ -107,7 +107,7 @@ bot
*/
*/
.
on
(
'
room-topic
'
,
(
room
,
topic
,
oldTopic
,
changer
)
=>
{
.
on
(
'
room-topic
'
,
(
room
,
topic
,
oldTopic
,
changer
)
=>
{
try
{
try
{
log
.
info
(
'
Bot
'
,
'
room-topic event:
Room %s change topic to %s by member %s
'
log
.
info
(
'
Bot
'
,
'
EVENT: room-topic -
Room %s change topic to %s by member %s
'
,
oldTopic
,
oldTopic
,
topic
,
topic
,
changer
.
name
()
,
changer
.
name
()
...
@@ -120,7 +120,7 @@ bot
...
@@ -120,7 +120,7 @@ bot
/**
/**
* Global Event: message
* Global Event: message
*/
*/
.
on
(
'
message
'
,
message
=>
{
.
on
(
'
message
'
,
(
message
)
=>
{
const
room
=
message
.
room
()
const
room
=
message
.
room
()
const
sender
=
message
.
from
()
const
sender
=
message
.
from
()
const
content
=
message
.
content
()
const
content
=
message
.
content
()
...
@@ -166,7 +166,7 @@ bot
...
@@ -166,7 +166,7 @@ bot
* room found
* room found
*/
*/
if
(
dingRoom
)
{
if
(
dingRoom
)
{
log
.
info
(
'
Bot
'
,
'
onMessage: got dingRoom
'
)
log
.
info
(
'
Bot
'
,
'
onMessage: got dingRoom
: %s
'
,
dingRoom
.
topic
()
)
/**
/**
* speaker is already in room
* speaker is already in room
...
@@ -183,7 +183,8 @@ bot
...
@@ -183,7 +183,8 @@ bot
* put speaker into room
* put speaker into room
*/
*/
}
else
{
}
else
{
log
.
info
(
'
Bot
'
,
'
onMessage: add sender to dingRoom
'
)
log
.
info
(
'
Bot
'
,
'
onMessage: add sender(%s) to dingRoom(%s)
'
,
sender
.
name
(),
dingRoom
.
topic
())
sender
.
say
(
'
ok, I will put you in ding room!
'
)
putInRoom
(
sender
,
dingRoom
)
putInRoom
(
sender
,
dingRoom
)
}
}
...
@@ -230,22 +231,23 @@ function manageDingRoom() {
...
@@ -230,22 +231,23 @@ function manageDingRoom() {
/**
/**
* Event: Join
* Event: Join
*/
*/
room
.
on
(
'
join
'
,
(
invitee
:
Contact
|
Contact
[],
inviter
:
Contact
)
=>
room
.
on
(
'
join
'
,
(
invitee
:
Contact
|
Contact
[],
inviter
:
Contact
)
=>
{
log
.
verbose
(
'
Bot
'
,
'
Room EVENT: join - %s, %s
'
,
typeof
invitee
,
typeof
inviter
)
checkRoomJoin
.
call
(
this
,
room
,
invitee
,
inviter
)
checkRoomJoin
.
call
(
this
,
room
,
invitee
,
inviter
)
)
}
)
/**
/**
* Event: Leave
* Event: Leave
*/
*/
room
.
on
(
'
leave
'
,
(
leaver
)
=>
{
room
.
on
(
'
leave
'
,
(
leaver
)
=>
{
log
.
info
(
'
Bot
'
,
'
room event:
%s leave, byebye
'
,
leaver
.
name
())
log
.
info
(
'
Bot
'
,
'
Room EVENT: leave -
%s leave, byebye
'
,
leaver
.
name
())
})
})
/**
/**
* Event: Topic Change
* Event: Topic Change
*/
*/
room
.
on
(
'
topic
'
,
(
topic
,
oldTopic
,
changer
)
=>
{
room
.
on
(
'
topic
'
,
(
topic
,
oldTopic
,
changer
)
=>
{
log
.
info
(
'
Bot
'
,
'
room event: topic
changed from %s to %s by member %s
'
log
.
info
(
'
Bot
'
,
'
Room EVENT: topic -
changed from %s to %s by member %s
'
,
oldTopic
,
oldTopic
,
topic
,
topic
,
changer
.
name
()
,
changer
.
name
()
...
...
package.json
100755 → 100644
浏览文件 @
d713c77e
文件模式从 100755 更改为 100644
src/contact.ts
浏览文件 @
d713c77e
...
@@ -7,7 +7,9 @@
...
@@ -7,7 +7,9 @@
*
*
*/
*/
import
Config
from
'
./config
'
import
Config
from
'
./config
'
import
Message
from
'
./message
'
import
UtilLib
from
'
./util-lib
'
import
UtilLib
from
'
./util-lib
'
import
Wechaty
from
'
./wechaty
'
import
log
from
'
./brolog-env
'
import
log
from
'
./brolog-env
'
...
@@ -184,6 +186,22 @@ class Contact {
...
@@ -184,6 +186,22 @@ class Contact {
return
Contact
.
pool
[
id
]
return
Contact
.
pool
[
id
]
}
}
public
say
(
content
:
string
):
Promise
<
any
>
{
log
.
verbose
(
'
Contact
'
,
'
say(%s)
'
,
content
)
const
wechaty
=
Wechaty
.
instance
()
const
user
=
wechaty
.
user
()
const
m
=
new
Message
()
m
.
from
(
user
)
m
.
to
(
this
)
m
.
content
(
content
)
log
.
silly
(
'
Contact
'
,
'
say() from: %s to: %s content: %s
'
,
user
.
name
(),
this
.
name
(),
content
)
return
wechaty
.
send
(
m
)
}
}
}
// Contact.search = function(options) {
// Contact.search = function(options) {
...
...
src/event-scope.ts
浏览文件 @
d713c77e
...
@@ -45,14 +45,11 @@ class EventScope {
...
@@ -45,14 +45,11 @@ class EventScope {
return
Object
.
keys
(
EVENT_CONFIG
)
return
Object
.
keys
(
EVENT_CONFIG
)
}
}
public
static
wrap
(
this
:
Wechaty
|
Room
,
event
:
WechatyEventType
,
callback
:
Function
)
{
public
static
wrap
(
this
:
Wechaty
|
Room
,
event
:
WechatyEventType
,
listener
:
Function
):
Function
{
log
.
verbose
(
'
WechatyEvent
'
,
'
wrap(%s, %s)
'
,
event
,
typeof
callback
)
log
.
verbose
(
'
WechatyEvent
'
,
'
wrap(%s, %s)
'
,
event
,
typeof
listener
)
// if (!(this instanceof Wechaty)) {
if
(
typeof
listener
!==
'
function
'
)
{
// throw new Error('`this` should be Wechaty instance')
throw
new
Error
(
'
`listener` should be function
'
)
// }
if
(
typeof
callback
!==
'
function
'
)
{
throw
new
Error
(
'
`callback` should be function
'
)
}
}
if
(
!
(
event
in
EVENT_CONFIG
))
{
if
(
!
(
event
in
EVENT_CONFIG
))
{
...
@@ -61,13 +58,13 @@ class EventScope {
...
@@ -61,13 +58,13 @@ class EventScope {
const
wrapper
=
EVENT_CONFIG
[
event
]
const
wrapper
=
EVENT_CONFIG
[
event
]
/**
/**
* We assign a empty object to each event
callback
,
* We assign a empty object to each event
listener
,
* to carry the indenpendent scope
* to carry the indenpendent scope
*/
*/
if
(
wrapper
)
{
if
(
wrapper
)
{
return
wrapper
(
callback
)
return
wrapper
(
listener
)
}
else
{
}
else
{
return
callback
return
listener
}
}
}
}
}
}
...
@@ -92,11 +89,11 @@ function isRoom(room) {
...
@@ -92,11 +89,11 @@ function isRoom(room) {
return
true
return
true
}
}
function
wrapContact
(
callback
)
{
function
wrapContact
(
listener
)
{
log
.
verbose
(
'
WechatyEvent
'
,
'
wrapContact()
'
)
log
.
verbose
(
'
WechatyEvent
'
,
'
wrapContact()
'
)
return
(...
argList
)
=>
{
return
(...
argList
)
=>
{
log
.
silly
(
'
WechatyEvent
'
,
'
wrapContact()
callback
'
)
log
.
silly
(
'
WechatyEvent
'
,
'
wrapContact()
listener
'
)
if
(
!
isContact
(
argList
[
0
]))
{
if
(
!
isContact
(
argList
[
0
]))
{
throw
new
Error
(
'
contact not found in argList
'
)
throw
new
Error
(
'
contact not found in argList
'
)
...
@@ -113,15 +110,15 @@ function wrapContact(callback) {
...
@@ -113,15 +110,15 @@ function wrapContact(callback) {
.
send
(
msg
)
.
send
(
msg
)
}
}
return
callback
.
apply
(
eventScope
,
argList
)
return
listener
.
apply
(
eventScope
,
argList
)
}
}
}
}
function
wrapRoom
(
callback
)
{
function
wrapRoom
(
listener
)
{
log
.
verbose
(
'
WechatyEvent
'
,
'
wrapRoom()
'
)
log
.
verbose
(
'
WechatyEvent
'
,
'
wrapRoom()
'
)
return
(
room
:
Room
,
...
argList
)
=>
{
return
(
room
:
Room
,
...
argList
)
=>
{
log
.
silly
(
'
WechatyEvent
'
,
'
wrapRoom(%s, %s, %s, %s)
callback
'
,
room
.
topic
(),
argList
[
0
],
argList
[
1
],
argList
[
2
])
log
.
silly
(
'
WechatyEvent
'
,
'
wrapRoom(%s, %s, %s, %s)
listener
'
,
room
.
topic
(),
argList
[
0
],
argList
[
1
],
argList
[
2
])
let
contact
let
contact
for
(
let
arg
of
argList
)
{
for
(
let
arg
of
argList
)
{
...
@@ -144,17 +141,17 @@ function wrapRoom(callback) {
...
@@ -144,17 +141,17 @@ function wrapRoom(callback) {
return
room
.
say
(
content
,
replyTo
)
return
room
.
say
(
content
,
replyTo
)
}
}
return
callback
.
apply
(
eventScope
,
[
room
,
...
argList
])
return
listener
.
apply
(
eventScope
,
[
room
,
...
argList
])
}
}
}
}
function
wrapMessage
(
callback
)
{
function
wrapMessage
(
listener
)
{
log
.
verbose
(
'
WechatyEvent
'
,
'
wrapMessage()
'
)
log
.
verbose
(
'
WechatyEvent
'
,
'
wrapMessage()
'
)
return
(...
argList
)
=>
{
return
(...
argList
)
=>
{
log
.
silly
(
'
WechatyEvent
'
,
'
wrapMessage()
callback
'
)
log
.
silly
(
'
WechatyEvent
'
,
'
wrapMessage()
listener
'
)
// console.log('############### wrapped on message
callback
')
// console.log('############### wrapped on message
listener
')
// console.log(typeof Message)
// console.log(typeof Message)
// console.log(argList)
// console.log(argList)
if
(
!
(
argList
[
0
]
instanceof
Message
))
{
if
(
!
(
argList
[
0
]
instanceof
Message
))
{
...
@@ -183,15 +180,15 @@ function wrapMessage(callback) {
...
@@ -183,15 +180,15 @@ function wrapMessage(callback) {
.
send
(
m
)
.
send
(
m
)
}
}
return
callback
.
apply
(
eventScope
,
argList
)
return
listener
.
apply
(
eventScope
,
argList
)
}
}
}
}
function
wrapFilehelper
(
callback
)
{
function
wrapFilehelper
(
listener
)
{
log
.
verbose
(
'
WechatyEvent
'
,
'
wrapFilehelper()
'
)
log
.
verbose
(
'
WechatyEvent
'
,
'
wrapFilehelper()
'
)
return
(...
argList
)
=>
{
return
(...
argList
)
=>
{
log
.
silly
(
'
WechatyEvent
'
,
'
wrapFilehelper()
callback
'
)
log
.
silly
(
'
WechatyEvent
'
,
'
wrapFilehelper()
listener
'
)
const
eventScope
=
<
WechatyEventScope
>
{}
const
eventScope
=
<
WechatyEventScope
>
{}
eventScope
.
say
=
(
content
)
=>
{
eventScope
.
say
=
(
content
)
=>
{
log
.
silly
(
'
WechatyEvent
'
,
'
wrapFilehelper() say(%s)
'
,
content
)
log
.
silly
(
'
WechatyEvent
'
,
'
wrapFilehelper() say(%s)
'
,
content
)
...
@@ -202,7 +199,7 @@ function wrapFilehelper(callback) {
...
@@ -202,7 +199,7 @@ function wrapFilehelper(callback) {
.
send
(
msg
)
.
send
(
msg
)
}
}
return
callback
.
apply
(
eventScope
,
argList
)
return
listener
.
apply
(
eventScope
,
argList
)
}
}
}
}
...
...
src/message.ts
浏览文件 @
d713c77e
...
@@ -134,7 +134,7 @@ class Message {
...
@@ -134,7 +134,7 @@ class Message {
return
'
{
'
+
this
.
type
()
+
'
}
'
+
content
return
'
{
'
+
this
.
type
()
+
'
}
'
+
content
}
}
public
from
(
contact
?:
Contact
)
{
public
from
(
contact
?:
Contact
)
:
Contact
{
if
(
contact
)
{
if
(
contact
)
{
if
(
contact
instanceof
Contact
)
{
if
(
contact
instanceof
Contact
)
{
this
.
obj
.
from
=
contact
.
id
this
.
obj
.
from
=
contact
.
id
...
...
src/puppet-web/firer.ts
浏览文件 @
d713c77e
...
@@ -210,11 +210,11 @@ async function fireRoomJoin(m: Message): Promise<void> {
...
@@ -210,11 +210,11 @@ async function fireRoomJoin(m: Message): Promise<void> {
await
room
.
ready
()
await
room
.
ready
()
if
(
inviteeContactList
.
length
===
1
)
{
if
(
inviteeContactList
.
length
===
1
)
{
this
.
emit
(
'
room-join
'
,
room
,
inviteeContactList
[
0
],
inviterContact
)
this
.
emit
(
'
room-join
'
,
room
,
inviteeContactList
[
0
]
,
inviterContact
)
room
.
emit
(
'
join
'
,
inviteeContactList
[
0
],
inviterContact
)
room
.
emit
(
'
join
'
,
inviteeContactList
[
0
]
,
inviterContact
)
}
else
{
}
else
{
this
.
emit
(
'
room-join
'
,
room
,
inviteeContactList
,
inviterContact
)
this
.
emit
(
'
room-join
'
,
room
,
inviteeContactList
,
inviterContact
)
room
.
emit
(
'
join
'
,
inviteeContactList
,
inviterContact
)
room
.
emit
(
'
join
'
,
inviteeContactList
,
inviterContact
)
}
}
// }).catch(e => {
// }).catch(e => {
...
...
src/room.ts
浏览文件 @
d713c77e
...
@@ -109,19 +109,34 @@ class Room extends EventEmitter {
...
@@ -109,19 +109,34 @@ class Room extends EventEmitter {
})
})
}
}
public
on
(
event
:
'
join
'
|
'
leave
'
|
'
topic
'
public
on
(
event
:
'
join
'
,
listener
:
(
invitee
:
Contact
,
inviter
:
Contact
)
=>
void
)
// XXX ???
,
listener
:
Function
public
on
(
event
:
'
join
'
,
listener
:
(
inviteeList
:
Contact
[]
,
inviter
:
Contact
)
=>
void
):
Room
)
{
public
on
(
event
:
'
topic
'
,
listener
:
(
topic
:
string
,
oldTopic
:
string
,
changer
:
Contact
)
=>
void
):
Room
public
on
(
event
:
'
leave
'
,
listener
:
(
leaver
:
Contact
)
=>
void
):
Room
public
on
(
event
:
string
,
listener
:
Function
):
Room
{
log
.
verbose
(
'
Room
'
,
'
on(%s, %s)
'
,
event
,
typeof
listener
)
log
.
verbose
(
'
Room
'
,
'
on(%s, %s)
'
,
event
,
typeof
listener
)
/**
* wrap a room event listener to a global event listener
*/
const
listenerWithRoomArg
=
(
room
:
Room
,
...
argList
)
=>
{
return
listener
.
apply
(
this
,
argList
)
}
/**
/**
* every room event must can be mapped to a global event.
* every room event must can be mapped to a global event.
* such as: `join` to `room-join`
* such as: `join` to `room-join`
*/
*/
const
callbackWithScope
=
EventScope
.
wrap
.
call
(
this
,
'
room-
'
+
event
,
listener
)
const
globalEventName
=
'
room-
'
+
event
const
listenerWithScope
=
EventScope
.
wrap
.
call
(
this
,
globalEventName
,
listenerWithRoomArg
)
// bind(this1, this2): the second this is for simulate the global room-* event
/**
super
.
on
(
event
,
callbackWithScope
.
bind
(
this
,
this
))
* bind(listenerWithScope, this):
* the `this` is for simulate the global room-* event,
* provide the first argument `room`
*/
super
.
on
(
event
,
listenerWithScope
.
bind
(
listenerWithScope
,
this
))
return
this
return
this
}
}
...
...
src/wechaty.ts
浏览文件 @
d713c77e
...
@@ -18,14 +18,16 @@ import Config, {
...
@@ -18,14 +18,16 @@ import Config, {
,
PuppetType
,
PuppetType
}
from
'
./config
'
}
from
'
./config
'
import
Contact
from
'
./contact
'
import
Contact
from
'
./contact
'
import
Message
from
'
./message
'
import
FriendRequest
from
'
./friend-request
'
import
Puppet
from
'
./puppet
'
import
Message
from
'
./message
'
import
PuppetWeb
from
'
./puppet-web/index
'
import
Puppet
from
'
./puppet
'
import
UtilLib
from
'
./util-lib
'
import
PuppetWeb
from
'
./puppet-web/index
'
import
EventScope
from
'
./event-scope
'
import
Room
from
'
./room
'
import
UtilLib
from
'
./util-lib
'
import
EventScope
from
'
./event-scope
'
import
log
from
'
./brolog-env
'
import
log
from
'
./brolog-env
'
type
WechatySetting
=
{
type
WechatySetting
=
{
profile
?:
string
profile
?:
string
...
@@ -152,11 +154,23 @@ class Wechaty extends EventEmitter {
...
@@ -152,11 +154,23 @@ class Wechaty extends EventEmitter {
return
this
return
this
}
}
public
on
(
event
:
string
,
listener
:
Function
)
{
public
on
(
event
:
'
message
'
,
listener
:
(
message
:
Message
,
n
:
number
)
=>
void
)
// XXX ???
public
on
(
event
:
'
scan
'
,
listener
:
({
url
:
string
,
code
:
number
})
=>
void
):
Wechaty
public
on
(
event
:
'
logout
'
,
listener
:
(
user
:
Contact
)
=>
void
):
Wechaty
public
on
(
event
:
'
login
'
,
listener
:
(
user
:
Contact
)
=>
void
):
Wechaty
public
on
(
event
:
'
friend
'
,
listener
:
(
friend
:
Contact
,
request
:
FriendRequest
)
=>
void
):
Wechaty
public
on
(
event
:
'
error
'
,
listener
:
(
error
:
Error
)
=>
void
):
Wechaty
public
on
(
event
:
'
heartbeat
'
,
listener
:
(
data
:
any
)
=>
void
):
Wechaty
public
on
(
event
:
'
room-join
'
,
listener
:
(
room
:
Room
,
invitee
:
Contact
,
inviter
:
Contact
)
=>
void
):
Wechaty
public
on
(
event
:
'
room-join
'
,
listener
:
(
room
:
Room
,
inviteeList
:
Contact
,
inviter
:
Contact
)
=>
void
):
Wechaty
public
on
(
event
:
'
room-leave
'
,
listener
:
(
room
:
Room
,
leaver
:
Contact
)
=>
void
):
Wechaty
public
on
(
event
:
'
room-topic
'
,
listener
:
(
room
:
Room
,
topic
:
string
,
oldTopic
:
string
,
changer
:
Contact
)
=>
void
):
Wechaty
public
on
(
event
:
string
,
listener
:
Function
):
Wechaty
{
log
.
verbose
(
'
Wechaty
'
,
'
on(%s, %s)
'
,
event
,
typeof
listener
)
log
.
verbose
(
'
Wechaty
'
,
'
on(%s, %s)
'
,
event
,
typeof
listener
)
const
wrapListener
=
EventScope
.
wrap
.
call
(
this
,
event
,
listener
)
const
listenerWithScope
=
EventScope
.
wrap
.
call
(
this
,
event
,
listener
)
super
.
on
(
event
,
wrapListener
)
super
.
on
(
event
,
listenerWithScope
)
return
this
return
this
}
}
...
@@ -231,7 +245,7 @@ class Wechaty extends EventEmitter {
...
@@ -231,7 +245,7 @@ class Wechaty extends EventEmitter {
return
this
.
puppet
.
self
(
message
)
return
this
.
puppet
.
self
(
message
)
}
}
public
send
(
message
)
{
public
send
(
message
:
Message
):
Promise
<
any
>
{
return
this
.
puppet
.
send
(
message
)
return
this
.
puppet
.
send
(
message
)
.
catch
(
e
=>
{
.
catch
(
e
=>
{
log
.
error
(
'
Wechaty
'
,
'
send() exception: %s
'
,
e
.
message
)
log
.
error
(
'
Wechaty
'
,
'
send() exception: %s
'
,
e
.
message
)
...
@@ -239,7 +253,7 @@ class Wechaty extends EventEmitter {
...
@@ -239,7 +253,7 @@ class Wechaty extends EventEmitter {
})
})
}
}
public
reply
(
message
,
reply
)
{
public
reply
(
message
:
Message
,
reply
:
string
)
{
return
this
.
puppet
.
reply
(
message
,
reply
)
return
this
.
puppet
.
reply
(
message
,
reply
)
.
catch
(
e
=>
{
.
catch
(
e
=>
{
log
.
error
(
'
Wechaty
'
,
'
reply() exception: %s
'
,
e
.
message
)
log
.
error
(
'
Wechaty
'
,
'
reply() exception: %s
'
,
e
.
message
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录