Skip to content

Commit c76df79

Browse files
authored
Merge pull request #171 from simple-robot/dev/main
dev/main
2 parents 21d29fc + ffc382f commit c76df79

File tree

12 files changed

+52
-77
lines changed

12 files changed

+52
-77
lines changed

.changelog/v4.0.0-beta2.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changelog/v4.0.0-beta3.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changelog/v4.0.0-beta4.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changelog/v4.0.0-beta5.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changelog/v4.0.0-beta6.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changelog/v4.0.0-dev1.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.changelog/v4.0.0-dev2.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changelog/v4.0.0-dev3.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changelog/v4.0.1.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
> [!note]
2+
> 对应核心版本: [**v4.6.0**](https://github.com/simple-robot/simpler-robot/releases/tag/v4.6.0)
3+
4+
我们欢迎并期望着您的 [反馈](https://github.com/simple-robot/simbot-component-kook/issues)[协助](https://github.com/simple-robot/simbot-component-kook/pulls),感谢您的贡献与支持!

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# v4.0.1
2+
3+
> Release & Pull Notes: [v4.0.1](https://github.com/simple-robot/simpler-robot/releases/tag/v4.0.1)
4+
5+
- fix(api): 为 CardMessage 相关的部分类型的部分属性添加默认值,以及修正部分缺陷 ([`a3745a7`](https://github.com/simple-robot/simpler-robot/commit/a3745a7))
6+
17
# v4.0.0
28

39
> Release & Pull Notes: [v4.0.0](https://github.com/simple-robot/simpler-robot/releases/tag/v4.0.0)
@@ -15,7 +21,6 @@
1521
- build(deps): Update Kotlin to 2.0.10, simbot to 4.6.0 ([`f81d7e7`](https://github.com/simple-robot/simpler-robot/commit/f81d7e7))
1622
- build(deps): bump ksp from 2.0.0-1.0.24 to 2.0.10-1.0.24 ([`11bfb0c`](https://github.com/simple-robot/simpler-robot/commit/11bfb0c))
1723

18-
# v4.0.0-beta6
1924

2025
> Release & Pull Notes: [v4.0.0-beta6](https://github.com/simple-robot/simpler-robot/releases/tag/v4.0.0-beta6)
2126

buildSrc/src/main/kotlin/P.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ object P : ProjectDetail() {
3232
override val homepage: String
3333
get() = HOMEPAGE
3434

35-
const val VERSION = "4.0.0"
36-
const val NEXT_VERSION = "4.0.1"
35+
const val VERSION = "4.0.1"
36+
const val NEXT_VERSION = "4.0.2"
3737

3838
override val snapshotVersion = "$NEXT_VERSION-SNAPSHOT"
3939
override val version = if (isSnapshot()) snapshotVersion else VERSION

simbot-component-kook-api/src/commonMain/kotlin/love/forte/simbot/kook/objects/card/Card.kt

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ public sealed class CardElement {
377377
@SerialName(Image.TYPE)
378378
public data class Image @JvmOverloads constructor(
379379
public val src: String,
380-
public val alt: String,
380+
public val alt: String = "",
381381
public val size: Size = Size.Default,
382382
public val circle: Boolean = false
383383
) : CardElement() {
@@ -453,7 +453,7 @@ public sealed class CardElement {
453453
@SerialName(Paragraph.TYPE)
454454
public data class Paragraph(
455455
public val cols: Int,
456-
public val fields: List<Text>
456+
public val fields: List<Text> = emptyList()
457457
) : CardElement() {
458458
init {
459459
require(cols in 1..3) { "Cols must in 1..3, but $cols" }
@@ -625,8 +625,10 @@ public sealed class CardModule {
625625
*/
626626
@Serializable
627627
@SerialName(ImageGroup.TYPE)
628-
public data class ImageGroup(@Serializable(CardImageListWithTypeSerializer::class) public val elements: List<CardElement.Image>) :
629-
CardModule() {
628+
public data class ImageGroup(
629+
@Serializable(CardImageListWithTypeSerializer::class)
630+
public val elements: List<CardElement.Image>
631+
) : CardModule() {
630632
init {
631633
require(elements.size in 1..9) { "The size of elements must be 1..9, but ${elements.size}" }
632634
}
@@ -659,8 +661,10 @@ public sealed class CardModule {
659661
*/
660662
@Serializable
661663
@SerialName(Container.TYPE)
662-
public data class Container(@Serializable(CardImageListWithTypeSerializer::class) public val elements: List<CardElement.Image>) :
663-
CardModule() {
664+
public data class Container(
665+
@Serializable(CardImageListWithTypeSerializer::class)
666+
public val elements: List<CardElement.Image>
667+
) : CardModule() {
664668
init {
665669
require(elements.size in 1..9) { "The size of elements must be 1..9, but ${elements.size}" }
666670
}
@@ -693,8 +697,10 @@ public sealed class CardModule {
693697
*/
694698
@Serializable
695699
@SerialName(ActionGroup.TYPE)
696-
public data class ActionGroup(@Serializable(CardButtonListWithTypeSerializer::class) public val elements: List<CardElement.Button>) :
697-
CardModule() {
700+
public data class ActionGroup(
701+
@Serializable(CardButtonListWithTypeSerializer::class)
702+
public val elements: List<CardElement.Button> = emptyList()
703+
) : CardModule() {
698704
init {
699705
require(elements.size <= 4) { "The size of elements must be <= 4, but ${elements.size}" }
700706
}
@@ -789,23 +795,35 @@ public sealed class CardModule {
789795
*/
790796
@Serializable
791797
@SerialName(FILE_TYPE)
792-
public data class File(override val src: String, override val title: String, override val cover: String) :
798+
public data class File(
799+
override val src: String = "",
800+
override val title: String = "",
801+
override val cover: String = ""
802+
) :
793803
Files()
794804

795805
/**
796806
* 音频。
797807
*/
798808
@Serializable
799809
@SerialName(AUDIO_TYPE)
800-
public data class Audio(override val src: String, override val title: String, override val cover: String) :
810+
public data class Audio(
811+
override val src: String = "",
812+
override val title: String = "",
813+
override val cover: String = ""
814+
) :
801815
Files()
802816

803817
/**
804818
* 视频。
805819
*/
806820
@Serializable
807821
@SerialName(VIDEO_TYPE)
808-
public data class Video(override val src: String, override val title: String, override val cover: String) :
822+
public data class Video(
823+
override val src: String = "",
824+
override val title: String = "",
825+
override val cover: String = ""
826+
) :
809827
Files()
810828

811829
public companion object {
@@ -814,13 +832,16 @@ public sealed class CardModule {
814832
public const val VIDEO_TYPE: String = "video"
815833

816834
@JvmStatic
817-
public fun file(src: String, title: String, cover: String): File = File(src, title, cover)
835+
@JvmOverloads
836+
public fun file(src: String, title: String, cover: String = ""): File = File(src, title, cover)
818837

819838
@JvmStatic
820-
public fun audio(src: String, title: String, cover: String): Audio = Audio(src, title, cover)
839+
@JvmOverloads
840+
public fun audio(src: String, title: String, cover: String = ""): Audio = Audio(src, title, cover)
821841

822842
@JvmStatic
823-
public fun video(src: String, title: String, cover: String): Video = Video(src, title, cover)
843+
@JvmOverloads
844+
public fun video(src: String, title: String, cover: String = ""): Video = Video(src, title, cover)
824845

825846
}
826847
}
@@ -853,8 +874,10 @@ public sealed class CardModule {
853874
public val endTime: Long
854875
) : CardModule() {
855876
init {
856-
require(mode == CountdownMode.SECOND && startTime != null) {
857-
"When mode is 'SECOND', 'startTime' must not be null."
877+
if (mode == CountdownMode.SECOND) {
878+
requireNotNull(startTime) {
879+
"When mode is 'SECOND', 'startTime' must not be null."
880+
}
858881
}
859882
}
860883

@@ -898,7 +921,7 @@ public sealed class CardModule {
898921
public val code: String
899922
) : CardModule() {
900923
public companion object {
901-
public const val TYPE: String = ""
924+
public const val TYPE: String = "invite"
902925
}
903926
}
904927

0 commit comments

Comments
 (0)