This commit is contained in:
idranme
2024-09-03 01:24:21 +08:00
parent 387c9dcb52
commit 56706f3838
4 changed files with 11 additions and 12 deletions

View File

@@ -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,
},

View File

@@ -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<Payload, FileResponse> {
}
getHeaders(headersIn?: string | string[]): Record<string, string> {
const headers = {}
const headers: Dict = {}
if (typeof headersIn == 'string') {
headersIn = headersIn.split('[\\r\\n]')
}

View File

@@ -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)