Skip to content

Commit ffe18cc

Browse files
committed
feat(milky): implement markdown segment, group_disband event, persist group file
1 parent 6d4f15f commit ffe18cc

4 files changed

Lines changed: 19 additions & 5 deletions

File tree

acidify-milky/src/commonMain/kotlin/org/ntqqrev/acidify/milky/api/HttpRoutes.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ val apiHandlers = listOf(
180180
MoveGroupFile,
181181
RenameGroupFile,
182182
DeleteGroupFile,
183+
PersistGroupFile,
183184
CreateGroupFolder,
184185
RenameGroupFolder,
185186
DeleteGroupFolder,

acidify-milky/src/commonMain/kotlin/org/ntqqrev/acidify/milky/api/handler/File.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ val DeleteGroupFile = ApiEndpoint.DeleteGroupFile.define {
5959
DeleteGroupFileOutput()
6060
}
6161

62+
val PersistGroupFile = ApiEndpoint.PersistGroupFile.define {
63+
bot.persistGroupFile(it.groupId, it.fileId)
64+
PersistGroupFileOutput()
65+
}
66+
6267
val CreateGroupFolder = ApiEndpoint.CreateGroupFolder.define {
6368
val folderId = bot.createGroupFolder(it.groupId, it.folderName)
6469
CreateGroupFolderOutput(folderId)

acidify-milky/src/commonMain/kotlin/org/ntqqrev/acidify/milky/transform/EventTransform.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ suspend fun MilkyContext.transformAcidifyEvent(event: AcidifyEvent): Event? {
167167
)
168168
)
169169

170+
is GroupDisbandEvent -> Event.GroupDisband(
171+
time = Clock.System.now().epochSeconds,
172+
selfId = bot.uin,
173+
data = Event.GroupDisband.Data(
174+
groupId = event.groupUin,
175+
operatorId = event.operatorUin,
176+
)
177+
)
178+
170179
is GroupNameChangeEvent -> Event.GroupNameChange(
171180
time = Clock.System.now().epochSeconds,
172181
selfId = bot.uin,

acidify-milky/src/commonMain/kotlin/org/ntqqrev/acidify/milky/transform/MessageTransform.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ suspend fun MilkyContext.transformIncomingSegment(segment: BotIncomingSegment):
169169
)
170170
)
171171

172-
is BotIncomingSegment.Markdown -> IncomingSegment.Text(
173-
data = IncomingSegment.Text.Data(
174-
text = segment.content // TODO: Markdown segment
172+
is BotIncomingSegment.Markdown -> IncomingSegment.Markdown(
173+
data = IncomingSegment.Markdown.Data(
174+
content = segment.content
175175
)
176176
)
177177
}
@@ -254,12 +254,11 @@ suspend fun MilkyContext.transformOutgoingSegment(
254254
}
255255

256256
is OutgoingSegment.Video -> {
257-
// TODO: refactor Codec API to Source-based
258257
val videoSource = resolveUri(segment.data.uri)
259258
val videoInfo = codec.getVideoInfo(videoSource)
260259
logger.d { "视频 ${segment.data.uri} 信息:${videoInfo.width}x${videoInfo.height},时长 ${videoInfo.duration.inWholeSeconds}" }
261260
val thumbSource = if (segment.data.thumbUri != null) {
262-
resolveUri(segment.data.thumbUri!!)
261+
resolveUri(segment.data.thumbUri)
263262
} else {
264263
tracked {
265264
codec.getVideoFirstFrameJpg(videoSource).toMediaSource()

0 commit comments

Comments
 (0)