mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
commit
ce5cf82339
9
.editorconfig
Normal file
9
.editorconfig
Normal 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
|
@ -4,7 +4,7 @@
|
|||||||
"name": "LLOneBot",
|
"name": "LLOneBot",
|
||||||
"slug": "LLOneBot",
|
"slug": "LLOneBot",
|
||||||
"description": "实现 OneBot 11 协议,用以 QQ 机器人开发",
|
"description": "实现 OneBot 11 协议,用以 QQ 机器人开发",
|
||||||
"version": "3.28.1",
|
"version": "3.28.2",
|
||||||
"icon": "./icon.webp",
|
"icon": "./icon.webp",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@ -13,13 +13,10 @@ import {
|
|||||||
CHANNEL_UPDATE,
|
CHANNEL_UPDATE,
|
||||||
} from '../common/channels'
|
} from '../common/channels'
|
||||||
import { ob11WebsocketServer } from '../onebot11/server/ws/WebsocketServer'
|
import { ob11WebsocketServer } from '../onebot11/server/ws/WebsocketServer'
|
||||||
import { DATA_DIR, qqPkgInfo } from '../common/utils'
|
import { DATA_DIR } from '../common/utils'
|
||||||
import {
|
import {
|
||||||
friendRequests,
|
friendRequests,
|
||||||
getFriend,
|
|
||||||
getGroup,
|
|
||||||
getGroupMember,
|
getGroupMember,
|
||||||
groups,
|
|
||||||
llonebotError,
|
llonebotError,
|
||||||
selfInfo,
|
selfInfo,
|
||||||
uidMaps,
|
uidMaps,
|
||||||
@ -27,9 +24,7 @@ import {
|
|||||||
import { hookNTQQApiCall, hookNTQQApiReceive, ReceiveCmdS, registerReceiveHook, startHook } from '../ntqqapi/hook'
|
import { hookNTQQApiCall, hookNTQQApiReceive, ReceiveCmdS, registerReceiveHook, startHook } from '../ntqqapi/hook'
|
||||||
import { OB11Constructor } from '../onebot11/constructor'
|
import { OB11Constructor } from '../onebot11/constructor'
|
||||||
import {
|
import {
|
||||||
ChatType,
|
|
||||||
FriendRequestNotify,
|
FriendRequestNotify,
|
||||||
GroupMemberRole,
|
|
||||||
GroupNotifies,
|
GroupNotifies,
|
||||||
GroupNotifyTypes,
|
GroupNotifyTypes,
|
||||||
RawMessage,
|
RawMessage,
|
||||||
|
@ -358,8 +358,9 @@ export class NTQQMsgApi {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static async getMsgsBySeqAndCount(peer: Peer, seq: string, count: number, desc: boolean, z: boolean) {
|
static async getMsgsBySeqAndCount(peer: Peer, seq: string, count: number, desc: boolean, z: boolean) {
|
||||||
const session = getSession()
|
const session = getSession()
|
||||||
return await session?.getMsgService().getMsgsBySeqAndCount(peer, seq, count, desc, z);
|
return await session?.getMsgService().getMsgsBySeqAndCount(peer, seq, count, desc, z)!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ export class NTQQUserApi {
|
|||||||
static async getUidByUinV1(Uin: string) {
|
static async getUidByUinV1(Uin: string) {
|
||||||
const session = getSession()
|
const session = getSession()
|
||||||
// 通用转换开始尝试
|
// 通用转换开始尝试
|
||||||
let uid = (await session?.getUixConvertService().getUid([Uin])!).uidInfo.get(Uin);
|
let uid = (await session?.getUixConvertService().getUid([Uin]))?.uidInfo.get(Uin)
|
||||||
// Uid 好友转
|
// Uid 好友转
|
||||||
if (!uid) {
|
if (!uid) {
|
||||||
friends.forEach((t) => {
|
friends.forEach((t) => {
|
||||||
@ -251,11 +251,11 @@ export class NTQQUserApi {
|
|||||||
|
|
||||||
static async getUidByUinV2(Uin: string) {
|
static async getUidByUinV2(Uin: string) {
|
||||||
const session = getSession()
|
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
|
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
|
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
|
if (uid) return uid
|
||||||
console.log((await NTQQFriendApi.getBuddyIdMapCache(true)))
|
console.log((await NTQQFriendApi.getBuddyIdMapCache(true)))
|
||||||
uid = (await NTQQFriendApi.getBuddyIdMapCache(true)).getValue(Uin)//从Buddy缓存获取Uid
|
uid = (await NTQQFriendApi.getBuddyIdMapCache(true)).getValue(Uin)//从Buddy缓存获取Uid
|
||||||
@ -263,7 +263,7 @@ export class NTQQUserApi {
|
|||||||
uid = (await NTQQFriendApi.getBuddyIdMap(true)).getValue(Uin)
|
uid = (await NTQQFriendApi.getBuddyIdMap(true)).getValue(Uin)
|
||||||
if (uid) return uid
|
if (uid) return uid
|
||||||
let unveifyUid = (await NTQQUserApi.getUserDetailInfoByUinV2(Uin)).detail.uid//从QQ Native 特殊转换
|
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
|
//if (uid) return uid
|
||||||
return uid
|
return uid
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
return {
|
||||||
elementType: ElementType.TEXT,
|
elementType: ElementType.TEXT,
|
||||||
elementId: '',
|
elementId: '',
|
||||||
textElement: {
|
textElement: {
|
||||||
content: `@${atName}`,
|
content: display,
|
||||||
atType,
|
atType,
|
||||||
atUid,
|
atUid,
|
||||||
atTinyId: '',
|
atTinyId: '',
|
||||||
|
@ -109,15 +109,22 @@ export async function createSendElements(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isAdmin && remainAtAllCount > 0) {
|
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) {
|
else if (peer.chatType === ChatType.group) {
|
||||||
// const atMember = group?.members.find(m => m.uin == atQQ)
|
|
||||||
const atMember = await getGroupMember(peer.peerUid, atQQ)
|
const atMember = await getGroupMember(peer.peerUid, atQQ)
|
||||||
if (atMember) {
|
if (atMember) {
|
||||||
|
const display = `@${atMember.cardName || atMember.nick}`
|
||||||
sendElements.push(
|
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),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -554,7 +554,7 @@ export class OB11Constructor {
|
|||||||
if (msgList[0].senderUin === '0') {
|
if (msgList[0].senderUin === '0') {
|
||||||
msgList[0].senderUin = postMsg?.senderUin ?? selfInfo.uin
|
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可获取具体消息
|
// 获取MsgSeq+Peer可获取具体消息
|
||||||
}
|
}
|
||||||
if (grayTipElement.jsonGrayTipElement.busiId == 2407) {
|
if (grayTipElement.jsonGrayTipElement.busiId == 2407) {
|
||||||
|
@ -1 +1 @@
|
|||||||
export const version = '3.28.1'
|
export const version = '3.28.2'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user