Skip to content

Instantly share code, notes, and snippets.

@ONLym22
Last active December 16, 2025 08:12
Show Gist options
  • Select an option

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

Select an option

Save ONLym22/caac2c5c616d584f32bade3d0f2669eb to your computer and use it in GitHub Desktop.
// 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.