Upload case.js
Browse files
case.js
CHANGED
@@ -1764,7 +1764,46 @@ case 'kick': {
|
|
1764 |
|
1765 |
|
1766 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1767 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1768 |
case 'getdevice':
|
1769 |
case 'device':
|
1770 |
case 'phone': {
|
|
|
1764 |
|
1765 |
|
1766 |
|
1767 |
+
case "vv":
|
1768 |
+
case "readviewonce": {
|
1769 |
+
if (!isOwner) return reply(mess.only.owner);
|
1770 |
+
|
1771 |
+
if (!quoted) return reply("reply to a view-once message!");
|
1772 |
+
|
1773 |
+
let msg = quoted;
|
1774 |
+
let msgType = Object.keys(msg)[0];
|
1775 |
+
|
1776 |
+
if (!msg[msgType]?.viewOnce) return reply(toFancyFont("this isn't a view-once message!"));
|
1777 |
+
await loading();
|
1778 |
+
try {
|
1779 |
+
let media = await downloadMediaMessage(
|
1780 |
+
msg[msgType],
|
1781 |
+
msgType === "imageMessage" ? "image" :
|
1782 |
+
msgType === "videoMessage" ? "video" :
|
1783 |
+
"audio"
|
1784 |
+
);
|
1785 |
+
|
1786 |
+
if (!media) return reply("Failed to retrieve the media.");
|
1787 |
|
1788 |
+
let originalCaption = msg[msgType]?.caption || "No caption";
|
1789 |
+
let formattedCaption = originalCaption.split("\n").map(line => `> ${line}`).join("\n");
|
1790 |
+
|
1791 |
+
let finalCaption = `> ${caption}`;
|
1792 |
+
|
1793 |
+
if (/video/.test(msgType)) {
|
1794 |
+
await conn.sendMessage(chat, { video: media, caption: finalCaption }, { quoted: mess });
|
1795 |
+
} else if (/image/.test(msgType)) {
|
1796 |
+
await conn.sendMessage(chat, { image: media, caption: finalCaption }, { quoted: mess });
|
1797 |
+
} else if (/audio/.test(msgType)) {
|
1798 |
+
await conn.sendMessage(chat, { audio: media, mimetype: "audio/mpeg", ptt: true }, { quoted: mess });
|
1799 |
+
}
|
1800 |
+
|
1801 |
+
} catch (error) {
|
1802 |
+
console.error("❌ Error retrieving View Once message:", error);
|
1803 |
+
return reply("Failed to retrieve the View Once message.");
|
1804 |
+
}
|
1805 |
+
}
|
1806 |
+
break;
|
1807 |
case 'getdevice':
|
1808 |
case 'device':
|
1809 |
case 'phone': {
|