Compare commits

...

34 Commits

Author SHA1 Message Date
手瓜一十雪
bbaca3f044 fix 2025-04-26 19:10:00 +08:00
Mlikiowa
bb8a44b918 release: v4.7.42 2025-04-26 11:02:25 +00:00
手瓜一十雪
b5574d5999 fix: #976 2025-04-26 19:00:31 +08:00
手瓜一十雪
06dde072da Merge pull request #975 from pohgxz/main
接口 _get_model_show 的 model 设置为可选属性
2025-04-26 18:31:10 +08:00
Nepenthe
8e92a81bb9 接口 _get_model_show 的 model 设置为可选属性 2025-04-26 14:48:35 +08:00
Nepenthe
2c7345ae88 Merge branch 'NapNeko:main' into main 2025-04-26 14:40:38 +08:00
Mlikiowa
33d4696155 release: v4.7.41 2025-04-24 09:43:32 +00:00
手瓜一十雪
7d2dcc10e5 fix 2025-04-24 17:43:13 +08:00
Mlikiowa
e82687454c release: v4.7.40 2025-04-24 07:57:16 +00:00
手瓜一十雪
84382caebc fix 2025-04-24 15:56:55 +08:00
Mlikiowa
662530e507 release: v4.7.36 2025-04-24 07:53:59 +00:00
手瓜一十雪
edf81d0a2e feat: 34606 2025-04-24 15:37:44 +08:00
手瓜一十雪
7cbae86941 Revert "fix: 私聊撤回"
This reverts commit 8ff7420a5e.
2025-04-24 11:34:07 +08:00
手瓜一十雪
8ff7420a5e fix: 私聊撤回 2025-04-24 11:33:11 +08:00
手瓜一十雪
7ae59b1419 Merge pull request #971 from Sn0wo2/main
fix: temp_source
2025-04-24 09:54:29 +08:00
手瓜一十雪
41036f8ee8 fix: 969 2025-04-24 09:50:26 +08:00
Me0wo
380777ca04 fix: #970 2025-04-24 04:11:31 +08:00
Mlikiowa
c658cd1096 release: v4.7.35 2025-04-23 08:52:43 +00:00
手瓜一十雪
c7b9946d2f feat: doubt friends支持 2025-04-23 16:46:09 +08:00
手瓜一十雪
0caca473d6 feat: 34566 2025-04-23 16:18:48 +08:00
手瓜一十雪
3e5d35957d fix 2025-04-23 16:12:56 +08:00
手瓜一十雪
6b8b14aba2 fix: #963 2025-04-23 11:47:58 +08:00
手瓜一十雪
5db7a90a24 feat: 301 302自动跟随下载 2025-04-21 18:43:44 +08:00
Mlikiowa
88b86611a3 release: v4.7.34 2025-04-20 14:12:47 +00:00
手瓜一十雪
886fe2052e feat: 避免危险信息 2025-04-20 22:12:12 +08:00
手瓜一十雪
e4dd194d4a fix: #960
神经设计
2025-04-20 22:10:24 +08:00
手瓜一十雪
a47af60f58 feat: disband 2025-04-20 19:28:35 +08:00
Mlikiowa
35f24eb806 release: v4.7.33 2025-04-19 12:17:18 +00:00
Nepenthe
faf390bb18 Merge branch 'NapNeko:main' into main 2025-02-21 21:19:02 +08:00
Nepenthe
941b30847b Merge branch 'NapNeko:main' into main 2025-01-25 23:14:26 +08:00
Nepenthe
4c5a26698e Merge branch 'NapNeko:main' into main 2025-01-15 21:33:43 +08:00
Nepenthe
d14a1dd948 Merge branch 'NapNeko:main' into main 2024-11-17 17:28:31 +08:00
Nepenthe
1c0b434f47 Merge branch 'NapNeko:main' into main 2024-10-31 19:15:25 +08:00
Nepenthe
573451bade 修复<get_record>接口 2024-10-30 21:07:01 +08:00
23 changed files with 286 additions and 85 deletions

View File

@@ -4,7 +4,7 @@
"name": "NapCatQQ", "name": "NapCatQQ",
"slug": "NapCat.Framework", "slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现", "description": "高性能的 OneBot 11 协议实现",
"version": "4.7.32", "version": "4.7.42",
"icon": "./logo.png", "icon": "./logo.png",
"authors": [ "authors": [
{ {

View File

@@ -2,7 +2,7 @@
"name": "napcat", "name": "napcat",
"private": true, "private": true,
"type": "module", "type": "module",
"version": "4.7.32", "version": "4.7.42",
"scripts": { "scripts": {
"build:universal": "npm run build:webui && vite build --mode universal || exit 1", "build:universal": "npm run build:webui && vite build --mode universal || exit 1",
"build:framework": "npm run build:webui && vite build --mode framework || exit 1", "build:framework": "npm run build:webui && vite build --mode framework || exit 1",

View File

@@ -115,7 +115,7 @@ async function tryDownload(options: string | HttpDownloadOptions, useReferer: bo
if (useReferer && !headers['Referer']) { if (useReferer && !headers['Referer']) {
headers['Referer'] = url; headers['Referer'] = url;
} }
const fetchRes = await fetch(url, { headers }).catch((err) => { const fetchRes = await fetch(url, { headers, redirect: 'follow' }).catch((err) => {
if (err.cause) { if (err.cause) {
throw err.cause; throw err.cause;
} }

View File

@@ -1 +1 @@
export const napCatVersion = '4.7.32'; export const napCatVersion = '4.7.42';

View File

@@ -345,6 +345,7 @@ export class NTQQFileApi {
'NodeIKernelMsgListener/onRichMediaDownloadComplete', 'NodeIKernelMsgListener/onRichMediaDownloadComplete',
[{ [{
fileModelId: '0', fileModelId: '0',
downSourceType: 0,
downloadSourceType: 0, downloadSourceType: 0,
triggerType: 1, triggerType: 1,
msgId: msgId, msgId: msgId,

View File

@@ -86,4 +86,31 @@ export class NTQQFriendApi {
accept, accept,
}); });
} }
async handleDoubtFriendRequest(friendUid: string, str1: string = '', str2: string = '') {
this.context.session.getBuddyService().approvalDoubtBuddyReq(friendUid, str1, str2);
}
async getDoubtFriendRequest(count: number) {
let date = Date.now().toString();
const [, ret] = await this.core.eventWrapper.callNormalEventV2(
'NodeIKernelBuddyService/getDoubtBuddyReq',
'NodeIKernelBuddyListener/onDoubtBuddyReqChange',
[date, count, ''],
() => true,
(data) => data.reqId === date
);
let requests = Promise.all(ret.doubtList.map(async (item) => {
return {
flag: item.uid, //注意强制String 非isNumeric 不遵守则不符合设计
uin: await this.core.apis.UserApi.getUinByUidV2(item.uid) ?? 0,// 信息字段
nick: item.nick, // 信息字段 这个不是nickname 可能是来源的群内的昵称
source: item.source, // 信息字段
reason: item.reason, // 信息字段
msg: item.msg, // 信息字段
group_code: item.groupCode, // 信息字段
time: item.reqTime, // 信息字段
type: 'doubt' //保留字段
};
}))
return requests;
}
} }

View File

@@ -258,5 +258,21 @@
"3.2.17-34467": { "3.2.17-34467": {
"appid": 537282292, "appid": 537282292,
"qua": "V1_LNX_NQ_3.2.17_34467_GW_B" "qua": "V1_LNX_NQ_3.2.17_34467_GW_B"
},
"9.9.19-34566": {
"appid": 537282307,
"qua": "V1_WIN_NQ_9.9.19_34566_GW_B"
},
"3.2.17-34566": {
"appid": 537282343,
"qua": "V1_LNX_NQ_3.2.17_34566_GW_B"
},
"3.2.17-34606": {
"appid": 537282343,
"qua": "V1_LNX_NQ_3.2.17_34606_GW_B"
},
"9.9.19-34606": {
"appid": 537282307,
"qua": "V1_WIN_NQ_9.9.19_34606_GW_B"
} }
} }

View File

@@ -327,12 +327,28 @@
"send": "770CDC0", "send": "770CDC0",
"recv": "77106F0" "recv": "77106F0"
}, },
"9.9.19-34362-x64":{ "9.9.19-34362-x64": {
"send": "3BD80D0", "send": "3BD80D0",
"recv": "3BDC8D0" "recv": "3BDC8D0"
}, },
"9.9.19-34467-x64": { "9.9.19-34467-x64": {
"send": "3BD8690", "send": "3BD8690",
"recv": "3BDCE90" "recv": "3BDCE90"
},
"9.9.19-34566-x64": {
"send": "3BDA110",
"recv": "3BDE910"
},
"9.9.19-34606-x64": {
"send": "3BDA110",
"recv": "3BDE910"
},
"3.2.17-34606-x64": {
"send": "AD7DC60",
"recv": "AD81680"
},
"3.2.17-34606-arm64": {
"send": "7711270",
"recv": "7714BA0"
} }
} }

View File

@@ -40,12 +40,30 @@ export class NodeIKernelBuddyListener {
} }
onDelBatchBuddyInfos(arg: unknown): any { onDelBatchBuddyInfos(arg: unknown): any {
console.log('onDelBatchBuddyInfos not implemented', ...arguments);
} }
onDoubtBuddyReqChange(arg: unknown): any { onDoubtBuddyReqChange(_arg:
{
reqId: string;
cookie: string;
doubtList: Array<{
uid: string;
nick: string;
age: number,
sex: number;
commFriendNum: number;
reqTime: string;
msg: string;
source: string;
reason: string;
groupCode: string;
nameMore?: null;
}>;
}): void | Promise<void> {
} }
onDoubtBuddyReqUnreadNumChange(arg: unknown): any { onDoubtBuddyReqUnreadNumChange(_num: number): void | Promise<void> {
} }
onNickUpdated(arg: unknown): any { onNickUpdated(arg: unknown): any {

View File

@@ -21,7 +21,8 @@ export interface OnRichMediaDownloadCompleteParams {
clientMsg: string, clientMsg: string,
businessId: number, businessId: number,
userTotalSpacePerDay: unknown, userTotalSpacePerDay: unknown,
userUsedSpacePerDay: unknown userUsedSpacePerDay: unknown,
chatType: number,
} }
export interface GroupFileInfoUpdateParamType { export interface GroupFileInfoUpdateParamType {
@@ -97,112 +98,112 @@ export interface TempOnRecvParams {
} }
export class NodeIKernelMsgListener { export class NodeIKernelMsgListener {
onAddSendMsg(msgRecord: RawMessage): any { onAddSendMsg(_msgRecord: RawMessage): any {
} }
onBroadcastHelperDownloadComplete(broadcastHelperTransNotifyInfo: unknown): any { onBroadcastHelperDownloadComplete(_broadcastHelperTransNotifyInfo: unknown): any {
} }
onBroadcastHelperProgressUpdate(broadcastHelperTransNotifyInfo: unknown): any { onBroadcastHelperProgressUpdate(_broadcastHelperTransNotifyInfo: unknown): any {
} }
onChannelFreqLimitInfoUpdate(contact: unknown, z: unknown, freqLimitInfo: unknown): any { onChannelFreqLimitInfoUpdate(_contact: unknown, _z: unknown, _freqLimitInfo: unknown): any {
} }
onContactUnreadCntUpdate(hashMap: unknown): any { onContactUnreadCntUpdate(_hashMap: unknown): any {
} }
onCustomWithdrawConfigUpdate(customWithdrawConfig: unknown): any { onCustomWithdrawConfigUpdate(_customWithdrawConfig: unknown): any {
} }
onDraftUpdate(contact: unknown, arrayList: unknown, j2: unknown): any { onDraftUpdate(_contact: unknown, _arrayList: unknown, _j2: unknown): any {
} }
onEmojiDownloadComplete(emojiNotifyInfo: unknown): any { onEmojiDownloadComplete(_emojiNotifyInfo: unknown): any {
} }
onEmojiResourceUpdate(emojiResourceInfo: unknown): any { onEmojiResourceUpdate(_emojiResourceInfo: unknown): any {
} }
onFeedEventUpdate(firstViewDirectMsgNotifyInfo: unknown): any { onFeedEventUpdate(_firstViewDirectMsgNotifyInfo: unknown): any {
} }
onFileMsgCome(arrayList: unknown): any { onFileMsgCome(_arrayList: unknown): any {
} }
onFirstViewDirectMsgUpdate(firstViewDirectMsgNotifyInfo: unknown): any { onFirstViewDirectMsgUpdate(_firstViewDirectMsgNotifyInfo: unknown): any {
} }
onFirstViewGroupGuildMapping(arrayList: unknown): any { onFirstViewGroupGuildMapping(_arrayList: unknown): any {
} }
onGrabPasswordRedBag(i2: unknown, str: unknown, i3: unknown, recvdOrder: unknown, msgRecord: unknown): any { onGrabPasswordRedBag(_i2: unknown, _str: unknown, _i3: unknown, _recvdOrder: unknown, _msgRecord: unknown): any {
} }
onGroupFileInfoAdd(groupItem: unknown): any { onGroupFileInfoAdd(_groupItem: unknown): any {
} }
onGroupFileInfoUpdate(groupFileListResult: GroupFileInfoUpdateParamType): any { onGroupFileInfoUpdate(_groupFileListResult: GroupFileInfoUpdateParamType): any {
} }
onGroupGuildUpdate(groupGuildNotifyInfo: unknown): any { onGroupGuildUpdate(_groupGuildNotifyInfo: unknown): any {
} }
onGroupTransferInfoAdd(groupItem: unknown): any { onGroupTransferInfoAdd(_groupItem: unknown): any {
} }
onGroupTransferInfoUpdate(groupFileListResult: unknown): any { onGroupTransferInfoUpdate(_groupFileListResult: unknown): any {
} }
onGuildInteractiveUpdate(guildInteractiveNotificationItem: unknown): any { onGuildInteractiveUpdate(_guildInteractiveNotificationItem: unknown): any {
} }
onGuildMsgAbFlagChanged(guildMsgAbFlag: unknown): any { onGuildMsgAbFlagChanged(_guildMsgAbFlag: unknown): any {
} }
onGuildNotificationAbstractUpdate(guildNotificationAbstractInfo: unknown): any { onGuildNotificationAbstractUpdate(_guildNotificationAbstractInfo: unknown): any {
} }
onHitCsRelatedEmojiResult(downloadRelateEmojiResultInfo: unknown): any { onHitCsRelatedEmojiResult(_downloadRelateEmojiResultInfo: unknown): any {
} }
onHitEmojiKeywordResult(hitRelatedEmojiWordsResult: unknown): any { onHitEmojiKeywordResult(_hitRelatedEmojiWordsResult: unknown): any {
} }
onHitRelatedEmojiResult(relatedWordEmojiInfo: unknown): any { onHitRelatedEmojiResult(_relatedWordEmojiInfo: unknown): any {
} }
onImportOldDbProgressUpdate(importOldDbMsgNotifyInfo: unknown): any { onImportOldDbProgressUpdate(_importOldDbMsgNotifyInfo: unknown): any {
} }
onInputStatusPush(inputStatusInfo: { onInputStatusPush(_inputStatusInfo: {
chatType: number; chatType: number;
eventType: number; eventType: number;
fromUin: string; fromUin: string;
@@ -215,55 +216,55 @@ export class NodeIKernelMsgListener {
} }
onKickedOffLine(kickedInfo: KickedOffLineInfo): any { onKickedOffLine(_kickedInfo: KickedOffLineInfo): any {
} }
onLineDev(arrayList: unknown): any { onLineDev(_arrayList: unknown): any {
} }
onLogLevelChanged(j2: unknown): any { onLogLevelChanged(_j2: unknown): any {
} }
onMsgAbstractUpdate(arrayList: unknown): any { onMsgAbstractUpdate(_arrayList: unknown): any {
} }
onMsgBoxChanged(arrayList: unknown): any { onMsgBoxChanged(_arrayList: unknown): any {
} }
onMsgDelete(contact: unknown, arrayList: unknown): any { onMsgDelete(_contact: unknown, _arrayList: unknown): any {
} }
onMsgEventListUpdate(hashMap: unknown): any { onMsgEventListUpdate(_hashMap: unknown): any {
} }
onMsgInfoListAdd(arrayList: unknown): any { onMsgInfoListAdd(_arrayList: unknown): any {
} }
onMsgInfoListUpdate(msgList: RawMessage[]): any { onMsgInfoListUpdate(_msgList: RawMessage[]): any {
} }
onMsgQRCodeStatusChanged(i2: unknown): any { onMsgQRCodeStatusChanged(_i2: unknown): any {
} }
onMsgRecall(chatType: ChatType, uid: string, msgSeq: string): any { onMsgRecall(_chatType: ChatType, _uid: string, _msgSeq: string): any {
} }
onMsgSecurityNotify(msgRecord: unknown): any { onMsgSecurityNotify(_msgRecord: unknown): any {
} }
onMsgSettingUpdate(msgSetting: unknown): any { onMsgSettingUpdate(_msgSetting: unknown): any {
} }
@@ -279,108 +280,108 @@ export class NodeIKernelMsgListener {
} }
onReadFeedEventUpdate(firstViewDirectMsgNotifyInfo: unknown): any { onReadFeedEventUpdate(_firstViewDirectMsgNotifyInfo: unknown): any {
} }
onRecvGroupGuildFlag(i2: unknown): any { onRecvGroupGuildFlag(_i2: unknown): any {
} }
onRecvMsg(arrayList: RawMessage[]): any { onRecvMsg(_arrayList: RawMessage[]): any {
} }
onRecvMsgSvrRspTransInfo(j2: unknown, contact: unknown, i2: unknown, i3: unknown, str: unknown, bArr: unknown): any { onRecvMsgSvrRspTransInfo(_j2: unknown, _contact: unknown, _i2: unknown, _i3: unknown, _str: unknown, _bArr: unknown): any {
} }
onRecvOnlineFileMsg(arrayList: unknown): any { onRecvOnlineFileMsg(_arrayList: unknown): any {
} }
onRecvS2CMsg(arrayList: unknown): any { onRecvS2CMsg(_arrayList: unknown): any {
} }
onRecvSysMsg(arrayList: Array<number>): any { onRecvSysMsg(_arrayList: Array<number>): any {
} }
onRecvUDCFlag(i2: unknown): any { onRecvUDCFlag(_i2: unknown): any {
} }
onRichMediaDownloadComplete(fileTransNotifyInfo: OnRichMediaDownloadCompleteParams): any { onRichMediaDownloadComplete(_fileTransNotifyInfo: OnRichMediaDownloadCompleteParams): any {
} }
onRichMediaProgerssUpdate(fileTransNotifyInfo: unknown): any { onRichMediaProgerssUpdate(_fileTransNotifyInfo: unknown): any {
} }
onRichMediaUploadComplete(fileTransNotifyInfo: unknown): any { onRichMediaUploadComplete(_fileTransNotifyInfo: unknown): any {
} }
onSearchGroupFileInfoUpdate(searchGroupFileResult: unknown): any { onSearchGroupFileInfoUpdate(_searchGroupFileResult: unknown): any {
} }
onSendMsgError(j2: unknown, contact: unknown, i2: unknown, str: unknown): any { onSendMsgError(_j2: unknown, _contact: unknown, _i2: unknown, _str: unknown): any {
} }
onSysMsgNotification(i2: unknown, j2: unknown, j3: unknown, arrayList: unknown): any { onSysMsgNotification(_i2: unknown, _j2: unknown, _j3: unknown, _arrayList: unknown): any {
} }
onTempChatInfoUpdate(tempChatInfo: TempOnRecvParams): any { onTempChatInfoUpdate(_tempChatInfo: TempOnRecvParams): any {
} }
onUnreadCntAfterFirstView(hashMap: unknown): any { onUnreadCntAfterFirstView(_hashMap: unknown): any {
} }
onUnreadCntUpdate(hashMap: unknown): any { onUnreadCntUpdate(_hashMap: unknown): any {
} }
onUserChannelTabStatusChanged(z: unknown): any { onUserChannelTabStatusChanged(_z: unknown): any {
} }
onUserOnlineStatusChanged(z: unknown): any { onUserOnlineStatusChanged(_z: unknown): any {
} }
onUserTabStatusChanged(arrayList: unknown): any { onUserTabStatusChanged(_arrayList: unknown): any {
} }
onlineStatusBigIconDownloadPush(i2: unknown, j2: unknown, str: unknown): any { onlineStatusBigIconDownloadPush(_i2: unknown, _j2: unknown, _str: unknown): any {
} }
onlineStatusSmallIconDownloadPush(i2: unknown, j2: unknown, str: unknown): any { onlineStatusSmallIconDownloadPush(_i2: unknown, _j2: unknown, _str: unknown): any {
} }
// 第一次发现于Linux // 第一次发现于Linux
onUserSecQualityChanged(...args: unknown[]): any { onUserSecQualityChanged(..._args: unknown[]): any {
} }
onMsgWithRichLinkInfoUpdate(...args: unknown[]): any { onMsgWithRichLinkInfoUpdate(..._args: unknown[]): any {
} }
onRedTouchChanged(...args: unknown[]): any { onRedTouchChanged(..._args: unknown[]): any {
} }
// 第一次发现于Win 9.9.9-23159 // 第一次发现于Win 9.9.9-23159
onBroadcastHelperProgerssUpdate(...args: unknown[]): any { onBroadcastHelperProgerssUpdate(..._args: unknown[]): any {
} }
} }

View File

@@ -106,15 +106,15 @@ export interface NodeIKernelBuddyService {
getAddMeSetting(): unknown; getAddMeSetting(): unknown;
getDoubtBuddyReq(): unknown; getDoubtBuddyReq(reqId: string, num: number,uk:string): Promise<GeneralCallResult>;
getDoubtBuddyUnreadNum(): number; getDoubtBuddyUnreadNum(): number;
approvalDoubtBuddyReq(uid: number, isAgree: boolean): void; approvalDoubtBuddyReq(uid: string, str1: string, str2: string): void;
delDoubtBuddyReq(uid: number): void; delDoubtBuddyReq(uid: number): void;
delAllDoubtBuddyReq(): void; delAllDoubtBuddyReq(): Promise<GeneralCallResult>;
reportDoubtBuddyReqUnread(): void; reportDoubtBuddyReqUnread(): void;

View File

@@ -425,7 +425,20 @@ export interface NodeIKernelMsgService {
switchToOfflineGetRichMediaElement(...args: unknown[]): unknown; switchToOfflineGetRichMediaElement(...args: unknown[]): unknown;
downloadRichMedia(...args: unknown[]): unknown; downloadRichMedia(args: {
fileModelId: string,
downSourceType: number,
triggerType: number,
msgId: string,
chatType: number,
peerUid: string,
elementId: string,
thumbSize: number,
downloadType: number,
filePath: string
} & {
downloadSourceType: number, //33800左右一下的老版本 新版34606已经完全上面格式
}): unknown;
getFirstUnreadMsgSeq(args: { getFirstUnreadMsgSeq(args: {
peerUid: string peerUid: string

View File

@@ -3,7 +3,7 @@ import { ActionName } from '@/onebot/action/router';
import { Static, Type } from '@sinclair/typebox'; import { Static, Type } from '@sinclair/typebox';
const SchemaData = Type.Object({ const SchemaData = Type.Object({
model: Type.String(), model: Type.Optional(Type.String()),
}); });
type Payload = Static<typeof SchemaData>; type Payload = Static<typeof SchemaData>;

View File

@@ -38,6 +38,7 @@ export default class GoCQHTTPUploadGroupFile extends OneBotAction<Payload, null>
deleteAfterSentFiles: [] deleteAfterSentFiles: []
}; };
const sendFileEle = await this.core.apis.FileApi.createValidSendFileElement(msgContext, downloadResult.path, payload.name, payload.folder ?? payload.folder_id); const sendFileEle = await this.core.apis.FileApi.createValidSendFileElement(msgContext, downloadResult.path, payload.name, payload.folder ?? payload.folder_id);
msgContext.deleteAfterSentFiles.push(downloadResult.path);
await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(peer, [sendFileEle], msgContext.deleteAfterSentFiles); await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(peer, [sendFileEle], msgContext.deleteAfterSentFiles);
return null; return null;
} }

View File

@@ -23,7 +23,7 @@ export default class GoCQHTTPUploadPrivateFile extends OneBotAction<Payload, nul
if (payload.user_id) { if (payload.user_id) {
const peerUid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString()); const peerUid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
if (!peerUid) { if (!peerUid) {
throw new Error( `私聊${payload.user_id}不存在`); throw new Error(`私聊${payload.user_id}不存在`);
} }
const isBuddy = await this.core.apis.FriendApi.isBuddy(peerUid); const isBuddy = await this.core.apis.FriendApi.isBuddy(peerUid);
return { chatType: isBuddy ? ChatType.KCHATTYPEC2C : ChatType.KCHATTYPETEMPC2CFROMGROUP, peerUid }; return { chatType: isBuddy ? ChatType.KCHATTYPEC2C : ChatType.KCHATTYPETEMPC2CFROMGROUP, peerUid };
@@ -48,6 +48,7 @@ export default class GoCQHTTPUploadPrivateFile extends OneBotAction<Payload, nul
deleteAfterSentFiles: [] deleteAfterSentFiles: []
}; };
const sendFileEle: SendFileElement = await this.core.apis.FileApi.createValidSendFileElement(msgContext, downloadResult.path, payload.name); const sendFileEle: SendFileElement = await this.core.apis.FileApi.createValidSendFileElement(msgContext, downloadResult.path, payload.name);
msgContext.deleteAfterSentFiles.push(downloadResult.path);
await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(await this.getPeer(payload), [sendFileEle], msgContext.deleteAfterSentFiles); await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(await this.getPeer(payload), [sendFileEle], msgContext.deleteAfterSentFiles);
return null; return null;
} }

View File

@@ -115,10 +115,16 @@ import { RenameGroupFile } from './extends/RenameGroupFile';
import { GetRkeyServer } from './packet/GetRkeyServer'; import { GetRkeyServer } from './packet/GetRkeyServer';
import { GetRkeyEx } from './packet/GetRkeyEx'; import { GetRkeyEx } from './packet/GetRkeyEx';
import { CleanCache } from './system/CleanCache'; import { CleanCache } from './system/CleanCache';
import SetFriendRemark from './user/SetFriendRemark';
import { SetDoubtFriendsAddRequest } from './new/SetDoubtFriendsAddRequest';
import { GetDoubtFriendsAddRequest } from './new/GetDoubtFriendsAddRequest';
export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore) { export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore) {
const actionHandlers = [ const actionHandlers = [
new SetDoubtFriendsAddRequest(obContext, core),
new GetDoubtFriendsAddRequest(obContext, core),
new SetFriendRemark(obContext, core),
new GetRkeyEx(obContext, core), new GetRkeyEx(obContext, core),
new GetRkeyServer(obContext, core), new GetRkeyServer(obContext, core),
new SetGroupRemark(obContext, core), new SetGroupRemark(obContext, core),

View File

@@ -0,0 +1,18 @@
import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '@/onebot/action/router';
import { Static, Type } from '@sinclair/typebox';
const SchemaData = Type.Object({
count: Type.Number({ default: 50 }),
});
type Payload = Static<typeof SchemaData>;
export class GetDoubtFriendsAddRequest extends OneBotAction<Payload, unknown> {
override actionName = ActionName.GetDoubtFriendsAddRequest;
override payloadSchema = SchemaData;
async _handle(payload: Payload) {
return await this.core.apis.FriendApi.getDoubtFriendRequest(payload.count);
}
}

View File

@@ -0,0 +1,21 @@
import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '@/onebot/action/router';
import { Static, Type } from '@sinclair/typebox';
const SchemaData = Type.Object({
flag: Type.String(),
//注意强制String 非isNumeric 不遵守则不符合设计
approve: Type.Boolean({ default: true }),
//该字段没有语义 仅做保留 强制为True
});
type Payload = Static<typeof SchemaData>;
export class SetDoubtFriendsAddRequest extends OneBotAction<Payload, unknown> {
override actionName = ActionName.SetDoubtFriendsAddRequest;
override payloadSchema = SchemaData;
async _handle(payload: Payload) {
return await this.core.apis.FriendApi.handleDoubtFriendRequest(payload.flag);
}
}

View File

@@ -10,6 +10,10 @@ export interface InvalidCheckResult {
} }
export const ActionName = { export const ActionName = {
// new extends 完全差异OneBot类别
GetDoubtFriendsAddRequest: 'get_doubt_friends_add_request',
SetDoubtFriendsAddRequest: 'set_doubt_friends_add_request',
// napcat
GetRkeyEx: 'get_rkey', GetRkeyEx: 'get_rkey',
GetRkeyServer: 'get_rkey_server', GetRkeyServer: 'get_rkey_server',
SetGroupRemark: 'set_group_remark', SetGroupRemark: 'set_group_remark',
@@ -35,6 +39,7 @@ export const ActionName = {
SetGroupLeave: 'set_group_leave', SetGroupLeave: 'set_group_leave',
SetSpecialTitle: 'set_group_special_title', SetSpecialTitle: 'set_group_special_title',
SetFriendAddRequest: 'set_friend_add_request', SetFriendAddRequest: 'set_friend_add_request',
SetFriendRemark: 'set_friend_remark',
SetGroupAddRequest: 'set_group_add_request', SetGroupAddRequest: 'set_group_add_request',
GetLoginInfo: 'get_login_info', GetLoginInfo: 'get_login_info',
GoCQHTTP_GetStrangerInfo: 'get_stranger_info', GoCQHTTP_GetStrangerInfo: 'get_stranger_info',

View File

@@ -0,0 +1,25 @@
import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '@/onebot/action/router';
import { Static, Type } from '@sinclair/typebox';
const SchemaData = Type.Object({
user_id: Type.String(),
remark: Type.String()
});
type Payload = Static<typeof SchemaData>;
export default class SetFriendRemark extends OneBotAction<Payload, null> {
override actionName = ActionName.SetFriendRemark;
override payloadSchema = SchemaData;
async _handle(payload: Payload): Promise<null> {
let friendUid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id);
let is_friend = await this.core.apis.FriendApi.isBuddy(friendUid);
if (!is_friend) {
throw new Error(`用户 ${payload.user_id} 不是好友`);
}
await this.core.apis.FriendApi.setBuddyRemark(friendUid, payload.remark);
return null;
}
}

View File

@@ -250,7 +250,34 @@ export class OneBotGroupApi {
'invite' 'invite'
); );
} }
async parse51TypeEvent(msg: RawMessage, grayTipElement: GrayTipElement) {
// 神经腾讯 没了妈妈想出来的
// Warn 下面存在高并发危险
if (grayTipElement.jsonGrayTipElement.jsonStr) {
const json: {
align: string,
items: Array<{ txt: string, type: string }>
} = JSON.parse(grayTipElement.jsonGrayTipElement.jsonStr);
if (json.items.length === 1 && json.items[0]?.txt.endsWith('加入群')) {
let old_members = structuredClone(this.core.apis.GroupApi.groupMemberCache.get(msg.peerUid));
if (!old_members) return;
let new_members_map = await this.core.apis.GroupApi.refreshGroupMemberCache(msg.peerUid, true);
if (!new_members_map) return;
let new_members = Array.from(new_members_map.values());
// 对比members查找新成员
let new_member = new_members.find((member) => old_members.get(member.uid) == undefined);
if (!new_member) return;
return new OB11GroupIncreaseEvent(
this.core,
+msg.peerUid,
+new_member.uin,
0,
'invite',
);
}
}
return;
}
async parseGrayTipElement(msg: RawMessage, grayTipElement: GrayTipElement) { async parseGrayTipElement(msg: RawMessage, grayTipElement: GrayTipElement) {
if (grayTipElement.subElementType === NTGrayTipElementSubTypeV2.GRAYTIP_ELEMENT_SUBTYPE_GROUP) { if (grayTipElement.subElementType === NTGrayTipElementSubTypeV2.GRAYTIP_ELEMENT_SUBTYPE_GROUP) {
// 解析群组事件 由sysmsg解析 // 解析群组事件 由sysmsg解析
@@ -282,6 +309,9 @@ export class OneBotGroupApi {
return await this.parsePaiYiPai(msg, grayTipElement.jsonGrayTipElement.jsonStr); return await this.parsePaiYiPai(msg, grayTipElement.jsonGrayTipElement.jsonStr);
} else if (grayTipElement.jsonGrayTipElement.busiId == JsonGrayBusiId.AIO_GROUP_ESSENCE_MSG_TIP) { } else if (grayTipElement.jsonGrayTipElement.busiId == JsonGrayBusiId.AIO_GROUP_ESSENCE_MSG_TIP) {
return await this.parseEssenceMsg(msg, grayTipElement.jsonGrayTipElement.jsonStr); return await this.parseEssenceMsg(msg, grayTipElement.jsonGrayTipElement.jsonStr);
} else if (+(grayTipElement.jsonGrayTipElement.busiId ?? 0) == 51) {
// 51是什么{"align":"center","items":[{"txt":"下一秒起床通过王者荣耀加入群","type":"nor"}]
return await this.parse51TypeEvent(msg, grayTipElement);
} else { } else {
return await this.parseOtherJsonEvent(msg, grayTipElement.jsonGrayTipElement.jsonStr, this.core.context); return await this.parseOtherJsonEvent(msg, grayTipElement.jsonGrayTipElement.jsonStr, this.core.context);
} }

View File

@@ -907,10 +907,10 @@ export class OneBotMsgApi {
const member = await this.core.apis.GroupApi.getGroupMember(msg.peerUin, msg.senderUin); const member = await this.core.apis.GroupApi.getGroupMember(msg.peerUin, msg.senderUin);
resMsg.group_id = parseInt(ret.tmpChatInfo!.groupCode); resMsg.group_id = parseInt(ret.tmpChatInfo!.groupCode);
resMsg.sender.nickname = member?.nick ?? member?.cardName ?? '临时会话'; resMsg.sender.nickname = member?.nick ?? member?.cardName ?? '临时会话';
resMsg.temp_source = resMsg.group_id; resMsg.temp_source = 0;
} else { } else {
resMsg.group_id = 284840486; resMsg.group_id = 284840486;
resMsg.temp_source = resMsg.group_id; resMsg.temp_source = 0;
resMsg.sender.nickname = '临时会话'; resMsg.sender.nickname = '临时会话';
} }
} }
@@ -1105,6 +1105,8 @@ export class OneBotMsgApi {
return 'kick'; return 'kick';
case 3: case 3:
return 'kick_me'; return 'kick_me';
case 129:
return 'disband';
default: default:
return 'kick'; return 'kick';
} }

View File

@@ -1,7 +1,7 @@
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent'; import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
import { NapCatCore } from '@/core'; import { NapCatCore } from '@/core';
export type GroupDecreaseSubType = 'leave' | 'kick' | 'kick_me'; export type GroupDecreaseSubType = 'leave' | 'kick' | 'kick_me' | 'disband';
export class OB11GroupDecreaseEvent extends OB11GroupNoticeEvent { export class OB11GroupDecreaseEvent extends OB11GroupNoticeEvent {
notice_type = 'group_decrease'; notice_type = 'group_decrease';
@@ -11,7 +11,7 @@ export class OB11GroupDecreaseEvent extends OB11GroupNoticeEvent {
constructor(core: NapCatCore, groupId: number, userId: number, operatorId: number, subType: GroupDecreaseSubType = 'leave') { constructor(core: NapCatCore, groupId: number, userId: number, operatorId: number, subType: GroupDecreaseSubType = 'leave') {
super(core, groupId, userId); super(core, groupId, userId);
this.group_id = groupId; this.group_id = groupId;
this.operator_id = operatorId; this.operator_id = operatorId;
this.user_id = userId; this.user_id = userId;
this.sub_type = subType; this.sub_type = subType;
} }