Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加接口 UrlAwareMessage 用以描述能够获取到 URL 信息的消息元素 #875

Merged
merged 1 commit into from
Jul 10, 2024
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
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/P.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ sealed class P(override val group: String) : ProjectDetail() {
companion object {
const val VERSION = "4.2.0"
const val SNAPSHOT_VERSION = "$VERSION-SNAPSHOT"
const val NEXT_VERSION = "4.2.0"
const val NEXT_VERSION = "4.3.0"
const val NEXT_SNAPSHOT_VERSION = "$NEXT_VERSION-SNAPSHOT"

const val GROUP = "love.forte.simbot"
Expand Down
10 changes: 7 additions & 3 deletions simbot-api/api/simbot-api.api
Original file line number Diff line number Diff line change
Expand Up @@ -1830,7 +1830,7 @@ public final class love/forte/simbot/message/AtAll : love/forte/simbot/message/M
public fun toString ()Ljava/lang/String;
}

public final class love/forte/simbot/message/Emoji : love/forte/simbot/message/EmoticonMessage {
public final class love/forte/simbot/message/Emoji : love/forte/simbot/message/EmoticonMessage, love/forte/simbot/message/StandardMessage {
public static final field Companion Llove/forte/simbot/message/Emoji$Companion;
public fun <init> (Llove/forte/simbot/common/id/ID;)V
public final fun component1 ()Llove/forte/simbot/common/id/ID;
Expand Down Expand Up @@ -1860,7 +1860,7 @@ public final class love/forte/simbot/message/Emoji$Companion {
public abstract interface class love/forte/simbot/message/EmoticonMessage : love/forte/simbot/message/StandardMessage {
}

public final class love/forte/simbot/message/Face : love/forte/simbot/message/EmoticonMessage {
public final class love/forte/simbot/message/Face : love/forte/simbot/message/EmoticonMessage, love/forte/simbot/message/StandardMessage {
public static final field Companion Llove/forte/simbot/message/Face$Companion;
public fun <init> (Llove/forte/simbot/common/id/ID;)V
public final fun component1 ()Llove/forte/simbot/common/id/ID;
Expand Down Expand Up @@ -2319,7 +2319,11 @@ public final class love/forte/simbot/message/Text$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}

public abstract interface class love/forte/simbot/message/UrlAwareImage : love/forte/simbot/message/Image {
public abstract interface class love/forte/simbot/message/UrlAwareImage : love/forte/simbot/message/Image, love/forte/simbot/message/UrlAwareMessage {
public abstract synthetic fun url (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public abstract interface class love/forte/simbot/message/UrlAwareMessage {
public fun getUrl ()Ljava/lang/String;
public fun getUrlAsync ()Ljava/util/concurrent/CompletableFuture;
public fun getUrlReserve ()Llove/forte/simbot/suspendrunner/reserve/SuspendReserve;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,13 @@ public data object AtAll : MentionMessage
/**
* 一个图片消息元素类型。
*
* 图片消息可能被分为 [离线图片][OfflineImage] 和 [远端图片][RemoteImage]。
* 图片消息可能被分为 [离线图片][OfflineImage]
* 和 [远端图片][RemoteImage]。
*
* 在不同的平台中,图片的表现方式或实现方式千变万化,
* 它们的类型很可能并非标准消息类型中提供的已知类型。
* 对于实现者,应当尽可能支持 [UrlAwareImage]
* 来表示一个能够得到 URL 信息的图片。
*
* @see OfflineImage
* @see RemoteImage
Expand All @@ -250,12 +256,12 @@ public interface IDAwareImage : Image {
* 一个可以感知或获取到 url 信息的 [Image]。
*
*/
@STP
public interface UrlAwareImage : Image {
public interface UrlAwareImage : Image, UrlAwareMessage {
/**
* 获取到这个图片的链接字符串
* 获取或查询此图片的链接
*/
public suspend fun url(): String
@JvmSynthetic
override suspend fun url(): String
}


Expand Down Expand Up @@ -437,13 +443,27 @@ public interface EmoticonMessage : StandardMessage
*/
@Serializable
@SerialName("m.std.emoji")
public data class Emoji(public val id: ID) : EmoticonMessage
public data class Emoji(public val id: ID) : StandardMessage, EmoticonMessage

/**
* 一个表情。一般代表平台提供的自带系统表情。
*/
@Serializable
@SerialName("m.std.face")
public data class Face(public val id: ID) : EmoticonMessage
public data class Face(public val id: ID) : StandardMessage, EmoticonMessage
//endregion


/**
* 表示为一个可以得知 URL 地址的消息元素,
* 例如 [UrlAwareImage]。
*
* @since 4.3.0
*/
@STP
public interface UrlAwareMessage {
/**
* 获取到链接字符串。
*/
public suspend fun url(): String
}
Loading