mirror of https://github.com/Nofated095/Q2TG.git
fix: recovery message type undefinded
This commit is contained in:
parent
6713eb37dc
commit
ba52c663a0
|
@ -252,12 +252,18 @@ export default class {
|
||||||
await this.updateStatusMessage();
|
await this.updateStatusMessage();
|
||||||
const { fileTypeFromFile } = await (Function('return import("file-type")')() as Promise<typeof import('file-type')>);
|
const { fileTypeFromFile } = await (Function('return import("file-type")')() as Promise<typeof import('file-type')>);
|
||||||
for (const [fileKey, filePath] of Object.entries(this.filesMap)) {
|
for (const [fileKey, filePath] of Object.entries(this.filesMap)) {
|
||||||
const type = fileKey.endsWith('.tgs') ? {
|
let type = fileKey.endsWith('.tgs') ? {
|
||||||
ext: 'tgs',
|
ext: 'tgs',
|
||||||
mime: 'application/x-tgsticker',
|
mime: 'application/x-tgsticker',
|
||||||
} : await fileTypeFromFile(filePath);
|
} : await fileTypeFromFile(filePath);
|
||||||
|
if(!type){
|
||||||
|
type = {
|
||||||
|
ext: 'bin',
|
||||||
|
mime: 'application/octet-stream',
|
||||||
|
}
|
||||||
|
}
|
||||||
let media: Api.TypeInputMedia;
|
let media: Api.TypeInputMedia;
|
||||||
if (['webp', 'tgs'].includes(type.ext)) {
|
if (['.webp', '.tgs'].includes(path.extname(filePath))) {
|
||||||
// 贴纸
|
// 贴纸
|
||||||
media = new Api.InputMediaUploadedDocument({
|
media = new Api.InputMediaUploadedDocument({
|
||||||
file: await importSession.uploadFile(new CustomFile(
|
file: await importSession.uploadFile(new CustomFile(
|
||||||
|
|
Loading…
Reference in New Issue