diff --git a/package.json b/package.json index 987f9d38..7b379f8a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "napcat", "private": true, "type": "module", - "version": "1.8.5", + "version": "1.8.6", "scripts": { "watch:dev": "vite --mode development", "watch:prod": "vite --mode production", diff --git a/src/onebot11/action/group/SetGroupBan.ts b/src/onebot11/action/group/SetGroupBan.ts index 27155b46..19bcec5b 100644 --- a/src/onebot11/action/group/SetGroupBan.ts +++ b/src/onebot11/action/group/SetGroupBan.ts @@ -3,6 +3,7 @@ import { getGroupMember } from '@/core/data'; import { ActionName } from '../types'; import { NTQQGroupApi } from '@/core/apis/group'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; +import { NTQQUserApi } from '@/core'; const SchemaData = { type: 'object', @@ -20,12 +21,8 @@ export default class SetGroupBan extends BaseAction { actionName = ActionName.SetGroupBan; PayloadSchema = SchemaData; protected async _handle(payload: Payload): Promise { - const member = await getGroupMember(payload.group_id, payload.user_id); - if (!member) { - throw `群成员${payload.user_id}不存在`; - } 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; } } diff --git a/src/onebot11/action/group/SetGroupKick.ts b/src/onebot11/action/group/SetGroupKick.ts index 2af20234..fa8df27b 100644 --- a/src/onebot11/action/group/SetGroupKick.ts +++ b/src/onebot11/action/group/SetGroupKick.ts @@ -3,6 +3,7 @@ import { getGroupMember } from '@/core/data'; import { ActionName } from '../types'; import { NTQQGroupApi } from '@/core/apis/group'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; +import { NTQQUserApi } from '@/core'; const SchemaData = { @@ -21,12 +22,8 @@ export default class SetGroupKick extends BaseAction { actionName = ActionName.SetGroupKick; PayloadSchema = SchemaData; protected async _handle(payload: Payload): Promise { - const member = await getGroupMember(payload.group_id, payload.user_id); - if (!member) { - throw `群成员${payload.user_id}不存在`; - } 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; } } diff --git a/src/onebot11/version.ts b/src/onebot11/version.ts index 4446404f..d8a11cba 100644 --- a/src/onebot11/version.ts +++ b/src/onebot11/version.ts @@ -1 +1 @@ -export const version = '1.8.5'; +export const version = '1.8.6'; diff --git a/src/webui/ui/NapCat.ts b/src/webui/ui/NapCat.ts index 8deb9045..d4fc4e37 100644 --- a/src/webui/ui/NapCat.ts +++ b/src/webui/ui/NapCat.ts @@ -29,7 +29,7 @@ async function onSettingWindowCreated(view: Element) { SettingItem( 'Napcat', undefined, - SettingButton('V1.8.5', 'napcat-update-button', 'secondary') + SettingButton('V1.8.6', 'napcat-update-button', 'secondary') ), ]), SettingList([ diff --git a/static/assets/renderer.js b/static/assets/renderer.js index f66b64a4..4f95ade3 100644 --- a/static/assets/renderer.js +++ b/static/assets/renderer.js @@ -163,7 +163,7 @@ async function onSettingWindowCreated(view) { SettingItem( 'Napcat', void 0, - SettingButton("V1.8.5", "napcat-update-button", "secondary") + SettingButton("V1.8.6", "napcat-update-button", "secondary") ) ]), SettingList([