Last active
December 31, 2025 03:22
-
-
Save ONLym22/77bfe3339b79287a0f72ba2c6ebb0b75 to your computer and use it in GitHub Desktop.
Uploaded via ONLym Bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 📂 Source: JavaScript | |
| case "getgist": { | |
| if (!text && !m.quoted) return xreply(`Contoh: ${prefix + command} https://gist.github.com/username/id`); | |
| xreact(); | |
| try { | |
| const url = (text || m.quoted.text).trim(); | |
| const apiUrl = `https://onlym.my.id/tools/getgits?url=${encodeURIComponent(url)}`; | |
| const res = await fetch(apiUrl, { | |
| headers: { | |
| "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", | |
| "x-custom-auth": "ONLymHeaders", | |
| "Accept": "application/json" | |
| } | |
| }); | |
| const textRes = await res.text(); | |
| let json; | |
| try { | |
| json = JSON.parse(textRes); | |
| } catch { | |
| return xreply("❌ Respons bukan JSON, kemungkinan URL Gist salah atau API sedang bermasalah."); | |
| } | |
| if (!json.status) return xreply("❌ Gagal mengambil data dari Gist"); | |
| for (let i = 0; i < json.result.length; i++) { | |
| const file = json.result[i]; | |
| const caption = `📄 *Filename:* ${file.filename}\n• *Type:* ${file.type}\n• *Size:* ${file.size} bytes\n• *Raw URL:* ${file.raw_url}`; | |
| await vellia.sendMessage( | |
| m.chat, | |
| { | |
| text: caption, | |
| contextInfo: { | |
| forwardingScore: 999, | |
| isForwarded: true, | |
| forwardedNewsletterMessageInfo: { | |
| newsletterName: `${wm}`, | |
| newsletterJid: chjid + "@newsletter", | |
| }, | |
| }, | |
| }, | |
| { quoted: qkontak } | |
| ); | |
| if (file.content) { | |
| await vellia.sendMessage( | |
| m.chat, | |
| { | |
| document: Buffer.from(file.content), | |
| fileName: file.filename, | |
| mimetype: file.type || "application/javascript", | |
| contextInfo: { | |
| forwardingScore: 999, | |
| isForwarded: true, | |
| forwardedNewsletterMessageInfo: { | |
| newsletterName: `${wm}`, | |
| newsletterJid: chjid + "@newsletter", | |
| }, | |
| }, | |
| }, | |
| { quoted: qkontak } | |
| ); | |
| } | |
| } | |
| } catch (e) { | |
| console.error("Error getgist:", e); | |
| xreply(`❌ Terjadi kesalahan: ${e.message}`); | |
| } | |
| } | |
| break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment