Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
.Veneno.
wechaty
提交
447310e5
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,发现更多精彩内容 >>
提交
447310e5
编写于
6月 09, 2018
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: support contactSelf.qrcode() & say(voice.slk) (#1300 #1301)
上级
d050b58c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
79 deletion
+28
-79
src/puppet-padchat/bridge.ts
src/puppet-padchat/bridge.ts
+2
-68
src/puppet-padchat/padchat-rpc.ts
src/puppet-padchat/padchat-rpc.ts
+4
-4
src/puppet-padchat/puppet-padchat.ts
src/puppet-padchat/puppet-padchat.ts
+22
-7
未找到文件。
src/puppet-padchat/bridge.ts
浏览文件 @
447310e5
...
@@ -767,72 +767,6 @@ export class Bridge extends PadchatRpc {
...
@@ -767,72 +767,6 @@ export class Bridge extends PadchatRpc {
const
result
=
await
this
.
WXHeartBeat
()
const
result
=
await
this
.
WXHeartBeat
()
return
result
.
message
return
result
.
message
}
}
// public async WXSetUserRemark(contactId: string, alias: string): Promise<void> {
// await this.padchatRpc.WXSetUserRemark(contactId, alias)
// }
// public async WXSendMsg(to: string, content: string, at = ''): Promise<void> {
// await this.padchatRpc.WXSendMsg(to, content, at)
// return
// }
// public async WXSendImage(to: string, data: string): Promise<void> {
// await this.padchatRpc.WXSendImage(to, data)
// }
// public async WXGetChatRoomMember(id: string): Promise<PadchatRoomMemberPayload> {
// log.verbose('PuppetPadchatBridge', 'WXGetChatRoomMember(%s)', id)
// let lastResult: PadchatRoomMemberPayload
// const result = await Misc.retry(async (retry, attempt) => {
// log.silly('PuppetPadchatBridge', 'WXGetChatRoomMember(%s) retry() attempt=%d', id, attempt)
// try {
// lastResult = await this.padchatRpc.WXGetChatRoomMember(id)
// if (lastResult.member.length <= 0) {
// throw new Error('no room member for room ' + id)
// }
// return lastResult
// } catch (e) {
// return retry(e)
// }
// }).catch(e => {
// log.silly('PuppetPadchatBridge', 'WXGetChatRoomMember(%s) retry() fail: %s', id, e)
// return lastResult
// })
// return result
// }
// public async WXDeleteChatRoomMember(roomId: string, contactId: string): Promise<StandardType> {
// const result = await this.padchatRpc.WXDeleteChatRoomMember(roomId, contactId)
// return result
// }
// public async WXAddChatRoomMember(roomId: string, contactId: string): Promise<number> {
// const result = await this.padchatRpc.WXAddChatRoomMember(roomId, contactId)
// return result
// }
// public async WXSetChatroomName(roomId: string, topic: string): Promise<void> {
// await this.padchatRpc.WXSetChatroomName(roomId, topic)
// return
// }
// public async WXQuitChatRoom(roomId: string): Promise<void> {
// await this.padchatRpc.WXQuitChatRoom(roomId)
// }
// public async WXAddUser(strangerV1: string, strangerV2: string, type: string, verify: string): Promise<void> {
// await this.padchatRpc.WXAddUser(strangerV1, strangerV2, type, verify)
// }
// public async WXSetChatroomAnnouncement(chatroom: string, content: string): Promise<void> {
// await this.padchatRpc.WXSetChatroomAnnouncement(chatroom, content)
// }
// public async WXGetChatroomAnnouncement(chatroom: string): Promise<string> {
// return await this.padchatRpc.WXGetChatroomAnnouncement(chatroom)
// }
}
}
export
default
Bridge
src/puppet-padchat/padchat-rpc.ts
浏览文件 @
447310e5
...
@@ -1284,8 +1284,8 @@ export class PadchatRpc extends EventEmitter {
...
@@ -1284,8 +1284,8 @@ export class PadchatRpc extends EventEmitter {
// 获取用户二维码(自己或者已加入的群)
// 获取用户二维码(自己或者已加入的群)
// user 用户名
// user 用户名
// style 是否使用风格化二维码
// style 是否使用风格化二维码
public
async
WXGetUserQRCode
(
user
:
string
,
style
:
string
):
Promise
<
any
>
{
public
async
WXGetUserQRCode
(
user
:
string
,
style
:
number
):
Promise
<
any
>
{
const
result
=
await
this
.
rpcCall
(
'
WXGetUserQRCode
'
,
user
,
style
)
const
result
=
await
this
.
rpcCall
(
'
WXGetUserQRCode
'
,
user
,
String
(
style
)
)
log
.
silly
(
'
PadchatRpc
'
,
'
WXGetUserQRCode , stranger,result: %s
'
,
JSON
.
stringify
(
result
))
log
.
silly
(
'
PadchatRpc
'
,
'
WXGetUserQRCode , stranger,result: %s
'
,
JSON
.
stringify
(
result
))
if
(
!
result
||
result
.
status
!==
0
)
{
if
(
!
result
||
result
.
status
!==
0
)
{
throw
Error
(
'
WXGetUserQRCode , stranger,error! canot get result from websocket server
'
)
throw
Error
(
'
WXGetUserQRCode , stranger,error! canot get result from websocket server
'
)
...
@@ -1311,8 +1311,8 @@ export class PadchatRpc extends EventEmitter {
...
@@ -1311,8 +1311,8 @@ export class PadchatRpc extends EventEmitter {
// voice_data 语音数据
// voice_data 语音数据
// voice_size 语音大小 (应该不需要)
// voice_size 语音大小 (应该不需要)
// voice_time 语音时间(毫秒,最大60 * 1000)
// voice_time 语音时间(毫秒,最大60 * 1000)
public
async
WXSendVoice
(
user
:
string
,
data
:
string
,
time
:
string
):
Promise
<
any
>
{
public
async
WXSendVoice
(
user
:
string
,
data
:
string
,
time
:
number
):
Promise
<
any
>
{
const
result
=
await
this
.
rpcCall
(
'
WXSendVoice
'
,
user
,
data
,
time
)
const
result
=
await
this
.
rpcCall
(
'
WXSendVoice
'
,
user
,
data
,
String
(
time
)
)
log
.
silly
(
'
PadchatRpc
'
,
'
WXSendVoice , stranger,result: %s
'
,
JSON
.
stringify
(
result
))
log
.
silly
(
'
PadchatRpc
'
,
'
WXSendVoice , stranger,result: %s
'
,
JSON
.
stringify
(
result
))
if
(
!
result
||
result
.
status
!==
0
)
{
if
(
!
result
||
result
.
status
!==
0
)
{
throw
Error
(
'
WXSendVoice , stranger,error! canot get result from websocket server
'
)
throw
Error
(
'
WXSendVoice , stranger,error! canot get result from websocket server
'
)
...
...
src/puppet-padchat/puppet-padchat.ts
浏览文件 @
447310e5
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
*
*
*/
*/
//
import path from 'path'
import
path
from
'
path
'
// import fs from 'fs'
// import fs from 'fs'
// import cuid from 'cuid'
// import cuid from 'cuid'
...
@@ -350,8 +350,9 @@ export class PuppetPadchat extends Puppet {
...
@@ -350,8 +350,9 @@ export class PuppetPadchat extends Puppet {
throw
new
Error
(
'
can not set avatar for others
'
)
throw
new
Error
(
'
can not set avatar for others
'
)
}
}
throw
new
Error
(
'
not supported
'
)
const
base64
=
await
this
.
bridge
.
WXGetUserQRCode
(
contactId
,
0
)
// return await this.bridge.WXqr
const
qrcode
=
await
pfHelper
.
imageBase64ToQrCode
(
base64
)
return
qrcode
}
}
public
async
contactRawPayload
(
contactId
:
string
):
Promise
<
PadchatContactPayload
>
{
public
async
contactRawPayload
(
contactId
:
string
):
Promise
<
PadchatContactPayload
>
{
...
@@ -443,10 +444,24 @@ export class PuppetPadchat extends Puppet {
...
@@ -443,10 +444,24 @@ export class PuppetPadchat extends Puppet {
throw
new
Error
(
'
no id!
'
)
throw
new
Error
(
'
no id!
'
)
}
}
await
this
.
bridge
.
WXSendImage
(
const
type
=
file
.
mimeType
||
path
.
extname
(
file
.
name
)
id
,
switch
(
type
)
{
await
file
.
toBase64
(),
case
'
.slk
'
:
)
// 发送语音消息(微信silk格式语音)
await
this
.
bridge
.
WXSendVoice
(
id
,
await
file
.
toBase64
(),
60
,
)
break
default
:
await
this
.
bridge
.
WXSendImage
(
id
,
await
file
.
toBase64
(),
)
break
}
}
}
public
async
messageForward
(
public
async
messageForward
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录