Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
.www.
wechaty
提交
c8a1550e
W
wechaty
项目概览
.www.
/
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,发现更多精彩内容 >>
提交
c8a1550e
编写于
8月 24, 2020
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:Chatie/wechaty
上级
fc0838ef
2beef180
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
118 addition
and
209 deletion
+118
-209
README.md
README.md
+3
-3
package.json
package.json
+25
-25
src/user/contact.ts
src/user/contact.ts
+65
-52
src/user/friendship.ts
src/user/friendship.ts
+0
-10
src/user/message.ts
src/user/message.ts
+0
-32
src/user/room-invitation.ts
src/user/room-invitation.ts
+0
-29
src/user/room.ts
src/user/room.ts
+0
-29
src/wechaty.ts
src/wechaty.ts
+25
-29
未找到文件。
README.md
浏览文件 @
c8a1550e
# Wechaty [![NPM Version](https://img.shields.io/npm/v/wechaty?color=brightgreen)](https://www.npmjs.com/package/wechaty) [![NPM](https://github.com/wechaty/wechaty/workflows/NPM/badge.svg)](https://github.com/wechaty/wechaty/actions?query=workflow%3ANPM) [![Docker](https://github.com/wechaty/wechaty/workflows/Docker/badge.svg)](https://github.com/wechaty/wechaty/actions?query=workflow%3ADocker)
[
![Wechaty
](
https://wechaty.js.org/img/wechaty-logo.svg
)
](https://
github.com/wechaty/wechaty
)
[
![Wechaty
](
https://wechaty.js.org/img/wechaty-logo.svg
)
](https://
wechaty.js.org
)
[
![Downloads
](
https://img.shields.io/npm/dm/wechaty.svg?style=flat-square
)
](https://www.npmjs.com/package/wechaty)
[
![GitHub stars
](
https://img.shields.io/github/stars/wechaty/wechaty.svg?label=github%20stars
)
](https://github.com/wechaty/wechaty)
...
...
@@ -356,12 +356,12 @@ See:
## :sparkling_heart: POWERED BY WECHATY
[
![Powered by Wechaty
](
https://img.shields.io/badge/Powered%20By-Wechaty-brightgreen.svg
)
](https://
github.com/Wechaty/wechaty
)
[
![Powered by Wechaty
](
https://img.shields.io/badge/Powered%20By-Wechaty-brightgreen.svg
)
](https://
wechaty.js.org
)
### :sparkles: Wechaty Badge
```
markdown
[
![Powered by Wechaty
](
https://img.shields.io/badge/Powered%20By-Wechaty-brightgreen.svg
)
](https://
github.com/Wechaty/wechaty
)
[
![Powered by Wechaty
](
https://img.shields.io/badge/Powered%20By-Wechaty-brightgreen.svg
)
](https://
wechaty.js.org
)
```
Get more embed html/markdown code from
[
Wiki:Badge
](
https://github.com/wechaty/wechaty/wiki/Badge
)
...
...
package.json
浏览文件 @
c8a1550e
{
"name"
:
"wechaty"
,
"version"
:
"0.4
7.20
"
,
"version"
:
"0.4
8.1
"
,
"description"
:
"Wechaty is Conversational SDK Chatbot Makers, Powered by TypeScript, Docker, and 💖"
,
"main"
:
"dist/src/mod.js"
,
"typings"
:
"dist/src/mod.d.ts"
,
...
...
@@ -83,59 +83,59 @@
},
"homepage"
:
"
https://github.com/wechaty/
"
,
"dependencies"
:
{
"
brolog
"
:
"
^1.
8.3
"
,
"
brolog
"
:
"
^1.
12.4
"
,
"
clone-class
"
:
"
^0.7.3
"
,
"
cuid
"
:
"
^2.1.8
"
,
"
dotenv
"
:
"
^8.2.0
"
,
"
in-gfw
"
:
"
^1.2.0
"
,
"
json-rpc-peer
"
:
"
^0.1
5.5
"
,
"
json-rpc-peer
"
:
"
^0.1
6.0
"
,
"
npm-programmatic
"
:
"
0.0.12
"
,
"
open-graph
"
:
"
^0.2.4
"
,
"
opencollective
"
:
"
^1.0.3
"
,
"
opencollective-postinstall
"
:
"
^2.0.
2
"
,
"
opencollective-postinstall
"
:
"
^2.0.
3
"
,
"
pkg-dir
"
:
"
^4.2.0
"
,
"
portfinder
"
:
"
^1.0.2
5
"
,
"
promise-retry
"
:
"
^
1.1
.1
"
,
"
portfinder
"
:
"
^1.0.2
8
"
,
"
promise-retry
"
:
"
^
2.0
.1
"
,
"
raven
"
:
"
^2.6.4
"
,
"
read-pkg-up
"
:
"
^7.0.1
"
,
"
state-switch
"
:
"
^0.9.9
"
,
"
typed-emitter
"
:
"
^1.
2
.0
"
,
"
typed-emitter
"
:
"
^1.
3
.0
"
,
"
watchdog
"
:
"
^0.8.17
"
,
"
wechaty-puppet-hostie
"
:
"
^0.
9.13
"
,
"
wechaty-puppet
"
:
"
^0.3
1.5
"
,
"
ws
"
:
"
^7.
2.3
"
"
wechaty-puppet-hostie
"
:
"
^0.
10.0
"
,
"
wechaty-puppet
"
:
"
^0.3
2.3
"
,
"
ws
"
:
"
^7.
3.1
"
},
"devDependencies"
:
{
"
@babel/core
"
:
"
^7.
8.7
"
,
"
@babel/node
"
:
"
^7.
8.7
"
,
"
@babel/preset-env
"
:
"
^7.
8.7
"
,
"
@chatie/eslint-config
"
:
"
^0.1
1.5
"
,
"
@chatie/git-scripts
"
:
"
^0.
5
.2
"
,
"
@babel/core
"
:
"
^7.
11.4
"
,
"
@babel/node
"
:
"
^7.
10.5
"
,
"
@babel/preset-env
"
:
"
^7.
11.0
"
,
"
@chatie/eslint-config
"
:
"
^0.1
2.1
"
,
"
@chatie/git-scripts
"
:
"
^0.
6
.2
"
,
"
@chatie/semver
"
:
"
^0.4.7
"
,
"
@chatie/tsconfig
"
:
"
^0.
8
.0
"
,
"
@types/cuid
"
:
"
^1.3.
0
"
,
"
@chatie/tsconfig
"
:
"
^0.
13
.0
"
,
"
@types/cuid
"
:
"
^1.3.
1
"
,
"
@types/dotenv
"
:
"
^8.2.0
"
,
"
@types/glob
"
:
"
^7.1.
1
"
,
"
@types/glob
"
:
"
^7.1.
3
"
,
"
@types/open-graph
"
:
"
^0.2.0
"
,
"
@types/promise-retry
"
:
"
^1.1.3
"
,
"
@types/raven
"
:
"
^2.5.3
"
,
"
@types/retry
"
:
"
^0.12.0
"
,
"
@types/ws
"
:
"
^7.2.
2
"
,
"
@types/ws
"
:
"
^7.2.
6
"
,
"
apiai
"
:
"
^4.0.3
"
,
"
check-node-version
"
:
"
^4.0.
2
"
,
"
coveralls
"
:
"
^3.
0.9
"
,
"
check-node-version
"
:
"
^4.0.
3
"
,
"
coveralls
"
:
"
^3.
1.0
"
,
"
cross-env
"
:
"
^7.0.2
"
,
"
finis
"
:
"
^0.4.4
"
,
"
glob
"
:
"
^7.1.6
"
,
"
jsdoc-to-markdown
"
:
"
^
5.0.3
"
,
"
markdownlint-cli
"
:
"
^0.2
2.0
"
,
"
nyc
"
:
"
^15.
0
.0
"
,
"
jsdoc-to-markdown
"
:
"
^
6.0.1
"
,
"
markdownlint-cli
"
:
"
^0.2
3.2
"
,
"
nyc
"
:
"
^15.
1
.0
"
,
"
pkg-jq
"
:
"
^0.2.4
"
,
"
qrcode-terminal
"
:
"
^0.12.0
"
,
"
shx
"
:
"
^0.3.2
"
,
"
sloc
"
:
"
^0.2.1
"
,
"
tstest
"
:
"
^0.4.10
"
,
"
typedoc
"
:
"
^0.1
6.11
"
,
"
typedoc
"
:
"
^0.1
8.0
"
,
"
wechaty-puppet-mock
"
:
"
^0.27.2
"
},
"files_comment__whitelist_npm_publish"
:
"http://stackoverflow.com/a/8617868/1123955"
,
...
...
src/user/contact.ts
浏览文件 @
c8a1550e
...
...
@@ -570,7 +570,7 @@ class Contact extends ContactEventEmitter implements Sayable {
}
if
(
typeof
phoneList
===
'
undefined
'
)
{
return
this
.
wechaty
.
puppet
.
contactPhone
(
this
.
id
)
return
this
.
payload
.
phone
}
try
{
...
...
@@ -583,18 +583,70 @@ class Contact extends ContactEventEmitter implements Sayable {
}
}
/**
*
* @description
* Should use {@link Contact#friend} instead
*
* @deprecated
* @ignore
*/
public
stranger
():
null
|
boolean
{
log
.
warn
(
'
Contact
'
,
'
stranger() DEPRECATED. use friend() instead.
'
)
if
(
!
this
.
payload
)
return
null
return
!
this
.
friend
()
public
async
corporation
():
Promise
<
string
|
null
>
public
async
corporation
(
remark
:
string
|
null
):
Promise
<
void
>
public
async
corporation
(
remark
?:
string
|
null
):
Promise
<
string
|
null
|
void
>
{
log
.
silly
(
'
Contact
'
,
'
corporation(%s)
'
,
remark
)
if
(
!
this
.
payload
)
{
throw
new
Error
(
'
no payload
'
)
}
if
(
typeof
remark
===
'
undefined
'
)
{
return
this
.
payload
.
corporation
||
null
}
if
(
this
.
payload
.
type
!==
ContactType
.
Individual
)
{
throw
new
Error
(
'
Can not set corporation remark on non individual contact.
'
)
}
try
{
await
this
.
wechaty
.
puppet
.
contactCorporationRemark
(
this
.
id
,
remark
)
await
this
.
wechaty
.
puppet
.
dirtyPayload
(
PayloadType
.
Contact
,
this
.
id
)
this
.
payload
=
await
this
.
wechaty
.
puppet
.
contactPayload
(
this
.
id
)
}
catch
(
e
)
{
log
.
error
(
'
Contact
'
,
'
corporation(%s) rejected: %s
'
,
remark
,
e
.
message
)
Raven
.
captureException
(
e
)
}
}
public
async
description
():
Promise
<
string
|
null
>
public
async
description
(
newDescription
:
string
|
null
):
Promise
<
void
>
public
async
description
(
newDescription
?:
string
|
null
):
Promise
<
string
|
null
|
void
>
{
log
.
silly
(
'
Contact
'
,
'
description(%s)
'
,
newDescription
)
if
(
!
this
.
payload
)
{
throw
new
Error
(
'
no payload
'
)
}
if
(
typeof
newDescription
===
'
undefined
'
)
{
return
this
.
payload
.
description
||
null
}
try
{
await
this
.
wechaty
.
puppet
.
contactDescription
(
this
.
id
,
newDescription
)
await
this
.
wechaty
.
puppet
.
dirtyPayload
(
PayloadType
.
Contact
,
this
.
id
)
this
.
payload
=
await
this
.
wechaty
.
puppet
.
contactPayload
(
this
.
id
)
}
catch
(
e
)
{
log
.
error
(
'
Contact
'
,
'
description(%s) rejected: %s
'
,
newDescription
,
e
.
message
)
Raven
.
captureException
(
e
)
}
}
public
title
():
string
|
null
{
if
(
!
this
.
payload
)
{
throw
new
Error
(
'
no payload
'
)
}
return
this
.
payload
.
title
||
null
}
public
coworker
():
boolean
{
if
(
!
this
.
payload
)
{
throw
new
Error
(
'
no payload
'
)
}
return
!!
this
.
payload
.
coworker
}
/**
...
...
@@ -618,33 +670,6 @@ class Contact extends ContactEventEmitter implements Sayable {
return
this
.
payload
.
friend
||
null
}
/**
* @ignore
* @see {@link https://github.com/Chatie/webwx-app-tracker/blob/7c59d35c6ea0cff38426a4c5c912a086c4c512b2/formatted/webwxApp.js#L3243|webwxApp.js#L324}
* @see {@link https://github.com/Urinx/WeixinBot/blob/master/README.md|Urinx/WeixinBot/README}
*/
/**
* @description
* Check if it's a official account, should use {@link Contact#type} instead
* @deprecated
* @ignore
*/
public
official
():
boolean
{
log
.
warn
(
'
Contact
'
,
'
official() DEPRECATED. use type() instead
'
)
return
!!
this
.
payload
&&
(
this
.
payload
.
type
===
ContactType
.
Official
)
}
/**
* @description
* Check if it's a personal account, should use {@link Contact#type} instead
* @deprecated
* @ignore
*/
public
personal
():
boolean
{
log
.
warn
(
'
Contact
'
,
'
personal() DEPRECATED. use type() instead
'
)
return
!!
this
.
payload
&&
this
.
payload
.
type
===
ContactType
.
Personal
}
/**
* Enum for ContactType
* @enum {number}
...
...
@@ -768,18 +793,6 @@ class Contact extends ContactEventEmitter implements Sayable {
}
}
/**
* @description
* Force reload(re-ready()) data for Contact, use {@link Contact#sync} instead
*
* @deprecated
* @ignore
*/
public
refresh
():
Promise
<
void
>
{
log
.
warn
(
'
Contact
'
,
'
refresh() DEPRECATED. use sync() instead.
'
)
return
this
.
sync
()
}
/**
* Force reload data for Contact, Sync data from low-level API again.
*
...
...
src/user/friendship.ts
浏览文件 @
c8a1550e
...
...
@@ -105,16 +105,6 @@ class Friendship extends EventEmitter implements Acceptable {
return
contact
}
/**
* @description
* use {@link Friendship#add} instead
* @deprecated
*/
public
static
async
send
(
contact
:
Contact
,
hello
:
string
)
{
log
.
warn
(
'
Friendship
'
,
'
static send() DEPRECATED, use add() instead.
'
)
return
this
.
add
(
contact
,
hello
)
}
/**
* Send a Friend Request to a `contact` with message `hello`.
*
...
...
src/user/message.ts
浏览文件 @
c8a1550e
...
...
@@ -327,17 +327,6 @@ class Message extends EventEmitter implements Sayable {
return
room
}
/**
* @description
* use {@link Message#text} instead
*
* @deprecated
*/
public
content
():
string
{
log
.
warn
(
'
Message
'
,
'
content() DEPRECATED. use text() instead.
'
)
return
this
.
text
()
}
/**
* Get the text content of the message
*
...
...
@@ -777,17 +766,6 @@ class Message extends EventEmitter implements Sayable {
return
textWithoutMention
.
trim
()
}
/**
* @description
* should use {@link Message#mention} instead
* @deprecated
* @ignore
*/
public
async
mentioned
():
Promise
<
Contact
[]
>
{
log
.
warn
(
'
Message
'
,
'
mentioned() DEPRECATED. use mention() instead.
'
)
return
this
.
mentionList
()
}
/**
* Check if a message is mention self.
*
...
...
@@ -938,16 +916,6 @@ class Message extends EventEmitter implements Sayable {
return
ageSeconds
}
/**
* @description
* use {@link Message#toFileBox} instead
* @deprecated
*/
public
async
file
():
Promise
<
FileBox
>
{
log
.
warn
(
'
Message
'
,
'
file() DEPRECATED. use toFileBox() instead.
'
)
return
this
.
toFileBox
()
}
/**
* Extract the Media File from the Message, and put it into the FileBox.
* > Tips:
...
...
src/user/room-invitation.ts
浏览文件 @
c8a1550e
...
...
@@ -177,36 +177,17 @@ class RoomInvitation implements Acceptable {
public
async
topic
():
Promise
<
string
>
{
const
payload
=
await
this
.
wechaty
.
puppet
.
roomInvitationPayload
(
this
.
id
)
// roomTopic deprecated. use topic instead:
return
payload
.
topic
||
payload
.
topic
||
''
}
/**
* @deprecated: use topic() instead
* @ignore
*/
public
async
roomTopic
():
Promise
<
string
>
{
return
this
.
topic
()
}
public
async
memberCount
():
Promise
<
number
>
{
log
.
verbose
(
'
RoomInvitation
'
,
'
memberCount()
'
)
const
payload
=
await
this
.
wechaty
.
puppet
.
roomInvitationPayload
(
this
.
id
)
// roomMemberCount deprecated. use memberCount instead:
return
payload
.
memberCount
||
payload
.
memberCount
||
0
}
/**
* @deprecated: use memberCount() instead
* @ignore
*/
public
async
roomMemberCount
():
Promise
<
number
>
{
log
.
warn
(
'
RoomInvitation
'
,
'
roomMemberCount() DEPRECATED. use memberCount() instead.
'
)
return
this
.
memberCount
()
}
/**
* List of Room Members that you known(is friend)
* @ignore
...
...
@@ -216,7 +197,6 @@ class RoomInvitation implements Acceptable {
const
payload
=
await
this
.
wechaty
.
puppet
.
roomInvitationPayload
(
this
.
id
)
// roomMemberIdList deprecated. use memberIdList isntead.
const
contactIdList
=
payload
.
memberIdList
||
payload
.
memberIdList
||
[]
const
contactList
=
contactIdList
.
map
(
...
...
@@ -231,15 +211,6 @@ class RoomInvitation implements Acceptable {
return
contactList
}
/**
* @deprecated: use memberList() instead.
* @ignore
*/
public
async
roomMemberList
():
Promise
<
Contact
[]
>
{
log
.
warn
(
'
RoomInvitation
'
,
'
roomMemberList() DEPRECATED. use memberList() instead.
'
)
return
this
.
roomMemberList
()
}
/**
* Get the invitation time
*
...
...
src/user/room.ts
浏览文件 @
c8a1550e
...
...
@@ -302,15 +302,6 @@ class Room extends RoomEventEmitter implements Sayable {
}
}
/**
* @ignore
* @ignore
* @deprecated: Use `sync()` instead
*/
public
async
refresh
():
Promise
<
void
>
{
await
this
.
sync
()
}
/**
* Force reload data for Room, Sync data from puppet API again.
*
...
...
@@ -959,14 +950,6 @@ class Room extends RoomEventEmitter implements Sayable {
}
}
/**
* @deprecated: use qrCode() instead
*/
public
async
qrcode
()
{
log
.
warn
(
'
Room
'
,
'
qrcode() is deprecated. use qrCode() instead.
'
)
return
this
.
qrCode
()
}
/**
* Get QR Code Value of the Room from the room, which can be used as scan and join the room.
* > Tips:
...
...
@@ -1007,18 +990,6 @@ class Room extends RoomEventEmitter implements Sayable {
return
null
}
/**
* Same as function alias
* @param {Contact} contact
* @returns {Promise<string | null>}
* @deprecated: use room.alias() instead
* @ignore
*/
public
async
roomAlias
(
contact
:
Contact
):
Promise
<
null
|
string
>
{
log
.
warn
(
'
Room
'
,
'
roomAlias() DEPRECATED. use room.alias() instead
'
)
return
this
.
alias
(
contact
)
}
/**
* Check if the room has member `contact`, the return is a Promise and must be `await`-ed
*
...
...
src/wechaty.ts
浏览文件 @
c8a1550e
...
...
@@ -101,9 +101,6 @@ export interface WechatyOptions {
memory
?
:
MemoryCard
,
name
?
:
string
,
// Wechaty Name
// @deprecated: use `name` instead of `profile`
profile
?
:
null
|
string
,
// DEPRECATED: use name instead
puppet
?
:
PuppetModuleName
|
Puppet
,
// Puppet name or instance
puppetOptions
?
:
PuppetOptions
,
// Puppet TOKEN
ioToken
?
:
string
,
// Io TOKEN
...
...
@@ -134,7 +131,7 @@ const PUPPET_MEMORY_NAME = 'puppet'
* bot.on('message', message => console.log(`Message: ${message}`))
* bot.start()
*/
export
class
Wechaty
extends
WechatyEventEmitter
implements
Sayable
{
class
Wechaty
extends
WechatyEventEmitter
implements
Sayable
{
public
static
readonly
VERSION
=
VERSION
...
...
@@ -176,16 +173,16 @@ export class Wechaty extends WechatyEventEmitter implements Sayable {
protected
wechatifiedTag
?
:
typeof
Tag
protected
wechatifiedUrlLink
?
:
typeof
UrlLink
public
get
Contact
()
:
typeof
Contact
{
return
this
.
wechatifiedContact
!
}
public
get
ContactSelf
()
:
typeof
ContactSelf
{
return
this
.
wechatifiedContactSelf
!
}
public
get
Friendship
()
:
typeof
Friendship
{
return
this
.
wechatifiedFriendship
!
}
public
get
Image
()
:
typeof
Image
{
return
this
.
wechatifiedImage
!
}
public
get
Message
()
:
typeof
Message
{
return
this
.
wechatifiedMessage
!
}
public
get
MiniProgram
()
:
typeof
MiniProgram
{
return
this
.
wechatifiedMiniProgram
!
}
public
get
Room
()
:
typeof
Room
{
return
this
.
wechatifiedRoom
!
}
public
get
RoomInvitation
()
:
typeof
RoomInvitation
{
return
this
.
wechatifiedRoomInvitation
!
}
public
get
Tag
()
:
typeof
Tag
{
return
this
.
wechatifiedTag
!
}
public
get
UrlLink
()
:
typeof
UrlLink
{
return
this
.
wechatifiedUrlLink
!
}
public
get
Contact
()
:
typeof
Contact
{
return
guardWechatify
(
this
.
wechatifiedContact
)
}
public
get
ContactSelf
()
:
typeof
ContactSelf
{
return
guardWechatify
(
this
.
wechatifiedContactSelf
)
}
public
get
Friendship
()
:
typeof
Friendship
{
return
guardWechatify
(
this
.
wechatifiedFriendship
)
}
public
get
Image
()
:
typeof
Image
{
return
guardWechatify
(
this
.
wechatifiedImage
)
}
public
get
Message
()
:
typeof
Message
{
return
guardWechatify
(
this
.
wechatifiedMessage
)
}
public
get
MiniProgram
()
:
typeof
MiniProgram
{
return
guardWechatify
(
this
.
wechatifiedMiniProgram
)
}
public
get
Room
()
:
typeof
Room
{
return
guardWechatify
(
this
.
wechatifiedRoom
)
}
public
get
RoomInvitation
()
:
typeof
RoomInvitation
{
return
guardWechatify
(
this
.
wechatifiedRoomInvitation
)
}
public
get
Tag
()
:
typeof
Tag
{
return
guardWechatify
(
this
.
wechatifiedTag
)
}
public
get
UrlLink
()
:
typeof
UrlLink
{
return
guardWechatify
(
this
.
wechatifiedUrlLink
)
}
/**
* Get the global instance of Wechaty
...
...
@@ -287,10 +284,6 @@ export class Wechaty extends WechatyEventEmitter implements Sayable {
super
()
log
.
verbose
(
'
Wechaty
'
,
'
constructor()
'
)
if
(
!
options
.
name
&&
options
.
profile
)
{
log
.
verbose
(
'
Wechaty
'
,
'
constructor() WechatyOptions.profile DEPRECATED. use WechatyOptions.name instead.
'
)
options
.
name
=
options
.
profile
}
this
.
memory
=
this
.
options
.
memory
this
.
id
=
cuid
()
...
...
@@ -837,17 +830,6 @@ export class Wechaty extends WechatyEventEmitter implements Sayable {
}
}
/**
* @description
* Should use {@link Wechaty#userSelf} instead
* @deprecated Use `userSelf()` instead
* @ignore
*/
public
self
():
Contact
{
log
.
warn
(
'
Wechaty
'
,
'
self() DEPRECATED. use userSelf() instead.
'
)
return
this
.
userSelf
()
}
/**
* Get current user
*
...
...
@@ -1028,3 +1010,17 @@ export class Wechaty extends WechatyEventEmitter implements Sayable {
}
}
/**
* Huan(202008): we will bind the wechaty puppet with user modules (Contact, Room, etc) together inside the start() method
*/
function
guardWechatify
<
T
extends
Function
>
(
userModule
?:
T
):
T
{
if
(
!
userModule
)
{
throw
new
Error
(
'
Wechaty user module (for example, wechaty.Room) can not be used before wechaty.start()!
'
)
}
return
userModule
}
export
{
Wechaty
,
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录