This repository has been archived by the owner on Aug 12, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
9 changed files
with
137 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
xposed/src/main/java/moe/fuqiuluo/shamrock/remote/action/handlers/DeleteEssenceMessage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package moe.fuqiuluo.shamrock.remote.action.handlers | ||
|
||
import com.tencent.qqnt.kernel.nativeinterface.MsgConstant | ||
import kotlinx.serialization.json.JsonElement | ||
import moe.fuqiuluo.qqinterface.servlet.GroupSvc | ||
import moe.fuqiuluo.qqinterface.servlet.MsgSvc | ||
import moe.fuqiuluo.shamrock.remote.action.ActionSession | ||
import moe.fuqiuluo.shamrock.remote.action.IActionHandler | ||
import moe.fuqiuluo.shamrock.tools.EmptyJsonString | ||
|
||
internal object DeleteEssenceMessage: IActionHandler() { | ||
override suspend fun internalHandle(session: ActionSession): String { | ||
val messageId = session.getInt("message_id") | ||
return invoke(messageId, session.echo) | ||
} | ||
|
||
suspend operator fun invoke(messageId: Int, echo: JsonElement = EmptyJsonString): String { | ||
val msg = MsgSvc.getMsg(messageId).onFailure { | ||
return logic("Obtain msg failed, please check your msg_id.", echo) | ||
}.getOrThrow() | ||
val (success, tip) = GroupSvc.deleteEssenceMessage( | ||
if (msg.chatType == MsgConstant.KCHATTYPEGROUP) msg.peerUin else 0, | ||
msg.msgSeq, | ||
msg.msgRandom | ||
) | ||
return if (success) { | ||
ok("成功", echo) | ||
} else { | ||
logic(tip, echo) | ||
} | ||
} | ||
|
||
override val alias: Array<String> = arrayOf("delete_essence_message") | ||
override fun path(): String = "delete_essence_msg" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
xposed/src/main/java/moe/fuqiuluo/shamrock/remote/action/handlers/SetEssenceMessage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package moe.fuqiuluo.shamrock.remote.action.handlers | ||
|
||
import com.tencent.qqnt.kernel.nativeinterface.MsgConstant | ||
import kotlinx.serialization.json.JsonElement | ||
import moe.fuqiuluo.qqinterface.servlet.GroupSvc | ||
import moe.fuqiuluo.qqinterface.servlet.MsgSvc | ||
import moe.fuqiuluo.shamrock.remote.action.ActionSession | ||
import moe.fuqiuluo.shamrock.remote.action.IActionHandler | ||
import moe.fuqiuluo.shamrock.tools.EmptyJsonString | ||
|
||
internal object SetEssenceMessage: IActionHandler() { | ||
override suspend fun internalHandle(session: ActionSession): String { | ||
val messageId = session.getInt("message_id") | ||
return invoke(messageId, session.echo) | ||
} | ||
|
||
suspend operator fun invoke(messageId: Int, echo: JsonElement = EmptyJsonString): String { | ||
val msg = MsgSvc.getMsg(messageId).onFailure { | ||
return logic("Obtain msg failed, please check your msg_id.", echo) | ||
}.getOrThrow() | ||
val (success, tip) = GroupSvc.setEssenceMessage( | ||
if (msg.chatType == MsgConstant.KCHATTYPEGROUP) msg.peerUin else 0, | ||
msg.msgSeq, | ||
msg.msgRandom | ||
) | ||
return if (success) { | ||
ok("成功", echo) | ||
} else { | ||
logic(tip, echo) | ||
} | ||
|
||
} | ||
|
||
override val alias: Array<String> = arrayOf("set_essence_message") | ||
override fun path(): String = "set_essence_msg" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters