mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix: Check pic fil name ext
This commit is contained in:
parent
1489c6df25
commit
b3aad8b0d9
@ -188,6 +188,7 @@ export const IMAGE_HTTP_HOST = 'https://gchat.qpic.cn'
|
|||||||
export const IMAGE_HTTP_HOST_NT = 'https://multimedia.nt.qq.com.cn'
|
export const IMAGE_HTTP_HOST_NT = 'https://multimedia.nt.qq.com.cn'
|
||||||
|
|
||||||
export interface PicElement {
|
export interface PicElement {
|
||||||
|
picType: PicType // 有这玩意儿吗
|
||||||
originImageUrl: string // http url, 没有host,host是https://gchat.qpic.cn/, 带download参数的是https://multimedia.nt.qq.com.cn
|
originImageUrl: string // http url, 没有host,host是https://gchat.qpic.cn/, 带download参数的是https://multimedia.nt.qq.com.cn
|
||||||
originImageMd5?: string
|
originImageMd5?: string
|
||||||
sourcePath: string // 图片本地路径
|
sourcePath: string // 图片本地路径
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import fastXmlParser, { XMLParser } from 'fast-xml-parser'
|
import fastXmlParser from 'fast-xml-parser'
|
||||||
import {
|
import {
|
||||||
OB11Group,
|
OB11Group,
|
||||||
OB11GroupMember,
|
OB11GroupMember,
|
||||||
@ -16,8 +16,7 @@ import {
|
|||||||
GrayTipElementSubType,
|
GrayTipElementSubType,
|
||||||
Group,
|
Group,
|
||||||
GroupMember,
|
GroupMember,
|
||||||
IMAGE_HTTP_HOST,
|
PicType,
|
||||||
IMAGE_HTTP_HOST_NT,
|
|
||||||
RawMessage,
|
RawMessage,
|
||||||
SelfInfo,
|
SelfInfo,
|
||||||
Sex,
|
Sex,
|
||||||
@ -25,7 +24,7 @@ import {
|
|||||||
User,
|
User,
|
||||||
VideoElement,
|
VideoElement,
|
||||||
} from '../ntqqapi/types'
|
} from '../ntqqapi/types'
|
||||||
import { deleteGroup, getFriend, getGroupMember, groups, selfInfo, tempGroupCodeMap } from '../common/data'
|
import { deleteGroup, getFriend, getGroupMember, selfInfo, tempGroupCodeMap } from '../common/data'
|
||||||
import { EventType } from './event/OB11BaseEvent'
|
import { EventType } from './event/OB11BaseEvent'
|
||||||
import { encodeCQCode } from './cqcode'
|
import { encodeCQCode } from './cqcode'
|
||||||
import { dbUtil } from '../common/db'
|
import { dbUtil } from '../common/db'
|
||||||
@ -156,7 +155,12 @@ export class OB11Constructor {
|
|||||||
else if (element.picElement) {
|
else if (element.picElement) {
|
||||||
message_data['type'] = 'image'
|
message_data['type'] = 'image'
|
||||||
// message_data["data"]["file"] = element.picElement.sourcePath
|
// message_data["data"]["file"] = element.picElement.sourcePath
|
||||||
message_data['data']['file'] = element.picElement.fileName
|
let fileName = element.picElement.fileName;
|
||||||
|
const sourcePath = element.picElement.sourcePath;
|
||||||
|
if (element.picElement.picType === PicType.gif && !fileName.endsWith('.gif')){
|
||||||
|
fileName += ".gif";
|
||||||
|
}
|
||||||
|
message_data['data']['file'] = fileName
|
||||||
// message_data["data"]["path"] = element.picElement.sourcePath
|
// message_data["data"]["path"] = element.picElement.sourcePath
|
||||||
// let currentRKey = "CAQSKAB6JWENi5LMk0kc62l8Pm3Jn1dsLZHyRLAnNmHGoZ3y_gDZPqZt-64"
|
// let currentRKey = "CAQSKAB6JWENi5LMk0kc62l8Pm3Jn1dsLZHyRLAnNmHGoZ3y_gDZPqZt-64"
|
||||||
|
|
||||||
@ -164,9 +168,9 @@ export class OB11Constructor {
|
|||||||
// message_data["data"]["file_id"] = element.picElement.fileUuid
|
// message_data["data"]["file_id"] = element.picElement.fileUuid
|
||||||
message_data['data']['file_size'] = element.picElement.fileSize
|
message_data['data']['file_size'] = element.picElement.fileSize
|
||||||
dbUtil
|
dbUtil
|
||||||
.addFileCache(element.picElement.fileName, {
|
.addFileCache(fileName, {
|
||||||
fileName: element.picElement.fileName,
|
fileName,
|
||||||
filePath: element.picElement.sourcePath,
|
filePath: sourcePath,
|
||||||
fileSize: element.picElement.fileSize.toString(),
|
fileSize: element.picElement.fileSize.toString(),
|
||||||
url: message_data['data']['url'],
|
url: message_data['data']['url'],
|
||||||
downloadFunc: async () => {
|
downloadFunc: async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user