Skip to content

Instantly share code, notes, and snippets.

@ONLym22
Created December 21, 2025 08:25
Show Gist options
  • Select an option

  • Save ONLym22/80cc7f6be5a3b3f928225f2a7e2fad93 to your computer and use it in GitHub Desktop.

Select an option

Save ONLym22/80cc7f6be5a3b3f928225f2a7e2fad93 to your computer and use it in GitHub Desktop.
ONLym BOT Gist Uploaded
case 'aio':
case 'alldl':
case 'download': {
if (!text)
return m.reply(
`Gunakan:\n${p_c} *url*\n\nContoh:\n${p_c} https://www.tiktok.com/@user/video/1234567`
)
if (!global.apikey)
return xreply("❌ API key belum diset di global.apikey")
xreact()
try {
const url = encodeURIComponent(text)
const apiUrl = `${global.api.base}/download/aio?url=${url}&apikey=${global.apikey}`
const res = await fetchJson(apiUrl)
if (!res || res.status !== true || !res.result) {
return xreply("❌ API gagal mengambil data atau link tidak didukung.")
}
const r = res.result
if (r.error) return m.reply(`❌ Error: ${r.error}`)
let caption = `*All In One Downloader*\n\n`
caption += `• Source : ${r.source || '-'}\n`
caption += `• Title : ${r.title || '-'}\n`
caption += `• Author : ${r.author || '-'}\n`
caption += `• Duration : ${r.duration || '-'}\n\n`
caption += `© ${wm}`
if (r.thumbnail && (!r.medias || r.medias[0]?.type !== 'audio')) {
await vellia.sendMessage(m.chat, { image: { url: r.thumbnail }, caption }, { quoted: m })
} else if (r.medias && r.medias[0]?.type === 'audio') {
await vellia.sendMessage(m.chat, { text: caption }, { quoted: m })
}
if (!r.medias || r.medias.length === 0) return m.reply("❌ Media tidak ditemukan.")
for (const media of r.medias) {
if (!media.url) continue
if (media.type === 'video') {
await vellia.sendMessage(
m.chat,
{
video: { url: media.url },
caption: `*Quality:* ${media.quality || '-'}\n*Format:* ${media.extension || '-'}`
},
{ quoted: m }
)
}
else if (media.type === 'audio') {
await vellia.sendMessage(
m.chat,
{
audio: { url: media.url },
mimetype: 'audio/mpeg',
fileName: `${r.title || 'audio'}.mp3`
},
{ quoted: m }
)
}
else if (media.type === 'image') {
await vellia.sendMessage(
m.chat,
{ image: { url: media.url } },
{ quoted: m }
)
}
if (r.medias.length > 1) await sleep(1500)
}
} catch (err) {
console.error("Error AIO DL:", err)
xreply("❌ Terjadi kesalahan teknis saat memproses link tersebut.")
}
}
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment