MCPcopy
hub / github.com/nodeWechat/wechat4u / getDisplayName

Function getDisplayName

src/interface/contact.js:47–59  ·  view source on GitHub ↗
(contact)

Source from the content-addressed store, hash-verified

45}
46
47export function getDisplayName (contact) {
48 if (isRoomContact(contact)) {
49 if (contact.MemberCount >= 2) {
50 return '[群] ' + (contact.RemarkName || contact.DisplayName || contact.NickName ||
51 `${getDisplayName(contact.MemberList[0])}、${getDisplayName(contact.MemberList[1])}`)
52 } else {
53 return '[群] ' + (contact.RemarkName || contact.DisplayName || contact.NickName ||
54 `${getDisplayName(contact.MemberList[0])}`)
55 }
56 } else {
57 return contact.DisplayName || contact.RemarkName || contact.NickName || contact.UserName
58 }
59}
60
61export function isRoomContact (contact) {
62 return contact.UserName ? /^@@|@chatroom$/.test(contact.UserName) : false

Callers 1

contact.jsFile · 0.85

Calls 1

isRoomContactFunction · 0.85

Tested by

no test coverage detected