MCPcopy Create free account

hub / github.com/AvengersWeChat/PadChat-SDK / functions

Functions80 in github.com/AvengersWeChat/PadChat-SDK

↓ 64 callersMethodsendCmd
* 包装ws发送指令数据包 * * @param {string} cmd - 要操作的接口 * @param {object} data - 要发送的数据 * @returns {Promise<object>} 返回ws处理结果 * @private * @membero
index.js:218
↓ 3 callersMethodlogin
* 登录账号 * 首次登录不需要传入`wxData`,登陆成功后本地保存`wxData`和`token`,以后使用断线重连或二次登陆,可降低封号概率。 * 任何登陆方式,使用成功登陆过的`wxData`都可降低封号概率。 * * @param {string} type - 登录类型
index.js:331
↓ 3 callersMethodsyncContact
* 同步通讯录 * * 使用此接口可以触发同步通讯录,如果设置`reset`为`true`,则在通讯录同步完毕后触发`loaded`事件 * * @param {boolean} [reset=false] 是否重置通讯录加载完毕状态 * @returns {Promise<ob
index.js:475
↓ 2 callersFunctionsaveAutoData
* @description 保存自动登陆数据
demo.js:356
↓ 2 callersMethodsendMsg
* 发送文字信息 * * @param {string} toUserName - 接收者的wxid * @param {string} content - 内容文本 * @param {Array<string>} [atList=[]] - 向群内发信息时,要@的用户wxid数组
index.js:548
↓ 2 callersMethodstart
* 启动websocket连接 * * @memberof Padchat
index.js:80
↓ 2 callersMethodsyncMsg
* 同步消息 * * 使用此接口手动触发同步消息,一般用于刚登陆后调用,可立即开始同步消息。 * 否则会在有新消息时才开始同步消息。 * * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * @memberof
index.js:462
↓ 1 callersMethod_send
* ws发送数据 * * @param {object} data - 数据 * @returns {Promise<object>} 返回ws处理结果 * @private * @memberof Padchat
index.js:160
↓ 1 callersMethodasyncSend
* 包装ws发送数据 * * @param {object} data - 要发送的数据 * @param {number} timeout - 发送超时时间 * @returns {Promise<object>} 返回ws处理结果 * @private * @member
index.js:184
↓ 1 callersFunctionclearRawMsg
* 清除消息结构中多余字段 * * @param {object} obj - 要处理的数据结构 * @private * @returns {object}
index.js:2981
↓ 1 callersMethodgetLoginToken
* 获取二次登陆数据 * * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { error : '', success: true, data : {
index.js:410
↓ 1 callersMethodgetMsgImage
* 获取消息原始图片 * * 在push事件中收到的data数据是缩略图图片数据,使用本接口获取原图数据 * * @param {object} rawMsgData - 推送的消息结构体,即`push`事件中收到的Object * @returns {Promise<objec
index.js:755
↓ 1 callersMethodgetMsgVideo
* 获取消息原始视频 * * 在push事件中只获得推送通知,不包含视频数据,需要使用本接口获取视频文件数据 * * @param {object} rawMsgData - 推送的消息结构体,即`push`事件中收到的Object * @returns {Promise<obj
index.js:783
↓ 1 callersMethodgetMsgVoice
* 获取消息语音数据 * * 这个接口获取到的与push事件中接收到的数据一致,是base64编码的silk格式语音数据 * * BUG: 超过60Kb的语音数据,只能拉取到60Kb,也就是说大约36~40秒以上的语音会丢失后边部分语音内容 * * @param {objec
index.js:812
↓ 1 callersMethodgetMyInfo
* 获取微信号信息 * * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { error : '', success: true, data: { use
index.js:431
↓ 1 callersMethodgetWxData
* 获取设备62数据 * * 事实上,只要你有一次登陆成功,以后一直用这个62数据,不需要更换。 * * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { error: '', success
index.js:387
↓ 1 callersMethodinit
* 初始化 * * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { error : '', success: true } * ``` * @memberof Padchat
index.js:252
↓ 1 callersFunctiononMsg
(data)
demo.js:378
↓ 1 callersMethodsendImage
* 发送图片消息 * * @param {string} toUserName - 接收者的wxid * @param {Buffer|string} file - 图片Buffer数据或base64 * @returns {Promise<object>} 返回Promise<ob
index.js:691
↓ 1 callersMethodsendVoice
* 发送语音消息 * 注意:只能发送silk格式的语音文件 * * @param {string} toUserName - 接收者的wxid * @param {Buffer|string} file - 语音Buffer数据或base64 * @param {number}
index.js:723
MethodacceptTransfer
* 接受转账 * * @param {object} rawMsgData - 推送的消息结构体,即`push`事件中收到的Object * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { su
index.js:1902
MethodacceptUser
* 通过好友验证 * * @param {string} stranger - 用户stranger数据 * @param {string} ticket - 用户ticket数据 * @returns {Promise<object>} 返回Promise<object>,注意捕捉
index.js:1231
MethodaddContact
* 添加好友 * * @param {string} stranger - 用户stranger数据 * @param {string} ticket - 用户ticket数据 * @param {Number} type - 添加好友途径 <br> `0` : 通过微信号搜索
index.js:1269
MethodaddFav
* 添加收藏 * * @param {string} content - 内容文本 * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * @memberof Padchat
index.js:1643
MethodaddLabel
* 添加标签 * * @param {string} label - 标签名称 * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success: true, data : {
index.js:1767
MethodaddRoomMember
* 添加群成员 * * @param {string} groupId - 群id * @param {string} userId - 用户wxid * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ```
index.js:897
Methodclose
* 关闭微信实例(不退出登陆) * * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * @memberof Padchat
index.js:262
MethodclosePush
* 关闭推送 * * @description 仅用于开发调试,不需要使用 * @private * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * @memberof Padchat
index.js:500
Methodconstructor
* Creates an instance of Padchat. * @param {string} [url] - 服务器url,后缀你的token:`ws://127.0.0.1:7777/{YourToken}` * 如:`ws://127.0.0.1:7777/mytoken_
index.js:55
MethodcreateRoom
* 创建群 * * 注意:如果有用户存在问题不能进群,则会建群失败。 * 但判断是否成功应以`userName`字段 * * @param {string[]} userList - 用户wxid数组 * @returns {Promise<object>} 返回Promis
index.js:839
MethoddeleteContact
* 删除好友 * * @param {string} userId - 用户wxid * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success: true, data :
index.js:1180
MethoddeleteFav
* 删除收藏 * * @param {Number} favId - 收藏id * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success: true, data :
index.js:1718
MethoddeleteLabel
* 删除标签 * * @param {string} labelId - 标签id,注意是id是string类型 * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success: true,
index.js:1789
MethoddeleteRoomMember
* 删除群成员 * * @param {string} groupId - 群id * @param {string} userId - 用户wxid * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ```
index.js:946
MethoddumpWxuser
* @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * @private * @memberof Padchat
index.js:668
FunctiongetCmdRecv
* 等待指定cmdId返回 * * @param {string} cmdId - 要监听的cmdId * @param {number} [timeout=3000] 超时时间默认为3秒 * @private * @returns {Promise<object>}
index.js:2488
MethodgetContact
* 获取用户/群信息 * * @param {string} userId - 用户wxid/群id * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * * 微信用户/公众号返回: * * ``` {
index.js:1122
MethodgetContactQrcode
* 获取用户二维码 * 仅限获取自己的二维码,无法获取其他人的二维码 * * @param {string} userId - 用户wxid * @param {Number} style - 二维码风格。可用范围0-3 * @returns {Promise<object>}
index.js:1207
MethodgetFav
* 获取收藏消息详情 * * @param {Number} favId - 收藏id * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success: true, data :
index.js:1684
MethodgetLabelList
* 获取所有标签 * * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success: true, data : { label: //标签列表
index.js:1747
MethodgetRequestToken
* 获取网页访问授权 * * @param {string} ghName - 公众号gh名称,即`gh_`格式的id * @param {string} url - 网页url * @returns {Promise<object>} 返回Promise<object>,注意捕捉c
index.js:2444
MethodgetRoomMembers
* 获取群成员信息 * * @param {string} groupId - 群id * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success: true, data :
index.js:874
MethodgetRoomQrcode
* 获取微信群二维码 * * @param {string} groupId - 群id * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success: true, data
index.js:1042
MethodgetSubscriptionInfo
* 获取公众号信息 * * @param {string} ghName - 公众号gh名称,即`gh_`格式的id * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success: tru
index.js:2385
MethodheartBeat
* 启动心跳 * * @description 仅用于开发调试,不需要使用 * @private * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * @memberof Padchat
index.js:512
MethodinviteRoomMember
* 邀请群成员 * 会给对方发送一条邀请消息,无法判断对方是否真的接收到 * * @param {string} groupId - 群id * @param {string} userId - 用户wxid * @returns {Promise<object>} 返回Prom
index.js:922
Methodlogout
* 退出登录 * * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * @memberof Padchat
index.js:488
MethodmassMsg
* 群发文字信息 * * FIXME: 此接口有问题,暂停使用 * * @param {Array<string>} [userList=[]] - 接收者wxid数组 * @param {string} content - 内容文本 * @returns {Promise<
index.js:574
FunctiononWsMsg
* 加工处理ws接收到的数据 * * @param {string} msg - ws连接接收到的文本消息 * @private
index.js:2516
MethodopenRedPacket
* 领取红包 * * @param {object} rawMsgData - 推送的消息结构体,即`push`事件中收到的Object * @param {string} key - 红包的验证key,通过调用 receiveRedPacket 获得 * @returns {Pro
index.js:2157
MethodoperateSubscription
* 操作公众号菜单 * * @param {string} ghName - 公众号gh名称,即`gh_`格式的id * @param {Number} menuId - 菜单id * @param {string} menuKey - 菜单key * @returns {Pro
index.js:2409
MethodqueryRedPacket
* 查看红包信息 * NOTE: 如果是别人发的红包,未领取且未领取完毕时,无法取到红包信息 * * @param {object} rawMsgData - 推送的消息结构体,即`push`事件中收到的Object * @param {Number} [index=0] - 列表索
index.js:2062
MethodqueryTransfer
* 查看转账消息 * * @param {object} rawMsgData - 推送的消息结构体,即`push`事件中收到的Object * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` {
index.js:1869
MethodquitRoom
* 退出群 * * @param {string} groupId - 群id * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success: true, data : {
index.js:969
MethodreceiveRedPacket
* 接收红包 * * @param {object} rawMsgData - 推送的消息结构体,即`push`事件中收到的Object * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { su
index.js:1951
MethodrequestUrl
* 访问网页 * * @param {string} url - 网页url地址 * @param {string} xKey - 访问Key,用`getRequestToken`获取 * @param {string} xUin - 访问uin,用`getRequestToken`
index.js:2472
MethodsayHello
* 打招呼 * 如果已经是好友,会收到由系统自动发送,来自对方的一条文本信息 * “xx已通过你的朋友验证请求,现在可以开始聊天了” * * @param {string} stranger - 用户stranger数据 * @param {string} ticket - 用户
index.js:1298
MethodsearchContact
* 搜索用户 * 可用此接口来判断是否已经加对方为好友 * * @param {string} userId - 用户wxid * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { succe
index.js:1158
MethodsearchMp
* 搜索公众号 * * @param {string} content - 公众号名称等关键字 * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success: true, data
index.js:2279
MethodsendAppMsg
* 发送App消息(含小程序) * * @param {string} toUserName - 接收者的wxid * @param {object|string} content - app消息体文本(appmsg xml结构) * @param {object} object -
index.js:623
MethodsetHeadImg
* 设置头像 * * @param {Buffer|string} file - 图片Buffer数据或base64 * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success:
index.js:1351
MethodsetLabel
* 设置用户标签 * * @param {string} userId - 用户wxid * @param {string} labelId - 标签id * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ```
index.js:1812
MethodsetRemark
* 设置备注 * * @param {string} userId - 用户wxid * @param {string} remark - 备注名称 * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ```
index.js:1323
MethodsetRoomAnnouncement
* 设置群公告 * * @param {string} groupId - 群id * @param {string} content - 群公告内容 * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ```
index.js:992
MethodsetRoomName
* 设置群名称 * * @param {string} groupId - 群id * @param {string} content - 群名称 * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` {
index.js:1016
MethodsetSyncContact
* 设置是否同步联系人 * * @memberof Padchat
index.js:440
MethodsetSyncMsg
* 设置是否同步消息 * * @memberof Padchat
index.js:449
MethodshareCard
* 分享名片 * * @param {string} toUserName - 接收者的wxid * @param {string} content - 内容文本 * @param {string} userId - 被分享人wxid * @returns {Promise<ob
index.js:655
MethodsnsComment
* 评论朋友圈 * * @param {string} userId - 用户wxid * @param {string} momentId - 朋友圈信息id * @param {string} content - 内容文本 * @returns {Promise<object
index.js:1566
MethodsnsGetObject
* 获取朋友圈信息详情 * * @param {string} momentId - 朋友圈信息id * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success: true, d
index.js:1540
MethodsnsLike
* 朋友圈点赞 * * @param {string} userId - 用户wxid * @param {string} momentId - 朋友圈信息id * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch *
index.js:1592
MethodsnsSendMoment
* 发朋友圈 * * @param {string} content - 文本内容或`Timelineobject`结构体文本 * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success
index.js:1447
MethodsnsTimeline
* 查看朋友圈动态 * * @param {string} [momentId=''] - 朋友圈信息id * 首次传入空即获取第一页,以后传入上次拉取的最后一条信息id * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch
index.js:1517
MethodsnsUpload
* 上传图片到朋友圈 * NOTE: 此接口只能上传图片,并不会将图片发到朋友圈中 * * @param {Buffer|string} file - 图片Buffer数据或base64 * @returns {Promise<object>} 返回Promise<object>,注
index.js:1384
MethodsnsUserPage
* 查看用户朋友圈 * * @param {string} userId - 用户wxid * @param {string} [momentId=''] - 朋友圈信息id * 首次传入空即获取第一页,以后传入上次拉取的最后一条信息id * @returns {Promise<
index.js:1482
MethodsnsobjectOp
* 操作朋友圈 * * @param {string} momentId - 朋友圈信息id * @param {Number} type - 操作类型,1为删除朋友圈,4为删除评论,5为取消赞 * @param {Number} commentId - 操作类型,当type为4时,
index.js:1412
FunctionstructureXml
* 组装appmsg消息体 * * @param {object} object 消息体参数 * @param {object} [object.appid] - appid,忽略即可 * @param {object} [object.sdkver] - sdk版本,忽略即可 * @pa
helper.js:91
MethodsyncFav
* 同步收藏消息 * * @param {string} [favKey=''] - 同步key,首次不用传入 * @returns {Promise<object>} 返回Promise<object>,注意捕捉catch * ``` { success: true,
index.js:1630
FunctiontoCamelCase
* 将object中的属性名称从下划线转换为驼峰格式 * (包含子数据的属性名,会遍历转换) * * @param {any} obj 要转换的object * @param {boolean} [big=true] 是否转换为大驼峰格式 * @returns {Object} 转换后的o
helper.js:20
FunctiontoUnderLine
* 将object中的属性名称从驼峰转换为下划线格式 * * @param {any} obj 要转换的object * @returns {Object} 转换后的object
helper.js:55