File tree Expand file tree Collapse file tree
commonMain/kotlin/org/ntqqrev/acidify
jsMain/kotlin/org/ntqqrev/acidify/js Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -290,6 +290,19 @@ suspend fun AbstractBot.deleteGroupFile(
290290 DeleteGroupFile .Req (groupUin, fileId)
291291)
292292
293+ /* *
294+ * 转存群文件为永久文件
295+ * @param groupUin 群号
296+ * @param fileId 文件 ID
297+ */
298+ suspend fun AbstractBot.persistGroupFile (
299+ groupUin : Long ,
300+ fileId : String
301+ ) = client.callService(
302+ PersistGroupFile ,
303+ PersistGroupFile .Req (groupUin, fileId)
304+ )
305+
293306/* *
294307 * 创建群文件夹
295308 * @param groupUin 群号
Original file line number Diff line number Diff line change @@ -4,11 +4,19 @@ import kotlinx.serialization.Serializable
44import kotlinx.serialization.protobuf.ProtoNumber
55
66@Serializable
7- internal class BroadcastGroupFileReq (
8- @ProtoNumber(5 ) val body : Body = Body (),
7+ internal class Oidb0x6D9Req (
8+ @ProtoNumber(1 ) val persistBody : PersistBody ? = null ,
9+ @ProtoNumber(5 ) val broadcastBody : BroadcastBody ? = null ,
910) {
1011 @Serializable
11- class Body (
12+ class PersistBody (
13+ @ProtoNumber(1 ) val groupUin : Long = 0L ,
14+ @ProtoNumber(3 ) val busiType : Int = 0 ,
15+ @ProtoNumber(4 ) val fileId : String = " " ,
16+ )
17+
18+ @Serializable
19+ class BroadcastBody (
1220 @ProtoNumber(1 ) val groupUin : Long = 0L ,
1321 @ProtoNumber(2 ) val type : Int = 0 ,
1422 @ProtoNumber(3 ) val info : Info = Info (),
Original file line number Diff line number Diff line change 11package org.ntqqrev.acidify.internal.service.file
22
33import org.ntqqrev.acidify.internal.AbstractClient
4- import org.ntqqrev.acidify.internal.proto.oidb.BroadcastGroupFileReq
4+ import org.ntqqrev.acidify.internal.proto.oidb.Oidb0x6D9Req
55import org.ntqqrev.acidify.internal.service.NoOutputOidbService
66import org.ntqqrev.acidify.internal.util.pbEncode
77import kotlin.random.Random
@@ -13,11 +13,11 @@ internal object BroadcastGroupFile : NoOutputOidbService<BroadcastGroupFile.Req>
1313 )
1414
1515 override fun buildOidb (client : AbstractClient , payload : Req ): ByteArray =
16- BroadcastGroupFileReq (
17- body = BroadcastGroupFileReq . Body (
16+ Oidb0x6D9Req (
17+ broadcastBody = Oidb0x6D9Req . BroadcastBody (
1818 groupUin = payload.groupUin,
1919 type = 2 ,
20- info = BroadcastGroupFileReq . Body .Info (
20+ info = Oidb0x6D9Req . BroadcastBody .Info (
2121 busiType = 102 ,
2222 fileId = payload.fileId,
2323 field3 = Random .nextInt(),
Original file line number Diff line number Diff line change 1+ package org.ntqqrev.acidify.internal.service.file
2+
3+ import org.ntqqrev.acidify.internal.AbstractClient
4+ import org.ntqqrev.acidify.internal.proto.oidb.Oidb0x6D9Req
5+ import org.ntqqrev.acidify.internal.service.NoOutputOidbService
6+ import org.ntqqrev.acidify.internal.util.pbEncode
7+
8+ internal object PersistGroupFile : NoOutputOidbService<PersistGroupFile.Req>(0x6d9 , 0 , true ) {
9+ class Req (
10+ val groupUin : Long ,
11+ val fileId : String ,
12+ )
13+
14+ override fun buildOidb (client : AbstractClient , payload : Req ): ByteArray =
15+ Oidb0x6D9Req (
16+ persistBody = Oidb0x6D9Req .PersistBody (
17+ groupUin = payload.groupUin,
18+ busiType = 102 ,
19+ fileId = payload.fileId,
20+ )
21+ ).pbEncode()
22+ }
Original file line number Diff line number Diff line change @@ -404,6 +404,10 @@ abstract class JsAbstractBot internal constructor(
404404 bot.deleteGroupFile(groupUin, fileId)
405405 }
406406
407+ fun persistGroupFile (groupUin : Long , fileId : String ) = promise {
408+ bot.persistGroupFile(groupUin, fileId)
409+ }
410+
407411 fun createGroupFolder (groupUin : Long , folderName : String ): Promise <String > = promise {
408412 bot.createGroupFolder(groupUin, folderName)
409413 }
You can’t perform that action at this time.
0 commit comments