Skip to content

Commit

Permalink
fix: 修复发送语音显示时间为1秒问题
Browse files Browse the repository at this point in the history
  • Loading branch information
binsee committed Jun 8, 2018
1 parent 6783d5b commit dbb9b24
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ class Padchat extends EventEmitter {
*
* @param {string} toUserName - 接收者的wxid
* @param {Buffer|string} file - 语音Buffer数据或base64
* @param {number} time - 语音时间,单位为毫秒
* @returns {Promise<object>} 返回Promise<object>,注意捕捉catch
* ```
{
Expand All @@ -528,13 +529,14 @@ class Padchat extends EventEmitter {
* ```
* @memberof Padchat
*/
async sendVoice(toUserName, file) {
async sendVoice(toUserName, file, time = 0) {
if (file instanceof Buffer) {
file = file.toString('base64')
}
return await this.sendCmd('sendVoice', {
toUserName,
file,
time: time * 1
})
}

Expand Down

0 comments on commit dbb9b24

Please sign in to comment.