Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
update kritor
Browse files Browse the repository at this point in the history
  • Loading branch information
Simplxss committed Apr 7, 2024
1 parent 042f4bd commit 72af392
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions xposed/src/main/java/kritor/service/FriendService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ internal object FriendService : FriendServiceGrpcKt.FriendServiceCoroutineImplBa
}

@Grpc("FriendService", "GetUidByUin")
override suspend fun getUidByUin(request: GetUidRequest): GetUidResponse {
return GetUidResponse.newBuilder().apply {
override suspend fun getUidByUin(request: GetUidByUinRequest): GetUidByUinResponse {
return GetUidByUinResponse.newBuilder().apply {
request.targetUinsList.forEach {
putUidMap(it, ContactHelper.getUidByUinAsync(it))
}
Expand Down
6 changes: 3 additions & 3 deletions xposed/src/main/java/qq/service/msg/MsgConvertor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,10 @@ private object MsgConvertor {
suspend fun convertInlineKeyboard(record: MsgRecord, element: MsgElement): Result<Element> {
val inlineKeyboard = element.inlineKeyboardElement
val elem = Element.newBuilder()
elem.type = ElementType.BUTTON
elem.setButton(ButtonElement.newBuilder().apply {
elem.type = ElementType.KEYBOARD
elem.setKeyboard(KeyboardElement.newBuilder().apply {
inlineKeyboard.rows.forEach { row ->
this.addRows(ButtonRow.newBuilder().apply {
this.addRows(KeyboardRow.newBuilder().apply {
row.buttons.forEach buttonsLoop@{ button ->
if (button == null) return@buttonsLoop
this.addButtons(Button.newBuilder().apply {
Expand Down
4 changes: 2 additions & 2 deletions xposed/src/main/java/qq/service/msg/MultiConvertor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ suspend fun List<Elem>.toKritorResponseMessages(contact: Contact): ArrayList<Ele
46 -> {
val buttonExtra = commonElem.elem!!.decodeProtobuf<ButtonExtra>()
kritorMessages.add(
Element.newBuilder().setButton(ButtonElement.newBuilder().apply {
Element.newBuilder().setKeyboard(KeyboardElement.newBuilder().apply {
this.addAllRows(buttonExtra.field1!!.rows!!.map { row ->
ButtonRow.newBuilder().apply {
KeyboardRow.newBuilder().apply {
this.addAllButtons(row.buttons!!.map { button ->
Button.newBuilder().apply {
this.id = button.id
Expand Down
4 changes: 2 additions & 2 deletions xposed/src/main/java/qq/service/msg/NtMsgConvertor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ object NtMsgConvertor {
ElementType.JSON to ::jsonConvertor,
ElementType.FORWARD to ::forwardConvertor,
ElementType.MARKDOWN to ::markdownConvertor,
ElementType.BUTTON to ::buttonConvertor,
ElementType.KEYBOARD to ::buttonConvertor,
)

suspend fun convertToNtMsgs(contact: Contact, msgId: Long, msgs: Messages): ArrayList<MsgElement> {
Expand Down Expand Up @@ -848,7 +848,7 @@ object NtMsgConvertor {
elem.elementType = MsgConstant.KELEMTYPEINLINEKEYBOARD
val rows = arrayListOf<InlineKeyboardRow>()

val keyboard = sourceButton.button
val keyboard = sourceButton.keyboard
keyboard.rowsList.forEach { row ->
val buttons = arrayListOf<InlineKeyboardButton>()
row.buttonsList.forEach { button ->
Expand Down
4 changes: 2 additions & 2 deletions xposed/src/main/java/qq/service/msg/ReqMessageConvertor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,9 @@ private object ReqMsgConvertor {
suspend fun convertInlineKeyboard(contact: Contact, element: MsgElement): Result<Element> {
val inlineKeyboard = element.inlineKeyboardElement
val elem = Element.newBuilder()
elem.setButton(ButtonElement.newBuilder().apply {
elem.setKeyboard(KeyboardElement.newBuilder().apply {
this.addAllRows(inlineKeyboard.rows.map { row ->
ButtonRow.newBuilder().apply {
KeyboardRow.newBuilder().apply {
this.addAllButtons(row.buttons.map { button ->
Button.newBuilder().apply {
this.id = button.id
Expand Down
6 changes: 3 additions & 3 deletions xposed/src/main/java/qq/service/msg/ReqMultiConvertor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -511,13 +511,13 @@ suspend fun List<Element>.toRichText(contact: Contact): Result<Pair<String, Rich
elems.add(elem)
summary.append("[Markdown消息]")
}
Element.ElementType.BUTTON -> {
Element.ElementType.KEYBOARD -> {
val elem = Elem(
commonElem = CommonElem(
serviceType = 46,
elem = ButtonExtra(
field1 = Object1(
rows = it.button.rowsList.map { row ->
rows = it.keyboard.rowsList.map { row ->
Row(buttons = row.buttonsList.map { button ->
val renderData = button.renderData
val action = button.action
Expand All @@ -544,7 +544,7 @@ suspend fun List<Element>.toRichText(contact: Contact): Result<Pair<String, Rich
)
})
},
appid = it.button.botAppid.toULong()
appid = it.keyboard.botAppid.toULong()
)
).toByteArray(),
businessType = 1
Expand Down

0 comments on commit 72af392

Please sign in to comment.