Skip to content

Commit 67b62c2

Browse files
committed
1. 修复查找房间联系人的时候联系人没有payload的bug
1 parent 9b4f815 commit 67b62c2

File tree

3 files changed

+21
-27
lines changed

3 files changed

+21
-27
lines changed

wechaty-puppet/src/main/kotlin/Puppet.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,7 @@ abstract class Puppet : EventEmitter {
841841
}
842842

843843
var idList = ArrayList(contactSearch(contactQuery, roomMemberIdList).get())
844+
844845
val memberPayloadList = roomMemberIdList.mapNotNull { x -> roomMemberPayload(roomId, x).get() }
845846

846847
if (query.roomAlias != null) {
@@ -943,6 +944,7 @@ abstract class Puppet : EventEmitter {
943944

944945
fun setMemory(memoryCard: MemoryCard) {
945946
log.debug("Puppet, setMemory()")
947+
946948
this.memory = memoryCard
947949
}
948950

wechaty/src/main/kotlin/io/github/wechaty/Wechaty.kt

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ class Wechaty private constructor(private var wechatyOptions: WechatyOptions) :
5656

5757

5858
fun start(await: Boolean = false):Wechaty {
59+
if (this.status.on() == StateEnum.ON) {
60+
this.status.ready(StateEnum.ON)
61+
return this
62+
}
63+
64+
this.readyState.off(StateEnum.OFF)
65+
this.status.on(StateEnum.PENDING)
66+
5967
initPuppet()
6068
puppet.start().get()
6169
// status = StateEnum.ON
@@ -78,40 +86,25 @@ class Wechaty private constructor(private var wechatyOptions: WechatyOptions) :
7886
}
7987

8088
fun stop() {
89+
// if (this.status.off() == StateEnum.OFF) {
90+
// this.status.ready(StateEnum.OFF)
91+
// return
92+
// }
93+
//
94+
// this.readyState.off(StateEnum.OFF)
95+
// this.status.off(StateEnum.PENDING)
8196
puppet.stop()
97+
98+
// this.status.off(StateEnum.OFF)
8299
}
83100

84101
fun name(): String {
85102
return wechatyOptions.name
86103
}
87104

88105
fun say(something: Any): Future<Void> {
89-
90106
val msgId: String?
91107
this.userSelf().say(something)
92-
// this.puppet.selfId()?.let {
93-
// when (something) {
94-
// is String -> {
95-
// msgId = puppet.messageSendText(it, something).get()
96-
// }
97-
// is Contact -> {
98-
// msgId = puppet.messageSendContact(it, something.id).get()
99-
// }
100-
// is FileBox -> {
101-
// msgId = puppet.messageSendFile(it, something).get()
102-
// }
103-
// is UrlLink -> {
104-
// msgId = puppet.messageSendUrl(it, something.payload).get()
105-
// }
106-
// is MiniProgram -> {
107-
// msgId = puppet.messageSendMiniProgram(it, something.payload).get()
108-
// }
109-
// else -> {
110-
// throw Exception("unsupported arg:$something")
111-
// }
112-
// }
113-
// return@let
114-
// }
115108
return CompletableFuture.completedFuture(null)
116109
}
117110
fun onLogin(listener: LoginListener):Wechaty{

wechaty/src/main/kotlin/io/github/wechaty/user/Room.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,10 @@ class Room(wechaty: Wechaty, val id: String) : Accessory(wechaty), Sayable {
325325

326326
val contactIdList = wechaty.getPuppet().roomMemberSearch(this.id, query).get()
327327
val contactList = contactIdList.map {
328-
wechaty.contactManager.load(id)
328+
id -> wechaty.contactManager.load(id)
329329
}
330330

331331
return contactList
332-
333332
}
334333

335334
fun memberList(): List<Contact> {
@@ -341,7 +340,7 @@ class Room(wechaty: Wechaty, val id: String) : Accessory(wechaty), Sayable {
341340
}
342341

343342
val contactList = memberIdList.map {
344-
wechaty.contactManager.load(id)
343+
id -> wechaty.contactManager.load(id)
345344
}
346345
return contactList
347346

0 commit comments

Comments
 (0)