From 56706f38382e7cdec7af9a53e0f9f9c665cd1a93 Mon Sep 17 00:00:00 2001 From: idranme Date: Tue, 3 Sep 2024 01:24:21 +0800 Subject: [PATCH] chore --- src/ntqqapi/entities.ts | 11 +++++------ src/onebot11/action/go-cqhttp/DownloadFile.ts | 3 ++- src/renderer/components/select.ts | 8 +++----- tsconfig.json | 1 + 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/ntqqapi/entities.ts b/src/ntqqapi/entities.ts index ced370c..3a8cc3e 100644 --- a/src/ntqqapi/entities.ts +++ b/src/ntqqapi/entities.ts @@ -295,7 +295,7 @@ export namespace SendElementEntities { } } - export function mface(emojiPackageId: number, emojiId: string, key: string, summary: string): SendMarketFaceElement { + export function mface(emojiPackageId: number, emojiId: string, key: string, summary?: string): SendMarketFaceElement { return { elementType: ElementType.MFACE, marketFaceElement: { @@ -309,9 +309,8 @@ export namespace SendElementEntities { } } - export function dice(resultId: number | null): SendFaceElement { + export function dice(resultId?: string | number): SendFaceElement { // 实际测试并不能控制结果 - // 随机1到6 if (isNullable(resultId)) resultId = Math.floor(Math.random() * 6) + 1 return { @@ -325,7 +324,7 @@ export namespace SendElementEntities { stickerId: '33', sourceType: 1, stickerType: 2, - resultId: resultId?.toString(), + resultId: resultId.toString(), surpriseId: '', // "randomType": 1, }, @@ -333,7 +332,7 @@ export namespace SendElementEntities { } // 猜拳(石头剪刀布)表情 - export function rps(resultId: number | null): SendFaceElement { + export function rps(resultId?: string | number): SendFaceElement { // 实际测试并不能控制结果 if (isNullable(resultId)) resultId = Math.floor(Math.random() * 3) + 1 return { @@ -347,7 +346,7 @@ export namespace SendElementEntities { stickerId: '34', sourceType: 1, stickerType: 2, - resultId: resultId?.toString(), + resultId: resultId.toString(), surpriseId: '', // "randomType": 1, }, diff --git a/src/onebot11/action/go-cqhttp/DownloadFile.ts b/src/onebot11/action/go-cqhttp/DownloadFile.ts index 2f25aa0..d8a5a9e 100644 --- a/src/onebot11/action/go-cqhttp/DownloadFile.ts +++ b/src/onebot11/action/go-cqhttp/DownloadFile.ts @@ -6,6 +6,7 @@ import { ActionName } from '../types' import { calculateFileMD5, fetchFile } from '@/common/utils' import { TEMP_DIR } from '@/common/globalVars' import { randomUUID } from 'node:crypto' +import { Dict } from 'cosmokit' interface Payload { thread_count?: number @@ -51,7 +52,7 @@ export class DownloadFile extends BaseAction { } getHeaders(headersIn?: string | string[]): Record { - const headers = {} + const headers: Dict = {} if (typeof headersIn == 'string') { headersIn = headersIn.split('[\\r\\n]') } diff --git a/src/renderer/components/select.ts b/src/renderer/components/select.ts index 8562491..344264b 100644 --- a/src/renderer/components/select.ts +++ b/src/renderer/components/select.ts @@ -38,11 +38,9 @@ window.customElements.define( const buttonClick = () => { const isHidden = this._context.classList.toggle('hidden') - window[`${isHidden ? 'remove' : 'add'}EventListener`]('pointerdown', windowPointerDown) - } - - const windowPointerDown = ({ target }) => { - if (!this.contains(target)) buttonClick() + window[`${isHidden ? 'remove' : 'add'}EventListener`]('pointerdown', ({ target }) => { + if (!this.contains(target as any)) buttonClick() + }) } this._button.addEventListener('click', buttonClick) diff --git a/tsconfig.json b/tsconfig.json index b2d3960..13c53f1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,7 @@ "module": "CommonJS", "outDir": "./dist", "strict": true, + "isolatedModules": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "experimentalDecorators": true,