Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
.Veneno.
wechaty
提交
96ee73c0
W
wechaty
项目概览
.Veneno.
/
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,体验更适合开发者的 AI 搜索 >>
提交
96ee73c0
编写于
6月 15, 2018
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bridge -> manager
上级
4d3db1cd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
25 deletion
+27
-25
src/puppet-padchat/puppet-padchat.ts
src/puppet-padchat/puppet-padchat.ts
+27
-25
未找到文件。
src/puppet-padchat/puppet-padchat.ts
浏览文件 @
96ee73c0
...
...
@@ -140,7 +140,7 @@ export class PuppetPadchat extends Puppet {
log
.
verbose
(
'
PuppetPadchat
'
,
'
startWatchdog()
'
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
// clean the dog because this could be re-inited
...
...
@@ -204,7 +204,7 @@ export class PuppetPadchat extends Puppet {
protected
async
login
(
selfId
:
string
):
Promise
<
void
>
{
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
await
super
.
login
(
selfId
)
this
.
padchatManager
.
syncContactsAndRooms
()
...
...
@@ -488,7 +488,7 @@ export class PuppetPadchat extends Puppet {
log
.
verbose
(
'
PuppetPadchat
'
,
'
stop()
'
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
if
(
this
.
state
.
off
())
{
...
...
@@ -520,7 +520,7 @@ export class PuppetPadchat extends Puppet {
}
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
this
.
emit
(
'
logout
'
,
this
.
id
)
// becore we will throw above by logonoff() when this.user===undefined
...
...
@@ -550,7 +550,7 @@ export class PuppetPadchat extends Puppet {
}
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
await
this
.
padchatManager
.
WXSetUserRemark
(
contactId
,
alias
||
''
)
...
...
@@ -562,7 +562,7 @@ export class PuppetPadchat extends Puppet {
log
.
verbose
(
'
PuppetPadchat
'
,
'
contactList()
'
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
const
contactIdList
=
this
.
padchatManager
.
getContactIdList
()
...
...
@@ -587,7 +587,7 @@ export class PuppetPadchat extends Puppet {
throw
new
Error
(
'
can not set avatar for others
'
)
}
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
await
this
.
padchatManager
.
WXSetHeadImage
(
await
file
.
toBase64
())
return
...
...
@@ -614,7 +614,7 @@ export class PuppetPadchat extends Puppet {
throw
new
Error
(
'
can not set avatar for others
'
)
}
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
const
base64
=
await
this
.
padchatManager
.
WXGetUserQRCode
(
contactId
,
0
)
const
qrcode
=
await
fileBoxToQrcode
(
base64
)
...
...
@@ -635,7 +635,7 @@ export class PuppetPadchat extends Puppet {
log
.
silly
(
'
PuppetPadchat
'
,
'
contactRawPayload(%s)
'
,
contactId
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
const
rawPayload
=
await
this
.
padchatManager
.
contactRawPayload
(
contactId
)
return
rawPayload
...
...
@@ -660,7 +660,7 @@ export class PuppetPadchat extends Puppet {
// TODO
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
const
rawPayload
=
await
this
.
messageRawPayload
(
messageId
)
...
...
@@ -763,7 +763,7 @@ export class PuppetPadchat extends Puppet {
throw
Error
(
'
no id
'
)
}
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
await
this
.
padchatManager
.
WXSendMsg
(
id
,
text
)
}
...
...
@@ -782,7 +782,7 @@ export class PuppetPadchat extends Puppet {
}
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
const
type
=
file
.
mimeType
||
path
.
extname
(
file
.
name
)
...
...
@@ -812,7 +812,7 @@ export class PuppetPadchat extends Puppet {
log
.
verbose
(
'
PuppetPadchat
'
,
'
messageSend("%s", %s)
'
,
JSON
.
stringify
(
receiver
),
contactId
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
// roomId first, contactId second.
...
...
@@ -875,7 +875,7 @@ export class PuppetPadchat extends Puppet {
log
.
silly
(
'
PuppetPadchat
'
,
'
roomMemberRawPayload(%s)
'
,
roomId
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
const
memberDictRawPayload
=
await
this
.
padchatManager
.
roomMemberRawPayload
(
roomId
)
...
...
@@ -913,7 +913,7 @@ export class PuppetPadchat extends Puppet {
log
.
verbose
(
'
PuppetPadchat
'
,
'
roomRawPayload(%s)
'
,
roomId
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
const
rawPayload
=
await
this
.
padchatManager
.
roomRawPayload
(
roomId
)
...
...
@@ -931,7 +931,7 @@ export class PuppetPadchat extends Puppet {
log
.
verbose
(
'
PuppetPadchat
'
,
'
roomMemberList(%s)
'
,
roomId
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
const
memberIdList
=
await
this
.
padchatManager
.
getRoomMemberIdList
(
roomId
)
...
...
@@ -944,7 +944,7 @@ export class PuppetPadchat extends Puppet {
log
.
verbose
(
'
PuppetPadchat
'
,
'
roomList()
'
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
const
roomIdList
=
await
this
.
padchatManager
.
getRoomIdList
()
...
...
@@ -960,7 +960,7 @@ export class PuppetPadchat extends Puppet {
log
.
verbose
(
'
PuppetPadchat
'
,
'
roomDel(%s, %s)
'
,
roomId
,
contactId
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
// Should check whether user is in the room. WXDeleteChatRoomMember won't check if user in the room automatically
...
...
@@ -997,7 +997,7 @@ export class PuppetPadchat extends Puppet {
log
.
verbose
(
'
PuppetPadchat
'
,
'
roomAdd(%s, %s)
'
,
roomId
,
contactId
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
// XXX: did there need to calc the total number of the members in this room?
...
...
@@ -1012,6 +1012,8 @@ export class PuppetPadchat extends Puppet {
log
.
verbose
(
'
PuppetPadchat
'
,
'
roomAdd(%s, %s) try to Invite
'
,
roomId
,
contactId
)
await
this
.
padchatManager
.
WXInviteChatRoomMember
(
roomId
,
contactId
)
}
await
this
.
roomPayloadDirty
(
roomId
)
await
this
.
roomMemberPayloadDirty
(
roomId
)
}
...
...
@@ -1030,7 +1032,7 @@ export class PuppetPadchat extends Puppet {
}
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
await
this
.
padchatManager
.
WXSetChatroomName
(
roomId
,
topic
)
...
...
@@ -1046,7 +1048,7 @@ export class PuppetPadchat extends Puppet {
log
.
verbose
(
'
PuppetPadchat
'
,
'
roomCreate(%s, %s)
'
,
contactIdList
,
topic
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
const
roomId
=
await
this
.
padchatManager
.
WXCreateChatRoom
(
contactIdList
)
...
...
@@ -1061,7 +1063,7 @@ export class PuppetPadchat extends Puppet {
log
.
verbose
(
'
PuppetPadchat
'
,
'
roomQuit(%s)
'
,
roomId
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
await
this
.
padchatManager
.
WXQuitChatRoom
(
roomId
)
...
...
@@ -1076,7 +1078,7 @@ export class PuppetPadchat extends Puppet {
log
.
verbose
(
'
PuppetPadchat
'
,
'
roomAnnounce(%s, %s)
'
,
roomId
,
text
?
text
:
''
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
if
(
text
)
{
...
...
@@ -1098,7 +1100,7 @@ export class PuppetPadchat extends Puppet {
log
.
verbose
(
'
PuppetPadchat
'
,
'
friendshipVerify(%s, %s)
'
,
contactId
,
hello
)
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
const
rawSearchPayload
:
WXSearchContactType
=
await
this
.
padchatManager
.
WXSearchContact
(
contactId
)
...
...
@@ -1150,7 +1152,7 @@ export class PuppetPadchat extends Puppet {
}
if
(
!
this
.
padchatManager
)
{
throw
new
Error
(
'
no
bridge
'
)
throw
new
Error
(
'
no
padchat manager
'
)
}
await
this
.
padchatManager
.
WXAcceptUser
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录