Skip to content

Commit 2e46c2e

Browse files
committed
feat: update spamAdv function to parse JSON response and format output message
1 parent 7a43822 commit 2e46c2e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/plugins/toram/adv1.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,8 @@ export const spamAdv = async (sock, chatId, msg, text) => {
3939
const jsonResponse = await response.json();
4040

4141
// Normalisasi: support array maupun object {data: ...}
42-
const result = Array.isArray(jsonResponse)
43-
? jsonResponse[0]
44-
: Array.isArray(jsonResponse?.data)
45-
? jsonResponse.data[0]
46-
: (jsonResponse?.data ?? null);
42+
const result = jsonResponse.data.result[0];
43+
console.log(result);
4744

4845
if (!result) {
4946
return await sock.sendMessage(
@@ -63,7 +60,7 @@ export const spamAdv = async (sock, chatId, msg, text) => {
6360
.join("\n")
6461
: "Tidak ada detail progres.";
6562

66-
const responseText = `*🗡️ SPAM ADV CALCULATOR*
63+
const responseText = `*SPAM ADV CALCULATOR*
6764
━━━━━━━━━━━━━━━━━━
6865
*📊 Initial State:*
6966
- Start Level : ${result.startLevel} (${result.startPercent}%)

0 commit comments

Comments
 (0)