This commit is contained in:
idranme 2024-08-28 10:25:17 +08:00
parent 738b0a96a0
commit 6be6151d73
No known key found for this signature in database
GPG Key ID: 926F7B5B668E495F
7 changed files with 12 additions and 7 deletions

View File

@ -143,7 +143,7 @@ export async function uri2local(uri: string, filename?: string): Promise<Uri2Loc
await fsPromise.writeFile(filePath, res.data) await fsPromise.writeFile(filePath, res.data)
return { success: true, errMsg: '', fileName: filename, path: filePath, isLocal: false } return { success: true, errMsg: '', fileName: filename, path: filePath, isLocal: false }
} catch (e: any) { } catch (e: any) {
const errMsg = `${uri}下载失败,` + e.toString() const errMsg = `${uri} 下载失败, ${e.message}`
return { success: false, errMsg, fileName: '', path: '', isLocal: false } return { success: false, errMsg, fileName: '', path: '', isLocal: false }
} }
} }

View File

@ -9,6 +9,7 @@ export function calcQQLevel(level: QQLevel) {
return crownNum * 64 + sunNum * 16 + moonNum * 4 + starNum return crownNum * 64 + sunNum * 16 + moonNum * 4 + starNum
} }
/** QQ Build Version */
export function getBuildVersion(): number { export function getBuildVersion(): number {
const version: string = globalThis.LiteLoader.versions.qqnt const version: string = globalThis.LiteLoader.versions.qqnt
return +version.split('-')[1] return +version.split('-')[1]

View File

@ -303,6 +303,8 @@ export namespace SendMsgElementConstructor {
return { return {
elementType: ElementType.MFACE, elementType: ElementType.MFACE,
marketFaceElement: { marketFaceElement: {
imageWidth: 300,
imageHeight: 300,
emojiPackageId, emojiPackageId,
emojiId, emojiId,
key, key,

View File

@ -335,6 +335,8 @@ export interface MarketFaceElement {
faceName?: string faceName?: string
emojiId: string emojiId: string
key: string key: string
imageWidth?: number
imageHeight?: number
} }
export interface VideoElement { export interface VideoElement {

View File

@ -14,9 +14,9 @@ export default class Debug extends BaseAction<Payload, any> {
const { ntMsgApi, ntFileApi, ntFileCacheApi, ntFriendApi, ntGroupApi, ntUserApi, ntWindowApi } = this.ctx const { ntMsgApi, ntFileApi, ntFileCacheApi, ntFriendApi, ntGroupApi, ntUserApi, ntWindowApi } = this.ctx
const ntqqApi = [ntMsgApi, ntFriendApi, ntGroupApi, ntUserApi, ntFileApi, ntFileCacheApi, ntWindowApi] const ntqqApi = [ntMsgApi, ntFriendApi, ntGroupApi, ntUserApi, ntFileApi, ntFileCacheApi, ntWindowApi]
for (const ntqqApiClass of ntqqApi) { for (const ntqqApiClass of ntqqApi) {
const method = ntqqApiClass[payload.method] const method = ntqqApiClass[payload.method] as Function
if (method) { if (method) {
const result = method(...payload.args) const result = method.apply(ntqqApiClass, payload.args)
if (method.constructor.name === 'AsyncFunction') { if (method.constructor.name === 'AsyncFunction') {
return await result return await result
} }

View File

@ -113,7 +113,7 @@ class OB11Http {
this.ctx.logger.error(err) this.ctx.logger.error(err)
throw err throw err
} }
this.expressAPP[method](url, this.authorize, async (req: Request, res: Response) => { this.expressAPP[method](url, this.authorize.bind(this), async (req: Request, res: Response) => {
let payload = req.body let payload = req.body
if (method == 'get') { if (method == 'get') {
payload = req.query payload = req.query

View File

@ -119,7 +119,7 @@ export async function createSendElements(
case OB11MessageDataType.mface: { case OB11MessageDataType.mface: {
sendElements.push( sendElements.push(
SendMsgElementConstructor.mface( SendMsgElementConstructor.mface(
sendMsg.data.emoji_package_id, +sendMsg.data.emoji_package_id,
sendMsg.data.emoji_id, sendMsg.data.emoji_id,
sendMsg.data.key, sendMsg.data.key,
sendMsg.data.summary, sendMsg.data.summary,
@ -203,8 +203,8 @@ async function handleOb11FileLikeMessage(
} = (await uri2local(inputdata?.url || inputdata.file)) } = (await uri2local(inputdata?.url || inputdata.file))
if (!success) { if (!success) {
ctx.logger.error('文件下载失败', errMsg) ctx.logger.error(errMsg)
throw Error('文件下载失败' + errMsg) throw Error(errMsg)
} }
if (!isLocal) { // 只删除http和base64转过来的文件 if (!isLocal) { // 只删除http和base64转过来的文件