release: 1.8.6

This commit is contained in:
手瓜一十雪 2024-08-09 21:41:56 +08:00
parent 717b246cb6
commit 6f6b258f22
6 changed files with 8 additions and 14 deletions

View File

@ -2,7 +2,7 @@
"name": "napcat", "name": "napcat",
"private": true, "private": true,
"type": "module", "type": "module",
"version": "1.8.5", "version": "1.8.6",
"scripts": { "scripts": {
"watch:dev": "vite --mode development", "watch:dev": "vite --mode development",
"watch:prod": "vite --mode production", "watch:prod": "vite --mode production",

View File

@ -3,6 +3,7 @@ import { getGroupMember } from '@/core/data';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { NTQQGroupApi } from '@/core/apis/group'; import { NTQQGroupApi } from '@/core/apis/group';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { NTQQUserApi } from '@/core';
const SchemaData = { const SchemaData = {
type: 'object', type: 'object',
@ -20,12 +21,8 @@ export default class SetGroupBan extends BaseAction<Payload, null> {
actionName = ActionName.SetGroupBan; actionName = ActionName.SetGroupBan;
PayloadSchema = SchemaData; PayloadSchema = SchemaData;
protected async _handle(payload: Payload): Promise<null> { protected async _handle(payload: Payload): Promise<null> {
const member = await getGroupMember(payload.group_id, payload.user_id);
if (!member) {
throw `群成员${payload.user_id}不存在`;
}
await NTQQGroupApi.banMember(payload.group_id.toString(), await NTQQGroupApi.banMember(payload.group_id.toString(),
[{ uid: member.uid, timeStamp: parseInt(payload.duration.toString()) }]); [{ uid: (await NTQQUserApi.getUidByUin(payload.user_id.toString()))!, timeStamp: parseInt(payload.duration.toString()) }]);
return null; return null;
} }
} }

View File

@ -3,6 +3,7 @@ import { getGroupMember } from '@/core/data';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { NTQQGroupApi } from '@/core/apis/group'; import { NTQQGroupApi } from '@/core/apis/group';
import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { NTQQUserApi } from '@/core';
const SchemaData = { const SchemaData = {
@ -21,12 +22,8 @@ export default class SetGroupKick extends BaseAction<Payload, null> {
actionName = ActionName.SetGroupKick; actionName = ActionName.SetGroupKick;
PayloadSchema = SchemaData; PayloadSchema = SchemaData;
protected async _handle(payload: Payload): Promise<null> { protected async _handle(payload: Payload): Promise<null> {
const member = await getGroupMember(payload.group_id, payload.user_id);
if (!member) {
throw `群成员${payload.user_id}不存在`;
}
const rejectReq = payload.reject_add_request?.toString() == 'true'; const rejectReq = payload.reject_add_request?.toString() == 'true';
await NTQQGroupApi.kickMember(payload.group_id.toString(), [member.uid], rejectReq); await NTQQGroupApi.kickMember(payload.group_id.toString(), [(await NTQQUserApi.getUidByUin(payload.user_id.toString()))!], rejectReq);
return null; return null;
} }
} }

View File

@ -1 +1 @@
export const version = '1.8.5'; export const version = '1.8.6';

View File

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

View File

@ -163,7 +163,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("V1.8.5", "napcat-update-button", "secondary") SettingButton("V1.8.6", "napcat-update-button", "secondary")
) )
]), ]),
SettingList([ SettingList([