Merge pull request #325 from LLOneBot/dev

3.28.2
This commit is contained in:
idranme 2024-08-09 18:10:50 +08:00 committed by GitHub
commit ce5cf82339
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 32 additions and 20 deletions

9
.editorconfig Normal file
View File

@ -0,0 +1,9 @@
root = true
[*]
insert_final_newline = true
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true

View File

@ -4,7 +4,7 @@
"name": "LLOneBot",
"slug": "LLOneBot",
"description": "实现 OneBot 11 协议,用以 QQ 机器人开发",
"version": "3.28.1",
"version": "3.28.2",
"icon": "./icon.webp",
"authors": [
{

View File

@ -13,13 +13,10 @@ import {
CHANNEL_UPDATE,
} from '../common/channels'
import { ob11WebsocketServer } from '../onebot11/server/ws/WebsocketServer'
import { DATA_DIR, qqPkgInfo } from '../common/utils'
import { DATA_DIR } from '../common/utils'
import {
friendRequests,
getFriend,
getGroup,
getGroupMember,
groups,
llonebotError,
selfInfo,
uidMaps,
@ -27,9 +24,7 @@ import {
import { hookNTQQApiCall, hookNTQQApiReceive, ReceiveCmdS, registerReceiveHook, startHook } from '../ntqqapi/hook'
import { OB11Constructor } from '../onebot11/constructor'
import {
ChatType,
FriendRequestNotify,
GroupMemberRole,
GroupNotifies,
GroupNotifyTypes,
RawMessage,

View File

@ -358,8 +358,9 @@ export class NTQQMsgApi {
})
})
}
static async getMsgsBySeqAndCount(peer: Peer, seq: string, count: number, desc: boolean, z: boolean) {
const session = getSession()
return await session?.getMsgService().getMsgsBySeqAndCount(peer, seq, count, desc, z);
return await session?.getMsgService().getMsgsBySeqAndCount(peer, seq, count, desc, z)!
}
}

View File

@ -221,7 +221,7 @@ export class NTQQUserApi {
static async getUidByUinV1(Uin: string) {
const session = getSession()
// 通用转换开始尝试
let uid = (await session?.getUixConvertService().getUid([Uin])!).uidInfo.get(Uin);
let uid = (await session?.getUixConvertService().getUid([Uin]))?.uidInfo.get(Uin)
// Uid 好友转
if (!uid) {
friends.forEach((t) => {
@ -251,11 +251,11 @@ export class NTQQUserApi {
static async getUidByUinV2(Uin: string) {
const session = getSession()
let uid = (await session?.getProfileService().getUidByUin('FriendsServiceImpl', [Uin])!).get(Uin)
let uid = (await session?.getProfileService().getUidByUin('FriendsServiceImpl', [Uin]))?.get(Uin)
if (uid) return uid
uid = (await session?.getGroupService().getUidByUins([Uin])!).uids.get(Uin)
uid = (await session?.getGroupService().getUidByUins([Uin]))?.uids.get(Uin)
if (uid) return uid
uid = (await session?.getUixConvertService().getUid([Uin])!).uidInfo.get(Uin)
uid = (await session?.getUixConvertService().getUid([Uin]))?.uidInfo.get(Uin)
if (uid) return uid
console.log((await NTQQFriendApi.getBuddyIdMapCache(true)))
uid = (await NTQQFriendApi.getBuddyIdMapCache(true)).getValue(Uin)//从Buddy缓存获取Uid
@ -263,7 +263,7 @@ export class NTQQUserApi {
uid = (await NTQQFriendApi.getBuddyIdMap(true)).getValue(Uin)
if (uid) return uid
let unveifyUid = (await NTQQUserApi.getUserDetailInfoByUinV2(Uin)).detail.uid//从QQ Native 特殊转换
if (unveifyUid.indexOf("*") == -1) uid = unveifyUid
if (unveifyUid.indexOf('*') == -1) uid = unveifyUid
//if (uid) return uid
return uid
}

View File

@ -44,12 +44,12 @@ export class SendMsgElementConstructor {
}
}
static at(atUid: string, atNtUid: string, atType: AtType, atName: string): SendTextElement {
static at(atUid: string, atNtUid: string, atType: AtType, display: string): SendTextElement {
return {
elementType: ElementType.TEXT,
elementId: '',
textElement: {
content: `@${atName}`,
content: display,
atType,
atUid,
atTinyId: '',

View File

@ -109,15 +109,22 @@ export async function createSendElements(
}
}
if (isAdmin && remainAtAllCount > 0) {
sendElements.push(SendMsgElementConstructor.at(atQQ, atQQ, AtType.atAll, '全体成员'))
sendElements.push(SendMsgElementConstructor.at(atQQ, atQQ, AtType.atAll, '@全体成员'))
}
}
else if (peer.chatType === ChatType.group) {
// const atMember = group?.members.find(m => m.uin == atQQ)
const atMember = await getGroupMember(peer.peerUid, atQQ)
if (atMember) {
const display = `@${atMember.cardName || atMember.nick}`
sendElements.push(
SendMsgElementConstructor.at(atQQ, atMember.uid, AtType.atUser, atMember.cardName || atMember.nick),
SendMsgElementConstructor.at(atQQ, atMember.uid, AtType.atUser, display),
)
} else {
const atNmae = sendMsg.data?.name
const uid = await NTQQUserApi.getUidByUin(atQQ) || ''
const display = atNmae ? `@${atNmae}` : ''
sendElements.push(
SendMsgElementConstructor.at(atQQ, uid, AtType.atUser, display),
)
}
}

View File

@ -554,7 +554,7 @@ export class OB11Constructor {
if (msgList[0].senderUin === '0') {
msgList[0].senderUin = postMsg?.senderUin ?? selfInfo.uin
}
return new OB11GroupEssenceEvent(parseInt(msg.peerUid), postMsg?.msgShortId!, parseInt(msgList[0].senderUin))
return new OB11GroupEssenceEvent(parseInt(msg.peerUid), postMsg?.msgShortId!, parseInt(msgList[0].senderUin!))
// 获取MsgSeq+Peer可获取具体消息
}
if (grayTipElement.jsonGrayTipElement.busiId == 2407) {

View File

@ -1 +1 @@
export const version = '3.28.1'
export const version = '3.28.2'