failsaphe
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 40s

This commit is contained in:
Flummi 2023-05-01 15:51:41 +02:00
parent 9a55781a64
commit 4e6b337d4f

View File

@ -113,17 +113,18 @@ export default async bot => {
try { try {
if(mime == 'video/x-matroska') { // mkv failsafe if(mime == 'video/x-matroska') { // mkv failsafe
await queue.exec(`ffmpeg -i ./tmp/${uuid}.mkv -codec copy ./tmp/${uuid}.mp4`); await queue.exec(`ffmpeg -i ./tmp/${uuid}.mkv -codec copy ./tmp/${uuid}.mp4`);
await fs.promises.unlink(source); await fs.promises.unlink(source).catch(_=>{});
source = source.replace(/\.mkv$/, '.mp4'); source = source.replace(/\.mkv$/, '.mp4');
mime = 'video/mp4'; mime = 'video/mp4';
} }
if(source.match(/\.opus$/)) { // opus failsave if(source.match(/\.opus$/)) { // opus failsafe
await queue.exec(`ffmpeg -i ./tmp/${uuid}.opus -codec copy ./tmp/${uuid}.ogg`); await queue.exec(`ffmpeg -i ./tmp/${uuid}.opus -codec copy ./tmp/${uuid}.ogg`);
await fs.promises.unlink(source); await fs.promises.unlink(source);
source = source.replace(/\.opus$/, '.ogg'); source = source.replace(/\.opus$/, '.ogg');
mime = 'audio/ogg'; mime = 'audio/ogg';
} }
} catch(err) { } catch(err) {
await fs.promises.unlink(source).catch(_=>{});
if(e.type == 'tg') if(e.type == 'tg')
return await e.editMessageText(msg.result.chat.id, msg.result.message_id, "something went wrong lol"); return await e.editMessageText(msg.result.chat.id, msg.result.message_id, "something went wrong lol");
return await e.reply("something went wrong lol"); return await e.reply("something went wrong lol");