MCPcopy
hub / github.com/wechaty/wechaty / room

Method room

src/user/message.ts:328–339  ·  view source on GitHub ↗

* Get the room from the message. * If the message is not in a room, then will return `null` * * @returns {(Room | null)} * @example * const bot = new Wechaty() * bot * .on('message', async m => { * const contact = msg.from() * const text = msg.text() * const room

()

Source from the content-addressed store, hash-verified

326 * .start()
327 */
328 public room (): null | Room {
329 if (!this.payload) {
330 throw new Error('no payload')
331 }
332 const roomId = this.payload.roomId
333 if (!roomId) {
334 return null
335 }
336
337 const room = this.wechaty.Room.load(roomId)
338 return room
339 }
340
341 /**
342 * Get the text content of the message

Callers 7

toStringMethod · 0.95
conversationMethod · 0.95
sayMethod · 0.95
mentionListMethod · 0.95
mentionTextMethod · 0.95
initPuppetEventBridgeMethod · 0.80
message.spec.tsFile · 0.80

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected