@@ -174,18 +168,6 @@ export default defineComponent({
return getMsgRawTxt(message)
},
- /**
- * 判断是否需要隐藏重复的 At
- * @param source 回复信息
- * @param at at 信息
- */
- isAtShow (source: any, at: any) {
- if (source) {
- return !(at === source.user_id)
- }
- return true
- },
-
/**
* 根据消息状态获取 At 消息实际的 CSS class
* @param who
@@ -423,21 +405,6 @@ export default defineComponent({
}
},
- /**
- * 获取回复内容(拼接名字和消息内容)
- * @param msg 消息对象
- * @param data 回复信息
- */
- getRepInfo (msg: any, data: any) {
- const list = this.runtimeData.chatInfo.info.group_members.filter((item) => {
- return Number(item.user_id) === Number(data.source.user_id)
- })
- if (list.length === 1) {
- return (list[0].card !== '' ? list[0].card : list[0].nickname) + ': ' + msg
- }
- return msg
- },
-
/**
* 尝试在消息列表中寻找这条被回复的消息,获取消息内容
* @param message_id
diff --git a/src/function/electron/ipc.ts b/src/function/electron/ipc.ts
index 5e9db4ff..b7850801 100644
--- a/src/function/electron/ipc.ts
+++ b/src/function/electron/ipc.ts
@@ -89,7 +89,7 @@ export function regIpcListener() {
})
// 获取补充的调试信息
ipcMain.handle('opt:getSystemInfo', () => {
- const systemInfo = {} as { [key: string]: any }
+ const systemInfo = {} as { [key: string]: [string, string] }
systemInfo.electron = ['Electron Version', process.versions.electron]
return systemInfo
})
diff --git a/src/function/msg.ts b/src/function/msg.ts
index 49224962..cb2fc40d 100644
--- a/src/function/msg.ts
+++ b/src/function/msg.ts
@@ -28,7 +28,6 @@ import { GroupMemberInfoElem, UserFriendElem, UserGroupElem, MsgItemElem, RunTim
import { NotificationElem } from './elements/system'
import { IPinyinOptions } from 'pinyin/lib/declare'
-const logger = new Logger()
const popInfo = new PopInfo()
// eslint-disable-next-line
let msgPath = require('@/assets/pathMap/Lagrange.OneBot.yaml')
@@ -52,6 +51,7 @@ export function parse(str: string) {
case 'getMoreLoginInfo' : runtimeData.loginInfo.info = msg.data.data.result.buddy.info_list[0]; break
case 'getGroupList' : saveUser(msg, 'group'); break
case 'getFriendList' : saveUser(msg, 'friend'); break
+ case 'getFriendCategory' : saveClassInfoAlone(msg); break
case 'getUserInfoInGroup' : runtimeData.chatInfo.info.me_info = msg; break
case 'getGroupMemberList' : saveGroupMember(msg.data); break
case 'getChatHistoryFist' : saveMsg(msg, 'top'); break
@@ -245,9 +245,23 @@ function saveUser(msg: { [key: string]: any }, type: string) {
switch(type) {
case 'friend':
list = getMsgData('friend_list', msg, msgPath.friend_list)
+ if(list)
+ // 根据 user_id 去重
+ list = list.filter((item, index, arr) => {
+ return arr.findIndex((item2) => {
+ return item2.user_id == item.user_id
+ }) == index
+ })
break
case 'group':
list = getMsgData('group_list', msg, msgPath.group_list)
+ if(list)
+ // 根据 group_id 去重
+ list = list.filter((item, index, arr) => {
+ return arr.findIndex((item2) => {
+ return item2.group_id == item.group_id
+ }) == index
+ })
break
}
}
@@ -324,6 +338,10 @@ function saveUser(msg: { [key: string]: any }, type: string) {
if(runtimeData.jsonMap.recent_contact)
Connector.send(runtimeData.jsonMap.recent_contact.name, {}, 'GetRecentContact')
}
+ // 如果是分离式的好友列表,继续获取分类信息
+ if(type == 'friend' && runtimeData.jsonMap.friend_category) {
+ Connector.send(runtimeData.jsonMap.friend_category.name, {}, 'getFriendCategory')
+ }
}
function updateTopMsg(msg: any, echoList: string[]) {
@@ -349,7 +367,29 @@ function updateTopMsg(msg: any, echoList: string[]) {
}
}
-function saveClassInfo(list: { class_id: number, class_name: string }[]) {
+function saveClassInfoAlone(msg: any) {
+ const list = getMsgData('friend_category', msg, msgPath.friend_category) as {
+ class_id: number,
+ class_name: string,
+ sort_id: number,
+ users: number[]
+ }[]
+ if (list != undefined) {
+ saveClassInfo(list)
+ }
+ // 刷新用户列表的分类信息
+ list.forEach((item) => {
+ item.users.forEach((id) => {
+ runtimeData.userList.forEach((user) => {
+ if (user.user_id == id && user.class_id == undefined) {
+ user.class_id = item.class_id
+ user.class_name = item.class_name
+ }
+ })
+ })
+ })
+}
+function saveClassInfo(list: { class_id: number, class_name: string, sort_id?: number }[]) {
// 按拼音重新排序
// const names = [] as string[]
// list.forEach((item) => {
@@ -365,12 +405,21 @@ function saveClassInfo(list: { class_id: number, class_name: string }[]) {
// })
// })
- // 按 class_id 排序
- const back = list.sort((a, b) => {
- return a.class_id - b.class_id
- })
+ if(list[0].sort_id != undefined) {
+ // 如果有 sort_id,按 sort_id 排序,从小到大
+ list.sort((a, b) => {
+ if(a.sort_id && b.sort_id)
+ return a.sort_id - b.sort_id
+ else return 0
+ })
+ } else {
+ // 按 class_id 排序
+ list.sort((a, b) => {
+ return a.class_id - b.class_id
+ })
+ }
- runtimeData.tags.classes = back
+ runtimeData.tags.classes = list
}
function saveGroupMember(data: GroupMemberInfoElem[]) {
diff --git a/src/function/utils/msgUtil.ts b/src/function/utils/msgUtil.ts
index 85a531ba..4d282d71 100644
--- a/src/function/utils/msgUtil.ts
+++ b/src/function/utils/msgUtil.ts
@@ -39,7 +39,7 @@ export function getMsgData(name: string, msg: { [key: string]: any }, map: strin
nameKey = name
regexKey = key
}
- itemObj[key] = jp.query(item, replaceJPValue(nameKey))[0]
+ itemObj[key] = jp.query(item, replaceJPValue(nameKey))
if(regexKey != null) {
const regex = new RegExp(regexKey)
const match = itemObj[key].match(regex)
diff --git a/src/pages/Scripts.vue b/src/pages/Scripts.vue
index e83e44ec..5640e310 100644
--- a/src/pages/Scripts.vue
+++ b/src/pages/Scripts.vue
@@ -20,21 +20,21 @@
-
-
-
{{ item.title }}
+
+
+
+ {{ item.title }}
+ {{ $t('statue_enabled') }}
+ {{ $t('statue_disabled') }}
+
{{ $t('scripts_run_' + item.condition) }}{{ $t('scripts_run_trigger') }}
-
{{ $t('statue_enabled') }}
-
{{ $t('statue_disabled') }}
-
-
@@ -56,8 +56,9 @@
{{ $t('scripts_run_save') }}
runtimeData.watch.newMsg, () => {
if(runtimeData.sysConfig.append_scripts) {
this.message = runtimeData.watch.newMsg
- // FIXME 这儿没有判断是不是自身返回的消息,注意谨防死循环
- const infoList = getMsgData('message_info', this.message, runtimeData.jsonMap.message_info)
- if(infoList != undefined) {
- this.msgInfo = infoList[0]
- }
- if(this.msgInfo) {
- this.isMe = Number(this.msgInfo.sender) == Number(runtimeData.loginInfo.uin)
- } else {
- this.isMe = false
+ if(this.message) {
+ // FIXME 这儿没有判断是不是自身返回的消息,注意谨防死循环
+ const infoList = getMsgData('message_info', this.message, runtimeData.jsonMap.message_info)
+ if(infoList != undefined) {
+ this.msgInfo = infoList[0]
+ }
+ if(this.msgInfo) {
+ this.isMe = Number(this.msgInfo.sender) == Number(runtimeData.loginInfo.uin)
+ } else {
+ this.isMe = false
+ }
+ this.onEvent('message')
}
- this.onEvent('message')
}
})
// 监听好友/群列表刷新
@@ -325,15 +329,40 @@ export default defineComponent({
display: flex;
padding: 10px;
}
+.list-body > div > div:last-child > div:last-child {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ width: 30px;
+ height: 30px;
+ background: var(--color-card-2);
+ border-radius: 100%;
+ margin-right: 10px;
+}
+.list-body > div.selected > div:last-child > div:last-child {
+ background: #ffffffca;
+}
+.list-body > div > div:last-child > div:last-child svg {
+ color: var(--color-font-1);
+ font-size: 0.7rem;
+}
+.list-body > div.selected > div:last-child > div:last-child svg {
+ color: var(--color-main);
+}
+
.list-body > div.selected {
background: var(--color-main);
}
+.list-body > div.selected span,
.list-body > div.selected h2 {
color: var(--color-font-r);
}
-.list-body > div.selected span,
-.list-body > div.selected > div:last-child > svg {
- color: var(--color-font-1-r);
+.list-body > div.selected span > svg {
+ color: var(--color-font-r);
+}
+.list-body > div.selected svg {
+ color: var(--color-font-1);
}
.list-body h2 {
font-size: 1rem;
@@ -356,6 +385,7 @@ export default defineComponent({
flex: 1;
}
.list-body > div > div:last-child {
+ align-items: center;
justify-content: space-evenly;
margin-top: 5px;
display: flex;
diff --git a/src/pages/chat-view/SystemNotice.vue b/src/pages/chat-view/SystemNotice.vue
index 31bda3aa..13e35af4 100644
--- a/src/pages/chat-view/SystemNotice.vue
+++ b/src/pages/chat-view/SystemNotice.vue
@@ -95,7 +95,7 @@ export default defineComponent({
* @param notice 申请信息
* @param deal 同意 / 拒绝
*/
- dealFriend(notice:any, deal: boolean) {
+ dealFriend(notice:{ flag: string }, deal: boolean) {
Connector.send(
'set_friend_add_request',
{
@@ -111,7 +111,7 @@ export default defineComponent({
* @param notice 申请信息
* @param deal 同意 / 拒绝
*/
- dealGroupAdd(notice:any, deal: boolean) {
+ dealGroupAdd(notice: { flag: string, sub_type: string }, deal: boolean) {
Connector.send(
'set_group_add_request',
{
diff --git a/src/pages/options/OptDev.vue b/src/pages/options/OptDev.vue
index 565dea84..399425d7 100644
--- a/src/pages/options/OptDev.vue
+++ b/src/pages/options/OptDev.vue
@@ -268,7 +268,7 @@ export default defineComponent({
info += ` Browser Name -> ${browser.name}\n`
info += ` Browser Version -> ${browser.version}\n`
if(addInfo) {
- const get = addInfo as {[key: string]: any}
+ const get = addInfo as { [key: string]: [string, string] }
Object.keys(get).forEach((name: string) => {
info += ` ${get[name][0]} -> ${get[name][1]}\n`
})