mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-03-10 12:49:57 +00:00
conf: delete video from server
This commit is contained in:
parent
9e2c1104ba
commit
452aed5fd3
@ -1,4 +1,5 @@
|
||||
var exec = require('child_process').exec;
|
||||
const fs = require('fs');
|
||||
|
||||
async function DownloadFromYoutube(command) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -18,11 +19,16 @@ module.exports = (bot) => {
|
||||
const args = ctx.message.text.split(' ').slice(1).join(' ');
|
||||
const ytCommand = 'yt-dlp ' + args + ' -o video.mp4';
|
||||
await DownloadFromYoutube(ytCommand);
|
||||
try{
|
||||
await ctx.replyWithVideo({source: 'video.mp4'});
|
||||
}catch (error){
|
||||
console.log(error);
|
||||
}
|
||||
try {
|
||||
await ctx.replyWithVideo({ source: 'video.mp4' });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
try {
|
||||
fs.unlinkSync('video.mp4');
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user