Compare commits

..

4 Commits

Author SHA1 Message Date
pk5ls20
e7222653fa release: 3.0.6 2024-10-20 23:54:21 +08:00
pk5ls20
014f0758f5 chore: 部分回滚 https://github.com/NapNeko/NapCatQQ/commit/bb72d70b 2024-10-20 23:52:36 +08:00
pk5ls20
0e8b416f6d Merge pull request #448 from pk5ls20/feat/friend-poke
feat: add `friend_poke` OneBot11 API
2024-10-20 23:18:26 +08:00
pk5ls20
09a60a2204 feat: add friend_poke OneBot11 API 2024-10-20 23:09:38 +08:00
12 changed files with 39 additions and 14 deletions

View File

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

View File

@@ -2,7 +2,7 @@
"name": "napcat",
"private": true,
"type": "module",
"version": "3.0.5",
"version": "3.0.6",
"scripts": {
"build:framework": "vite build --mode framework",
"build:shell": "vite build --mode shell",
@@ -49,4 +49,4 @@
"silk-wasm": "^3.6.1",
"ws": "^8.18.0"
}
}
}

View File

@@ -1 +1 @@
export const napCatVersion = '3.0.5';
export const napCatVersion = '3.0.6';

View File

@@ -73,8 +73,8 @@ export class NTQQPacketApi {
return this.packetSession!.client.sendPacket(cmd, data, rsp);
}
async sendPokePacket(group: number, peer: number) {
const data = this.packetSession?.packer.packPokePacket(group, peer);
async sendPokePacket(peer: number, group?: number) {
const data = this.packetSession?.packer.packPokePacket(peer, group);
await this.sendPacket('OidbSvcTrpcTcp.0xed3_1', data!, false);
}

View File

@@ -47,11 +47,11 @@ export class PacketPacker {
});
}
packPokePacket(group: number, peer: number): PacketHexStr {
packPokePacket(peer: number, group?: number): PacketHexStr {
const oidb_0xed3 = new NapProtoMsg(OidbSvcTrpcTcp0XED3_1).encode({
uin: peer,
groupUin: group,
friendUin: group,
friendUin: group ?? peer,
ext: 0
});
return this.toHexStr(this.packOidbPacket(0xed3, 1, oidb_0xed3));

View File

@@ -18,6 +18,6 @@ export class GroupPoke extends GetPacketStatusDepends<Payload, any> {
payloadSchema = SchemaData;
async _handle(payload: Payload) {
await this.core.apis.PacketApi.sendPokePacket(+payload.group_id, +payload.user_id);
await this.core.apis.PacketApi.sendPokePacket(+payload.user_id, +payload.group_id);
}
}

View File

@@ -91,6 +91,7 @@ import { GetGroupShutList } from './group/GetGroupShutList';
import { GetGroupMemberList } from './group/GetGroupMemberList';
import { GetGroupFileUrl } from "@/onebot/action/file/GetGroupFileUrl";
import {GetPacketStatus} from "@/onebot/action/packet/GetPacketStatus";
import {FriendPoke} from "@/onebot/action/user/FriendPoke";
export type ActionMap = Map<string, BaseAction<any, any>>;
@@ -189,6 +190,7 @@ export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCo
new FetchUserProfileLike(obContext, core),
new GetPacketStatus(obContext, core),
new GroupPoke(obContext, core),
new FriendPoke(obContext, core),
new GetUserStatus(obContext, core),
new GetRkey(obContext, core),
new SetSpecialTittle(obContext, core),

View File

@@ -17,6 +17,7 @@ export enum ActionName {
// 以下为扩展napcat扩展
Unknown = 'unknown',
GroupPoke = 'group_poke',
FriendPoke = 'friend_poke',
SharePeer = 'ArkSharePeer',
ShareGroupEx = 'ArkShareGroup',
RebootNormal = 'reboot_normal',//无快速登录重新启动

View File

@@ -0,0 +1,22 @@
import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import {GetPacketStatusDepends} from "@/onebot/action/packet/GetPacketStatus";
const SchemaData = {
type: 'object',
properties: {
user_id: { type: ['number', 'string'] },
},
required: ['user_id'],
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
export class FriendPoke extends GetPacketStatusDepends<Payload, any> {
actionName = ActionName.FriendPoke;
payloadSchema = SchemaData;
async _handle(payload: Payload) {
await this.core.apis.PacketApi.sendPokePacket(+payload.user_id);
}
}

View File

@@ -304,10 +304,10 @@ export class NapCatOneBot11Adapter {
},
m.msgId,
);
if (m.sourceType == MsgSourceType.K_DOWN_SOURCETYPE_AIOINNER) {
// if (m.sourceType == MsgSourceType.K_DOWN_SOURCETYPE_AIOINNER) {
await this.emitMsg(m)
.catch(e => this.context.logger.logError.bind(this.context.logger)('处理消息失败', e));
}
// }
}
};
@@ -575,7 +575,7 @@ export class NapCatOneBot11Adapter {
// }
this.networkManager.emitEvent(ob11Msg);
}).catch(e => this.context.logger.logError.bind(this.context.logger)('constructMessage error: ', e));
this.apis.GroupApi.parseGroupEvent(message).then(groupEvent => {
if (groupEvent) {
// log("post group event", groupEvent);

View File

@@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) {
SettingItem(
'<span id="napcat-update-title">Napcat</span>',
undefined,
SettingButton('V3.0.5', 'napcat-update-button', 'secondary'),
SettingButton('V3.0.6', 'napcat-update-button', 'secondary'),
),
]),
SettingList([

View File

@@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
SettingItem(
'<span id="napcat-update-title">Napcat</span>',
void 0,
SettingButton("V3.0.5", "napcat-update-button", "secondary")
SettingButton("V3.0.6", "napcat-update-button", "secondary")
)
]),
SettingList([