How to use the wechaty-puppet.FriendshipType.Confirm function in wechaty-puppet

To help you get started, we’ve selected a few wechaty-puppet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wechaty / wechaty / src / puppet-puppeteer / puppeteer-friendship.spec.ts View on Github external
test('PuppetPuppeteerFriendship.confirm smoke testing', async t => {

  const puppet  = new PuppetTest({ memory: new MemoryCard() })
  const wechaty = new WechatyTest({ puppet })
  wechaty.initPuppetAccessory(puppet)

  /* tslint:disable:max-line-length */
  const rawMessagePayload: WebMessageRawPayload = JSON.parse(`
    {"MsgId":"3382012679535022763","FromUserName":"@04a0fa314d0d8d50dc54e2ec908744ebf46b87404d143fd9a6692182dd90bd49","ToUserName":"@f7321198e0349f1b38c9f2ef158f70eb","MsgType":10000,"Content":"You have added 李卓桓.PreAngel as your WeChat contact. Start chatting!","Status":4,"ImgStatus":1,"CreateTime":1475569920,"VoiceLength":0,"PlayLength":0,"FileName":"","FileSize":"","MediaId":"","Url":"","AppMsgType":0,"StatusNotifyCode":0,"StatusNotifyUserName":"","RecommendInfo":{"UserName":"","NickName":"","QQNum":0,"Province":"","City":"","Content":"","Signature":"","Alias":"","Scene":0,"VerifyFlag":0,"AttrStatus":0,"Sex":0,"Ticket":"","OpCode":0},"ForwardFlag":0,"AppInfo":{"AppID":"","Type":0},"HasProductId":0,"Ticket":"","ImgHeight":0,"ImgWidth":0,"SubMsgType":0,"NewMsgId":3382012679535022600,"MMPeerUserName":"@04a0fa314d0d8d50dc54e2ec908744ebf46b87404d143fd9a6692182dd90bd49","MMDigest":"You have added 李卓桓.PreAngel as your WeChat contact. Start chatting!","MMIsSend":false,"MMIsChatRoom":false,"LocalID":"3382012679535022763","ClientMsgId":"3382012679535022763","MMActualContent":"You have added 李卓桓.PreAngel as your WeChat contact. Start chatting!","MMActualSender":"@04a0fa314d0d8d50dc54e2ec908744ebf46b87404d143fd9a6692182dd90bd49","MMDigestTime":"16:32","MMDisplayTime":1475569920,"MMTime":"16:32"}
  `)

  const friendshipPayload: FriendshipPayload = {
    id        : 'id',
    type      : FriendshipType.Confirm,
    contactId : 'xxx',
  }

  const sandbox = sinon.createSandbox()

  sandbox.stub(puppet, 'messageRawPayload')   .resolves(rawMessagePayload)

  sandbox.stub(puppet, 'contactPayload')      .resolves({})
  sandbox.stub(puppet, 'contactPayloadCache') .returns({})

  sandbox.stub(puppet, 'friendshipPayload')      .resolves(friendshipPayload)
  sandbox.stub(puppet, 'friendshipPayloadCache') .returns(friendshipPayload)

  const msg = wechaty.Message.create(rawMessagePayload.MsgId)
  await msg.ready()
github wechaty / wechaty / src / puppet-padchat / pure-function-helpers / friendship-raw-payload-parser.ts View on Github external
function friendshipRawPayloadParserConfirm(
  rawPayload: PadchatMessagePayload,
): FriendshipPayload {
  const payload: FriendshipPayloadConfirm = {
    id        : rawPayload.msg_id,
    contactId : rawPayload.from_user,
    type      : FriendshipType.Confirm,
  }
  return payload
}
github wechaty / wechaty-puppet-padplus / src / pure-function-helpers / friendship-raw-payload-parser.ts View on Github external
async function friendshipRawPayloadParserConfirm (
  rawPayload: PadplusMessagePayload,
): Promise {
  const payload: FriendshipPayloadConfirm = {
    contactId : rawPayload.fromUserName,
    id        : rawPayload.msgId,
    timestamp : rawPayload.createTime,
    type      : FriendshipType.Confirm,
  }
  return payload
}