mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f8e231b8b8 | ||
![]() |
a0f5cc0e36 | ||
![]() |
277c2a9b67 | ||
![]() |
874acdd7fe | ||
![]() |
b2b996df9c | ||
![]() |
4427774c2d |
@@ -29,6 +29,7 @@ TG群:<https://t.me/+nLZEnpne-pQ1OWFl>
|
|||||||
|
|
||||||
## 鸣谢
|
## 鸣谢
|
||||||
|
|
||||||
|
- [NapCatQQ](https://github.com/NapNeko/NapCatQQ)
|
||||||
- [LiteLoaderQQNT](https://liteloaderqqnt.github.io/guide/install.html)
|
- [LiteLoaderQQNT](https://liteloaderqqnt.github.io/guide/install.html)
|
||||||
- [chronocat](https://github.com/chrononeko/chronocat)
|
- [chronocat](https://github.com/chrononeko/chronocat)
|
||||||
- [koishi-plugin-adapter-onebot](https://github.com/koishijs/koishi-plugin-adapter-onebot)
|
- [koishi-plugin-adapter-onebot](https://github.com/koishijs/koishi-plugin-adapter-onebot)
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"name": "LLOneBot",
|
"name": "LLOneBot",
|
||||||
"slug": "LLOneBot",
|
"slug": "LLOneBot",
|
||||||
"description": "实现 OneBot 11 协议,用以 QQ 机器人开发",
|
"description": "实现 OneBot 11 协议,用以 QQ 机器人开发",
|
||||||
"version": "3.28.5",
|
"version": "3.28.7",
|
||||||
"icon": "./icon.webp",
|
"icon": "./icon.webp",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@@ -127,4 +127,4 @@ export function getSelfUid() {
|
|||||||
|
|
||||||
export function getSelfUin() {
|
export function getSelfUin() {
|
||||||
return selfInfo['uin']
|
return selfInfo['uin']
|
||||||
}
|
}
|
||||||
|
@@ -401,8 +401,9 @@ function onLoad() {
|
|||||||
dbUtil.init(uin)
|
dbUtil.init(uin)
|
||||||
|
|
||||||
log('start activate group member info')
|
log('start activate group member info')
|
||||||
NTQQGroupApi.activateMemberInfoChange().then().catch(log)
|
// 下面两个会导致CPU占用过高,QQ卡死
|
||||||
NTQQGroupApi.activateMemberListChange().then().catch(log)
|
// NTQQGroupApi.activateMemberInfoChange().then().catch(log)
|
||||||
|
// NTQQGroupApi.activateMemberListChange().then().catch(log)
|
||||||
startReceiveHook().then()
|
startReceiveHook().then()
|
||||||
|
|
||||||
if (config.ob11.enableHttp) {
|
if (config.ob11.enableHttp) {
|
||||||
@@ -432,13 +433,13 @@ function onLoad() {
|
|||||||
}
|
}
|
||||||
//log('self info', selfInfo, globalThis.authData)
|
//log('self info', selfInfo, globalThis.authData)
|
||||||
if (current.uin) {
|
if (current.uin) {
|
||||||
start(current.uid, current.uin)
|
await start(current.uid, current.uin)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setTimeout(init, 1000)
|
setTimeout(init, 1000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init()
|
init().then()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建窗口时触发
|
// 创建窗口时触发
|
||||||
|
@@ -208,8 +208,9 @@ export class NTQQMsgApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async multiForwardMsg(srcPeer: Peer, destPeer: Peer, msgIds: string[]): Promise<RawMessage> {
|
static async multiForwardMsg(srcPeer: Peer, destPeer: Peer, msgIds: string[]): Promise<RawMessage> {
|
||||||
const msgInfos = msgIds.map(async id => {
|
const senderShowName = await getSelfNick()
|
||||||
return { msgId: id, senderShowName: await getSelfNick() }
|
const msgInfos = msgIds.map(id => {
|
||||||
|
return { msgId: id, senderShowName }
|
||||||
})
|
})
|
||||||
const selfUid = getSelfUid()
|
const selfUid = getSelfUid()
|
||||||
let data = await NTEventDispatch.CallNormalEvent<
|
let data = await NTEventDispatch.CallNormalEvent<
|
||||||
|
@@ -1,7 +1,16 @@
|
|||||||
import type { BrowserWindow } from 'electron'
|
import type { BrowserWindow } from 'electron'
|
||||||
import { NTQQApiClass, NTQQApiMethod } from './ntcall'
|
import { NTQQApiClass, NTQQApiMethod } from './ntcall'
|
||||||
import { NTQQMsgApi } from './api/msg'
|
import { NTQQMsgApi } from './api/msg'
|
||||||
import { CategoryFriend, ChatType, Group, GroupMember, GroupMemberRole, RawMessage } from './types'
|
import {
|
||||||
|
CategoryFriend,
|
||||||
|
ChatType,
|
||||||
|
FriendV2,
|
||||||
|
Group,
|
||||||
|
GroupMember,
|
||||||
|
GroupMemberRole,
|
||||||
|
RawMessage,
|
||||||
|
SimpleInfo, User,
|
||||||
|
} from './types'
|
||||||
import {
|
import {
|
||||||
deleteGroup,
|
deleteGroup,
|
||||||
friends,
|
friends,
|
||||||
@@ -103,8 +112,8 @@ export function hookNTQQApiReceive(window: BrowserWindow) {
|
|||||||
if (hook.hookFunc.constructor.name === 'AsyncFunction') {
|
if (hook.hookFunc.constructor.name === 'AsyncFunction') {
|
||||||
; (_ as Promise<void>).then()
|
; (_ as Promise<void>).then()
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e: any) {
|
||||||
log('hook error', e, receiveData.payload)
|
log('hook error', ntQQApiMethodName, e.stack.toString())
|
||||||
}
|
}
|
||||||
}).then()
|
}).then()
|
||||||
}
|
}
|
||||||
@@ -332,7 +341,7 @@ export async function startHook() {
|
|||||||
})
|
})
|
||||||
registerReceiveHook<{ groupList: Group[]; updateType: number }>(ReceiveCmdS.GROUPS_STORE, (payload) => {
|
registerReceiveHook<{ groupList: Group[]; updateType: number }>(ReceiveCmdS.GROUPS_STORE, (payload) => {
|
||||||
// updateType 3是群列表变动,2是群成员变动
|
// updateType 3是群列表变动,2是群成员变动
|
||||||
// log("群列表变动", payload.updateType, payload.groupList)
|
// log("群列表变动, store", payload.updateType, payload.groupList)
|
||||||
if (payload.updateType != 2) {
|
if (payload.updateType != 2) {
|
||||||
updateGroups(payload.groupList).then()
|
updateGroups(payload.groupList).then()
|
||||||
}
|
}
|
||||||
@@ -391,17 +400,32 @@ export async function startHook() {
|
|||||||
registerReceiveHook<{
|
registerReceiveHook<{
|
||||||
data: CategoryFriend[]
|
data: CategoryFriend[]
|
||||||
}>(ReceiveCmdS.FRIENDS, (payload) => {
|
}>(ReceiveCmdS.FRIENDS, (payload) => {
|
||||||
for (const fData of payload.data) {
|
// log("onBuddyListChange", payload)
|
||||||
const _friends = fData.buddyList
|
// let friendListV2: {userSimpleInfos: Map<string, SimpleInfo>} = []
|
||||||
for (let friend of _friends) {
|
type V2data = {userSimpleInfos: Map<string, SimpleInfo>}
|
||||||
NTQQMsgApi.activateChat({ peerUid: friend.uid, chatType: ChatType.friend }).then()
|
let friendList: User[] = [];
|
||||||
let existFriend = friends.find((f) => f.uin == friend.uin)
|
if ((payload as any).userSimpleInfos) {
|
||||||
if (!existFriend) {
|
// friendListV2 = payload as any
|
||||||
friends.push(friend)
|
friendList = Object.values((payload as unknown as V2data).userSimpleInfos).map((v: SimpleInfo) => {
|
||||||
}
|
return {
|
||||||
else {
|
...v.coreInfo,
|
||||||
Object.assign(existFriend, friend)
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
for (const fData of payload.data) {
|
||||||
|
friendList.push(...fData.buddyList)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log('好友列表变动', friendList)
|
||||||
|
for (let friend of friendList) {
|
||||||
|
NTQQMsgApi.activateChat({ peerUid: friend.uid, chatType: ChatType.friend }).then()
|
||||||
|
let existFriend = friends.find((f) => f.uin == friend.uin)
|
||||||
|
if (!existFriend) {
|
||||||
|
friends.push(friend)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Object.assign(existFriend, friend)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -508,4 +532,4 @@ export async function startHook() {
|
|||||||
log('重新激活聊天窗口', peer, { result: r.result, errMsg: r.errMsg })
|
log('重新激活聊天窗口', peer, { result: r.result, errMsg: r.errMsg })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -340,4 +340,4 @@ export interface UserDetailInfoByUin {
|
|||||||
pendantId: string
|
pendantId: string
|
||||||
vipNameColorId: string
|
vipNameColorId: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1 +1 @@
|
|||||||
export const version = '3.28.5'
|
export const version = '3.28.7'
|
||||||
|
Reference in New Issue
Block a user