mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
88de57f984 | ||
![]() |
61ddf38892 | ||
![]() |
52b3540ec3 | ||
![]() |
5f831958c3 | ||
![]() |
c3d4698af3 | ||
![]() |
bd6e83217d | ||
![]() |
50ec49d9a2 | ||
![]() |
dc3a089070 | ||
![]() |
530e380178 | ||
![]() |
10e4387add | ||
![]() |
e925bc3aa8 | ||
![]() |
427b3a7560 | ||
![]() |
c8da950725 | ||
![]() |
743c5b8196 | ||
![]() |
5e62abea57 | ||
![]() |
6bfc545582 | ||
![]() |
411108a2d2 | ||
![]() |
308a6fa9e4 | ||
![]() |
2dc7b785d0 |
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@@ -127,10 +127,10 @@ jobs:
|
|||||||
zip -q -r NapCat.Framework.Windows.Once.zip *
|
zip -q -r NapCat.Framework.Windows.Once.zip *
|
||||||
cd ..
|
cd ..
|
||||||
mv ./NapCat.Framework.Windows.Once/NapCat.Framework.Windows.Once.zip ./
|
mv ./NapCat.Framework.Windows.Once/NapCat.Framework.Windows.Once.zip ./
|
||||||
mv ./external/napcat.packet.arm64 ./
|
mv ./external/packet/napcat.packet.arm64 ./
|
||||||
mv ./external/napcat.packet.exe ./
|
mv ./external/packet/napcat.packet.exe ./
|
||||||
mv ./external/napcat.packet.linux ./
|
mv ./external/packet/napcat.packet.linux ./
|
||||||
mv ./external/napcat.packet.production.py ./
|
mv ./external/packet/napcat.packet.production.py ./
|
||||||
- name: Extract version from tag
|
- name: Extract version from tag
|
||||||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"name": "NapCatQQ",
|
"name": "NapCatQQ",
|
||||||
"slug": "NapCat.Framework",
|
"slug": "NapCat.Framework",
|
||||||
"description": "高性能的 OneBot 11 协议实现",
|
"description": "高性能的 OneBot 11 协议实现",
|
||||||
"version": "3.3.12",
|
"version": "3.3.21",
|
||||||
"icon": "./logo.png",
|
"icon": "./logo.png",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"name": "napcat",
|
"name": "napcat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "3.3.12",
|
"version": "3.3.21",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:framework": "vite build --mode framework",
|
"build:framework": "vite build --mode framework",
|
||||||
"build:shell": "vite build --mode shell",
|
"build:shell": "vite build --mode shell",
|
||||||
|
@@ -40,14 +40,14 @@ try {
|
|||||||
// 更新版本,构建安全的sed命令
|
// 更新版本,构建安全的sed命令
|
||||||
const safeScriptContent = `
|
const safeScriptContent = `
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
git config --global user.email "bot@test.wumiao.wang"
|
git config --global user.email "nanaeonn@outlook.com"
|
||||||
git config --global user.name "Version"
|
git config --global user.name "Mlikiowa"
|
||||||
sed -i "s/\\\"version\\\": \\\"${currentVersion}\\\"/\\\"version\\\": \\\"${targetVersion}\\\"/g" package.json
|
sed -i "s/\\"version\\": \\"${currentVersion}\\"/\\"version\\": \\"${targetVersion}\\"/g" package.json
|
||||||
sed -i "s/\\\"version\\\": \\\"${manifestCurrentVersion}\\\"/\\\"version\\\": \\\"${targetVersion}\\\"/g" manifest.json
|
sed -i "s/\\"version\\": \\"${manifestCurrentVersion}\\"/\\"version\\": \\"${targetVersion}\\"/g" manifest.json
|
||||||
sed -i "s/napCatVersion = '\\${currentVersion}'/napCatVersion = '\\${targetVersion}'/g" ./src/common/version.ts
|
sed -i "s/napCatVersion = '.*'/napCatVersion = '${targetVersion}'/g" ./src/common/version.ts
|
||||||
sed -i 's/SettingButton("V[0-9]\+\.[0-9]\+\.[0-9]\+", "napcat-update-button", "secondary")/SettingButton("'"${targetVersion}"'", "napcat-update-button", "secondary")/g' ./static/assets/renderer.js
|
sed -i "s/SettingButton(\\"V.*\\", \\"napcat-update-button\\", \\"secondary\\")/SettingButton(\\"V${targetVersion}\\", \\"napcat-update-button\\", \\"secondary\\")/g" ./static/assets/renderer.js
|
||||||
git add .
|
git add .
|
||||||
git commit -m "chore:version change"
|
git commit -m "release: v${targetVersion}"
|
||||||
git push -u origin main`;
|
git push -u origin main`;
|
||||||
writeScriptToFile(safeScriptContent);
|
writeScriptToFile(safeScriptContent);
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { PacketMsg } from "@/core/packet/msg/message";
|
import { PacketMsg } from "@/core/packet/message/message";
|
||||||
import * as crypto from "node:crypto";
|
import * as crypto from "node:crypto";
|
||||||
|
|
||||||
interface ForwardMsgJson {
|
interface ForwardMsgJson {
|
||||||
|
@@ -1 +1 @@
|
|||||||
export const napCatVersion = '3.3.12';
|
export const napCatVersion = '3.3.21';
|
||||||
|
@@ -12,6 +12,7 @@ import {
|
|||||||
import { isNumeric, solveAsyncProblem } from '@/common/helper';
|
import { isNumeric, solveAsyncProblem } from '@/common/helper';
|
||||||
import { LimitedHashTable } from '@/common/message-unique';
|
import { LimitedHashTable } from '@/common/message-unique';
|
||||||
import { NTEventWrapper } from '@/common/event';
|
import { NTEventWrapper } from '@/common/event';
|
||||||
|
import { c } from 'vite/dist/node/types.d-aGj9QkWt';
|
||||||
|
|
||||||
export class NTQQGroupApi {
|
export class NTQQGroupApi {
|
||||||
context: InstanceContext;
|
context: InstanceContext;
|
||||||
@@ -337,19 +338,20 @@ export class NTQQGroupApi {
|
|||||||
}
|
}
|
||||||
this.context.session.getGroupService().destroyMemberListScene(sceneId);
|
this.context.session.getGroupService().destroyMemberListScene(sceneId);
|
||||||
return {
|
return {
|
||||||
infos: resMode2?.infos || result.result.infos,
|
infos: new Map([...(resMode2?.infos ?? []), ...result.result.infos]),
|
||||||
finish: result.result.finish,
|
finish: result.result.finish,
|
||||||
hasNext: resMode2?.hasNext,
|
hasNext: resMode2?.hasNext,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupMembersV2(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> {
|
async getGroupMembersV2(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> {
|
||||||
let res = await this.tryGetGroupMembersV2(true, groupQQ);
|
console.log("-start-", groupQQ);
|
||||||
|
let res = await this.tryGetGroupMembersV2(true, groupQQ, 3000);
|
||||||
if (res.hasNext || !res.finish || res.infos.size === 0) {
|
if (res.hasNext || !res.finish || res.infos.size === 0) {
|
||||||
res = await this.tryGetGroupMembersV2(false, groupQQ, num);
|
res = await this.tryGetGroupMembersV2(false, groupQQ, 3000);
|
||||||
}
|
}
|
||||||
if ((res.infos.size === 0 || res.infos.size === 30) && res.finish) {
|
if (res.infos.size === 0 && res.finish) {
|
||||||
res = await this.tryGetGroupMembersV2(true, groupQQ, num);
|
res = await this.tryGetGroupMembersV2(true, groupQQ, 3000);
|
||||||
}
|
}
|
||||||
return res.infos;
|
return res.infos;
|
||||||
}
|
}
|
||||||
|
@@ -10,14 +10,16 @@ import { OidbSvcTrpcTcpBase, OidbSvcTrpcTcpBaseRsp } from '@/core/packet/proto/o
|
|||||||
import { OidbSvcTrpcTcp0XFE1_2RSP } from '@/core/packet/proto/oidb/Oidb.0XFE1_2';
|
import { OidbSvcTrpcTcp0XFE1_2RSP } from '@/core/packet/proto/oidb/Oidb.0XFE1_2';
|
||||||
import { LogWrapper } from "@/common/log";
|
import { LogWrapper } from "@/common/log";
|
||||||
import { SendLongMsgResp } from "@/core/packet/proto/message/action";
|
import { SendLongMsgResp } from "@/core/packet/proto/message/action";
|
||||||
import { PacketMsg } from "@/core/packet/msg/message";
|
import { PacketMsg } from "@/core/packet/message/message";
|
||||||
import { OidbSvcTrpcTcp0x6D6Response } from "@/core/packet/proto/oidb/Oidb.0x6D6";
|
import { OidbSvcTrpcTcp0x6D6Response } from "@/core/packet/proto/oidb/Oidb.0x6D6";
|
||||||
import {
|
import {
|
||||||
PacketMsgFileElement,
|
PacketMsgFileElement,
|
||||||
PacketMsgPicElement,
|
PacketMsgPicElement,
|
||||||
PacketMsgPttElement,
|
PacketMsgPttElement,
|
||||||
PacketMsgVideoElement
|
PacketMsgVideoElement
|
||||||
} from "@/core/packet/msg/element";
|
} from "@/core/packet/message/element";
|
||||||
|
import { MiniAppReqParams, MiniAppRawData } from "@/core/packet/entities/miniApp";
|
||||||
|
import { MiniAppAdaptShareInfoResp } from "@/core/packet/proto/action/miniAppAdaptShareInfo";
|
||||||
|
|
||||||
|
|
||||||
interface OffsetType {
|
interface OffsetType {
|
||||||
@@ -185,4 +187,11 @@ export class NTQQPacketApi {
|
|||||||
}
|
}
|
||||||
return `https://${resp.download.downloadDns}/ftn_handler/${Buffer.from(resp.download.downloadUrl).toString('hex')}/?fname=`;
|
return `https://${resp.download.downloadDns}/ftn_handler/${Buffer.from(resp.download.downloadUrl).toString('hex')}/?fname=`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async sendMiniAppShareInfoReq(param: MiniAppReqParams) {
|
||||||
|
const data = this.packetSession?.packer.packMiniAppAdaptShareInfo(param);
|
||||||
|
const ret = await this.sendPacket("LightAppSvc.mini_app_share.AdaptShareInfo", data!, true);
|
||||||
|
const body = new NapProtoMsg(MiniAppAdaptShareInfoResp).decode(Buffer.from(ret.hex_data, 'hex'))
|
||||||
|
return JSON.parse(body.content.jsonContent) as MiniAppRawData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@ export class NTQQUserApi {
|
|||||||
async getStatusByUid(uid: string) {
|
async getStatusByUid(uid: string) {
|
||||||
return this.context.session.getProfileService().getStatus(uid);
|
return this.context.session.getProfileService().getStatus(uid);
|
||||||
}
|
}
|
||||||
async getProfileLike(uid: string) {
|
async getProfileLike(uid: string, start: number, count: number) {
|
||||||
return this.context.session.getProfileLikeService().getBuddyProfileLike({
|
return this.context.session.getProfileLikeService().getBuddyProfileLike({
|
||||||
friendUids: [uid],
|
friendUids: [uid],
|
||||||
basic: 1,
|
basic: 1,
|
||||||
@@ -26,8 +26,8 @@ export class NTQQUserApi {
|
|||||||
favorite: 0,
|
favorite: 0,
|
||||||
userProfile: 1,
|
userProfile: 1,
|
||||||
type: 2,
|
type: 2,
|
||||||
start: 0,
|
start: start,
|
||||||
limit: 20,
|
limit: count,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async fetchOtherProfileLike(uid: string) {
|
async fetchOtherProfileLike(uid: string) {
|
||||||
|
79
src/core/packet/entities/miniApp.ts
Normal file
79
src/core/packet/entities/miniApp.ts
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
export interface MiniAppReqCustomParams {
|
||||||
|
title: string;
|
||||||
|
desc: string;
|
||||||
|
picUrl: string;
|
||||||
|
jumpUrl: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MiniAppReqTemplateParams {
|
||||||
|
sdkId: string;
|
||||||
|
appId: string;
|
||||||
|
scene: number;
|
||||||
|
iconUrl: string;
|
||||||
|
templateType: number;
|
||||||
|
businessType: number;
|
||||||
|
verType: number;
|
||||||
|
shareType: number;
|
||||||
|
versionId: string;
|
||||||
|
withShareTicket: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MiniAppReqParams extends MiniAppReqCustomParams, MiniAppReqTemplateParams {}
|
||||||
|
|
||||||
|
export interface MiniAppData {
|
||||||
|
ver: string;
|
||||||
|
prompt: string;
|
||||||
|
config: Config;
|
||||||
|
app: string;
|
||||||
|
view: string;
|
||||||
|
meta: MetaData;
|
||||||
|
miniappShareOrigin: number;
|
||||||
|
miniappOpenRefer: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MiniAppRawData {
|
||||||
|
appName: string;
|
||||||
|
appView: string;
|
||||||
|
ver: string;
|
||||||
|
desc: string;
|
||||||
|
prompt: string;
|
||||||
|
metaData: MetaData;
|
||||||
|
config: Config;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Config {
|
||||||
|
type: string;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
forward: number;
|
||||||
|
autoSize: number;
|
||||||
|
ctime: number;
|
||||||
|
token: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Host {
|
||||||
|
uin: number;
|
||||||
|
nick: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Detail {
|
||||||
|
appid: string;
|
||||||
|
appType: number;
|
||||||
|
title: string;
|
||||||
|
desc: string;
|
||||||
|
icon: string;
|
||||||
|
preview: string;
|
||||||
|
url: string;
|
||||||
|
scene: number;
|
||||||
|
host: Host;
|
||||||
|
shareTemplateId: string;
|
||||||
|
shareTemplateData: Record<string, unknown>;
|
||||||
|
showLittleTail: string;
|
||||||
|
gamePoints: string;
|
||||||
|
gamePointsUrl: string;
|
||||||
|
shareOrigin: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface MetaData {
|
||||||
|
detail_1: Detail;
|
||||||
|
}
|
94
src/core/packet/helper/miniAppHelper.ts
Normal file
94
src/core/packet/helper/miniAppHelper.ts
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
import {
|
||||||
|
MiniAppData,
|
||||||
|
MiniAppReqParams,
|
||||||
|
MiniAppRawData,
|
||||||
|
MiniAppReqCustomParams,
|
||||||
|
MiniAppReqTemplateParams
|
||||||
|
} from "@/core/packet/entities/miniApp";
|
||||||
|
|
||||||
|
type MiniAppTemplateNameList = "bili" | "weibo";
|
||||||
|
|
||||||
|
export abstract class MiniAppInfo {
|
||||||
|
static sdkId: string = "V1_PC_MINISDK_99.99.99_1_APP_A";
|
||||||
|
template: MiniAppReqTemplateParams;
|
||||||
|
|
||||||
|
private static appMap = new Map<MiniAppTemplateNameList, MiniAppInfo>();
|
||||||
|
|
||||||
|
protected constructor(template: MiniAppReqTemplateParams) {
|
||||||
|
this.template = template;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get(name: MiniAppTemplateNameList): MiniAppInfo | undefined {
|
||||||
|
return this.appMap.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Bili = new class extends MiniAppInfo {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
sdkId: MiniAppInfo.sdkId,
|
||||||
|
appId: "1109937557",
|
||||||
|
scene: 1,
|
||||||
|
templateType: 1,
|
||||||
|
businessType: 0,
|
||||||
|
verType: 3,
|
||||||
|
shareType: 0,
|
||||||
|
versionId: "cfc5f7b05b44b5956502edaecf9d2240",
|
||||||
|
withShareTicket: 0,
|
||||||
|
iconUrl: "https://miniapp.gtimg.cn/public/appicon/51f90239b78a2e4994c11215f4c4ba15_200.jpg"
|
||||||
|
});
|
||||||
|
MiniAppInfo.appMap.set("bili", this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static WeiBo = new class extends MiniAppInfo {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
sdkId: MiniAppInfo.sdkId,
|
||||||
|
appId: "1109224783",
|
||||||
|
scene: 1,
|
||||||
|
templateType: 1,
|
||||||
|
businessType: 0,
|
||||||
|
verType: 3,
|
||||||
|
shareType: 0,
|
||||||
|
versionId: "e482a3cc4e574d9b772e96ba6eec9ba2",
|
||||||
|
withShareTicket: 0,
|
||||||
|
iconUrl: "https://miniapp.gtimg.cn/public/appicon/35bbb44dc68e65194cfacfb206b8f1f7_200.jpg"
|
||||||
|
});
|
||||||
|
MiniAppInfo.appMap.set("weibo", this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class MiniAppInfoHelper {
|
||||||
|
static generateReq(custom: MiniAppReqCustomParams, template: MiniAppReqTemplateParams): MiniAppReqParams {
|
||||||
|
return {
|
||||||
|
...custom,
|
||||||
|
...template
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static RawToSend(rawData: MiniAppRawData): MiniAppData {
|
||||||
|
return {
|
||||||
|
ver: rawData.ver,
|
||||||
|
prompt: rawData.prompt,
|
||||||
|
config: rawData.config,
|
||||||
|
app: rawData.appName,
|
||||||
|
view: rawData.appView,
|
||||||
|
meta: rawData.metaData,
|
||||||
|
miniappShareOrigin: 3,
|
||||||
|
miniappOpenRefer: "10002",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static SendToRaw(data: MiniAppData): MiniAppRawData {
|
||||||
|
return {
|
||||||
|
appName: data.app,
|
||||||
|
appView: data.view,
|
||||||
|
ver: data.ver,
|
||||||
|
desc: data.meta.detail_1.desc,
|
||||||
|
prompt: data.prompt,
|
||||||
|
metaData: data.meta,
|
||||||
|
config: data.config,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@@ -13,7 +13,7 @@ import {
|
|||||||
PacketMsgPicElement,
|
PacketMsgPicElement,
|
||||||
PacketMsgPttElement,
|
PacketMsgPttElement,
|
||||||
PacketMsgVideoElement
|
PacketMsgVideoElement
|
||||||
} from "@/core/packet/msg/element";
|
} from "@/core/packet/message/element";
|
||||||
import { FileUploadExt, NTV2RichMediaHighwayExt } from "@/core/packet/proto/highway/highway";
|
import { FileUploadExt, NTV2RichMediaHighwayExt } from "@/core/packet/proto/highway/highway";
|
||||||
import { int32ip2str, oidbIpv4s2HighwayIpv4s } from "@/core/packet/highway/utils";
|
import { int32ip2str, oidbIpv4s2HighwayIpv4s } from "@/core/packet/highway/utils";
|
||||||
import { calculateSha1, calculateSha1StreamBytes, computeMd5AndLengthWithLimit } from "@/core/packet/utils/crypto/hash";
|
import { calculateSha1, calculateSha1StreamBytes, computeMd5AndLengthWithLimit } from "@/core/packet/utils/crypto/hash";
|
||||||
|
@@ -2,8 +2,8 @@ import * as crypto from "crypto";
|
|||||||
import { PushMsgBody } from "@/core/packet/proto/message/message";
|
import { PushMsgBody } from "@/core/packet/proto/message/message";
|
||||||
import { NapProtoEncodeStructType } from "@/core/packet/proto/NapProto";
|
import { NapProtoEncodeStructType } from "@/core/packet/proto/NapProto";
|
||||||
import { LogWrapper } from "@/common/log";
|
import { LogWrapper } from "@/common/log";
|
||||||
import { PacketMsg, PacketSendMsgElement } from "@/core/packet/msg/message";
|
import { PacketMsg, PacketSendMsgElement } from "@/core/packet/message/message";
|
||||||
import { IPacketMsgElement, PacketMsgTextElement } from "@/core/packet/msg/element";
|
import { IPacketMsgElement, PacketMsgTextElement } from "@/core/packet/message/element";
|
||||||
import { SendTextElement } from "@/core";
|
import { SendTextElement } from "@/core";
|
||||||
|
|
||||||
export class PacketMsgBuilder {
|
export class PacketMsgBuilder {
|
@@ -30,8 +30,8 @@ import {
|
|||||||
PacketMsgTextElement,
|
PacketMsgTextElement,
|
||||||
PacketMsgVideoElement,
|
PacketMsgVideoElement,
|
||||||
PacketMultiMsgElement
|
PacketMultiMsgElement
|
||||||
} from "@/core/packet/msg/element";
|
} from "@/core/packet/message/element";
|
||||||
import { PacketMsg, PacketSendMsgElement } from "@/core/packet/msg/message";
|
import { PacketMsg, PacketSendMsgElement } from "@/core/packet/message/message";
|
||||||
import { LogWrapper } from "@/common/log";
|
import { LogWrapper } from "@/common/log";
|
||||||
|
|
||||||
const SupportedElementTypes = [
|
const SupportedElementTypes = [
|
@@ -25,7 +25,7 @@ import {
|
|||||||
SendVideoElement
|
SendVideoElement
|
||||||
} from "@/core";
|
} from "@/core";
|
||||||
import { MsgInfo } from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
|
import { MsgInfo } from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
|
||||||
import { PacketMsg, PacketSendMsgElement } from "@/core/packet/msg/message";
|
import { PacketMsg, PacketSendMsgElement } from "@/core/packet/message/message";
|
||||||
import { ForwardMsgBuilder } from "@/common/forward-msg-builder";
|
import { ForwardMsgBuilder } from "@/common/forward-msg-builder";
|
||||||
import { FileExtra, GroupFileExtra } from "@/core/packet/proto/message/component";
|
import { FileExtra, GroupFileExtra } from "@/core/packet/proto/message/component";
|
||||||
import { OidbSvcTrpcTcp0XE37_800Response } from "@/core/packet/proto/oidb/Oidb.0XE37_800";
|
import { OidbSvcTrpcTcp0XE37_800Response } from "@/core/packet/proto/oidb/Oidb.0XE37_800";
|
@@ -1,4 +1,4 @@
|
|||||||
import { IPacketMsgElement } from "@/core/packet/msg/element";
|
import { IPacketMsgElement } from "@/core/packet/message/element";
|
||||||
import { SendMessageElement, SendStructLongMsgElement } from "@/core";
|
import { SendMessageElement, SendStructLongMsgElement } from "@/core";
|
||||||
|
|
||||||
export type PacketSendMsgElement = SendMessageElement | SendStructLongMsgElement
|
export type PacketSendMsgElement = SendMessageElement | SendStructLongMsgElement
|
@@ -10,22 +10,24 @@ import { OidbSvcTrpcTcp0XED3_1 } from "@/core/packet/proto/oidb/Oidb.0xED3_1";
|
|||||||
import { NTV2RichMediaReq } from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
|
import { NTV2RichMediaReq } from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
|
||||||
import { HttpConn0x6ff_501 } from "@/core/packet/proto/action/action";
|
import { HttpConn0x6ff_501 } from "@/core/packet/proto/action/action";
|
||||||
import { LongMsgResult, SendLongMsgReq } from "@/core/packet/proto/message/action";
|
import { LongMsgResult, SendLongMsgReq } from "@/core/packet/proto/message/action";
|
||||||
import { PacketMsgBuilder } from "@/core/packet/msg/builder";
|
import { PacketMsgBuilder } from "@/core/packet/message/builder";
|
||||||
import {
|
import {
|
||||||
PacketMsgFileElement,
|
PacketMsgFileElement,
|
||||||
PacketMsgPicElement,
|
PacketMsgPicElement,
|
||||||
PacketMsgPttElement,
|
PacketMsgPttElement,
|
||||||
PacketMsgVideoElement
|
PacketMsgVideoElement
|
||||||
} from "@/core/packet/msg/element";
|
} from "@/core/packet/message/element";
|
||||||
import { LogWrapper } from "@/common/log";
|
import { LogWrapper } from "@/common/log";
|
||||||
import { PacketMsg } from "@/core/packet/msg/message";
|
import { PacketMsg } from "@/core/packet/message/message";
|
||||||
import { OidbSvcTrpcTcp0x6D6 } from "@/core/packet/proto/oidb/Oidb.0x6D6";
|
import { OidbSvcTrpcTcp0x6D6 } from "@/core/packet/proto/oidb/Oidb.0x6D6";
|
||||||
import { OidbSvcTrpcTcp0XE37_1200 } from "@/core/packet/proto/oidb/Oidb.0xE37_1200";
|
import { OidbSvcTrpcTcp0XE37_1200 } from "@/core/packet/proto/oidb/Oidb.0xE37_1200";
|
||||||
import { PacketMsgConverter } from "@/core/packet/msg/converter";
|
import { PacketMsgConverter } from "@/core/packet/message/converter";
|
||||||
import { PacketClient } from "@/core/packet/client";
|
import { PacketClient } from "@/core/packet/client";
|
||||||
import { OidbSvcTrpcTcp0XE37_1700 } from "@/core/packet/proto/oidb/Oidb.0xE37_1700";
|
import { OidbSvcTrpcTcp0XE37_1700 } from "@/core/packet/proto/oidb/Oidb.0xE37_1700";
|
||||||
import { OidbSvcTrpcTcp0XE37_800 } from "@/core/packet/proto/oidb/Oidb.0XE37_800";
|
import { OidbSvcTrpcTcp0XE37_800 } from "@/core/packet/proto/oidb/Oidb.0XE37_800";
|
||||||
import { OidbSvcTrpcTcp0XEB7 } from "./proto/oidb/Oidb.0xEB7";
|
import { OidbSvcTrpcTcp0XEB7 } from "./proto/oidb/Oidb.0xEB7";
|
||||||
|
import { MiniAppReqParams } from "@/core/packet/entities/miniApp";
|
||||||
|
import { MiniAppAdaptShareInfoReq } from "@/core/packet/proto/action/miniAppAdaptShareInfo";
|
||||||
|
|
||||||
export type PacketHexStr = string & { readonly hexNya: unique symbol };
|
export type PacketHexStr = string & { readonly hexNya: unique symbol };
|
||||||
|
|
||||||
@@ -705,4 +707,41 @@ export class PacketPacker {
|
|||||||
}
|
}
|
||||||
), false, false);
|
), false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
packMiniAppAdaptShareInfo(req: MiniAppReqParams): PacketHexStr {
|
||||||
|
return this.packetPacket(
|
||||||
|
new NapProtoMsg(MiniAppAdaptShareInfoReq).encode(
|
||||||
|
{
|
||||||
|
appId: req.sdkId,
|
||||||
|
body: {
|
||||||
|
extInfo: {
|
||||||
|
field2: Buffer.alloc(0)
|
||||||
|
},
|
||||||
|
appid: req.appId,
|
||||||
|
title: req.title,
|
||||||
|
desc: req.desc,
|
||||||
|
time: BigInt(Date.now()),
|
||||||
|
scene: req.scene,
|
||||||
|
templateType: req.templateType,
|
||||||
|
businessType: req.businessType,
|
||||||
|
picUrl: req.picUrl,
|
||||||
|
vidUrl: "",
|
||||||
|
jumpUrl: req.jumpUrl,
|
||||||
|
iconUrl: req.iconUrl,
|
||||||
|
verType: req.verType,
|
||||||
|
shareType: req.shareType,
|
||||||
|
versionId: req.versionId,
|
||||||
|
withShareTicket: req.withShareTicket,
|
||||||
|
webURL: "",
|
||||||
|
appidRich: Buffer.alloc(0),
|
||||||
|
template: {
|
||||||
|
templateId: "",
|
||||||
|
templateData: ""
|
||||||
|
},
|
||||||
|
field20: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
49
src/core/packet/proto/action/miniAppAdaptShareInfo.ts
Normal file
49
src/core/packet/proto/action/miniAppAdaptShareInfo.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import { ScalarType } from "@protobuf-ts/runtime";
|
||||||
|
import { ProtoField } from "../NapProto";
|
||||||
|
|
||||||
|
export const MiniAppAdaptShareInfoReq = {
|
||||||
|
appId: ProtoField(2, ScalarType.STRING),
|
||||||
|
body: ProtoField(4, () => MiniAppAdaptShareInfoReqBody),
|
||||||
|
};
|
||||||
|
|
||||||
|
export const MiniAppAdaptShareInfoReqBody = {
|
||||||
|
extInfo: ProtoField(1, () => ExtInfo),
|
||||||
|
appid: ProtoField(2, ScalarType.STRING),
|
||||||
|
title: ProtoField(3, ScalarType.STRING),
|
||||||
|
desc: ProtoField(4, ScalarType.STRING),
|
||||||
|
time: ProtoField(5, ScalarType.UINT64),
|
||||||
|
scene: ProtoField(6, ScalarType.UINT32),
|
||||||
|
templateType: ProtoField(7, ScalarType.UINT32),
|
||||||
|
businessType: ProtoField(8, ScalarType.UINT32),
|
||||||
|
picUrl: ProtoField(9, ScalarType.STRING),
|
||||||
|
vidUrl: ProtoField(10, ScalarType.STRING),
|
||||||
|
jumpUrl: ProtoField(11, ScalarType.STRING),
|
||||||
|
iconUrl: ProtoField(12, ScalarType.STRING),
|
||||||
|
verType: ProtoField(13, ScalarType.UINT32),
|
||||||
|
shareType: ProtoField(14, ScalarType.UINT32),
|
||||||
|
versionId: ProtoField(15, ScalarType.STRING),
|
||||||
|
withShareTicket: ProtoField(16, ScalarType.UINT32),
|
||||||
|
webURL: ProtoField(17, ScalarType.STRING),
|
||||||
|
appidRich: ProtoField(18, ScalarType.BYTES),
|
||||||
|
template: ProtoField(19, () => Template),
|
||||||
|
field20: ProtoField(20, ScalarType.STRING),
|
||||||
|
};
|
||||||
|
|
||||||
|
export const ExtInfo = {
|
||||||
|
field2: ProtoField(2, ScalarType.BYTES),
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Template = {
|
||||||
|
templateId: ProtoField(1, ScalarType.STRING),
|
||||||
|
templateData: ProtoField(2, ScalarType.STRING),
|
||||||
|
};
|
||||||
|
|
||||||
|
export const MiniAppAdaptShareInfoResp = {
|
||||||
|
field2: ProtoField(2, ScalarType.UINT32),
|
||||||
|
field3: ProtoField(3, ScalarType.STRING),
|
||||||
|
content: ProtoField(4, () => MiniAppAdaptShareInfoRespContent),
|
||||||
|
};
|
||||||
|
|
||||||
|
export const MiniAppAdaptShareInfoRespContent = {
|
||||||
|
jsonContent: ProtoField(2, ScalarType.STRING),
|
||||||
|
};
|
85
src/onebot/action/extends/GetMiniAppArk.ts
Normal file
85
src/onebot/action/extends/GetMiniAppArk.ts
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
import {ActionName} from '../types';
|
||||||
|
import {FromSchema, JSONSchema} from 'json-schema-to-ts';
|
||||||
|
import {GetPacketStatusDepends} from "@/onebot/action/packet/GetPacketStatus";
|
||||||
|
import {MiniAppData, MiniAppRawData, MiniAppReqCustomParams, MiniAppReqParams} from "@/core/packet/entities/miniApp";
|
||||||
|
import {MiniAppInfo, MiniAppInfoHelper} from "@/core/packet/helper/miniAppHelper";
|
||||||
|
|
||||||
|
const SchemaData = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
type: {
|
||||||
|
type: 'string',
|
||||||
|
enum: ['bili', 'weibo']
|
||||||
|
},
|
||||||
|
title: {type: 'string'},
|
||||||
|
desc: {type: 'string'},
|
||||||
|
picUrl: {type: 'string'},
|
||||||
|
jumpUrl: {type: 'string'},
|
||||||
|
iconUrl: {type: 'string'},
|
||||||
|
sdkId: {type: 'string'},
|
||||||
|
appId: {type: 'string'},
|
||||||
|
scene: {type: ['number', 'string']},
|
||||||
|
templateType: {type: ['number', 'string']},
|
||||||
|
businessType: {type: ['number', 'string']},
|
||||||
|
verType: {type: ['number', 'string']},
|
||||||
|
shareType: {type: ['number', 'string']},
|
||||||
|
versionId: {type: 'string'},
|
||||||
|
withShareTicket: {type: ['number', 'string']},
|
||||||
|
rawArkData: {type: ['boolean', 'string']}
|
||||||
|
},
|
||||||
|
oneOf: [
|
||||||
|
{
|
||||||
|
required: ['type', 'title', 'desc', 'picUrl', 'jumpUrl']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: [
|
||||||
|
'title', 'desc', 'picUrl', 'jumpUrl',
|
||||||
|
'iconUrl', 'appId', 'scene', 'templateType', 'businessType',
|
||||||
|
'verType', 'shareType', 'versionId', 'withShareTicket'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
|
export class GetMiniAppArk extends GetPacketStatusDepends<Payload, {
|
||||||
|
data: MiniAppData | MiniAppRawData
|
||||||
|
}> {
|
||||||
|
actionName = ActionName.GetMiniAppArk;
|
||||||
|
payloadSchema = SchemaData;
|
||||||
|
|
||||||
|
async _handle(payload: Payload) {
|
||||||
|
let reqParam: MiniAppReqParams;
|
||||||
|
const customParams = {
|
||||||
|
title: payload.title,
|
||||||
|
desc: payload.desc,
|
||||||
|
picUrl: payload.picUrl,
|
||||||
|
jumpUrl: payload.jumpUrl
|
||||||
|
} as MiniAppReqCustomParams;
|
||||||
|
if (payload.type) {
|
||||||
|
reqParam = MiniAppInfoHelper.generateReq(customParams, MiniAppInfo.get(payload.type)!.template);
|
||||||
|
} else {
|
||||||
|
const { appId, scene, iconUrl, templateType, businessType, verType, shareType, versionId, withShareTicket } = payload as Required<Payload>;
|
||||||
|
reqParam = MiniAppInfoHelper.generateReq(
|
||||||
|
customParams,
|
||||||
|
{
|
||||||
|
sdkId: payload.sdkId ?? MiniAppInfo.sdkId,
|
||||||
|
appId: appId,
|
||||||
|
scene: +scene,
|
||||||
|
iconUrl: iconUrl,
|
||||||
|
templateType: +templateType,
|
||||||
|
businessType: +businessType,
|
||||||
|
verType: +verType,
|
||||||
|
shareType: +shareType,
|
||||||
|
versionId: versionId,
|
||||||
|
withShareTicket: +withShareTicket
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const arkData = await this.core.apis.PacketApi.sendMiniAppShareInfoReq(reqParam);
|
||||||
|
return {
|
||||||
|
data: Boolean(payload.rawArkData) ? arkData : MiniAppInfoHelper.RawToSend(arkData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,15 +1,22 @@
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName, BaseCheckResult } from '../types';
|
||||||
|
|
||||||
export class GetProfileLike extends BaseAction<void, any> {
|
interface Payload {
|
||||||
|
start: number,
|
||||||
|
count: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GetProfileLike extends BaseAction<Payload, any> {
|
||||||
actionName = ActionName.GetProfileLike;
|
actionName = ActionName.GetProfileLike;
|
||||||
|
|
||||||
async _handle(payload: void) {
|
async _handle(payload: Payload) {
|
||||||
const ret = await this.core.apis.UserApi.getProfileLike(this.core.selfInfo.uid);
|
const start = payload.start ? Number(payload.start) : 0;
|
||||||
const listdata: any[] = ret.info.userLikeInfos[0].favoriteInfo.userInfos;
|
const count = payload.count ? Number(payload.count) : 10;
|
||||||
|
const ret = await this.core.apis.UserApi.getProfileLike(this.core.selfInfo.uid, start, count);
|
||||||
|
const listdata: any[] = ret.info.userLikeInfos[0].voteInfo.userInfos;
|
||||||
for (let i = 0; i < listdata.length; i++) {
|
for (let i = 0; i < listdata.length; i++) {
|
||||||
listdata[i].uin = parseInt((await this.core.apis.UserApi.getUinByUidV2(listdata[i].uid)) || '');
|
listdata[i].uin = parseInt((await this.core.apis.UserApi.getUinByUidV2(listdata[i].uid)) || '');
|
||||||
}
|
}
|
||||||
return listdata;
|
return ret.info.userLikeInfos[0].voteInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,16 +1,15 @@
|
|||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName, BaseCheckResult } from '../types';
|
||||||
import { ChatType, Peer } from '@/core';
|
import { ChatType, Peer } from '@/core';
|
||||||
|
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
eventType: { type: 'string' },
|
event_type: { type: 'number' },
|
||||||
group_id: { type: 'string' },
|
user_id: { type: ['number', 'string'] },
|
||||||
user_id: { type: 'string' },
|
|
||||||
},
|
},
|
||||||
required: ['eventType'],
|
required: ['event_type','user_id'],
|
||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
type Payload = FromSchema<typeof SchemaData>;
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
@@ -19,23 +18,12 @@ export class SetInputStatus extends BaseAction<Payload, any> {
|
|||||||
actionName = ActionName.SetInputStatus;
|
actionName = ActionName.SetInputStatus;
|
||||||
|
|
||||||
async _handle(payload: Payload) {
|
async _handle(payload: Payload) {
|
||||||
let peer: Peer;
|
const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
||||||
if (payload.group_id) {
|
|
||||||
peer = {
|
|
||||||
chatType: ChatType.KCHATTYPEGROUP,
|
|
||||||
peerUid: payload.group_id,
|
|
||||||
};
|
|
||||||
} else if (payload.user_id) {
|
|
||||||
const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id);
|
|
||||||
if (!uid) throw new Error('uid is empty');
|
if (!uid) throw new Error('uid is empty');
|
||||||
peer = {
|
const peer = {
|
||||||
chatType: ChatType.KCHATTYPEC2C,
|
chatType: ChatType.KCHATTYPEC2C,
|
||||||
peerUid: uid,
|
peerUid: uid,
|
||||||
};
|
};
|
||||||
} else {
|
return await this.core.apis.MsgApi.sendShowInputStatusReq(peer, payload.event_type);
|
||||||
throw new Error('请指定 group_id 或 user_id');
|
|
||||||
}
|
|
||||||
|
|
||||||
return await this.core.apis.MsgApi.sendShowInputStatusReq(peer, parseInt(payload.eventType));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -98,6 +98,7 @@ import { GoCQHTTPCheckUrlSafely } from './go-cqhttp/GoCQHTTPCheckUrlSafely';
|
|||||||
import { GoCQHTTPGetModelShow } from './go-cqhttp/GoCQHTTPGetModelShow';
|
import { GoCQHTTPGetModelShow } from './go-cqhttp/GoCQHTTPGetModelShow';
|
||||||
import { GoCQHTTPSetModelShow } from './go-cqhttp/GoCQHTTPSetModelShow';
|
import { GoCQHTTPSetModelShow } from './go-cqhttp/GoCQHTTPSetModelShow';
|
||||||
import { GoCQHTTPDeleteFriend } from './go-cqhttp/GoCQHTTPDeleteFriend';
|
import { GoCQHTTPDeleteFriend } from './go-cqhttp/GoCQHTTPDeleteFriend';
|
||||||
|
import { GetMiniAppArk } from "@/onebot/action/extends/GetMiniAppArk";
|
||||||
|
|
||||||
|
|
||||||
export type ActionMap = Map<string, BaseAction<any, any>>;
|
export type ActionMap = Map<string, BaseAction<any, any>>;
|
||||||
@@ -210,6 +211,7 @@ export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCo
|
|||||||
// new UploadForwardMsg(obContext, core),
|
// new UploadForwardMsg(obContext, core),
|
||||||
new GetGroupShutList(obContext, core),
|
new GetGroupShutList(obContext, core),
|
||||||
new GetGroupFileUrl(obContext, core),
|
new GetGroupFileUrl(obContext, core),
|
||||||
|
new GetMiniAppArk(obContext, core),
|
||||||
];
|
];
|
||||||
const actionMap = new Map();
|
const actionMap = new Map();
|
||||||
for (const action of actionHandlers) {
|
for (const action of actionHandlers) {
|
||||||
|
@@ -11,8 +11,8 @@ import { decodeCQCode } from '@/onebot/cqcode';
|
|||||||
import { MessageUnique } from '@/common/message-unique';
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
import { ChatType, ElementType, NapCatCore, Peer, RawMessage, SendArkElement, SendMessageElement } from '@/core';
|
import { ChatType, ElementType, NapCatCore, Peer, RawMessage, SendArkElement, SendMessageElement } from '@/core';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { rawMsgWithSendMsg } from "@/core/packet/msg/converter";
|
import { rawMsgWithSendMsg } from "@/core/packet/message/converter";
|
||||||
import { PacketMsg } from "@/core/packet/msg/message";
|
import { PacketMsg } from "@/core/packet/message/message";
|
||||||
import { ForwardMsgBuilder } from "@/common/forward-msg-builder";
|
import { ForwardMsgBuilder } from "@/common/forward-msg-builder";
|
||||||
import { stringifyWithBigInt } from "@/common/helper";
|
import { stringifyWithBigInt } from "@/common/helper";
|
||||||
|
|
||||||
|
@@ -136,5 +136,6 @@ export enum ActionName {
|
|||||||
GetGroupIgnoredNotifies = 'get_group_ignored_notifies',
|
GetGroupIgnoredNotifies = 'get_group_ignored_notifies',
|
||||||
|
|
||||||
SetGroupSign = "set_group_sign",
|
SetGroupSign = "set_group_sign",
|
||||||
|
GetMiniAppArk = "get_mini_app_ark",
|
||||||
// UploadForwardMsg = "upload_forward_msg",
|
// UploadForwardMsg = "upload_forward_msg",
|
||||||
}
|
}
|
||||||
|
@@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
|
|||||||
SettingItem(
|
SettingItem(
|
||||||
'<span id="napcat-update-title">Napcat</span>',
|
'<span id="napcat-update-title">Napcat</span>',
|
||||||
void 0,
|
void 0,
|
||||||
SettingButton("V3.3.12", "napcat-update-button", "secondary")
|
SettingButton("V3.3.21", "napcat-update-button", "secondary")
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
Reference in New Issue
Block a user