How to use the wechaty-puppet.MessageType.Text 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-padchat / pure-function-helpers / message-type.ts View on Github external
export function messageType(
  rawType: PadchatMessageType,
): MessageType {
  let type: MessageType

  switch (rawType) {

    case PadchatMessageType.Text:
      type = MessageType.Text
      break

    case PadchatMessageType.Image:
      type = MessageType.Image
      // console.log(rawPayload)
      break

    case PadchatMessageType.Voice:
      type = MessageType.Audio
      // console.log(rawPayload)
      break

    case PadchatMessageType.Emoticon:
      type = MessageType.Emoticon
      // console.log(rawPayload)
      break
github wechaty / wechaty-puppet-padplus / src / pure-function-helpers / message-type.ts View on Github external
export function messageType (
  rawType: PadplusMessageType,
): MessageType {
  let type: MessageType

  switch (rawType) {

    case PadplusMessageType.Text:
      type = MessageType.Text
      break

    case PadplusMessageType.Image:
      type = MessageType.Image
      // console.log(rawPayload)
      break

    case PadplusMessageType.Voice:
      type = MessageType.Audio
      // console.log(rawPayload)
      break

    case PadplusMessageType.Emoticon:
      type = MessageType.Emoticon
      // console.log(rawPayload)
      break
github wechaty / wechaty / src / puppet-wechat4u / pure-function-helpers / message-type.ts View on Github external
case WebMessageType.SYS:
    case WebMessageType.APP:
      return MessageType.Text

    // VERIFYMSG           = 37,
    // POSSIBLEFRIEND_MSG  = 40,
    // SHARECARD           = 42,
    // LOCATION            = 48,
    // VOIPMSG             = 50,
    // STATUSNOTIFY        = 51,
    // VOIPNOTIFY          = 52,
    // VOIPINVITE          = 53,
    // SYSNOTICE           = 9999,
    // RECALLED            = 10002,
    default:
      return MessageType.Text
  }
}
github wechaty / wechaty / src / puppet-puppeteer / pure-function-helpers / web-message-type.ts View on Github external
case WebMessageType.TEXT:
      return MessageType.Text

    case WebMessageType.EMOTICON:
    case WebMessageType.IMAGE:
      return MessageType.Image

    case WebMessageType.VOICE:
      return MessageType.Audio

    case WebMessageType.MICROVIDEO:
    case WebMessageType.VIDEO:
      return MessageType.Video

    case WebMessageType.TEXT:
      return MessageType.Text

    /**
     * Treat those Types as TEXT
     *
     * Friendship is a SYS message
     * FIXME: should we use better message type at here???
     */
    case WebMessageType.SYS:
    case WebMessageType.APP:
      return MessageType.Text

    // VERIFYMSG           = 37,
    // POSSIBLEFRIEND_MSG  = 40,
    // SHARECARD           = 42,
    // LOCATION            = 48,
    // VOIPMSG             = 50,
github wechaty / wechaty-puppet-padplus / src / pure-function-helpers / message-raw-payload-parser.ts View on Github external
text,
      toId,
    }
  } else {
    throw new Error('neither toId nor roomId')
  }

  /**
   * 6. Set app payload type
   */
  if (type === MessageType.Attachment) {
    const appPayload = await appMessageParser(rawPayload)
    if (appPayload) {
      switch (appPayload.type) {
        case WechatAppMessageType.Text:
          payload.type = MessageType.Text
          payload.text = appPayload.title
          payload.filename = undefined
          break
        case WechatAppMessageType.Url:
          payload.type = MessageType.Url
          break
        case WechatAppMessageType.Attach:
          payload.type = MessageType.Attachment
          payload.filename = appPayload.title
          break
        case WechatAppMessageType.ChatHistory:
          payload.type = MessageType.ChatHistory
          break
        case WechatAppMessageType.MiniProgram:
        case WechatAppMessageType.MiniProgramApp:
          payload.type = MessageType.MiniProgram
github wechaty / wechaty / src / user / message.spec.ts View on Github external
if (id === EXPECTED_RECALL_MESSAGE_ID) {
      return {
        id: EXPECTED_RECALL_MESSAGE_ID,
        text: EXPECTED_RECALLED_MESSAGE_ID,
        timestamp: EXPECTED_MESSAGE_TIMESTAMP,
        type: MessageType.Recalled,
      } as MessagePayload
    } else {
      return {
        fromId: EXPECTED_FROM_CONTACT_ID,
        id: EXPECTED_RECALLED_MESSAGE_ID,
        roomId: EXPECTED_ROOM_ID,
        text: '',
        timestamp: EXPECTED_MESSAGE_TIMESTAMP,
        toId: EXPECTED_TO_CONTACT_ID,
        type: MessageType.Text,
      } as MessagePayload
    }
  })
  sandbox.stub(puppet, 'roomPayload').callsFake(async () => {