mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
update kritor
This commit is contained in:
parent
042f4bd330
commit
72af39208c
@ -1 +1 @@
|
||||
Subproject commit c49df3074cf193cdbdc49c3c29fda66a0d0110e8
|
||||
Subproject commit d94600bc7adef49c6dcd5a1973578d4a101c9b38
|
@ -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))
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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> {
|
||||
@ -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 ->
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user