JAVA SCRIPT GRENTZY <\0>
Открыть в Telegram
389
Подписчики
Нет данных24 часа
+307 дней
+12330 дней
Архив постов
bot.command('mp3', async (ctx) => {
try {
const chatId = ctx.chat.id;
const userId = ctx.from.id;
const reply = ctx.message.reply_to_message;
let videoFile = null;
if (reply && reply.video) {
videoFile = reply.video;
} else if (reply && reply.document && reply.document.mime_type && reply.document.mime_type.startsWith('video/')) {
videoFile = reply.document;
} else if (ctx.message.video) {
videoFile = ctx.message.video;
} else if (ctx.message.document && ctx.message.document.mime_type && ctx.message.document.mime_type.startsWith('video/')) {
videoFile = ctx.message.document;
}
if (!videoFile) {
await ctx.reply(
'😮💨 *Format salah!*\n' +
'Balas pesan video dengan `/mp3` atau kirim video langsung dengan caption `/mp3`.',
{ parse_mode: 'Markdown' }
);
return;
}
const fileId = videoFile.file_id;
const fileName = videoFile.file_name || 'video.mp4';
const statusMsg = await ctx.reply('⏳ *Mengunduh video dan mengonversi ke MP3...*', { parse_mode: 'Markdown' });
const file = await ctx.telegram.getFile(fileId);
const fileUrl = `https://api.telegram.org/file/bot${BOT_TOKEN}/${file.file_path}`;
try {
const ffmpeg = require('fluent-ffmpeg');
const os = require('os');
const tempDir = os.tmpdir();
const inputPath = path.join(tempDir, `input_${Date.now()}.mp4`);
const outputPath = path.join(tempDir, `output_${Date.now()}.mp3`);
const response = await axios.get(fileUrl, { responseType: 'stream' });
const writer = fs.createWriteStream(inputPath);
response.data.pipe(writer);
await new Promise((resolve, reject) => {
writer.on('finish', resolve);
writer.on('error', reject);
});
await new Promise((resolve, reject) => {
ffmpeg(inputPath)
.toFormat('mp3')
.on('end', resolve)
.on('error', reject)
.save(outputPath);
});
await ctx.replyWithAudio({ source: outputPath }, {
caption: `😎 *Konversi berhasil!*\n📄 ${fileName.replace(/\.[^/.]+$/, '')}.mp3`,
parse_mode: 'Markdown'
});
fs.unlinkSync(inputPath);
fs.unlinkSync(outputPath);
await ctx.deleteMessage(statusMsg.message_id);
} catch (ffmpegError) {
console.warn('FFmpeg tidak tersedia atau error:', ffmpegError.message);
await ctx.replyWithAudio(fileId, {
caption: `⚠️ *Konversi tidak dilakukan (FFmpeg tidak tersedia)*\nFile dikirim sebagai audio mentah.`,
parse_mode: 'Markdown'
});
await ctx.deleteMessage(statusMsg.message_id);
}
} catch (error) {
console.error('Error /mp3:', error.message);
await ctx.reply(`Erorr bang😮💨: ${error.message}`);
}
});
Case bot.command buat konversi video menjadi audio Create @GrenTzy
14 авг., 08:25
https://t.me/+OnVSogIFjfU0ZmM1
Gb panel free cuy yg mau join
14 авг., 07:55
NEW BOT BUILD APP
Fitur :
• Build App
• Build Web
• Rineme All
• Add Function
• Ubah Warna
• Dll
Bot : @ryuubuildapp_bot
06 авг., 00:06
+1
https://khususbanding749-ai.github.io/Web-cek-error-base-berupa-index.js-dll
Web buat cek error pada base berupa index.js
05 авг., 08:14
https://khususbanding749-ai.github.io/WebGrenTzy/
Yang mau web putar lagu dan video nih
05 авг., 02:49
Ada yang mau gak nih ?
Btw yang suka ngedit pake am ini berguna banget menurut gue jadi kalian bisa cek apakah xml itu ada eror atau gaknya
03 авг., 20:05
Kadang heran sama orang, siap dibantu bukan nya makasih malah ngatain, otak nya dimana? Mana hasil kita ditunjukin ke orang dan dibilang hasil dia sendiri... Otak nya itu loh, ntah kurang didikan orang tua atau gak ada orang tua 🤦♂🤦♂
01 авг., 23:43
