Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_46011646
wechaty
提交
f906d7a5
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,发现更多精彩内容 >>
提交
f906d7a5
编写于
7月 08, 2017
作者:
H
hcz
提交者:
Huan (李卓桓)
7月 08, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update(doc): add TODOs (#640)
上级
a1d366e1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
108 addition
and
3 deletion
+108
-3
src/contact.ts
src/contact.ts
+3
-0
src/message.ts
src/message.ts
+42
-0
src/room.ts
src/room.ts
+60
-1
src/wechaty.ts
src/wechaty.ts
+3
-2
未找到文件。
src/contact.ts
浏览文件 @
f906d7a5
...
...
@@ -104,6 +104,9 @@ export class Contact implements Sayable {
private
dirtyObj
:
ContactObj
|
null
private
rawObj
:
ContactRawObj
/**
* @private
*/
constructor
(
public
readonly
id
:
string
,
)
{
...
...
src/message.ts
浏览文件 @
f906d7a5
...
...
@@ -244,6 +244,9 @@ export class Message implements Sayable {
throw
Error
(
'
not a media message
'
)
}
/**
* @private
*/
constructor
(
public
rawObj
?:
MsgRawObj
)
{
this
.
_counter
=
Message
.
counter
++
log
.
silly
(
'
Message
'
,
'
constructor() SN:%d
'
,
this
.
_counter
)
...
...
@@ -315,6 +318,9 @@ export class Message implements Sayable {
return
'
{
'
+
this
.
type
()
+
'
}
'
+
content
}
/**
* @todo document me
*/
public
from
(
contact
:
Contact
):
void
public
from
(
id
:
string
):
void
public
from
():
Contact
...
...
@@ -340,6 +346,9 @@ export class Message implements Sayable {
// public to(room: Room): void
// public to(): Contact|Room
// public to(contact?: Contact|Room|string): Contact|Room|void {
/**
* @todo document me
*/
public
to
(
contact
:
Contact
):
void
public
to
(
id
:
string
):
void
public
to
():
Contact
|
null
// if to is not set, then room must had set
...
...
@@ -364,6 +373,9 @@ export class Message implements Sayable {
return
Contact
.
load
(
this
.
obj
.
to
)
}
/**
* @todo document me
*/
public
room
(
room
:
Room
):
void
public
room
(
id
:
string
):
void
public
room
():
Room
|
null
...
...
@@ -384,6 +396,9 @@ export class Message implements Sayable {
return
null
}
/**
* @todo document me
*/
public
content
():
string
public
content
(
content
:
string
):
void
...
...
@@ -395,10 +410,16 @@ export class Message implements Sayable {
return
this
.
obj
.
content
}
/**
* @todo document me
*/
public
type
():
MsgType
{
return
this
.
obj
.
type
}
/**
* @todo document me
*/
public
typeSub
():
MsgType
{
if
(
!
this
.
rawObj
)
{
throw
new
Error
(
'
no rawObj
'
)
...
...
@@ -406,6 +427,9 @@ export class Message implements Sayable {
return
this
.
rawObj
.
SubMsgType
}
/**
* @todo document me
*/
public
typeApp
():
AppMsgType
{
if
(
!
this
.
rawObj
)
{
throw
new
Error
(
'
no rawObj
'
)
...
...
@@ -413,9 +437,18 @@ export class Message implements Sayable {
return
this
.
rawObj
.
AppMsgType
}
/**
* @todo document me
*/
public
typeEx
()
{
return
MsgType
[
this
.
obj
.
type
]
}
/**
* @todo document me
*/
public
count
()
{
return
this
.
_counter
}
/**
* @todo document me
*/
public
self
():
boolean
{
const
userId
=
config
.
puppetInstance
()
.
userId
...
...
@@ -579,6 +612,9 @@ export class Message implements Sayable {
// })
// }
/**
* @todo document me
*/
public
say
(
text
:
string
,
replyTo
?:
Contact
|
Contact
[]):
Promise
<
any
>
public
say
(
mediaMessage
:
MediaMessage
,
replyTo
?:
Contact
|
Contact
[]):
Promise
<
any
>
...
...
@@ -736,6 +772,9 @@ export class MediaMessage extends Message {
}
}
/**
* @todo document me
*/
public
ext
():
string
{
if
(
this
.
fileExt
)
return
this
.
fileExt
...
...
@@ -770,6 +809,9 @@ export class MediaMessage extends Message {
throw
new
Error
(
'
not support type:
'
+
this
.
type
())
}
/**
* @todo document me
*/
public
filename
():
string
{
if
(
this
.
fileName
&&
this
.
fileExt
)
{
return
this
.
fileName
+
'
.
'
+
this
.
fileExt
...
...
src/room.ts
浏览文件 @
f906d7a5
...
...
@@ -92,11 +92,17 @@ export class Room extends EventEmitter implements Sayable {
private
obj
:
RoomObj
|
null
private
rawObj
:
RoomRawObj
/**
* @private
*/
constructor
(
public
id
:
string
)
{
super
()
log
.
silly
(
'
Room
'
,
`constructor(
${
id
}
)`
)
}
/**
* @private
*/
public
toString
()
{
return
this
.
id
}
public
toStringEx
()
{
return
`Room(
${
this
.
obj
&&
this
.
obj
.
topic
}
[
${
this
.
id
}
])`
}
...
...
@@ -104,6 +110,9 @@ export class Room extends EventEmitter implements Sayable {
return
!!
(
this
.
obj
&&
this
.
obj
.
memberList
&&
this
.
obj
.
memberList
.
length
)
}
/**
* @todo document me
*/
public
async
refresh
():
Promise
<
void
>
{
if
(
this
.
isReady
())
{
this
.
dirtyObj
=
this
.
obj
...
...
@@ -161,11 +170,25 @@ export class Room extends EventEmitter implements Sayable {
}
}
/**
* @todo document me
*/
public
on
(
event
:
'
leave
'
,
listener
:
(
this
:
Room
,
leaver
:
Contact
)
=>
void
):
this
/**
* @todo document me
*/
public
on
(
event
:
'
join
'
,
listener
:
(
this
:
Room
,
inviteeList
:
Contact
[]
,
inviter
:
Contact
)
=>
void
):
this
/**
* @todo document me
*/
public
on
(
event
:
'
topic
'
,
listener
:
(
this
:
Room
,
topic
:
string
,
oldTopic
:
string
,
changer
:
Contact
)
=>
void
):
this
/**
* @todo document me
*/
public
on
(
event
:
'
EVENT_PARAM_ERROR
'
,
listener
:
()
=>
void
):
this
/**
* @todo document me
*/
public
on
(
event
:
RoomEventName
,
listener
:
(...
args
:
any
[])
=>
any
):
this
{
log
.
verbose
(
'
Room
'
,
'
on(%s, %s)
'
,
event
,
typeof
listener
)
...
...
@@ -173,6 +196,9 @@ export class Room extends EventEmitter implements Sayable {
return
this
}
/**
* @todo document me
*/
public
say
(
mediaMessage
:
MediaMessage
)
public
say
(
content
:
string
)
public
say
(
content
:
string
,
replyTo
:
Contact
)
...
...
@@ -212,6 +238,9 @@ export class Room extends EventEmitter implements Sayable {
public
get
(
prop
):
string
{
return
(
this
.
obj
&&
this
.
obj
[
prop
])
||
(
this
.
dirtyObj
&&
this
.
dirtyObj
[
prop
])
}
/**
* @private
*/
private
parse
(
rawObj
:
RoomRawObj
):
RoomObj
|
null
{
if
(
!
rawObj
)
{
log
.
warn
(
'
Room
'
,
'
parse() on a empty rawObj?
'
)
...
...
@@ -278,6 +307,9 @@ export class Room extends EventEmitter implements Sayable {
Object
.
keys
(
this
.
obj
).
forEach
(
k
=>
console
.
error
(
`
${
k
}
:
${
this
.
obj
&&
this
.
obj
[
k
]}
`
))
}
/**
* @todo document me
*/
public
async
add
(
contact
:
Contact
):
Promise
<
number
>
{
log
.
verbose
(
'
Room
'
,
'
add(%s)
'
,
contact
)
...
...
@@ -290,6 +322,9 @@ export class Room extends EventEmitter implements Sayable {
return
n
}
/**
* @todo document me
*/
public
async
del
(
contact
:
Contact
):
Promise
<
number
>
{
log
.
verbose
(
'
Room
'
,
'
del(%s)
'
,
contact
.
name
())
...
...
@@ -302,6 +337,9 @@ export class Room extends EventEmitter implements Sayable {
return
n
}
/**
* @todo document me
*/
private
delLocal
(
contact
:
Contact
):
number
{
log
.
verbose
(
'
Room
'
,
'
delLocal(%s)
'
,
contact
)
...
...
@@ -379,6 +417,9 @@ export class Room extends EventEmitter implements Sayable {
return
this
.
roomAlias
(
contact
)
}
/**
* @todo document me
*/
public
roomAlias
(
contact
:
Contact
):
string
|
null
{
if
(
!
this
.
obj
||
!
this
.
obj
.
roomAliasMap
)
{
return
null
...
...
@@ -386,6 +427,9 @@ export class Room extends EventEmitter implements Sayable {
return
this
.
obj
.
roomAliasMap
[
contact
.
id
]
||
null
}
/**
* @todo document me
*/
public
has
(
contact
:
Contact
):
boolean
{
if
(
!
this
.
obj
||
!
this
.
obj
.
memberList
)
{
return
false
...
...
@@ -395,6 +439,9 @@ export class Room extends EventEmitter implements Sayable {
.
length
>
0
}
/**
* @todo document me
*/
public
owner
():
Contact
|
null
{
const
ownerUin
=
this
.
obj
&&
this
.
obj
.
ownerUin
...
...
@@ -499,6 +546,9 @@ export class Room extends EventEmitter implements Sayable {
}
}
/**
* @todo document me
*/
public
member
(
name
:
string
):
Contact
|
null
public
member
(
filter
:
MemberQueryFilter
):
Contact
|
null
...
...
@@ -524,6 +574,9 @@ export class Room extends EventEmitter implements Sayable {
return
memberList
[
0
]
}
/**
* @todo document me
*/
public
memberList
():
Contact
[]
{
log
.
verbose
(
'
Room
'
,
'
memberList
'
)
...
...
@@ -538,6 +591,9 @@ export class Room extends EventEmitter implements Sayable {
return
this
.
obj
.
memberList
}
/**
* @todo document me
*/
public
static
create
(
contactList
:
Contact
[],
topic
?:
string
):
Promise
<
Room
>
{
log
.
verbose
(
'
Room
'
,
'
create(%s, %s)
'
,
contactList
.
join
(
'
,
'
),
topic
)
...
...
@@ -554,6 +610,9 @@ export class Room extends EventEmitter implements Sayable {
})
}
/**
* @todo document me
*/
public
static
async
findAll
(
query
?:
RoomQueryFilter
):
Promise
<
Room
[]
>
{
if
(
!
query
)
{
query
=
{
topic
:
/.*/
}
...
...
src/wechaty.ts
浏览文件 @
f906d7a5
...
...
@@ -170,6 +170,9 @@ export class Wechaty extends EventEmitter implements Sayable {
return
config
.
npmVersion
()
}
/**
* @todo document me
*/
public
version
(
forceNpm
?)
{
return
Wechaty
.
version
(
forceNpm
)
}
...
...
@@ -281,7 +284,6 @@ export class Wechaty extends EventEmitter implements Sayable {
/**
* @todo document me
*/
public
on
(
event
:
WechatyEventName
,
listener
:
(...
args
:
any
[])
=>
any
):
this
{
log
.
verbose
(
'
Wechaty
'
,
'
addListener(%s, %s)
'
,
event
,
typeof
listener
)
...
...
@@ -447,7 +449,6 @@ export class Wechaty extends EventEmitter implements Sayable {
/**
* @todo document me
* @static
*
*/
public
static
async
sleep
(
millisecond
:
number
):
Promise
<
void
>
{
await
new
Promise
(
resolve
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录