Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/P.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ object P {
override val description: String get() = DESCRIPTION
override val homepage: String get() = HOMEPAGE

const val VERSION = "0.0.5"
const val NEXT_VERSION = "0.0.6"
const val VERSION = "0.0.6"
const val NEXT_VERSION = "0.0.7"

override val snapshotVersion = "$NEXT_VERSION-SNAPSHOT"
override val version = if (isSnapshot()) snapshotVersion else VERSION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import com.google.devtools.ksp.processing.SymbolProcessorEnvironment
import com.google.devtools.ksp.processing.SymbolProcessorProvider
import com.google.devtools.ksp.symbol.KSAnnotated
import com.google.devtools.ksp.symbol.KSClassDeclaration
import com.google.devtools.ksp.symbol.Modifier
import com.squareup.kotlinpoet.*
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
import com.squareup.kotlinpoet.ksp.toClassName
Expand Down Expand Up @@ -81,6 +82,8 @@ private class IncludeMessageElementsProcessor(val environment: SymbolProcessorEn
.filterIsInstance<KSClassDeclaration>()
// 是一个可序列化的具体的类
.filter { !it.isAbstract() }
// isAbstract 无法判断 sealed
.filter { Modifier.SEALED !in it.modifiers }
// 是 BaseMessageElement 的子类
.filter { baseDeclarationType.isAssignableFrom(it.asStarProjectedType()) }
.onEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,12 @@ public sealed class TelegramMessageEntity : TelegramMessageElement, PlainText {
@SerialName("telegram.m.message_entity.simple")
public class Simple internal constructor(
override val text: String,
override val type: String,
private val typeValue: String,
override val sourceEntity: MessageEntity?
) : TelegramMessageEntity()
) : TelegramMessageEntity() {
override val type: String
get() = typeValue
}

/**
* An implementation with type [MessageEntityType.TEXT_LINK]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ internal fun StdlibMessage.toMessages(): Messages {
else -> {
TelegramMessageEntity.Simple(
text = text.substring(entity),
type = entity.type,
typeValue = entity.type,
entity
)
}
Expand Down