wechaty/wechaty-puppet-padchat

群发消息问题

Opened this issue · 1 comments

重要:请不要删除模板自行填写,所有不按照模板填写的issue,我们将不会处理。

0. 发 Issue 指南

  1. 请运行下面的命令,看问题是否可以被解决:
rm -rf package-lock.json
rm -rf node_modules
npm install

不能被解决

  1. 请在 FAQ 清单 看是否已有解决办法。
    无此问题描述
  2. 请先在issue 中搜关键信息,确认你要发的内容和之前的issue 不重复。
    不重复

1. 提供你的包版本信息

  • wechaty 版本:0.26.1 偶数生产版本
  • wechaty-puppet-padchat 版本:wechaty-puppet-padpro 0.2.1偶数生产版本
  • node 版本: (运行 node --version 获取版本) v10.15.2
  • 你使用的操作系统: ubuntu

2. Bug 描述

请用精简的语言描述你遇到的bug
群发消息,当群发到被删除的好友时,pad协议服务器断开链接

3. 复现的步骤 (或者解决的步骤)

1。登陆,获取好友
2,群发消息
3,群发到一半,遇到被删除的好友断开协议服务器 no padpro manager
initLongSocket() connection to wechat long host server: long.weixin.qq.com ended
有时候还会出现长链接解包失败 个人感觉 应该是频率问题,但是发送频率0.35秒一次
有时候还会出现无法解包

这一部分非常重要,如果你无法给出复现步骤,我们也很难提供相应的解决办法:

复现步骤中一定要给出复现代码

例子:
s.on('sendStart',(data)=>{
var one = true
sendmessage = '清理好友'

        bot.on('scan', (qrcode, status) => {
            var msg ='请扫玛'
            if(status === 201){
                msg = '请确认'
            }else if(status === 200){
                msg = '登陆成功'
            }
            io.sockets.emit('renderQRcode', {
                'code': status,
                'loginUrl': `https://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(qrcode)}`,
                'msg':msg
            })

        }).on('login', async function send(user) {
            var users = bot.Contact
            var filehelper = await bot.Contact.find({ "id": 'filehelper' })
            await filehelper.say(`请设置您的群发消息`)
            
        }).on('message',async (message)=>{
            const msg_type = await message.type()
            const msg = await message.text()
            console.log(msg)
            if(msg === '你好欢迎使用我们的产品' || msg === '请设置您的群发消息'){
                return
            }
            const filehelper = await message.to()
            console.log(filehelper.id)
            if(filehelper.id === 'filehelper' && one){
                one = false
                console.log(msg_type)
                if(msg_type !== bot.Message.Type.Text){
                    await filehelper.say(`仅支持文本类型`)
                    return
                }
                var f = await bot.Contact.findAll()
                var newlist = f.filter((current) => {
                    return current.payload.friend && current.payload.type === 1
                })
                for (let i = 0; i < newlist.length; i += 1) {
                    if(newlist[i].id === 'filehelper')continue
                    await newlist[i].say(await message.text())
                    sleep(3500)
                }
            }
        }).on('error',()=>{
            try {
                bot.logout()
            
            } catch (e) {
                console.log(e)
            }
            try{
                bot.stop()
                s.disconnect()
            }catch(e){
                console.log(e)
            }
        }).on('loginout',()=>{
            try{
                bot.stop()
                s.disconnect()
            }catch(e){
                console.log(e)
            }
        }).start()
    }) 

4. 期待程序运行的结果

群发全部好友

5. 程序实际运行的结果

发送一半停止发送

6. 完整的日志信息:

通过WECHATY_LOG=silly设定环境变量,将设置log 等级为 silly,获取最详细的日志信息(默认log 等级为 info)
请提供完整的日志信息(不要只提供部分的日志截图,请复制粘贴日志内容!)
12:29:12 SILL Contact ready() @ Puppet#1()/PuppetPadpro#1
12:29:12 SILL Contact ready() @ Puppet#1()/PuppetPadpro#1
12:29:12 VERB Contact say(qqqq)
12:29:12 VERB Contact say(qqqq)
12:29:16 VERB Contact say(qqqq)
12:29:19 VERB Contact say(qqqq)
12:29:23 VERB Contact say(qqqq)
12:29:23 SILL Wechaty memoryCheck() free: 228 MB, require: 4 MB
12:29:23 SILL Wechaty memoryCheck() free: 228 MB, require: 4 MB
12:29:23 SILL Accessory #1320 constructor()
12:29:23 VERB Friendship constructor(id=1096275171)
12:29:23 VERB Puppet friendshipPayload(1096275171)
12:29:23 SILL Puppet friendshipPayloadCache(1096275171) cache MISS
12:29:26 VERB Contact say(qqqq)
12:29:30 VERB Contact say(qqqq)
12:29:33 VERB Contact say(qqqq)
12:29:37 VERB Contact say(qqqq)
12:29:41 VERB Contact say(qqqq)
12:29:44 VERB Contact say(qqqq)
12:29:48 VERB Contact say(qqqq)
12:29:48 SILL Accessory #1321 constructor()
12:29:48 VERB Friendship constructor(id=1096275183)
12:29:48 VERB Puppet friendshipPayload(1096275183)
12:29:48 SILL Puppet friendshipPayloadCache(1096275183) cache MISS
12:29:48 SILL Accessory #1322 constructor()
12:29:48 VERB Friendship constructor(id=1096275184)
12:29:48 VERB Puppet friendshipPayload(1096275184)
12:29:48 SILL Puppet friendshipPayloadCache(1096275184) cache MISS
12:29:51 VERB Contact say(qqqq)
12:29:55 VERB Contact say(qqqq)
12:29:55 SILL Accessory #1323 constructor()
12:29:55 VERB Friendship constructor(id=1096275185)
12:29:55 VERB Puppet friendshipPayload(1096275185)
12:29:55 SILL Puppet friendshipPayloadCache(1096275185) cache MISS
12:29:55 SILL Accessory #1324 constructor()
12:29:55 VERB Friendship constructor(id=1096275186)
12:29:55 VERB Puppet friendshipPayload(1096275186)
12:29:55 SILL Puppet friendshipPayloadCache(1096275186) cache MISS
12:29:58 VERB Contact say(qqqq)
12:29:58 SILL Wechaty memoryCheck() free: 238 MB, require: 4 MB
12:29:58 SILL Wechaty memoryCheck() free: 238 MB, require: 4 MB
12:30:02 VERB Contact say(qqqq)
12:30:06 VERB Contact say(qqqq)
12:30:09 VERB Contact say(qqqq)
12:30:13 VERB Contact say(qqqq)
12:30:16 VERB Contact say(qqqq)
12:30:20 VERB Contact say(qqqq)
12:30:24 VERB Contact say(qqqq)
12:30:27 VERB Contact say(qqqq)
12:30:31 VERB Contact say(qqqq)
12:30:34 VERB Contact say(qqqq)
12:30:34 SILL Wechaty memoryCheck() free: 234 MB, require: 4 MB
12:30:34 SILL Wechaty memoryCheck() free: 234 MB, require: 4 MB
12:30:38 VERB Contact say(qqqq)
12:30:41 VERB Contact say(qqqq)
12:30:45 VERB Contact say(qqqq)
12:30:49 VERB Contact say(qqqq)
12:30:52 VERB Contact say(qqqq)
12:30:56 VERB Contact say(qqqq)
12:30:59 VERB Contact say(qqqq)
12:31:03 VERB Contact say(qqqq)
12:31:07 VERB Contact say(qqqq)
12:31:07 SILL Wechaty memoryCheck() free: 242 MB, require: 4 MB
12:31:07 SILL Wechaty memoryCheck() free: 242 MB, require: 4 MB
12:31:10 VERB Contact say(qqqq)
12:31:14 VERB Contact say(qqqq)
12:31:17 VERB Contact say(qqqq)
12:31:21 VERB Contact say(qqqq)
12:31:25 VERB Contact say(qqqq)
12:31:28 VERB Contact say(qqqq)
12:31:32 VERB Contact say(qqqq)
12:31:35 VERB Contact say(qqqq)
<�Fa�] 5 WARN sendShort receive unknown package: [126] 7e0ffffffff3000000003342080d000000003c1ebc1f466100a70400000000 ~����3B
12:31:39 VERB Contact say(qqqq)
12:31:39 INFO PadproManager Connection has problem, reset self to recover the connection.
12:31:39 SILL Puppet constructor() this.on(reset) reason: undefined
12:31:39 SILL Puppet constructor() resetThrottleQueue.subscribe() reason: undefined
12:31:39 VERB Puppet reset(undefined)
12:31:39 SILL StateSwitch off() is false
12:31:39 INFO PadproManager Connection has problem, reset self to recover the connection.
12:31:39 SILL Puppet constructor() this.on(reset) reason: undefined
12:31:39 SILL StateSwitch off() is false
12:31:39 SILL StateSwitch off() is false
12:31:39 VERB StateSwitch off(pending) <- (false)
12:31:39 SILL Contact ready() @ Puppet#1()/PuppetPadpro#1
12:31:39 SILL Contact ready() isReady() true
12:31:39 INFO CacheManager release()
12:31:39 INFO CacheManager release()
12:31:39 INFO WechatGateway stop()
12:31:39 INFO WechatGateway initLongSocket() connection to wechat long host server: long.weixin.qq.com ended.
12:31:39 INFO WechatGateway stop() finished
12:31:39 SILL StateSwitch off() is pending
12:31:39 VERB StateSwitch off(true) <- (pending)
12:31:39 SILL StateSwitch on() is false
12:31:39 SILL StateSwitch on() is false
12:31:39 VERB StateSwitch on(pending) <- (false)
12:31:39 INFO WechatGateway init(puppet_padpro_gocnu1ya4ab4a292, padpro.botorange.com:6666, undefined)
E0726 12:31:39.429827278 24581 uri_parser.cc:46] bad uri.scheme: ''
E0726 12:31:39.429863247 24581 uri_parser.cc:52] ^ here
E0726 12:31:39.429876517 24581 http_proxy.cc:58] cannot parse value of 'http_proxy' env var
12:31:39 SILL StateSwitch off() is false
12:31:39 INFO WechatGateway initLongSocket() connection to wechat long host server: long.weixin.qq.com closed.
12:31:42 VERB Contact say(qqqq)
<�Fa�] 2 WARN sendShort receive unknown package: [126] 7e0ffffffff3000000003342080d000000003c1ebc1f466100a70400000000 ~����3B
<�Fa�] 2 WARN sendShort receive unknown package: [126] 7e0ffffffff3000000003342080d000000003c1ebc1f466100a70400000000 ~����3B
12:31:44 ERR Config ###########################
12:31:44 ERR Config unhandledRejection: TIMEOUT [object Promise]
12:31:44 ERR Config ###########################
12:31:44 ERR Config process.on(unhandledRejection) promise.catch(undefined)
Config TIMEOUT
(node:24581) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 10)
<�Fa�] 5 WARN sendShort receive unknown package: [126] 7e0ffffffff3000000003342080d000000003c1ebc1f466100a70400000000 ~����3B
<�Fa�] 5 WARN sendShort receive unknown package: [126] 7e0ffffffff3000000003342080d000000003c1ebc1f466100a70400000000 ~����3B
<�Fa�] 5 WARN sendShort receive unknown package: [126] 7e0ffffffff3000000003342080d000000003c1ebc1f466100a70400000000 ~����3B
<�Fa�] 5 WARN sendShort receive unknown package: [126] 7e0ffffffff3000000003342080d000000003c1ebc1f466100a70400000000 ~����3B
<�Fa�] 5 WARN sendShort receive unknown package: [126] 7e0ffffffff3000000003342080d000000003c1ebc1f466100a70400000000 ~����3B
<�Fa�] 5 WARN sendShort receive unknown package: [126] 7e0ffffffff3000000003342080d000000003c1ebc1f466100a70400000000 ~����3B
<�Fa�] 5 WARN sendShort receive unknown package: [126] 7e0ffffffff3000000003342080d000000003c1ebc1f466100a70400000000 ~����3B
12:31:48 VERB Contact say(qqqq)
12:31:48 SILL Wechaty memoryCheck() free: 265 MB, require: 4 MB
12:31:48 SILL Wechaty memoryCheck() free: 265 MB, require: 4 MB
12:31:48 SILL StateSwitch on() is pending
12:31:48 VERB StateSwitch on(true) <- (pending)
12:31:52 VERB Contact say(qqqq)
12:31:52 INFO WechatGateway initLongSocket() connection to wechat long host server: long.weixin.qq.com ended.
12:31:52 INFO WechatGateway initLongSocket() connection to wechat long host server: long.weixin.qq.com closed.
12:32:15 SILL Wechaty memoryCheck() free: 262 MB, require: 4 MB
12:32:15 SILL Wechaty memoryCheck() free: 262 MB, require: 4 MB

$ WECHATY_LOG=silly node yourbot.js

7. 其他信息

有相关bug 的背景信息,可以在这里说明

[bug]

同样的,用官方的接口同样是,群发失败