diff --git a/examples/pom.xml b/examples/pom.xml index f550c80..02f29dd 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -43,17 +43,20 @@ org.apache.logging.log4j log4j-core 2.13.2 + compile org.apache.logging.log4j log4j-slf4j-impl 2.13.1 + compile com.lmax disruptor 3.4.2 + compile diff --git a/examples/src/main/resources/log4j2.xml b/examples/src/main/resources/log4j2.xml new file mode 100644 index 0000000..1d4c1dd --- /dev/null +++ b/examples/src/main/resources/log4j2.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/wechaty/src/main/kotlin/io/github/wechaty/user/Friendship.kt b/wechaty/src/main/kotlin/io/github/wechaty/user/Friendship.kt index 8afcb75..bcda82b 100644 --- a/wechaty/src/main/kotlin/io/github/wechaty/user/Friendship.kt +++ b/wechaty/src/main/kotlin/io/github/wechaty/user/Friendship.kt @@ -3,10 +3,8 @@ package io.github.wechaty.user import io.github.wechaty.Accessory import io.github.wechaty.Wechaty import io.github.wechaty.schemas.FriendshipPayload -import io.github.wechaty.schemas.FriendshipSearchCondition import io.github.wechaty.schemas.FriendshipType import io.github.wechaty.utils.JsonUtils -import org.apache.commons.lang3.StringUtils import org.slf4j.LoggerFactory class Friendship (wechaty: Wechaty,val id:String):Accessory(wechaty){ @@ -50,7 +48,7 @@ class Friendship (wechaty: Wechaty,val id:String):Accessory(wechaty){ fun hello():String{ if(payload==null){ - throw Exception("ne payload") + throw Exception("no payload") } return this.payload?.hello ?: ""; } @@ -61,11 +59,15 @@ class Friendship (wechaty: Wechaty,val id:String):Accessory(wechaty){ fun toJson():String{ if(payload==null){ - throw Exception("ne payload") + throw Exception("no payload") } return JsonUtils.write(payload!!); } + fun getType():FriendshipType{ + return payload?.type ?: throw Exception("no payload") + } + companion object{ private val log = LoggerFactory.getLogger(Friendship::class.java) }