UNPKG

@juzi/wechaty-puppet-whatsapp

Version:
59 lines 1.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.genRoomAnnounce = exports.genRoomJoinEvent = exports.genRoomTopicEvent = void 0; const whatsapp_interface_js_1 = require("../../schema/whatsapp-interface.js"); function genRoomTopicEvent(notification, roomPayload) { const roomIdObj = notification.id; const roomId = roomIdObj.remote; const roomTopicPayload = { changerId: notification.author, newTopic: notification.body, oldTopic: roomPayload.name || '', roomId, timestamp: notification.timestamp, }; return roomTopicPayload; } exports.genRoomTopicEvent = genRoomTopicEvent; function genRoomJoinEvent(notification, members) { const roomIdObj = notification.id; const roomId = roomIdObj.remote; const roomJoinPayload = { inviteeIdList: members, inviterId: notification.author, roomId, timestamp: notification.timestamp, }; return roomJoinPayload; } exports.genRoomJoinEvent = genRoomJoinEvent; function genRoomAnnounce(notification, description) { const roomIdObj = notification.id; const roomId = roomIdObj.remote; const genMessagePayload = { ack: 2, author: notification.author, body: description, broadcast: false, forwardingScore: 0, from: roomIdObj.participant || notification.author, fromMe: roomIdObj.fromMe, hasMedia: false, hasQuotedMsg: false, id: notification.id, isEphemeral: false, isForwarded: false, isGif: false, isStarred: false, isStatus: false, links: [], mentionedIds: [], timestamp: Date.now(), to: roomId, type: whatsapp_interface_js_1.MessageTypes.TEXT, vCards: [], }; return genMessagePayload; } exports.genRoomAnnounce = genRoomAnnounce; //# sourceMappingURL=room-event-generator.js.map