mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
refactor InlineKeyboard
This commit is contained in:
parent
252a3527a8
commit
675a7a5321
@ -2,17 +2,20 @@ package com.tencent.qqnt.kernel.nativeinterface;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public final class InlineKeyboardButton {
|
||||||
public final class InlineKeyboardButton {
|
int anchor;
|
||||||
boolean atBotShowChannelList;
|
boolean atBotShowChannelList;
|
||||||
int clickLimit;
|
int clickLimit;
|
||||||
String data;
|
String data;
|
||||||
|
boolean enter;
|
||||||
String id;
|
String id;
|
||||||
|
boolean isReply;
|
||||||
String label;
|
String label;
|
||||||
int permissionType;
|
int permissionType;
|
||||||
ArrayList<String> specifyRoleIds;
|
ArrayList<String> specifyRoleIds;
|
||||||
ArrayList<String> specifyTinyids;
|
ArrayList<String> specifyTinyids;
|
||||||
int style;
|
int style;
|
||||||
|
ArrayList<SubscribeMsgTemplateID> subscribeDataTemplateIds;
|
||||||
int type;
|
int type;
|
||||||
String unsupportTips;
|
String unsupportTips;
|
||||||
String visitedLabel;
|
String visitedLabel;
|
||||||
@ -25,6 +28,11 @@ public final class InlineKeyboardButton {
|
|||||||
this.data = "";
|
this.data = "";
|
||||||
this.specifyRoleIds = new ArrayList<>();
|
this.specifyRoleIds = new ArrayList<>();
|
||||||
this.specifyTinyids = new ArrayList<>();
|
this.specifyTinyids = new ArrayList<>();
|
||||||
|
this.subscribeDataTemplateIds = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAnchor() {
|
||||||
|
return this.anchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getAtBotShowChannelList() {
|
public boolean getAtBotShowChannelList() {
|
||||||
@ -39,10 +47,18 @@ public final class InlineKeyboardButton {
|
|||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getEnter() {
|
||||||
|
return this.enter;
|
||||||
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getIsReply() {
|
||||||
|
return this.isReply;
|
||||||
|
}
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return this.label;
|
return this.label;
|
||||||
}
|
}
|
||||||
@ -63,6 +79,10 @@ public final class InlineKeyboardButton {
|
|||||||
return this.style;
|
return this.style;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<SubscribeMsgTemplateID> getSubscribeDataTemplateIds() {
|
||||||
|
return this.subscribeDataTemplateIds;
|
||||||
|
}
|
||||||
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
@ -76,14 +96,14 @@ public final class InlineKeyboardButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "InlineKeyboardButton{id=" + this.id + ",label=" + this.label + ",visitedLabel=" + this.visitedLabel + ",style=" + this.style + ",type=" + this.type + ",clickLimit=" + this.clickLimit + ",unsupportTips=" + this.unsupportTips + ",data=" + this.data + ",atBotShowChannelList=" + this.atBotShowChannelList + ",permissionType=" + this.permissionType + ",specifyRoleIds=" + this.specifyRoleIds + ",specifyTinyids=" + this.specifyTinyids + ",}";
|
return "InlineKeyboardButton{id=" + this.id + ",label=" + this.label + ",visitedLabel=" + this.visitedLabel + ",style=" + this.style + ",type=" + this.type + ",clickLimit=" + this.clickLimit + ",unsupportTips=" + this.unsupportTips + ",data=" + this.data + ",atBotShowChannelList=" + this.atBotShowChannelList + ",permissionType=" + this.permissionType + ",specifyRoleIds=" + this.specifyRoleIds + ",specifyTinyids=" + this.specifyTinyids + ",isReply=" + this.isReply + ",anchor=" + this.anchor + ",enter=" + this.enter + ",subscribeDataTemplateIds=" + this.subscribeDataTemplateIds + ",}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public InlineKeyboardButton(String str, String str2, String str3, int i, int i2, int i3, String str4, String str5, boolean z, int i4, ArrayList<String> arrayList, ArrayList<String> arrayList2, boolean z2, int i5, boolean z3, ArrayList<SubscribeMsgTemplateID> arrayList3) {
|
public InlineKeyboardButton(String str, String str2, String str3, int i, int i2, int i3, String str4, String str5, boolean z, int i4, ArrayList<String> arrayList, ArrayList<String> arrayList2) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public InlineKeyboardButton(String str, String str2, String str3, int i2, int i3, int i4, String str4, String str5, boolean z, int i5, ArrayList<String> arrayList, ArrayList<String> arrayList2) {
|
public InlineKeyboardButton(String str, String str2, String str3, int i2, int i3, int i4, String str4, String str5, boolean z, int i5, ArrayList<String> arrayList, ArrayList<String> arrayList2, boolean z2, int i6, boolean z3, ArrayList<SubscribeMsgTemplateID> arrayList3) {
|
||||||
this.id = "";
|
this.id = "";
|
||||||
this.label = "";
|
this.label = "";
|
||||||
this.visitedLabel = "";
|
this.visitedLabel = "";
|
||||||
@ -91,6 +111,7 @@ public final class InlineKeyboardButton {
|
|||||||
this.data = "";
|
this.data = "";
|
||||||
this.specifyRoleIds = new ArrayList<>();
|
this.specifyRoleIds = new ArrayList<>();
|
||||||
this.specifyTinyids = new ArrayList<>();
|
this.specifyTinyids = new ArrayList<>();
|
||||||
|
this.subscribeDataTemplateIds = new ArrayList<>();
|
||||||
this.id = str;
|
this.id = str;
|
||||||
this.label = str2;
|
this.label = str2;
|
||||||
this.visitedLabel = str3;
|
this.visitedLabel = str3;
|
||||||
@ -103,5 +124,9 @@ public final class InlineKeyboardButton {
|
|||||||
this.permissionType = i5;
|
this.permissionType = i5;
|
||||||
this.specifyRoleIds = arrayList;
|
this.specifyRoleIds = arrayList;
|
||||||
this.specifyTinyids = arrayList2;
|
this.specifyTinyids = arrayList2;
|
||||||
|
this.isReply = z2;
|
||||||
|
this.anchor = i6;
|
||||||
|
this.enter = z3;
|
||||||
|
this.subscribeDataTemplateIds = arrayList3;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -39,6 +39,7 @@ public class MsgRecord {
|
|||||||
boolean isOnlineMsg;
|
boolean isOnlineMsg;
|
||||||
FromRoleInfo levelRoleInfo;
|
FromRoleInfo levelRoleInfo;
|
||||||
HashMap<Integer, MsgAttributeInfo> msgAttrs;
|
HashMap<Integer, MsgAttributeInfo> msgAttrs;
|
||||||
|
byte[] msgEventInfo;
|
||||||
long msgId;
|
long msgId;
|
||||||
byte[] msgMeta;
|
byte[] msgMeta;
|
||||||
long msgRandom;
|
long msgRandom;
|
||||||
@ -231,6 +232,10 @@ public class MsgRecord {
|
|||||||
return this.msgAttrs;
|
return this.msgAttrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte[] getMsgEventInfo() {
|
||||||
|
return this.msgEventInfo;
|
||||||
|
}
|
||||||
|
|
||||||
public long getMsgId() {
|
public long getMsgId() {
|
||||||
return this.msgId;
|
return this.msgId;
|
||||||
}
|
}
|
||||||
@ -332,10 +337,10 @@ public class MsgRecord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "MsgRecord{msgId=" + this.msgId + ",msgRandom=" + this.msgRandom + ",msgSeq=" + this.msgSeq + ",cntSeq=" + this.cntSeq + ",chatType=" + this.chatType + ",msgType=" + this.msgType + ",subMsgType=" + this.subMsgType + ",sendType=" + this.sendType + ",senderUid=" + this.senderUid + ",peerUid=" + this.peerUid + ",channelId=" + this.channelId + ",guildId=" + this.guildId + ",guildCode=" + this.guildCode + ",fromUid=" + this.fromUid + ",fromAppid=" + this.fromAppid + ",msgTime=" + this.msgTime + ",msgMeta=" + this.msgMeta + ",sendStatus=" + this.sendStatus + ",sendRemarkName=" + this.sendRemarkName + ",sendMemberName=" + this.sendMemberName + ",sendNickName=" + this.sendNickName + ",guildName=" + this.guildName + ",channelName=" + this.channelName + ",elements=" + this.elements + ",records=" + this.records + ",emojiLikesList=" + this.emojiLikesList + ",commentCnt=" + this.commentCnt + ",directMsgFlag=" + this.directMsgFlag + ",directMsgMembers=" + this.directMsgMembers + ",peerName=" + this.peerName + ",freqLimitInfo=" + this.freqLimitInfo + ",editable=" + this.editable + ",avatarMeta=" + this.avatarMeta + ",avatarPendant=" + this.avatarPendant + ",feedId=" + this.feedId + ",roleId=" + this.roleId + ",timeStamp=" + this.timeStamp + ",clientIdentityInfo=" + this.clientIdentityInfo + ",isImportMsg=" + this.isImportMsg + ",atType=" + this.atType + ",roleType=" + this.roleType + ",fromChannelRoleInfo=" + this.fromChannelRoleInfo + ",fromGuildRoleInfo=" + this.fromGuildRoleInfo + ",levelRoleInfo=" + this.levelRoleInfo + ",recallTime=" + this.recallTime + ",isOnlineMsg=" + this.isOnlineMsg + ",generalFlags=" + this.generalFlags + ",clientSeq=" + this.clientSeq + ",fileGroupSize=" + this.fileGroupSize + ",foldingInfo=" + this.foldingInfo + ",multiTransInfo=" + this.multiTransInfo + ",senderUin=" + this.senderUin + ",peerUin=" + this.peerUin + ",msgAttrs=" + this.msgAttrs + ",anonymousExtInfo=" + this.anonymousExtInfo + ",nameType=" + this.nameType + ",avatarFlag=" + this.avatarFlag + ",extInfoForUI=" + this.extInfoForUI + ",personalMedal=" + this.personalMedal + ",categoryManage=" + this.categoryManage + ",}";
|
return "MsgRecord{msgId=" + this.msgId + ",msgRandom=" + this.msgRandom + ",msgSeq=" + this.msgSeq + ",cntSeq=" + this.cntSeq + ",chatType=" + this.chatType + ",msgType=" + this.msgType + ",subMsgType=" + this.subMsgType + ",sendType=" + this.sendType + ",senderUid=" + this.senderUid + ",peerUid=" + this.peerUid + ",channelId=" + this.channelId + ",guildId=" + this.guildId + ",guildCode=" + this.guildCode + ",fromUid=" + this.fromUid + ",fromAppid=" + this.fromAppid + ",msgTime=" + this.msgTime + ",msgMeta=" + this.msgMeta + ",sendStatus=" + this.sendStatus + ",sendRemarkName=" + this.sendRemarkName + ",sendMemberName=" + this.sendMemberName + ",sendNickName=" + this.sendNickName + ",guildName=" + this.guildName + ",channelName=" + this.channelName + ",elements=" + this.elements + ",records=" + this.records + ",emojiLikesList=" + this.emojiLikesList + ",commentCnt=" + this.commentCnt + ",directMsgFlag=" + this.directMsgFlag + ",directMsgMembers=" + this.directMsgMembers + ",peerName=" + this.peerName + ",freqLimitInfo=" + this.freqLimitInfo + ",editable=" + this.editable + ",avatarMeta=" + this.avatarMeta + ",avatarPendant=" + this.avatarPendant + ",feedId=" + this.feedId + ",roleId=" + this.roleId + ",timeStamp=" + this.timeStamp + ",clientIdentityInfo=" + this.clientIdentityInfo + ",isImportMsg=" + this.isImportMsg + ",atType=" + this.atType + ",roleType=" + this.roleType + ",fromChannelRoleInfo=" + this.fromChannelRoleInfo + ",fromGuildRoleInfo=" + this.fromGuildRoleInfo + ",levelRoleInfo=" + this.levelRoleInfo + ",recallTime=" + this.recallTime + ",isOnlineMsg=" + this.isOnlineMsg + ",generalFlags=" + this.generalFlags + ",clientSeq=" + this.clientSeq + ",fileGroupSize=" + this.fileGroupSize + ",foldingInfo=" + this.foldingInfo + ",multiTransInfo=" + this.multiTransInfo + ",senderUin=" + this.senderUin + ",peerUin=" + this.peerUin + ",msgAttrs=" + this.msgAttrs + ",anonymousExtInfo=" + this.anonymousExtInfo + ",nameType=" + this.nameType + ",avatarFlag=" + this.avatarFlag + ",extInfoForUI=" + this.extInfoForUI + ",personalMedal=" + this.personalMedal + ",categoryManage=" + this.categoryManage + ",msgEventInfo=" + this.msgEventInfo + ",}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public MsgRecord(long j2, long j3, long j4, long j5, int i2, int i3, int i4, int i5, String str, String str2, String str3, String str4, long j6, long j7, long j8, long j9, byte[] bArr, int i6, String str5, String str6, String str7, String str8, String str9, ArrayList<MsgElement> arrayList, ArrayList<MsgRecord> arrayList2, ArrayList<MsgEmojiLikes> arrayList3, long j10, int i7, ArrayList<DirectMsgMember> arrayList4, String str10, FreqLimitInfo freqLimitInfo, boolean z, String str11, String str12, String str13, long j11, long j12, GProClientIdentity gProClientIdentity, boolean z2, int i8, int i9, FromRoleInfo fromRoleInfo, FromRoleInfo fromRoleInfo2, FromRoleInfo fromRoleInfo3, long j13, boolean z3, byte[] bArr2, long j14, Integer num, FoldingInfo foldingInfo, MultiTransInfo multiTransInfo, long j15, long j16, HashMap<Integer, MsgAttributeInfo> hashMap, AnonymousExtInfo anonymousExtInfo, int i10, int i11, byte[] bArr3, GProMedal gProMedal, int i12) {
|
public MsgRecord(long j2, long j3, long j4, long j5, int i2, int i3, int i4, int i5, String str, String str2, String str3, String str4, long j6, long j7, long j8, long j9, byte[] bArr, int i6, String str5, String str6, String str7, String str8, String str9, ArrayList<MsgElement> arrayList, ArrayList<MsgRecord> arrayList2, ArrayList<MsgEmojiLikes> arrayList3, long j10, int i7, ArrayList<DirectMsgMember> arrayList4, String str10, FreqLimitInfo freqLimitInfo, boolean z, String str11, String str12, String str13, long j11, long j12, GProClientIdentity gProClientIdentity, boolean z2, int i8, int i9, FromRoleInfo fromRoleInfo, FromRoleInfo fromRoleInfo2, FromRoleInfo fromRoleInfo3, long j13, boolean z3, byte[] bArr2, long j14, Integer num, FoldingInfo foldingInfo, MultiTransInfo multiTransInfo, long j15, long j16, HashMap<Integer, MsgAttributeInfo> hashMap, AnonymousExtInfo anonymousExtInfo, int i10, int i11, byte[] bArr3, GProMedal gProMedal, int i12, byte[] bArr4) {
|
||||||
this.senderUid = "";
|
this.senderUid = "";
|
||||||
this.peerUid = "";
|
this.peerUid = "";
|
||||||
this.channelId = "";
|
this.channelId = "";
|
||||||
@ -419,5 +424,6 @@ public class MsgRecord {
|
|||||||
this.extInfoForUI = bArr3;
|
this.extInfoForUI = bArr3;
|
||||||
this.personalMedal = gProMedal;
|
this.personalMedal = gProMedal;
|
||||||
this.categoryManage = i12;
|
this.categoryManage = i12;
|
||||||
|
this.msgEventInfo = bArr4;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -449,32 +449,33 @@ internal object ElemConverter {
|
|||||||
type = "button",
|
type = "button",
|
||||||
data = buttonExtra.field1!!.let {
|
data = buttonExtra.field1!!.let {
|
||||||
mapOf(
|
mapOf(
|
||||||
"buttons" to it.rows!!.map { row ->
|
"rows" to it.rows!!.map { row ->
|
||||||
row.buttons!!.map { button ->
|
mapOf(
|
||||||
val renderData = button.renderData
|
"buttons" to row.buttons!!.map { button ->
|
||||||
val action = button.action
|
val renderData = button.renderData
|
||||||
val permission = action?.permission
|
val action = button.action
|
||||||
mapOf(
|
val permission = action?.permission
|
||||||
"id" to button.id,
|
mapOf(
|
||||||
"render_data" to mapOf(
|
"id" to button.id,
|
||||||
"label" to (renderData?.label ?: ""),
|
"render_data" to mapOf(
|
||||||
"visited_label" to (renderData?.visitedLabel ?: ""),
|
"label" to (renderData?.label ?: ""),
|
||||||
"style" to (renderData?.style ?: 0)
|
"visited_label" to (renderData?.visitedLabel ?: ""),
|
||||||
),
|
"style" to (renderData?.style ?: 0)
|
||||||
"action" to mapOf(
|
|
||||||
"type" to (action?.type ?: 0),
|
|
||||||
"permission" to mapOf(
|
|
||||||
"type" to (permission?.type ?: 0),
|
|
||||||
"specify_role_ids" to permission?.specifyRoleIds,
|
|
||||||
"specify_user_ids" to permission?.specifyUserIds
|
|
||||||
),
|
),
|
||||||
"unsupport_tips" to (action?.unsupportTips ?: ""),
|
"action" to mapOf(
|
||||||
"data" to (action?.data ?: ""),
|
"type" to (action?.type ?: 0),
|
||||||
"reply" to action?.reply,
|
"permission" to mapOf(
|
||||||
"enter" to action?.enter,
|
"type" to (permission?.type ?: 0),
|
||||||
|
"specify_role_ids" to permission?.specifyRoleIds,
|
||||||
|
"specify_user_ids" to permission?.specifyUserIds
|
||||||
|
),
|
||||||
|
"unsupport_tips" to (action?.unsupportTips ?: ""),
|
||||||
|
"data" to (action?.data ?: ""),
|
||||||
|
"reply" to action?.reply,
|
||||||
|
"enter" to action?.enter,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
})
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"appid" to it.appid
|
"appid" to it.appid
|
||||||
)
|
)
|
||||||
|
@ -193,6 +193,7 @@ internal object NtMsgElementConverter {
|
|||||||
fileSize = image.fileSize.toULong(),
|
fileSize = image.fileSize.toULong(),
|
||||||
peer = peerId,
|
peer = peerId,
|
||||||
)
|
)
|
||||||
|
|
||||||
MsgConstant.KCHATTYPEGUILD -> RichProtoSvc.getGuildPicDownUrl(
|
MsgConstant.KCHATTYPEGUILD -> RichProtoSvc.getGuildPicDownUrl(
|
||||||
originalUrl = originalUrl,
|
originalUrl = originalUrl,
|
||||||
md5 = md5,
|
md5 = md5,
|
||||||
@ -204,6 +205,7 @@ internal object NtMsgElementConverter {
|
|||||||
peer = peerId,
|
peer = peerId,
|
||||||
subPeer = subPeer
|
subPeer = subPeer
|
||||||
)
|
)
|
||||||
|
|
||||||
else -> throw UnsupportedOperationException("Not supported chat type: $chatType")
|
else -> throw UnsupportedOperationException("Not supported chat type: $chatType")
|
||||||
},
|
},
|
||||||
"subType" to image.picSubType,
|
"subType" to image.picSubType,
|
||||||
@ -558,39 +560,35 @@ internal object NtMsgElementConverter {
|
|||||||
): MessageSegment {
|
): MessageSegment {
|
||||||
val keyboard = element.inlineKeyboardElement
|
val keyboard = element.inlineKeyboardElement
|
||||||
return MessageSegment(
|
return MessageSegment(
|
||||||
type = "inline_keyboard",
|
type = "button",
|
||||||
data = mapOf(
|
data = mapOf(
|
||||||
"data" to buildJsonObject {
|
"rows" to keyboard.rows.map { row ->
|
||||||
putJsonArray("rows") {
|
mapOf("buttons" to row.buttons.map { button ->
|
||||||
keyboard.rows.forEach { row ->
|
mapOf(
|
||||||
add(buildJsonObject row@{
|
"id" to button.id,
|
||||||
putJsonArray("buttons") {
|
"render_data" to mapOf(
|
||||||
row.buttons.forEach { button ->
|
"label" to (button?.label ?: ""),
|
||||||
add(buildJsonObject {
|
"visited_label" to (button?.visitedLabel ?: ""),
|
||||||
put("id", button.id ?: "")
|
"style" to (button?.style ?: 0)
|
||||||
put("label", button.label ?: "")
|
|
||||||
put("visited_label", button.visitedLabel ?: "")
|
),
|
||||||
put("style", button.style)
|
"action" to mapOf(
|
||||||
put("type", button.type)
|
"type" to (button?.type ?: 0),
|
||||||
put("click_limit", button.clickLimit)
|
"permission" to mapOf(
|
||||||
put("unsupport_tips", button.unsupportTips ?: "")
|
"type" to (button?.permissionType ?: 0),
|
||||||
put("data", button.data)
|
"specify_role_ids" to button?.specifyRoleIds,
|
||||||
put("at_bot_show_channel_list", button.atBotShowChannelList)
|
"specify_user_ids" to button?.specifyTinyids
|
||||||
put("permission_type", button.permissionType)
|
),
|
||||||
putJsonArray("specify_role_ids") {
|
"unsupport_tips" to (button?.unsupportTips ?: ""),
|
||||||
button.specifyRoleIds?.forEach { add(it) }
|
"data" to (button?.data ?: ""),
|
||||||
}
|
"reply" to button?.isReply,
|
||||||
putJsonArray("specify_tinyids") {
|
"enter" to button?.enter
|
||||||
button.specifyTinyids?.forEach { add(it) }
|
)
|
||||||
}
|
)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
}
|
},
|
||||||
})
|
"appid" to keyboard.botAppid
|
||||||
}
|
|
||||||
}
|
|
||||||
put("bot_appid", keyboard.botAppid)
|
|
||||||
}.toString()
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@ internal object ElemMaker {
|
|||||||
// "video" to ElemMaker::createVideoElem,
|
// "video" to ElemMaker::createVideoElem,
|
||||||
"markdown" to ElemMaker::createMarkdownElem,
|
"markdown" to ElemMaker::createMarkdownElem,
|
||||||
"button" to ElemMaker::createButtonElem,
|
"button" to ElemMaker::createButtonElem,
|
||||||
"inline_keyboard" to ElemMaker::createButtonElem,
|
|
||||||
"dice" to ElemMaker::createNewDiceElem,
|
"dice" to ElemMaker::createNewDiceElem,
|
||||||
"rps" to ElemMaker::createNewRpsElem,
|
"rps" to ElemMaker::createNewRpsElem,
|
||||||
"poke" to ElemMaker::createPokeElem,
|
"poke" to ElemMaker::createPokeElem,
|
||||||
|
@ -97,37 +97,44 @@ internal object NtMsgElementMaker {
|
|||||||
peerId: String,
|
peerId: String,
|
||||||
data: JsonObject
|
data: JsonObject
|
||||||
): Result<MsgElement> {
|
): Result<MsgElement> {
|
||||||
fun tryNewKeyboardButton(btn: JsonObject): InlineKeyboardButton {
|
fun tryNewKeyboardButton(button: JsonObject): InlineKeyboardButton {
|
||||||
|
val renderData = button["render_data"].asJsonObject
|
||||||
|
val action = button["action"].asJsonObject
|
||||||
|
val permission = action["permission"].asJsonObject
|
||||||
return runCatching {
|
return runCatching {
|
||||||
InlineKeyboardButton(
|
InlineKeyboardButton(
|
||||||
btn["id"].asString,
|
button["id"].asStringOrNull ?: "",
|
||||||
btn["label"].asString,
|
renderData["label"].asString,
|
||||||
btn["visited_label"].asString,
|
renderData["visited_label"].asString,
|
||||||
btn["style"].asInt,
|
renderData["style"].asInt,
|
||||||
btn["type"].asInt,
|
action["type"].asInt,
|
||||||
btn["click_limit"].asInt,
|
action["click_limit"].asInt,
|
||||||
btn["unsupport_tips"].asString,
|
action["unsupport_tips"].asString,
|
||||||
btn["data"].asString,
|
action["data"].asString,
|
||||||
btn["at_bot_show_channel_list"].asBoolean,
|
action["at_bot_show_channel_list"].asBooleanOrNull ?: false,
|
||||||
btn["permission_type"].asInt,
|
permission["type"].asInt,
|
||||||
ArrayList(btn["specify_role_ids"].asJsonArray.map { it.asString }),
|
ArrayList(permission["specify_role_ids"].asJsonArrayOrNull?.map { id -> id.asString }
|
||||||
ArrayList(btn["specify_tinyids"].asJsonArray.map { it.asString }),
|
?: arrayListOf()),
|
||||||
|
ArrayList(permission["specify_user_ids"].asJsonArrayOrNull?.map { id -> id.asString }
|
||||||
|
?: arrayListOf()),
|
||||||
false, 0, false, arrayListOf()
|
false, 0, false, arrayListOf()
|
||||||
)
|
)
|
||||||
}.getOrElse {
|
}.getOrElse {
|
||||||
InlineKeyboardButton(
|
InlineKeyboardButton(
|
||||||
btn["id"].asString,
|
button["id"].asStringOrNull ?: "",
|
||||||
btn["label"].asString,
|
renderData["label"].asString,
|
||||||
btn["visited_label"].asString,
|
renderData["visited_label"].asString,
|
||||||
btn["style"].asInt,
|
renderData["style"].asInt,
|
||||||
btn["type"].asInt,
|
action["type"].asInt,
|
||||||
btn["click_limit"].asInt,
|
action["click_limit"].asInt,
|
||||||
btn["unsupport_tips"].asString,
|
action["unsupport_tips"].asString,
|
||||||
btn["data"].asString,
|
action["data"].asString,
|
||||||
btn["at_bot_show_channel_list"].asBoolean,
|
action["at_bot_show_channel_list"].asBooleanOrNull ?: false,
|
||||||
btn["permission_type"].asInt,
|
permission["type"].asInt,
|
||||||
ArrayList(btn["specify_role_ids"].asJsonArray.map { it.asString }),
|
ArrayList(permission["specify_role_ids"].asJsonArrayOrNull?.map { id -> id.asString }
|
||||||
ArrayList(btn["specify_tinyids"].asJsonArray.map { it.asString }),
|
?: arrayListOf()),
|
||||||
|
ArrayList(permission["specify_user_ids"].asJsonArrayOrNull?.map { id -> id.asString }
|
||||||
|
?: arrayListOf()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import moe.fuqiuluo.shamrock.helper.LogCenter
|
|||||||
import moe.fuqiuluo.shamrock.helper.MessageHelper
|
import moe.fuqiuluo.shamrock.helper.MessageHelper
|
||||||
import moe.fuqiuluo.shamrock.remote.action.handlers.SendMsgByResid
|
import moe.fuqiuluo.shamrock.remote.action.handlers.SendMsgByResid
|
||||||
import moe.fuqiuluo.shamrock.remote.service.config.ShamrockConfig
|
import moe.fuqiuluo.shamrock.remote.service.config.ShamrockConfig
|
||||||
|
import moe.fuqiuluo.shamrock.tools.fetchOrNull
|
||||||
import moe.fuqiuluo.shamrock.tools.fetchOrThrow
|
import moe.fuqiuluo.shamrock.tools.fetchOrThrow
|
||||||
import moe.fuqiuluo.shamrock.tools.getOrPost
|
import moe.fuqiuluo.shamrock.tools.getOrPost
|
||||||
import moe.fuqiuluo.shamrock.xposed.helper.NTServiceFetcher
|
import moe.fuqiuluo.shamrock.xposed.helper.NTServiceFetcher
|
||||||
|
Loading…
x
Reference in New Issue
Block a user