Last active
December 16, 2025 08:12
-
-
Save ONLym22/caac2c5c616d584f32bade3d0f2669eb to your computer and use it in GitHub Desktop.
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
| // pastikan untuk npm install iqc-canvas sebelum menggunakan fitur. | |
| const path = require("path"); | |
| const fs = require("fs"); | |
| const { generateIQC } = require("iqc-canvas"); | |
| const { pathToFileURL } = require("url"); | |
| const assetsPath = path.resolve( | |
| process.cwd(), | |
| "node_modules/iqc-canvas/assets" | |
| ); | |
| process.env.IQC_ASSET_PATH = pathToFileURL(assetsPath).href; | |
| let handler = async (m, { alip, text, isCreator, Reply }) => { | |
| if (!isRegistered(m.sender) && !isCreator) | |
| return Reply(global.mess.verifikasi); | |
| if (checkLimit(m.sender, global.isPrem(m.sender), isCreator)) | |
| return Reply(global.mess.limit); | |
| addLimit(m.sender, global.isPrem(m.sender), isCreator); | |
| if (!text) | |
| return Reply( | |
| `*Cara pakai iPhone Quote:* | |
| .iqc teks|waktu | |
| *Contoh:* | |
| .iqc Kata gue mah mending Alise MD π|23.13 | |
| *Dengan opsi:* | |
| .iqc teks|waktu|baterai|operator|wifi|timebar | |
| *Contoh lengkap:* | |
| .iqc Hello World|15:30|85|true|true|true | |
| *Keterangan:* | |
| β’ Baterai: 0β100 | |
| β’ Operator|Wifi|Timebar: *true / false*` | |
| ); | |
| let quoteText, quoteTime, battery, operator, wifi, timebar; | |
| if (text.includes("|")) { | |
| [ | |
| quoteText, | |
| quoteTime, | |
| battery, | |
| operator, | |
| wifi, | |
| timebar | |
| ] = text.split("|").map(v => v.trim()); | |
| } else { | |
| quoteText = text; | |
| const now = new Date(); | |
| quoteTime = | |
| String(now.getHours()).padStart(2, "0") + | |
| "." + | |
| String(now.getMinutes()).padStart(2, "0"); | |
| } | |
| if (!quoteText || quoteText.length > 200) | |
| return Reply("β Teks quote wajib dan maksimal 200 karakter."); | |
| if (!/^([0-1]?[0-9]|2[0-3])[:.]([0-5][0-9])$/.test(quoteTime)) | |
| return Reply("β Format waktu salah! Gunakan HH.MM atau HH:MM"); | |
| quoteTime = quoteTime.replace(":", "."); | |
| const options = { | |
| baterai: battery ? [true, String(battery)] : [false, "0"], | |
| operator: operator === "true" || operator === "1", | |
| wifi: wifi === "true" || wifi === "1", | |
| timebar: timebar === "true" || timebar === "1", | |
| }; | |
| // β³ Pesan ini SEKARANG TIDAK AKAN DIHAPUS | |
| await Reply("β³ Membuat iPhone Quote..."); | |
| try { | |
| const result = await generateIQC(quoteText, quoteTime, options); | |
| if (!result?.success) throw new Error("GEN_FAILED"); | |
| let caption = | |
| `β *iPHONE QUOTE BERHASIL DIBUAT* | |
| π Teks : ${quoteText} | |
| β° Waktu : ${quoteTime}`; | |
| if (battery) caption += `\nπ Baterai: ${battery}%`; | |
| if (options.operator) caption += `\nπ‘ Operator: Aktif`; | |
| if (options.wifi) caption += `\nπΆ WiFi: Aktif`; | |
| if (options.timebar) caption += `\nβ±οΈ Timebar: Aktif`; | |
| caption += `\n\n${result.message}\n\n${global.packname}`; | |
| await alip.sendMessage( | |
| m.chat, | |
| { | |
| image: result.image, | |
| caption: caption, | |
| }, | |
| { quoted: m } | |
| ); | |
| } catch (err) { | |
| console.error(err); | |
| let errMsg = "β Gagal membuat quote\n\n"; | |
| if (err.message === "GEN_FAILED") | |
| errMsg += "Terjadi kesalahan saat generate canvas."; | |
| else if (err.code === "ERR_INVALID_URL") | |
| errMsg += "Asset canvas tidak valid."; | |
| else | |
| errMsg += err.message; | |
| return Reply(errMsg); | |
| } | |
| }; | |
| handler.command = ["iqc", "iphonequote", "iphoneqc"]; | |
| module.exports = handler; |
Comments are disabled for this gist.