Skip to content

Commit 6d443dd

Browse files
committed
fix bug
1 parent bd48ab0 commit 6d443dd

File tree

6 files changed

+15
-10
lines changed

6 files changed

+15
-10
lines changed

examples/pom.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33

4-
<parent>
5-
<groupId>io.github.wechaty</groupId>
6-
<artifactId>wechaty-parent</artifactId>
7-
<version>1.0.0-SNAPSHOT</version>
8-
</parent>
4+
95
<modelVersion>4.0.0</modelVersion>
6+
<groupId>io.github.wechaty</groupId>
107
<artifactId>wechaty-example</artifactId>
118
<packaging>jar</packaging>
9+
<version>1.0.0-SNAPSHOT</version>
1210

1311
<properties>
1412
<kotlin.version>1.3.72</kotlin.version>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
<module>wechaty</module>
3131
<module>wechaty-puppet</module>
3232
<module>wechaty-puppet-hostie</module>
33-
<module>examples</module>
3433
<module>wechaty-puppet-mock</module>
34+
<module>examples</module>
3535
</modules>
3636

3737
<dependencyManagement>

wechaty-puppet-hostie/src/main/kotlin/io/github/wechaty/grpc/GrpcPuppet.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ class GrpcPuppet(puppetOptions: PuppetOptions) : Puppet(puppetOptions) {
946946
log.debug("PuppetHostie $type payload $payload")
947947

948948
if (type != Event.EventType.EVENT_TYPE_HEARTBEAT) {
949-
emit(EventEnum.HEART_BEAT, EventHeartbeatPayload("heartbeat"))
949+
emit(EventEnum.HEART_BEAT, EventHeartbeatPayload("heartbeat",6000))
950950
}
951951

952952
when (type) {

wechaty-puppet/src/main/kotlin/io/github/wechaty/schemas/Event.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ data class EventResetPayload(
135135
}
136136

137137
data class EventHeartbeatPayload(
138-
var data:String
138+
var data:String,
139+
var timeout:Long
139140
) {
140141
override fun toString(): String {
141142
return "EventHeartbeatPayload(data='$data')"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ class Room(wechaty: Wechaty, val id: String) : Accessory(wechaty), Sayable {
285285

286286
return CompletableFuture.supplyAsync {
287287
try {
288+
val newTop = puppet.roomTopic(id, newTopic).get()
288289
return@supplyAsync puppet.roomTopic(id, newTopic).get()
289290
} catch (e: Exception) {
290291
log.warn("Room topic(newTopic=$newTopic) exception:$e")

wechaty/src/main/kotlin/io/github/wechaty/user/manager/PuppetManager.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ class PuppetManager {
2929
throw java.lang.RuntimeException("expect one puppet,but can not found any one.")
3030
}
3131

32-
if (subTypes.size > 1) {
32+
val filterPuppet = subTypes.filter {
33+
val clazz = it as Class<*>
34+
clazz.name == wechatyOptions.puppet
35+
}
36+
37+
if (filterPuppet.size > 1) {
3338
throw RuntimeException("expect one puppet,but found ${subTypes.size}")
3439
}
35-
val clazz = subTypes.first() as Class<*>
40+
val clazz = filterPuppet.first() as Class<*>
3641
val declaredConstructor = clazz.getDeclaredConstructor(PuppetOptions::class.java)
3742
return CompletableFuture.completedFuture(declaredConstructor.newInstance(wechatyOptions.puppetOptions!!) as Puppet)
3843
}

0 commit comments

Comments
 (0)