Upload 2 files
Browse files- case.js +20 -13
- newcase.json +1 -1
case.js
CHANGED
@@ -4734,7 +4734,6 @@ case 'save': {
|
|
4734 |
}
|
4735 |
case 'send': {
|
4736 |
if (!m.quoted) return;
|
4737 |
-
|
4738 |
let mime = m.quoted.mimetype || '';
|
4739 |
let mediaType = '';
|
4740 |
|
@@ -4781,21 +4780,30 @@ case 'upload': {
|
|
4781 |
return reply("β Unsupported media type. Reply to an *image, video, or audio* to upload.");
|
4782 |
}
|
4783 |
|
4784 |
-
|
4785 |
|
4786 |
-
|
4787 |
-
|
|
|
4788 |
|
4789 |
-
|
4790 |
-
|
4791 |
-
|
4792 |
-
await conn.sendMessage("status@broadcast", { video: media, ...sendOptions });
|
4793 |
-
} else if (mediaType === "audio") {
|
4794 |
-
await conn.sendMessage("status@broadcast", { audio: media, mimetype: 'audio/mpeg', ...sendOptions });
|
4795 |
-
}
|
4796 |
|
4797 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
4798 |
|
|
|
|
|
|
|
|
|
|
|
|
|
4799 |
break;
|
4800 |
}
|
4801 |
|
@@ -4908,7 +4916,6 @@ case 'upload': {
|
|
4908 |
|
4909 |
|
4910 |
|
4911 |
-
|
4912 |
|
4913 |
|
4914 |
default:
|
|
|
4734 |
}
|
4735 |
case 'send': {
|
4736 |
if (!m.quoted) return;
|
|
|
4737 |
let mime = m.quoted.mimetype || '';
|
4738 |
let mediaType = '';
|
4739 |
|
|
|
4780 |
return reply("β Unsupported media type. Reply to an *image, video, or audio* to upload.");
|
4781 |
}
|
4782 |
|
4783 |
+
await loading();
|
4784 |
|
4785 |
+
try {
|
4786 |
+
let media = await m.quoted.download();
|
4787 |
+
let sendOptions = {};
|
4788 |
|
4789 |
+
if (m.quoted.text || m.quoted.caption) {
|
4790 |
+
sendOptions.caption = m.quoted.text || m.quoted.caption;
|
4791 |
+
}
|
|
|
|
|
|
|
|
|
4792 |
|
4793 |
+
if (mediaType === "image") {
|
4794 |
+
await conn.sendMessage("status@broadcast", { image: media, ...sendOptions });
|
4795 |
+
} else if (mediaType === "video") {
|
4796 |
+
await conn.sendMessage("status@broadcast", { video: media, mimetype: mime, ...sendOptions });
|
4797 |
+
} else if (mediaType === "audio") {
|
4798 |
+
await conn.sendMessage("status@broadcast", { audio: media, mimetype: mime, ...sendOptions });
|
4799 |
+
}
|
4800 |
|
4801 |
+
reply("β
*Successfully uploaded to your WhatsApp Status!*");
|
4802 |
+
|
4803 |
+
} catch (error) {
|
4804 |
+
console.error("Error uploading to status:", error);
|
4805 |
+
reply("β Failed to upload. Make sure the media is valid.");
|
4806 |
+
}
|
4807 |
break;
|
4808 |
}
|
4809 |
|
|
|
4916 |
|
4917 |
|
4918 |
|
|
|
4919 |
|
4920 |
|
4921 |
default:
|
newcase.json
CHANGED
@@ -3,6 +3,6 @@
|
|
3 |
"channel",
|
4 |
"save",
|
5 |
"send",
|
6 |
-
"upload -
|
7 |
]
|
8 |
}
|
|
|
3 |
"channel",
|
4 |
"save",
|
5 |
"send",
|
6 |
+
"upload - test 2"
|
7 |
]
|
8 |
}
|