mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 13:01:14 +00:00
Merge branch 'main' into upmain
This commit is contained in:
commit
485efa7d44
@ -4,7 +4,7 @@
|
||||
"name": "NapCatQQ",
|
||||
"slug": "NapCat.Framework",
|
||||
"description": "高性能的 OneBot 11 协议实现",
|
||||
"version": "2.2.5",
|
||||
"version": "2.2.6",
|
||||
"icon": "./logo.png",
|
||||
"authors": [
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "napcat",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"version": "2.2.5",
|
||||
"version": "2.2.6",
|
||||
"scripts": {
|
||||
"build:framework": "vite build --mode framework",
|
||||
"build:shell": "vite build --mode shell",
|
||||
|
@ -2,7 +2,7 @@ import path, { dirname } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import fs from 'fs';
|
||||
|
||||
export const napcat_version = '2.2.5';
|
||||
export const napcat_version = '2.2.6';
|
||||
|
||||
export class NapCatPathWrapper {
|
||||
binaryPath: string;
|
||||
|
@ -224,6 +224,10 @@ export class NTQQGroupApi {
|
||||
async kickMemberV2Inner(param: kickMemberV2Req) {
|
||||
return this.context.session.getGroupService().kickMemberV2(param);
|
||||
}
|
||||
async deleteGroupBulletin(GroupCode: string, feedId: string) {
|
||||
const _Pskey = (await this.core.apis.UserApi.getPSkey(['qun.qq.com'])).domainPskeyMap.get('qun.qq.com')!;
|
||||
return this.context.session.getGroupService().deleteGroupBulletin(GroupCode, _Pskey, feedId);
|
||||
}
|
||||
async quitGroupV2(GroupCode: string, needDeleteLocalMsg: boolean) {
|
||||
let param = {
|
||||
groupCode: GroupCode,
|
||||
|
@ -20,8 +20,7 @@ export class NTQQWebApi {
|
||||
|
||||
async shareDigest(groupCode: string, msgSeq: string, msgRandom: string, targetGroupCode: string) {
|
||||
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
||||
const url = `https://qun.qq.com/cgi-bin/group_digest/share_digest?${
|
||||
new URLSearchParams({
|
||||
const url = `https://qun.qq.com/cgi-bin/group_digest/share_digest?${new URLSearchParams({
|
||||
bkn: this.getBknFromCookie(cookieObject),
|
||||
group_code: groupCode,
|
||||
msg_seq: msgSeq,
|
||||
@ -38,8 +37,7 @@ export class NTQQWebApi {
|
||||
|
||||
async getGroupEssenceMsg(GroupCode: string, page_start: string) {
|
||||
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
||||
const url = `https://qun.qq.com/cgi-bin/group_digest/digest_list?${
|
||||
new URLSearchParams({
|
||||
const url = `https://qun.qq.com/cgi-bin/group_digest/digest_list?${new URLSearchParams({
|
||||
bkn: this.getBknFromCookie(cookieObject),
|
||||
group_code: GroupCode,
|
||||
page_start,
|
||||
@ -65,8 +63,7 @@ export class NTQQWebApi {
|
||||
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
||||
const retList: Promise<WebApiGroupMemberRet>[] = [];
|
||||
const fastRet = await RequestUtil.HttpGetJson<WebApiGroupMemberRet>
|
||||
(`https://qun.qq.com/cgi-bin/qun_mgr/search_group_members?${
|
||||
new URLSearchParams({
|
||||
(`https://qun.qq.com/cgi-bin/qun_mgr/search_group_members?${new URLSearchParams({
|
||||
st: '0',
|
||||
end: '40',
|
||||
sort: '1',
|
||||
@ -86,8 +83,7 @@ export class NTQQWebApi {
|
||||
//遍历批量请求
|
||||
for (let i = 2; i <= PageNum; i++) {
|
||||
const ret = RequestUtil.HttpGetJson<WebApiGroupMemberRet>
|
||||
(`https://qun.qq.com/cgi-bin/qun_mgr/search_group_members?${
|
||||
new URLSearchParams({
|
||||
(`https://qun.qq.com/cgi-bin/qun_mgr/search_group_members?${new URLSearchParams({
|
||||
st: ((i - 1) * 40).toString(),
|
||||
end: (i * 40).toString(),
|
||||
sort: '1',
|
||||
@ -127,8 +123,7 @@ export class NTQQWebApi {
|
||||
let ret: any = undefined;
|
||||
try {
|
||||
ret = await RequestUtil.HttpGetJson<any>
|
||||
(`https://web.qun.qq.com/cgi-bin/announce/add_qun_notice${
|
||||
new URLSearchParams({
|
||||
(`https://web.qun.qq.com/cgi-bin/announce/add_qun_notice${new URLSearchParams({
|
||||
bkn: this.getBknFromCookie(cookieObject),
|
||||
qid: GroupCode,
|
||||
text: Content,
|
||||
@ -147,15 +142,10 @@ export class NTQQWebApi {
|
||||
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
||||
let ret: WebApiGroupNoticeRet | undefined = undefined;
|
||||
try {
|
||||
ret = await RequestUtil.HttpGetJson<WebApiGroupNoticeRet>(`https://web.qun.qq.com/cgi-bin/announce/get_t_list?${
|
||||
new URLSearchParams({
|
||||
bkn: this.getBknFromCookie(cookieObject),
|
||||
qid: GroupCode,
|
||||
type: '1',
|
||||
start: '0',
|
||||
num: '1',
|
||||
}).toString()
|
||||
}`, 'GET', '', { 'Cookie': this.cookieToString(cookieObject) });
|
||||
const url = 'https://web.qun.qq.com/cgi-bin/announce/get_t_list?bkn=' +
|
||||
this.getBknFromCookie(cookieObject) + '&qid=' + GroupCode + '&ft=23&ni=1&n=1&i=1&log_read=1&platform=1&s=-1&n=20';
|
||||
|
||||
ret = await RequestUtil.HttpGetJson<WebApiGroupNoticeRet>(url, 'GET', '', { 'Cookie': this.cookieToString(cookieObject) });
|
||||
if (ret?.ec !== 0) {
|
||||
return undefined;
|
||||
}
|
||||
@ -168,8 +158,7 @@ export class NTQQWebApi {
|
||||
async getGroupHonorInfo(groupCode: string, getType: WebHonorType) {
|
||||
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
||||
const getDataInternal = async (Internal_groupCode: string, Internal_type: number) => {
|
||||
const url = `https://qun.qq.com/interactive/honorlist?${
|
||||
new URLSearchParams({
|
||||
const url = `https://qun.qq.com/interactive/honorlist?${new URLSearchParams({
|
||||
gc: Internal_groupCode,
|
||||
type: Internal_type.toString(),
|
||||
}).toString()
|
||||
|
@ -209,7 +209,7 @@ export interface NodeIKernelGroupService {
|
||||
|
||||
getGroupBulletin(groupCode: string): unknown;
|
||||
|
||||
deleteGroupBulletin(groupCode: string, seq: string): void;
|
||||
deleteGroupBulletin(groupCode: string, seq: string, feedId: string): void;
|
||||
|
||||
publishGroupBulletin(groupCode: string, pskey: string, data: any): Promise<GeneralCallResult>;
|
||||
|
||||
|
28
src/onebot/action/group/DelGroupNotice.ts
Normal file
28
src/onebot/action/group/DelGroupNotice.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { WebApiGroupNoticeFeed } from '@/core';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
|
||||
|
||||
const SchemaData = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
group_id: { type: ['number', 'string'] },
|
||||
feed_id: { type: 'string' },
|
||||
},
|
||||
required: ['group_id','feed_id'],
|
||||
} as const satisfies JSONSchema;
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class DelGroupNotice extends BaseAction<Payload, any> {
|
||||
actionName = ActionName.DelGroupNotice;
|
||||
PayloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
const NTQQGroupApi = this.CoreContext.apis.GroupApi;
|
||||
const group = payload.group_id.toString();
|
||||
const feedId = payload.feed_id;
|
||||
return await NTQQGroupApi.deleteGroupBulletin(group, feedId);
|
||||
}
|
||||
}
|
@ -80,6 +80,7 @@ import GetGuildProfile from './guild/GetGuildProfile';
|
||||
import SetModelShow from './go-cqhttp/SetModelShow';
|
||||
import { SetInputStatus } from './extends/SetInputStatus';
|
||||
import { GetCSRF } from './system/GetCSRF';
|
||||
import { DelGroupNotice } from './group/DelGroupNotice';
|
||||
|
||||
export type ActionMap = Map<string, BaseAction<any, any>>;
|
||||
|
||||
@ -169,6 +170,7 @@ export function createActionMap(onebotContext: NapCatOneBot11Adapter, coreContex
|
||||
new SetModelShow(onebotContext, coreContext),
|
||||
new SetInputStatus(onebotContext, coreContext),
|
||||
new GetCSRF(onebotContext, coreContext),
|
||||
new DelGroupNotice(onebotContext, coreContext),
|
||||
];
|
||||
const actionMap = new Map();
|
||||
for (const action of actionHandlers) {
|
||||
|
@ -171,7 +171,7 @@ const _handlers: {
|
||||
} else {
|
||||
postData = data;
|
||||
}
|
||||
// Mlikiowa V2.2.5 Refactor Todo
|
||||
// Mlikiowa V2.2.6 Refactor Todo
|
||||
const signUrl = obContext.configLoader.configData.musicSignUrl;
|
||||
if (!signUrl) {
|
||||
if (data.type === 'qq') {
|
||||
|
@ -109,4 +109,5 @@ export enum ActionName {
|
||||
SetModelShow = "_set_model_show",
|
||||
SetInputStatus = "set_input_status",
|
||||
GetCSRF = "get_csrf_token",
|
||||
DelGroupNotice = "_del_group_notice",
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) {
|
||||
SettingItem(
|
||||
'<span id="napcat-update-title">Napcat</span>',
|
||||
undefined,
|
||||
SettingButton('V2.2.5', 'napcat-update-button', 'secondary'),
|
||||
SettingButton('V2.2.6', 'napcat-update-button', 'secondary'),
|
||||
),
|
||||
]),
|
||||
SettingList([
|
||||
|
@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
|
||||
SettingItem(
|
||||
'<span id="napcat-update-title">Napcat</span>',
|
||||
void 0,
|
||||
SettingButton("V2.2.5", "napcat-update-button", "secondary")
|
||||
SettingButton("V2.2.6", "napcat-update-button", "secondary")
|
||||
)
|
||||
]),
|
||||
SettingList([
|
||||
|
Loading…
Reference in New Issue
Block a user