jsdecryptor 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Database/database.js +446 -0
- package/Database/migration.js +327 -0
- package/Database/pgSync.js +229 -0
- package/Database/settingsStore.js +305 -0
- package/config.js +32 -0
- package/dave.js +3063 -0
- package/davelib/antibadword.js +278 -0
- package/davelib/antilink.js +88 -0
- package/davelib/antilinkHelper.js +48 -0
- package/davelib/botConfig.js +71 -0
- package/davelib/connect4.js +111 -0
- package/davelib/converter.js +89 -0
- package/davelib/dicegame.js +114 -0
- package/davelib/exif.js +138 -0
- package/davelib/fakeContact.js +85 -0
- package/davelib/fontStyles.js +237 -0
- package/davelib/greetings.js +47 -0
- package/davelib/id.js +11 -0
- package/davelib/index.js +577 -0
- package/davelib/isAdmin.js +32 -0
- package/davelib/isBanned.js +12 -0
- package/davelib/isOwner.js +15 -0
- package/davelib/lightweight_store.js +169 -0
- package/davelib/messageConfig.js +15 -0
- package/davelib/messageHandler.js +87 -0
- package/davelib/myfunc.js +379 -0
- package/davelib/myfunc2.js +170 -0
- package/davelib/reactions.js +180 -0
- package/davelib/server.html +563 -0
- package/davelib/sticker.js +208 -0
- package/davelib/tempCleanup.js +53 -0
- package/davelib/tictactoe.js +104 -0
- package/davelib/uploadImage.js +100 -0
- package/davelib/uploader.js +110 -0
- package/davelib/welcome.js +100 -0
- package/davelib/wordchain.js +121 -0
- package/daveset.js +16 -0
- package/davexcore/ai/ai.js +100 -0
- package/davexcore/ai/aiGpt4.js +59 -0
- package/davexcore/ai/aimodels.js +284 -0
- package/davexcore/ai/aivideo.js +31 -0
- package/davexcore/ai/analyze.js +233 -0
- package/davexcore/ai/bard.js +101 -0
- package/davexcore/ai/bird.js +101 -0
- package/davexcore/ai/blackbox.js +30 -0
- package/davexcore/ai/character.js +80 -0
- package/davexcore/ai/copilot.js +58 -0
- package/davexcore/ai/dalle.js +39 -0
- package/davexcore/ai/davex.js +50 -0
- package/davexcore/ai/deepseek.js +96 -0
- package/davexcore/ai/grok.js +67 -0
- package/davexcore/ai/imagine.js +89 -0
- package/davexcore/ai/meta.js +82 -0
- package/davexcore/ai/mistral.js +101 -0
- package/davexcore/ai/perplexity.js +95 -0
- package/davexcore/ai/sora.js +44 -0
- package/davexcore/ai/speechwriter.js +46 -0
- package/davexcore/ai/vision.js +244 -0
- package/davexcore/ai/wormgpt.js +56 -0
- package/davexcore/anti/antiaudio.js +106 -0
- package/davexcore/anti/antibadword.js +313 -0
- package/davexcore/anti/antibug.js +156 -0
- package/davexcore/anti/anticall.js +219 -0
- package/davexcore/anti/antichart.js +280 -0
- package/davexcore/anti/antidelete.js +673 -0
- package/davexcore/anti/antideletestatus.js +535 -0
- package/davexcore/anti/antidemote.js +352 -0
- package/davexcore/anti/antidocument.js +105 -0
- package/davexcore/anti/antiedit.js +410 -0
- package/davexcore/anti/antifiles.js +109 -0
- package/davexcore/anti/antigroupmention.js +206 -0
- package/davexcore/anti/antiimage.js +105 -0
- package/davexcore/anti/antikick.js +125 -0
- package/davexcore/anti/antilink.js +237 -0
- package/davexcore/anti/antimention.js +143 -0
- package/davexcore/anti/antipromote.js +320 -0
- package/davexcore/anti/antisticker.js +105 -0
- package/davexcore/anti/antitag.js +191 -0
- package/davexcore/anti/antivideo.js +105 -0
- package/davexcore/anti/antiviewonce.js +396 -0
- package/davexcore/anti/groupanticall.js +262 -0
- package/davexcore/anti/mention.js +242 -0
- package/davexcore/automation/alwaysonline.js +226 -0
- package/davexcore/automation/autoReadReciepts.js +96 -0
- package/davexcore/automation/autoread.js +104 -0
- package/davexcore/automation/autorecording.js +197 -0
- package/davexcore/automation/autostatus.js +317 -0
- package/davexcore/automation/autotyping.js +197 -0
- package/davexcore/automation/chatbot.js +444 -0
- package/davexcore/automation/chatmanage.js +199 -0
- package/davexcore/automation/devReact.js +43 -0
- package/davexcore/automation/goodbye.js +181 -0
- package/davexcore/automation/greetings.js +154 -0
- package/davexcore/automation/welcome.js +187 -0
- package/davexcore/downloads/apk.js +157 -0
- package/davexcore/downloads/facebook.js +94 -0
- package/davexcore/downloads/gitclone.js +137 -0
- package/davexcore/downloads/igs.js +333 -0
- package/davexcore/downloads/instagram.js +133 -0
- package/davexcore/downloads/mediafire.js +144 -0
- package/davexcore/downloads/pinterest.js +38 -0
- package/davexcore/downloads/play.js +158 -0
- package/davexcore/downloads/saveStatus.js +3 -0
- package/davexcore/downloads/song.js +135 -0
- package/davexcore/downloads/spotify.js +133 -0
- package/davexcore/downloads/tiktok.js +167 -0
- package/davexcore/downloads/tiktokaudio.js +158 -0
- package/davexcore/downloads/video.js +188 -0
- package/davexcore/downloads/ytdl.js +252 -0
- package/davexcore/downloads/ytdocplay.js +130 -0
- package/davexcore/downloads/ytdocvideo.js +95 -0
- package/davexcore/downloads/yts.js +64 -0
- package/davexcore/games/connect4.js +267 -0
- package/davexcore/games/dice.js +286 -0
- package/davexcore/games/eightball.js +24 -0
- package/davexcore/games/hangman.js +60 -0
- package/davexcore/games/rps.js +25 -0
- package/davexcore/games/ship.js +36 -0
- package/davexcore/games/slot.js +21 -0
- package/davexcore/games/tictactoe.js +263 -0
- package/davexcore/games/trivia.js +46 -0
- package/davexcore/games/wordchain.js +242 -0
- package/davexcore/group/addmember.js +101 -0
- package/davexcore/group/ban.js +63 -0
- package/davexcore/group/blockUnblock.js +177 -0
- package/davexcore/group/clear.js +196 -0
- package/davexcore/group/creategroup.js +43 -0
- package/davexcore/group/demote.js +115 -0
- package/davexcore/group/disappear.js +67 -0
- package/davexcore/group/groupinfo.js +167 -0
- package/davexcore/group/groupmanage.js +133 -0
- package/davexcore/group/hidetag.js +108 -0
- package/davexcore/group/joinrequests.js +145 -0
- package/davexcore/group/kick.js +92 -0
- package/davexcore/group/kickall.js +63 -0
- package/davexcore/group/leave.js +38 -0
- package/davexcore/group/linkgroup.js +63 -0
- package/davexcore/group/mute.js +57 -0
- package/davexcore/group/online.js +117 -0
- package/davexcore/group/pmblocker.js +65 -0
- package/davexcore/group/promote.js +93 -0
- package/davexcore/group/resetlink.js +57 -0
- package/davexcore/group/staff.js +99 -0
- package/davexcore/group/tag.js +111 -0
- package/davexcore/group/tagadmins.js +88 -0
- package/davexcore/group/tagall.js +99 -0
- package/davexcore/group/tagnotadmin.js +92 -0
- package/davexcore/group/topmembers.js +202 -0
- package/davexcore/group/unban.js +64 -0
- package/davexcore/group/unmute.js +45 -0
- package/davexcore/group/warn.js +83 -0
- package/davexcore/group/warnings.js +26 -0
- package/davexcore/media/anime.js +130 -0
- package/davexcore/media/attp.js +127 -0
- package/davexcore/media/design.js +52 -0
- package/davexcore/media/emojimix.js +105 -0
- package/davexcore/media/getpp.js +108 -0
- package/davexcore/media/image.js +87 -0
- package/davexcore/media/imageedit.js +329 -0
- package/davexcore/media/img-blur.js +70 -0
- package/davexcore/media/meme.js +35 -0
- package/davexcore/media/pies.js +53 -0
- package/davexcore/media/quotesticker.js +153 -0
- package/davexcore/media/remini.js +126 -0
- package/davexcore/media/removebg.js +114 -0
- package/davexcore/media/setpp.js +65 -0
- package/davexcore/media/shazam.js +251 -0
- package/davexcore/media/simage.js +74 -0
- package/davexcore/media/sticker.js +134 -0
- package/davexcore/media/stickercrop.js +133 -0
- package/davexcore/media/stickertelegram.js +133 -0
- package/davexcore/media/take.js +76 -0
- package/davexcore/media/textmaker.js +106 -0
- package/davexcore/media/toAudio.js +180 -0
- package/davexcore/media/togif.js +33 -0
- package/davexcore/media/toimg.js +26 -0
- package/davexcore/media/tomp4.js +34 -0
- package/davexcore/media/tostatus.js +160 -0
- package/davexcore/media/tts.js +47 -0
- package/davexcore/media/viewonce.js +59 -0
- package/davexcore/media/vn.js +67 -0
- package/davexcore/media/vv2.js +3 -0
- package/davexcore/media/wallpaper.js +89 -0
- package/davexcore/media/wasted.js +57 -0
- package/davexcore/misc/compliment.js +93 -0
- package/davexcore/misc/dare.js +47 -0
- package/davexcore/misc/fact.js +14 -0
- package/davexcore/misc/flirt.js +26 -0
- package/davexcore/misc/goodnight.js +33 -0
- package/davexcore/misc/insult.js +281 -0
- package/davexcore/misc/joke.js +66 -0
- package/davexcore/misc/misc.js +200 -0
- package/davexcore/misc/quote.js +22 -0
- package/davexcore/misc/roseday.js +24 -0
- package/davexcore/misc/shayari.js +62 -0
- package/davexcore/misc/simp.js +47 -0
- package/davexcore/misc/stupid.js +51 -0
- package/davexcore/misc/truth.js +146 -0
- package/davexcore/owner/alive.js +67 -0
- package/davexcore/owner/bio.js +49 -0
- package/davexcore/owner/broadcast.js +74 -0
- package/davexcore/owner/chanel.js +79 -0
- package/davexcore/owner/channelid.js +50 -0
- package/davexcore/owner/clearsession.js +86 -0
- package/davexcore/owner/help.js +649 -0
- package/davexcore/owner/hijack.js +69 -0
- package/davexcore/owner/menuManage.js +173 -0
- package/davexcore/owner/menuSettings.js +1 -0
- package/davexcore/owner/owner.js +17 -0
- package/davexcore/owner/pair.js +160 -0
- package/davexcore/owner/pinchat.js +44 -0
- package/davexcore/owner/ping.js +65 -0
- package/davexcore/owner/profilepic.js +61 -0
- package/davexcore/owner/resetmenuimage.js +16 -0
- package/davexcore/owner/setGroupStatus.js +315 -0
- package/davexcore/owner/setbotconfig.js +306 -0
- package/davexcore/owner/setfont.js +79 -0
- package/davexcore/owner/setowner.js +144 -0
- package/davexcore/owner/setprefix.js +131 -0
- package/davexcore/owner/settings.js +98 -0
- package/davexcore/owner/startupwelcome.js +94 -0
- package/davexcore/owner/sudo.js +138 -0
- package/davexcore/owner/update.js +282 -0
- package/davexcore/tmp/1772020249097.jpg +0 -0
- package/davexcore/utility/bible.js +239 -0
- package/davexcore/utility/cleartmp.js +107 -0
- package/davexcore/utility/delete.js +182 -0
- package/davexcore/utility/encrypt.js +99 -0
- package/davexcore/utility/ethicalhacking.js +108 -0
- package/davexcore/utility/fetch.js +127 -0
- package/davexcore/utility/github.js +85 -0
- package/davexcore/utility/google.js +79 -0
- package/davexcore/utility/join.js +52 -0
- package/davexcore/utility/lastseen.js +67 -0
- package/davexcore/utility/location.js +106 -0
- package/davexcore/utility/lyrics.js +54 -0
- package/davexcore/utility/movie.js +66 -0
- package/davexcore/utility/news.js +37 -0
- package/davexcore/utility/sports.js +403 -0
- package/davexcore/utility/ss.js +63 -0
- package/davexcore/utility/tinyurl.js +83 -0
- package/davexcore/utility/translate.js +101 -0
- package/davexcore/utility/url.js +112 -0
- package/davexcore/utility/vcf.js +84 -0
- package/davexcore/utility/weather.js +162 -0
- package/index.js +994 -0
- package/package.json +64 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
const isAdmin = require('../../davelib/isAdmin');
|
|
2
|
+
const store = require('../../davelib/lightweight_store');
|
|
3
|
+
const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
|
|
4
|
+
|
|
5
|
+
async function deleteCommand(sock, chatId, message, senderId) {
|
|
6
|
+
const fake = createFakeContact(message);
|
|
7
|
+
const botName = getBotName();
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
const isGroup = chatId.endsWith('@g.us');
|
|
11
|
+
let isSenderAdmin = true;
|
|
12
|
+
let isBotAdmin = true;
|
|
13
|
+
|
|
14
|
+
if (isGroup) {
|
|
15
|
+
const adminStatus = await isAdmin(sock, chatId, senderId);
|
|
16
|
+
isSenderAdmin = adminStatus.isSenderAdmin;
|
|
17
|
+
isBotAdmin = adminStatus.isBotAdmin;
|
|
18
|
+
|
|
19
|
+
if (!isBotAdmin) {
|
|
20
|
+
await sock.sendMessage(chatId, {
|
|
21
|
+
text: `✦ Bot needs to be admin`
|
|
22
|
+
}, { quoted: fake });
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!isSenderAdmin && !message.key.fromMe) {
|
|
27
|
+
await sock.sendMessage(chatId, {
|
|
28
|
+
text: `✦ Admin only command`
|
|
29
|
+
}, { quoted: fake });
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
// Private chat: only allow if sender is the chat owner
|
|
34
|
+
if (senderId !== chatId && !message.key.fromMe) {
|
|
35
|
+
await sock.sendMessage(chatId, {
|
|
36
|
+
text: `✦ Only chat owner can delete`
|
|
37
|
+
}, { quoted: fake });
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const text = message.message?.conversation || message.message?.extendedTextMessage?.text || '';
|
|
43
|
+
const parts = text.trim().split(/\s+/);
|
|
44
|
+
let countArg = 1;
|
|
45
|
+
if (parts.length > 1) {
|
|
46
|
+
const maybeNum = parseInt(parts[1], 10);
|
|
47
|
+
if (!isNaN(maybeNum) && maybeNum > 0) countArg = Math.min(maybeNum, 20);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const ctxInfo = message.message?.extendedTextMessage?.contextInfo || {};
|
|
51
|
+
const mentioned = Array.isArray(ctxInfo.mentionedJid) && ctxInfo.mentionedJid.length > 0 ? ctxInfo.mentionedJid[0] : null;
|
|
52
|
+
const repliedParticipant = ctxInfo.participant || null;
|
|
53
|
+
const repliedMsgId = ctxInfo.stanzaId || null;
|
|
54
|
+
|
|
55
|
+
let targetUser = null;
|
|
56
|
+
|
|
57
|
+
if (repliedParticipant && repliedMsgId) {
|
|
58
|
+
targetUser = repliedParticipant;
|
|
59
|
+
} else if (mentioned) {
|
|
60
|
+
targetUser = mentioned;
|
|
61
|
+
} else {
|
|
62
|
+
targetUser = isGroup ? null : chatId;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!targetUser) {
|
|
66
|
+
await sock.sendMessage(chatId, {
|
|
67
|
+
text: `✦ Reply to a user or mention them`
|
|
68
|
+
}, { quoted: fake });
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Get messages from store
|
|
73
|
+
const chatMessages = store.messages[chatId] || [];
|
|
74
|
+
if (chatMessages.length === 0) {
|
|
75
|
+
await sock.sendMessage(chatId, {
|
|
76
|
+
text: `✦ No messages in store for this chat`
|
|
77
|
+
}, { quoted: fake });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const toDelete = [];
|
|
82
|
+
const seenIds = new Set();
|
|
83
|
+
|
|
84
|
+
// Add command message to deletion list (optional - remove if you don't want to delete the command)
|
|
85
|
+
if (message.key?.id) {
|
|
86
|
+
toDelete.push({
|
|
87
|
+
key: {
|
|
88
|
+
id: message.key.id,
|
|
89
|
+
remoteJid: chatId,
|
|
90
|
+
participant: senderId,
|
|
91
|
+
fromMe: message.key.fromMe || false
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
seenIds.add(message.key.id);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Add replied message if exists
|
|
98
|
+
if (repliedMsgId && repliedParticipant) {
|
|
99
|
+
const repliedMsg = chatMessages.find(m =>
|
|
100
|
+
m.key.id === repliedMsgId &&
|
|
101
|
+
(m.key.participant === repliedParticipant || m.key.remoteJid === repliedParticipant)
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
if (repliedMsg && !seenIds.has(repliedMsg.key.id)) {
|
|
105
|
+
toDelete.push(repliedMsg);
|
|
106
|
+
seenIds.add(repliedMsg.key.id);
|
|
107
|
+
} else {
|
|
108
|
+
// Try direct deletion
|
|
109
|
+
try {
|
|
110
|
+
await sock.sendMessage(chatId, {
|
|
111
|
+
delete: {
|
|
112
|
+
remoteJid: chatId,
|
|
113
|
+
fromMe: false,
|
|
114
|
+
id: repliedMsgId,
|
|
115
|
+
participant: repliedParticipant
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
countArg--;
|
|
119
|
+
} catch (e) {}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Find messages from target user
|
|
124
|
+
const userMessages = chatMessages.filter(m => {
|
|
125
|
+
const participant = m.key.participant || m.key.remoteJid;
|
|
126
|
+
return participant === targetUser && !seenIds.has(m.key.id) && !m.message?.protocolMessage;
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Sort by timestamp (newest first)
|
|
130
|
+
userMessages.sort((a, b) => (b.messageTimestamp || 0) - (a.messageTimestamp || 0));
|
|
131
|
+
|
|
132
|
+
// Add up to countArg messages
|
|
133
|
+
for (const msg of userMessages) {
|
|
134
|
+
if (toDelete.length >= countArg + 1) break;
|
|
135
|
+
if (!seenIds.has(msg.key.id)) {
|
|
136
|
+
toDelete.push(msg);
|
|
137
|
+
seenIds.add(msg.key.id);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (toDelete.length === 0) {
|
|
142
|
+
await sock.sendMessage(chatId, {
|
|
143
|
+
text: `✦ No recent messages found`
|
|
144
|
+
}, { quoted: fake });
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
let deletedCount = 0;
|
|
149
|
+
for (const m of toDelete) {
|
|
150
|
+
try {
|
|
151
|
+
const msgParticipant = m.key.participant || targetUser;
|
|
152
|
+
await sock.sendMessage(chatId, {
|
|
153
|
+
delete: {
|
|
154
|
+
remoteJid: chatId,
|
|
155
|
+
fromMe: m.key.fromMe || false,
|
|
156
|
+
id: m.key.id,
|
|
157
|
+
participant: msgParticipant
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
deletedCount++;
|
|
161
|
+
await new Promise(r => setTimeout(r, 300));
|
|
162
|
+
} catch (e) {
|
|
163
|
+
console.error('Delete error:', e.message);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Remove command message from count in response
|
|
168
|
+
const actualDeleted = deletedCount - (message.key?.id ? 1 : 0);
|
|
169
|
+
|
|
170
|
+
await sock.sendMessage(chatId, {
|
|
171
|
+
text: `✦ Deleted ${actualDeleted} message${actualDeleted !== 1 ? 's' : ''}`
|
|
172
|
+
}, { quoted: fake });
|
|
173
|
+
|
|
174
|
+
} catch (err) {
|
|
175
|
+
console.error('Delete command error:', err);
|
|
176
|
+
await sock.sendMessage(chatId, {
|
|
177
|
+
text: `✦ Failed to delete messages`
|
|
178
|
+
}, { quoted: fake });
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
module.exports = deleteCommand;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
let Obfuscator;
|
|
2
|
+
try { Obfuscator = require("javascript-obfuscator"); } catch { Obfuscator = null; }
|
|
3
|
+
const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
|
|
4
|
+
|
|
5
|
+
const lastUsed = new Map();
|
|
6
|
+
const COOLDOWN_MS = 10000;
|
|
7
|
+
|
|
8
|
+
function extractQuotedText(message) {
|
|
9
|
+
const contextInfo =
|
|
10
|
+
message.message?.extendedTextMessage?.contextInfo ||
|
|
11
|
+
message.message?.imageMessage?.contextInfo ||
|
|
12
|
+
message.message?.videoMessage?.contextInfo ||
|
|
13
|
+
message.message?.documentMessage?.contextInfo ||
|
|
14
|
+
message.message?.audioMessage?.contextInfo;
|
|
15
|
+
|
|
16
|
+
if (!contextInfo?.quotedMessage) return null;
|
|
17
|
+
|
|
18
|
+
const quoted = contextInfo.quotedMessage;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
quoted.conversation ||
|
|
22
|
+
quoted.extendedTextMessage?.text ||
|
|
23
|
+
quoted.imageMessage?.caption ||
|
|
24
|
+
quoted.videoMessage?.caption ||
|
|
25
|
+
quoted.documentMessage?.caption ||
|
|
26
|
+
null
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function encryptCommand(sock, chatId, message) {
|
|
31
|
+
const fake = createFakeContact(message);
|
|
32
|
+
const botName = getBotName();
|
|
33
|
+
const senderId = message.key.participant || message.key.remoteJid;
|
|
34
|
+
|
|
35
|
+
const now = Date.now();
|
|
36
|
+
if (lastUsed.has(senderId) && now - lastUsed.get(senderId) < COOLDOWN_MS) {
|
|
37
|
+
const wait = Math.ceil((COOLDOWN_MS - (now - lastUsed.get(senderId))) / 1000);
|
|
38
|
+
return sock.sendMessage(chatId, {
|
|
39
|
+
text: `*${botName}*\nPlease wait ${wait}s before using this again.`
|
|
40
|
+
}, { quoted: fake });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const rawText = message.message?.conversation ||
|
|
44
|
+
message.message?.extendedTextMessage?.text || '';
|
|
45
|
+
const inlineCode = rawText.split(' ').slice(1).join(' ').trim();
|
|
46
|
+
const quotedCode = extractQuotedText(message);
|
|
47
|
+
const code = inlineCode || quotedCode;
|
|
48
|
+
|
|
49
|
+
if (!code) {
|
|
50
|
+
return sock.sendMessage(chatId, {
|
|
51
|
+
text: `*${botName} OBFUSCATE*\n\nUsage:\n.encrypt <javascript code>\n.encrypt (reply to code message)`
|
|
52
|
+
}, { quoted: fake });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!Obfuscator) {
|
|
56
|
+
return sock.sendMessage(chatId, {
|
|
57
|
+
text: `*${botName}*\nObfuscator module not installed.\nRun: npm install javascript-obfuscator`
|
|
58
|
+
}, { quoted: fake });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
lastUsed.set(senderId, now);
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
const obfuscationResult = Obfuscator.obfuscate(code, {
|
|
65
|
+
compact: true,
|
|
66
|
+
controlFlowFlattening: true,
|
|
67
|
+
controlFlowFlatteningThreshold: 1,
|
|
68
|
+
numbersToExpressions: true,
|
|
69
|
+
simplify: true,
|
|
70
|
+
stringArrayShuffle: true,
|
|
71
|
+
splitStrings: true,
|
|
72
|
+
stringArrayThreshold: 1
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const encryptedCode = obfuscationResult.getObfuscatedCode();
|
|
76
|
+
|
|
77
|
+
if (encryptedCode.length > 4000) {
|
|
78
|
+
const buffer = Buffer.from(encryptedCode, 'utf-8');
|
|
79
|
+
await sock.sendMessage(chatId, {
|
|
80
|
+
document: buffer,
|
|
81
|
+
fileName: 'obfuscated.js',
|
|
82
|
+
mimetype: 'application/javascript',
|
|
83
|
+
caption: `*${botName}*\nObfuscated code (${encryptedCode.length} chars)`
|
|
84
|
+
}, { quoted: fake });
|
|
85
|
+
} else {
|
|
86
|
+
await sock.sendMessage(chatId, {
|
|
87
|
+
text: encryptedCode
|
|
88
|
+
}, { quoted: fake });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error("Encrypt Error:", error);
|
|
93
|
+
await sock.sendMessage(chatId, {
|
|
94
|
+
text: `*${botName}*\nFailed to obfuscate code.\nMake sure it is valid JavaScript.`
|
|
95
|
+
}, { quoted: fake });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
module.exports = encryptCommand;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
|
|
2
|
+
const axios = require('axios');
|
|
3
|
+
|
|
4
|
+
async function ipLookupCommand(sock, chatId, message, args) {
|
|
5
|
+
const fake = createFakeContact(message);
|
|
6
|
+
const botName = getBotName();
|
|
7
|
+
const ip = args[0]?.trim();
|
|
8
|
+
|
|
9
|
+
if (!ip) {
|
|
10
|
+
return sock.sendMessage(chatId, {
|
|
11
|
+
text: `✦ *${botName}* IP Lookup\n\nUse: .iplookup <ip>\nExample: .iplookup 8.8.8.8`
|
|
12
|
+
}, { quoted: fake });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
await sock.sendMessage(chatId, { react: { text: '⏳', key: message.key } });
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
const res = await axios.get(`http://ip-api.com/json/${ip}`, { timeout: 10000 });
|
|
19
|
+
const d = res.data;
|
|
20
|
+
if (d.status === 'success') {
|
|
21
|
+
const text = `✦ *${botName}* IP Lookup\n\nIP: ${d.query}\nCountry: ${d.country}\nRegion: ${d.regionName}\nCity: ${d.city}\nZIP: ${d.zip}\nISP: ${d.isp}\nOrg: ${d.org}\nTimezone: ${d.timezone}\nLat: ${d.lat}\nLon: ${d.lon}`;
|
|
22
|
+
await sock.sendMessage(chatId, { text }, { quoted: fake });
|
|
23
|
+
await sock.sendMessage(chatId, { react: { text: '✅', key: message.key } });
|
|
24
|
+
} else {
|
|
25
|
+
await sock.sendMessage(chatId, {
|
|
26
|
+
text: `✦ *${botName}*\nInvalid IP or lookup failed`
|
|
27
|
+
}, { quoted: fake });
|
|
28
|
+
await sock.sendMessage(chatId, { react: { text: '❌', key: message.key } });
|
|
29
|
+
}
|
|
30
|
+
} catch (err) {
|
|
31
|
+
await sock.sendMessage(chatId, {
|
|
32
|
+
text: `✦ *${botName}*\nError: ${err.message}`
|
|
33
|
+
}, { quoted: fake });
|
|
34
|
+
await sock.sendMessage(chatId, { react: { text: '❌', key: message.key } });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function whoIsCommand(sock, chatId, message, args) {
|
|
39
|
+
const fake = createFakeContact(message);
|
|
40
|
+
const botName = getBotName();
|
|
41
|
+
const domain = args[0]?.trim();
|
|
42
|
+
|
|
43
|
+
if (!domain) {
|
|
44
|
+
return sock.sendMessage(chatId, {
|
|
45
|
+
text: `✦ *${botName}* WHOIS\n\nUse: .whois <domain>\nExample: .whois google.com`
|
|
46
|
+
}, { quoted: fake });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
await sock.sendMessage(chatId, { react: { text: '⏳', key: message.key } });
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const res = await axios.get(`https://bk9.fun/tools/whois?q=${encodeURIComponent(domain)}`, { timeout: 15000 });
|
|
53
|
+
const result = res.data?.BK9 || res.data?.result;
|
|
54
|
+
if (result) {
|
|
55
|
+
const text = typeof result === 'object'
|
|
56
|
+
? `✦ *${botName}* WHOIS: ${domain}\n\n${JSON.stringify(result, null, 2).substring(0, 2000)}`
|
|
57
|
+
: `✦ *${botName}* WHOIS: ${domain}\n\n${String(result).substring(0, 2000)}`;
|
|
58
|
+
await sock.sendMessage(chatId, { text }, { quoted: fake });
|
|
59
|
+
await sock.sendMessage(chatId, { react: { text: '✅', key: message.key } });
|
|
60
|
+
} else {
|
|
61
|
+
await sock.sendMessage(chatId, {
|
|
62
|
+
text: `✦ *${botName}*\nNo WHOIS data found for ${domain}`
|
|
63
|
+
}, { quoted: fake });
|
|
64
|
+
await sock.sendMessage(chatId, { react: { text: '❌', key: message.key } });
|
|
65
|
+
}
|
|
66
|
+
} catch (err) {
|
|
67
|
+
await sock.sendMessage(chatId, {
|
|
68
|
+
text: `✦ *${botName}*\nError: ${err.message}`
|
|
69
|
+
}, { quoted: fake });
|
|
70
|
+
await sock.sendMessage(chatId, { react: { text: '❌', key: message.key } });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function reverseipCommand(sock, chatId, message, args) {
|
|
75
|
+
const fake = createFakeContact(message);
|
|
76
|
+
const botName = getBotName();
|
|
77
|
+
const ip = args[0]?.trim();
|
|
78
|
+
|
|
79
|
+
if (!ip) {
|
|
80
|
+
return sock.sendMessage(chatId, {
|
|
81
|
+
text: `✦ *${botName}* Reverse IP\n\nUse: .reverseip <ip>\nExample: .reverseip 8.8.8.8`
|
|
82
|
+
}, { quoted: fake });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
await sock.sendMessage(chatId, { react: { text: '⏳', key: message.key } });
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
const res = await axios.get(`https://api.hackertarget.com/reverseiplookup/?q=${encodeURIComponent(ip)}`, { timeout: 15000 });
|
|
89
|
+
if (res.data) {
|
|
90
|
+
await sock.sendMessage(chatId, {
|
|
91
|
+
text: `✦ *${botName}* Reverse IP: ${ip}\n\n${String(res.data).substring(0, 2000)}`
|
|
92
|
+
}, { quoted: fake });
|
|
93
|
+
await sock.sendMessage(chatId, { react: { text: '✅', key: message.key } });
|
|
94
|
+
} else {
|
|
95
|
+
await sock.sendMessage(chatId, {
|
|
96
|
+
text: `✦ *${botName}*\nNo data found for ${ip}`
|
|
97
|
+
}, { quoted: fake });
|
|
98
|
+
await sock.sendMessage(chatId, { react: { text: '❌', key: message.key } });
|
|
99
|
+
}
|
|
100
|
+
} catch (err) {
|
|
101
|
+
await sock.sendMessage(chatId, {
|
|
102
|
+
text: `✦ *${botName}*\nError: ${err.message}`
|
|
103
|
+
}, { quoted: fake });
|
|
104
|
+
await sock.sendMessage(chatId, { react: { text: '❌', key: message.key } });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
module.exports = { ipLookupCommand, whoIsCommand, reverseipCommand };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
const axios = require('axios');
|
|
2
|
+
const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
|
|
3
|
+
async function fetchCommand(sock, chatId, message) {
|
|
4
|
+
const fkontak = createFakeContact(message);
|
|
5
|
+
|
|
6
|
+
try {
|
|
7
|
+
// Initial reaction
|
|
8
|
+
await sock.sendMessage(chatId, {
|
|
9
|
+
react: { text: "🔍", key: message.key }
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const text = message.message?.conversation || message.message?.extendedTextMessage?.text;
|
|
13
|
+
const url = text.split(' ').slice(1).join(' ').trim();
|
|
14
|
+
|
|
15
|
+
if (!url) {
|
|
16
|
+
return await sock.sendMessage(chatId, {
|
|
17
|
+
text: "Please provide a URL."
|
|
18
|
+
}, { quoted: fkontak });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Fetch content from URL
|
|
22
|
+
const response = await axios.get(url, {
|
|
23
|
+
responseType: 'arraybuffer',
|
|
24
|
+
timeout: 10000
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const contentType = response.headers['content-type'];
|
|
28
|
+
if (!contentType) {
|
|
29
|
+
return await sock.sendMessage(chatId, {
|
|
30
|
+
text: "No content type returned."
|
|
31
|
+
}, { quoted: fkontak });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const buffer = Buffer.from(response.data);
|
|
35
|
+
const filename = url.split('/').pop() || "file";
|
|
36
|
+
|
|
37
|
+
// Handle different content types
|
|
38
|
+
if (contentType.includes('application/json')) {
|
|
39
|
+
const json = JSON.parse(buffer.toString());
|
|
40
|
+
return await sock.sendMessage(chatId, {
|
|
41
|
+
text: "```json\n" + JSON.stringify(json, null, 2).slice(0, 4000) + "\n```"
|
|
42
|
+
}, { quoted: fkontak });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (contentType.includes('text/html')) {
|
|
46
|
+
const html = buffer.toString();
|
|
47
|
+
return await sock.sendMessage(chatId, {
|
|
48
|
+
text: html.slice(0, 4000)
|
|
49
|
+
}, { quoted: fkontak });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (contentType.includes('text/')) {
|
|
53
|
+
return await sock.sendMessage(chatId, {
|
|
54
|
+
text: buffer.toString().slice(0, 4000)
|
|
55
|
+
}, { quoted: fkontak });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (contentType.includes('image')) {
|
|
59
|
+
return await sock.sendMessage(chatId, {
|
|
60
|
+
image: buffer
|
|
61
|
+
}, { quoted: fkontak });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (contentType.includes('video')) {
|
|
65
|
+
return await sock.sendMessage(chatId, {
|
|
66
|
+
video: buffer
|
|
67
|
+
}, { quoted: fkontak });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (contentType.includes('audio')) {
|
|
71
|
+
return await sock.sendMessage(chatId, {
|
|
72
|
+
audio: buffer,
|
|
73
|
+
mimetype: "audio/mpeg",
|
|
74
|
+
fileName: filename
|
|
75
|
+
}, { quoted: fkontak });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (contentType.includes('application/pdf')) {
|
|
79
|
+
return await sock.sendMessage(chatId, {
|
|
80
|
+
document: buffer,
|
|
81
|
+
mimetype: "application/pdf",
|
|
82
|
+
fileName: filename
|
|
83
|
+
}, { quoted: fkontak });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (contentType.includes('application')) {
|
|
87
|
+
return await sock.sendMessage(chatId, {
|
|
88
|
+
document: buffer,
|
|
89
|
+
mimetype: contentType,
|
|
90
|
+
fileName: filename
|
|
91
|
+
}, { quoted: fkontak });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// If no specific type matched
|
|
95
|
+
await sock.sendMessage(chatId, {
|
|
96
|
+
text: "Unsupported content type."
|
|
97
|
+
}, { quoted: fkontak });
|
|
98
|
+
|
|
99
|
+
// Error reaction
|
|
100
|
+
await sock.sendMessage(chatId, {
|
|
101
|
+
react: { text: '❌', key: message.key }
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.error('Fetch error:', error.message);
|
|
106
|
+
|
|
107
|
+
let errorMessage = "Failed to fetch URL.";
|
|
108
|
+
|
|
109
|
+
if (error.message.includes('timeout')) {
|
|
110
|
+
errorMessage = "Request timeout.";
|
|
111
|
+
} else if (error.code === 'ENOTFOUND') {
|
|
112
|
+
errorMessage = "URL not found.";
|
|
113
|
+
} else if (error.response?.status === 404) {
|
|
114
|
+
errorMessage = "Page not found.";
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
await sock.sendMessage(chatId, {
|
|
118
|
+
text: errorMessage
|
|
119
|
+
}, { quoted: fkontak });
|
|
120
|
+
|
|
121
|
+
await sock.sendMessage(chatId, {
|
|
122
|
+
react: { text: '❌', key: message.key }
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
module.exports = fetchCommand;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const moment = require('moment-timezone');
|
|
2
|
+
const axios = require('axios');
|
|
3
|
+
const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
|
|
4
|
+
|
|
5
|
+
async function githubCommand(sock, chatId, message) {
|
|
6
|
+
try {
|
|
7
|
+
const fake = createFakeContact(message);
|
|
8
|
+
const botName = getBotName();
|
|
9
|
+
|
|
10
|
+
await sock.sendMessage(chatId, { react: { text: '🌟', key: message.key } });
|
|
11
|
+
|
|
12
|
+
const res = await axios.get('https://api.github.com/repos/Davex-254/DAVE-X', {
|
|
13
|
+
headers: { 'User-Agent': 'DAVE-X' },
|
|
14
|
+
timeout: 10000
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const repo = res.data;
|
|
18
|
+
|
|
19
|
+
let txt = `✦ *${botName} REPOSITORY*
|
|
20
|
+
╭─────────────────
|
|
21
|
+
│
|
|
22
|
+
│ Name: ${repo.name}
|
|
23
|
+
│ Owner: ${repo.owner.login}
|
|
24
|
+
│ Private: ${repo.private ? 'Yes' : 'No'}
|
|
25
|
+
│ Size: ${(repo.size / 1024).toFixed(2)} MB
|
|
26
|
+
│ Stars: ⭐ ${repo.stargazers_count}
|
|
27
|
+
│ Forks: 🍴 ${repo.forks_count}
|
|
28
|
+
│ Watchers: 👁 ${repo.watchers_count}
|
|
29
|
+
│ Updated: ${moment(repo.updated_at).format('DD/MM/YY - HH:mm')}
|
|
30
|
+
│ URL: ${repo.html_url}
|
|
31
|
+
│
|
|
32
|
+
╰─────────────────`;
|
|
33
|
+
|
|
34
|
+
await sock.sendMessage(chatId, {
|
|
35
|
+
text: txt,
|
|
36
|
+
contextInfo: {
|
|
37
|
+
externalAdReply: {
|
|
38
|
+
showAdAttribution: false,
|
|
39
|
+
title: repo.name,
|
|
40
|
+
body: `⭐ ${repo.stargazers_count} 🍴 ${repo.forks_count}`,
|
|
41
|
+
thumbnailUrl: repo.owner.avatar_url,
|
|
42
|
+
sourceUrl: repo.html_url,
|
|
43
|
+
mediaType: 1,
|
|
44
|
+
renderLargerThumbnail: true
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}, { quoted: fake });
|
|
48
|
+
|
|
49
|
+
const zipUrl = `https://github.com/Davex-254/DAVE-X/archive/refs/heads/main.zip`;
|
|
50
|
+
const path = require('path');
|
|
51
|
+
const fs = require('fs');
|
|
52
|
+
const zipPath = path.join(__dirname, '../tmp/repo.zip');
|
|
53
|
+
fs.mkdirSync(path.dirname(zipPath), { recursive: true });
|
|
54
|
+
|
|
55
|
+
const zipResponse = await axios.get(zipUrl, {
|
|
56
|
+
responseType: 'arraybuffer',
|
|
57
|
+
headers: { 'User-Agent': 'DAVE-X' },
|
|
58
|
+
timeout: 30000
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
fs.writeFileSync(zipPath, zipResponse.data);
|
|
62
|
+
|
|
63
|
+
await sock.sendMessage(chatId, {
|
|
64
|
+
document: fs.readFileSync(zipPath),
|
|
65
|
+
mimetype: 'application/zip',
|
|
66
|
+
fileName: `DAVE-X-${moment().format('DDMMYY')}.zip`,
|
|
67
|
+
caption: `✦ ${botName} Source Code`
|
|
68
|
+
}, { quoted: fake });
|
|
69
|
+
|
|
70
|
+
fs.unlinkSync(zipPath);
|
|
71
|
+
|
|
72
|
+
await sock.sendMessage(chatId, {
|
|
73
|
+
react: { text: '✅', key: message.key }
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error('GitHub error:', error.message);
|
|
78
|
+
const fake = createFakeContact(message);
|
|
79
|
+
await sock.sendMessage(chatId, {
|
|
80
|
+
text: `✦ Failed to fetch repository info\n${error.message}`
|
|
81
|
+
}, { quoted: fake });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
module.exports = githubCommand;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const axios = require("axios");
|
|
2
|
+
const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
|
|
3
|
+
async function googleCommand(sock, chatId, message) {
|
|
4
|
+
const fake = createFakeContact(message);
|
|
5
|
+
|
|
6
|
+
const text = message.message?.conversation ||
|
|
7
|
+
message.message?.extendedTextMessage?.text || '';
|
|
8
|
+
|
|
9
|
+
const query = text.split(' ').slice(1).join(' ').trim();
|
|
10
|
+
|
|
11
|
+
if (!query) {
|
|
12
|
+
return sock.sendMessage(chatId, {
|
|
13
|
+
text: "◈━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◈\n" +
|
|
14
|
+
"│ ❒ ERROR\n" +
|
|
15
|
+
"◈━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◈\n" +
|
|
16
|
+
"│ 🚫 Please provide a search term!\n" +
|
|
17
|
+
"│ ❒ Example: .google What is treason\n" +
|
|
18
|
+
"◈━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◈"
|
|
19
|
+
}, { quoted: fake });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
await sock.sendMessage(chatId, {
|
|
24
|
+
text: "Searching Google..."
|
|
25
|
+
}, { quoted: fake });
|
|
26
|
+
|
|
27
|
+
let { data } = await axios.get(
|
|
28
|
+
`https://www.googleapis.com/customsearch/v1?q=${encodeURIComponent(query)}&key=AIzaSyDMbI3nvmQUrfjoCJYLS69Lej1hSXQjnWI&cx=baf9bdb0c631236e5`
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
if (!data.items || data.items.length == 0) {
|
|
32
|
+
return sock.sendMessage(chatId, {
|
|
33
|
+
text: "◈━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◈\n" +
|
|
34
|
+
"│ ❒ ERROR\n" +
|
|
35
|
+
"◈━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◈\n" +
|
|
36
|
+
"│ ❌ Unable to find any results\n" +
|
|
37
|
+
"◈━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◈"
|
|
38
|
+
}, { quoted: fake });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let tex = "";
|
|
42
|
+
tex += "◈━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◈\n";
|
|
43
|
+
tex += "│ ❒ GOOGLE SEARCH\n";
|
|
44
|
+
tex += "◈━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◈\n";
|
|
45
|
+
tex += "│ 🔍 Search Term: " + query + "\n";
|
|
46
|
+
tex += "◈━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◈\n";
|
|
47
|
+
|
|
48
|
+
// Show only first 3 results to avoid message too long
|
|
49
|
+
const results = data.items.slice(0, 3);
|
|
50
|
+
|
|
51
|
+
for (let i = 0; i < results.length; i++) {
|
|
52
|
+
tex += "│ ❒ Result " + (i + 1) + "\n";
|
|
53
|
+
tex += "│ 🪧 Title: " + results[i].title + "\n";
|
|
54
|
+
tex += "│ 📝 Description: " + results[i].snippet + "\n";
|
|
55
|
+
tex += "│ 🌐 Link: " + results[i].link + "\n";
|
|
56
|
+
tex += "◈━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◈\n";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
tex += `│ 📊 Total Results: ${data.searchInformation?.formattedTotalResults || 'Unknown'}\n`;
|
|
60
|
+
tex += `│ ⚡ Search Time: ${data.searchInformation?.formattedSearchTime || 'Unknown'} seconds\n`;
|
|
61
|
+
tex += "◈━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◈";
|
|
62
|
+
|
|
63
|
+
return sock.sendMessage(chatId, {
|
|
64
|
+
text: tex
|
|
65
|
+
}, { quoted: fake });
|
|
66
|
+
|
|
67
|
+
} catch (e) {
|
|
68
|
+
console.error("Google Search Error:", e);
|
|
69
|
+
return sock.sendMessage(chatId, {
|
|
70
|
+
text: "◈━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◈\n" +
|
|
71
|
+
"│ ❒ ERROR\n" +
|
|
72
|
+
"◈━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◈\n" +
|
|
73
|
+
"│ ❌ An error occurred: " + e.message + "\n" +
|
|
74
|
+
"◈━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━◈"
|
|
75
|
+
}, { quoted: fake });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
module.exports = googleCommand;
|