Shamrock: fix #110

This commit is contained in:
ikechan8370 2023-11-30 12:27:07 +08:00
parent 5c10a5a04e
commit 7b07698f7b
2 changed files with 4 additions and 2 deletions

View File

@ -13,7 +13,7 @@ import moe.fuqiuluo.shamrock.tools.EmptyJsonString
internal object SendGroupNotice: IActionHandler() { internal object SendGroupNotice: IActionHandler() {
override suspend fun internalHandle(session: ActionSession): String { override suspend fun internalHandle(session: ActionSession): String {
val groupId = session.getLong("group_id") val groupId = session.getLong("group_id")
val text = session.getString("text") val text = session.getString("content")
val image = session.getStringOrNull("image") val image = session.getStringOrNull("image")
return invoke(groupId, text, image, session.echo) return invoke(groupId, text, image, session.echo)
} }
@ -32,6 +32,8 @@ internal object SendGroupNotice: IActionHandler() {
} }
override val requiredParams: Array<String> = arrayOf("group_id", "content")
override val alias: Array<String> = arrayOf("send_group_notice") override val alias: Array<String> = arrayOf("send_group_notice")
override fun path(): String = "_send_group_notice" override fun path(): String = "_send_group_notice"
} }

View File

@ -135,7 +135,7 @@ fun Routing.troopAction() {
getOrPost("/_send_group_notice") { getOrPost("/_send_group_notice") {
val groupId = fetchOrThrow("group_id").toLong() val groupId = fetchOrThrow("group_id").toLong()
val text = fetchOrThrow("text") val text = fetchOrThrow("content")
val image = fetchOrNull("image") val image = fetchOrNull("image")
call.respondText(SendGroupNotice(groupId, text, image), ContentType.Application.Json) call.respondText(SendGroupNotice(groupId, text, image), ContentType.Application.Json)
} }