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.
Files changed (247) hide show
  1. package/Database/database.js +446 -0
  2. package/Database/migration.js +327 -0
  3. package/Database/pgSync.js +229 -0
  4. package/Database/settingsStore.js +305 -0
  5. package/config.js +32 -0
  6. package/dave.js +3063 -0
  7. package/davelib/antibadword.js +278 -0
  8. package/davelib/antilink.js +88 -0
  9. package/davelib/antilinkHelper.js +48 -0
  10. package/davelib/botConfig.js +71 -0
  11. package/davelib/connect4.js +111 -0
  12. package/davelib/converter.js +89 -0
  13. package/davelib/dicegame.js +114 -0
  14. package/davelib/exif.js +138 -0
  15. package/davelib/fakeContact.js +85 -0
  16. package/davelib/fontStyles.js +237 -0
  17. package/davelib/greetings.js +47 -0
  18. package/davelib/id.js +11 -0
  19. package/davelib/index.js +577 -0
  20. package/davelib/isAdmin.js +32 -0
  21. package/davelib/isBanned.js +12 -0
  22. package/davelib/isOwner.js +15 -0
  23. package/davelib/lightweight_store.js +169 -0
  24. package/davelib/messageConfig.js +15 -0
  25. package/davelib/messageHandler.js +87 -0
  26. package/davelib/myfunc.js +379 -0
  27. package/davelib/myfunc2.js +170 -0
  28. package/davelib/reactions.js +180 -0
  29. package/davelib/server.html +563 -0
  30. package/davelib/sticker.js +208 -0
  31. package/davelib/tempCleanup.js +53 -0
  32. package/davelib/tictactoe.js +104 -0
  33. package/davelib/uploadImage.js +100 -0
  34. package/davelib/uploader.js +110 -0
  35. package/davelib/welcome.js +100 -0
  36. package/davelib/wordchain.js +121 -0
  37. package/daveset.js +16 -0
  38. package/davexcore/ai/ai.js +100 -0
  39. package/davexcore/ai/aiGpt4.js +59 -0
  40. package/davexcore/ai/aimodels.js +284 -0
  41. package/davexcore/ai/aivideo.js +31 -0
  42. package/davexcore/ai/analyze.js +233 -0
  43. package/davexcore/ai/bard.js +101 -0
  44. package/davexcore/ai/bird.js +101 -0
  45. package/davexcore/ai/blackbox.js +30 -0
  46. package/davexcore/ai/character.js +80 -0
  47. package/davexcore/ai/copilot.js +58 -0
  48. package/davexcore/ai/dalle.js +39 -0
  49. package/davexcore/ai/davex.js +50 -0
  50. package/davexcore/ai/deepseek.js +96 -0
  51. package/davexcore/ai/grok.js +67 -0
  52. package/davexcore/ai/imagine.js +89 -0
  53. package/davexcore/ai/meta.js +82 -0
  54. package/davexcore/ai/mistral.js +101 -0
  55. package/davexcore/ai/perplexity.js +95 -0
  56. package/davexcore/ai/sora.js +44 -0
  57. package/davexcore/ai/speechwriter.js +46 -0
  58. package/davexcore/ai/vision.js +244 -0
  59. package/davexcore/ai/wormgpt.js +56 -0
  60. package/davexcore/anti/antiaudio.js +106 -0
  61. package/davexcore/anti/antibadword.js +313 -0
  62. package/davexcore/anti/antibug.js +156 -0
  63. package/davexcore/anti/anticall.js +219 -0
  64. package/davexcore/anti/antichart.js +280 -0
  65. package/davexcore/anti/antidelete.js +673 -0
  66. package/davexcore/anti/antideletestatus.js +535 -0
  67. package/davexcore/anti/antidemote.js +352 -0
  68. package/davexcore/anti/antidocument.js +105 -0
  69. package/davexcore/anti/antiedit.js +410 -0
  70. package/davexcore/anti/antifiles.js +109 -0
  71. package/davexcore/anti/antigroupmention.js +206 -0
  72. package/davexcore/anti/antiimage.js +105 -0
  73. package/davexcore/anti/antikick.js +125 -0
  74. package/davexcore/anti/antilink.js +237 -0
  75. package/davexcore/anti/antimention.js +143 -0
  76. package/davexcore/anti/antipromote.js +320 -0
  77. package/davexcore/anti/antisticker.js +105 -0
  78. package/davexcore/anti/antitag.js +191 -0
  79. package/davexcore/anti/antivideo.js +105 -0
  80. package/davexcore/anti/antiviewonce.js +396 -0
  81. package/davexcore/anti/groupanticall.js +262 -0
  82. package/davexcore/anti/mention.js +242 -0
  83. package/davexcore/automation/alwaysonline.js +226 -0
  84. package/davexcore/automation/autoReadReciepts.js +96 -0
  85. package/davexcore/automation/autoread.js +104 -0
  86. package/davexcore/automation/autorecording.js +197 -0
  87. package/davexcore/automation/autostatus.js +317 -0
  88. package/davexcore/automation/autotyping.js +197 -0
  89. package/davexcore/automation/chatbot.js +444 -0
  90. package/davexcore/automation/chatmanage.js +199 -0
  91. package/davexcore/automation/devReact.js +43 -0
  92. package/davexcore/automation/goodbye.js +181 -0
  93. package/davexcore/automation/greetings.js +154 -0
  94. package/davexcore/automation/welcome.js +187 -0
  95. package/davexcore/downloads/apk.js +157 -0
  96. package/davexcore/downloads/facebook.js +94 -0
  97. package/davexcore/downloads/gitclone.js +137 -0
  98. package/davexcore/downloads/igs.js +333 -0
  99. package/davexcore/downloads/instagram.js +133 -0
  100. package/davexcore/downloads/mediafire.js +144 -0
  101. package/davexcore/downloads/pinterest.js +38 -0
  102. package/davexcore/downloads/play.js +158 -0
  103. package/davexcore/downloads/saveStatus.js +3 -0
  104. package/davexcore/downloads/song.js +135 -0
  105. package/davexcore/downloads/spotify.js +133 -0
  106. package/davexcore/downloads/tiktok.js +167 -0
  107. package/davexcore/downloads/tiktokaudio.js +158 -0
  108. package/davexcore/downloads/video.js +188 -0
  109. package/davexcore/downloads/ytdl.js +252 -0
  110. package/davexcore/downloads/ytdocplay.js +130 -0
  111. package/davexcore/downloads/ytdocvideo.js +95 -0
  112. package/davexcore/downloads/yts.js +64 -0
  113. package/davexcore/games/connect4.js +267 -0
  114. package/davexcore/games/dice.js +286 -0
  115. package/davexcore/games/eightball.js +24 -0
  116. package/davexcore/games/hangman.js +60 -0
  117. package/davexcore/games/rps.js +25 -0
  118. package/davexcore/games/ship.js +36 -0
  119. package/davexcore/games/slot.js +21 -0
  120. package/davexcore/games/tictactoe.js +263 -0
  121. package/davexcore/games/trivia.js +46 -0
  122. package/davexcore/games/wordchain.js +242 -0
  123. package/davexcore/group/addmember.js +101 -0
  124. package/davexcore/group/ban.js +63 -0
  125. package/davexcore/group/blockUnblock.js +177 -0
  126. package/davexcore/group/clear.js +196 -0
  127. package/davexcore/group/creategroup.js +43 -0
  128. package/davexcore/group/demote.js +115 -0
  129. package/davexcore/group/disappear.js +67 -0
  130. package/davexcore/group/groupinfo.js +167 -0
  131. package/davexcore/group/groupmanage.js +133 -0
  132. package/davexcore/group/hidetag.js +108 -0
  133. package/davexcore/group/joinrequests.js +145 -0
  134. package/davexcore/group/kick.js +92 -0
  135. package/davexcore/group/kickall.js +63 -0
  136. package/davexcore/group/leave.js +38 -0
  137. package/davexcore/group/linkgroup.js +63 -0
  138. package/davexcore/group/mute.js +57 -0
  139. package/davexcore/group/online.js +117 -0
  140. package/davexcore/group/pmblocker.js +65 -0
  141. package/davexcore/group/promote.js +93 -0
  142. package/davexcore/group/resetlink.js +57 -0
  143. package/davexcore/group/staff.js +99 -0
  144. package/davexcore/group/tag.js +111 -0
  145. package/davexcore/group/tagadmins.js +88 -0
  146. package/davexcore/group/tagall.js +99 -0
  147. package/davexcore/group/tagnotadmin.js +92 -0
  148. package/davexcore/group/topmembers.js +202 -0
  149. package/davexcore/group/unban.js +64 -0
  150. package/davexcore/group/unmute.js +45 -0
  151. package/davexcore/group/warn.js +83 -0
  152. package/davexcore/group/warnings.js +26 -0
  153. package/davexcore/media/anime.js +130 -0
  154. package/davexcore/media/attp.js +127 -0
  155. package/davexcore/media/design.js +52 -0
  156. package/davexcore/media/emojimix.js +105 -0
  157. package/davexcore/media/getpp.js +108 -0
  158. package/davexcore/media/image.js +87 -0
  159. package/davexcore/media/imageedit.js +329 -0
  160. package/davexcore/media/img-blur.js +70 -0
  161. package/davexcore/media/meme.js +35 -0
  162. package/davexcore/media/pies.js +53 -0
  163. package/davexcore/media/quotesticker.js +153 -0
  164. package/davexcore/media/remini.js +126 -0
  165. package/davexcore/media/removebg.js +114 -0
  166. package/davexcore/media/setpp.js +65 -0
  167. package/davexcore/media/shazam.js +251 -0
  168. package/davexcore/media/simage.js +74 -0
  169. package/davexcore/media/sticker.js +134 -0
  170. package/davexcore/media/stickercrop.js +133 -0
  171. package/davexcore/media/stickertelegram.js +133 -0
  172. package/davexcore/media/take.js +76 -0
  173. package/davexcore/media/textmaker.js +106 -0
  174. package/davexcore/media/toAudio.js +180 -0
  175. package/davexcore/media/togif.js +33 -0
  176. package/davexcore/media/toimg.js +26 -0
  177. package/davexcore/media/tomp4.js +34 -0
  178. package/davexcore/media/tostatus.js +160 -0
  179. package/davexcore/media/tts.js +47 -0
  180. package/davexcore/media/viewonce.js +59 -0
  181. package/davexcore/media/vn.js +67 -0
  182. package/davexcore/media/vv2.js +3 -0
  183. package/davexcore/media/wallpaper.js +89 -0
  184. package/davexcore/media/wasted.js +57 -0
  185. package/davexcore/misc/compliment.js +93 -0
  186. package/davexcore/misc/dare.js +47 -0
  187. package/davexcore/misc/fact.js +14 -0
  188. package/davexcore/misc/flirt.js +26 -0
  189. package/davexcore/misc/goodnight.js +33 -0
  190. package/davexcore/misc/insult.js +281 -0
  191. package/davexcore/misc/joke.js +66 -0
  192. package/davexcore/misc/misc.js +200 -0
  193. package/davexcore/misc/quote.js +22 -0
  194. package/davexcore/misc/roseday.js +24 -0
  195. package/davexcore/misc/shayari.js +62 -0
  196. package/davexcore/misc/simp.js +47 -0
  197. package/davexcore/misc/stupid.js +51 -0
  198. package/davexcore/misc/truth.js +146 -0
  199. package/davexcore/owner/alive.js +67 -0
  200. package/davexcore/owner/bio.js +49 -0
  201. package/davexcore/owner/broadcast.js +74 -0
  202. package/davexcore/owner/chanel.js +79 -0
  203. package/davexcore/owner/channelid.js +50 -0
  204. package/davexcore/owner/clearsession.js +86 -0
  205. package/davexcore/owner/help.js +649 -0
  206. package/davexcore/owner/hijack.js +69 -0
  207. package/davexcore/owner/menuManage.js +173 -0
  208. package/davexcore/owner/menuSettings.js +1 -0
  209. package/davexcore/owner/owner.js +17 -0
  210. package/davexcore/owner/pair.js +160 -0
  211. package/davexcore/owner/pinchat.js +44 -0
  212. package/davexcore/owner/ping.js +65 -0
  213. package/davexcore/owner/profilepic.js +61 -0
  214. package/davexcore/owner/resetmenuimage.js +16 -0
  215. package/davexcore/owner/setGroupStatus.js +315 -0
  216. package/davexcore/owner/setbotconfig.js +306 -0
  217. package/davexcore/owner/setfont.js +79 -0
  218. package/davexcore/owner/setowner.js +144 -0
  219. package/davexcore/owner/setprefix.js +131 -0
  220. package/davexcore/owner/settings.js +98 -0
  221. package/davexcore/owner/startupwelcome.js +94 -0
  222. package/davexcore/owner/sudo.js +138 -0
  223. package/davexcore/owner/update.js +282 -0
  224. package/davexcore/tmp/1772020249097.jpg +0 -0
  225. package/davexcore/utility/bible.js +239 -0
  226. package/davexcore/utility/cleartmp.js +107 -0
  227. package/davexcore/utility/delete.js +182 -0
  228. package/davexcore/utility/encrypt.js +99 -0
  229. package/davexcore/utility/ethicalhacking.js +108 -0
  230. package/davexcore/utility/fetch.js +127 -0
  231. package/davexcore/utility/github.js +85 -0
  232. package/davexcore/utility/google.js +79 -0
  233. package/davexcore/utility/join.js +52 -0
  234. package/davexcore/utility/lastseen.js +67 -0
  235. package/davexcore/utility/location.js +106 -0
  236. package/davexcore/utility/lyrics.js +54 -0
  237. package/davexcore/utility/movie.js +66 -0
  238. package/davexcore/utility/news.js +37 -0
  239. package/davexcore/utility/sports.js +403 -0
  240. package/davexcore/utility/ss.js +63 -0
  241. package/davexcore/utility/tinyurl.js +83 -0
  242. package/davexcore/utility/translate.js +101 -0
  243. package/davexcore/utility/url.js +112 -0
  244. package/davexcore/utility/vcf.js +84 -0
  245. package/davexcore/utility/weather.js +162 -0
  246. package/index.js +994 -0
  247. package/package.json +64 -0
@@ -0,0 +1,244 @@
1
+ const { downloadContentFromMessage } = require('@whiskeysockets/baileys');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const axios = require('axios');
5
+ const FormData = require('form-data');
6
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
7
+
8
+ // =======================
9
+ // Upload Helpers
10
+ // =======================
11
+
12
+ // Upload to Catbox (primary)
13
+ async function uploadToCatbox(filePath) {
14
+ const form = new FormData();
15
+ form.append("reqtype", "fileupload");
16
+ form.append("fileToUpload", fs.createReadStream(filePath));
17
+
18
+ const res = await axios.post("https://catbox.moe/user/api.php", form, {
19
+ headers: form.getHeaders(),
20
+ timeout: 30000
21
+ });
22
+
23
+ return res.data; // permanent URL
24
+ }
25
+
26
+ // Upload to Ugu.se (fallback)
27
+ async function uploadToUgu(filePath) {
28
+ const form = new FormData();
29
+ form.append("files[]", fs.createReadStream(filePath), {
30
+ filename: path.basename(filePath)
31
+ });
32
+
33
+ const res = await axios.post("https://uguu.se/upload.php", form, {
34
+ headers: {
35
+ ...form.getHeaders(),
36
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
37
+ },
38
+ timeout: 30000
39
+ });
40
+
41
+ if (res.data && res.data.success && res.data.files && res.data.files[0]) {
42
+ return res.data.files[0].url;
43
+ }
44
+ throw new Error('Ugu upload failed');
45
+ }
46
+
47
+ // Main upload function with fallback
48
+ async function uploadImage(filePath) {
49
+ try {
50
+ console.log('[Upload] Trying Catbox...');
51
+ const catboxUrl = await uploadToCatbox(filePath);
52
+ console.log('[Upload] Catbox success:', catboxUrl);
53
+ return catboxUrl;
54
+ } catch (catboxError) {
55
+ console.log('[Upload] Catbox failed, trying Ugu...:', catboxError.message);
56
+
57
+ try {
58
+ const uguUrl = await uploadToUgu(filePath);
59
+ console.log('[Upload] Ugu success:', uguUrl);
60
+ return uguUrl;
61
+ } catch (uguError) {
62
+ console.log('[Upload] Both uploaders failed');
63
+ throw new Error(`Upload failed: Catbox - ${catboxError.message}, Ugu - ${uguError.message}`);
64
+ }
65
+ }
66
+ }
67
+
68
+ // =======================
69
+ // Media Extraction
70
+ // =======================
71
+
72
+ // Extract buffer + extension from different media types
73
+ async function extractMedia(message) {
74
+ const m = message.message || {};
75
+
76
+ const handlers = {
77
+ imageMessage: { type: 'image', ext: '.jpg' },
78
+ videoMessage: { type: 'video', ext: '.mp4' },
79
+ audioMessage: { type: 'audio', ext: '.mp3' },
80
+ documentMessage: { type: 'document', ext: null },
81
+ stickerMessage: { type: 'sticker', ext: '.webp' }
82
+ };
83
+
84
+ for (const key in handlers) {
85
+ if (m[key]) {
86
+ const { type, ext } = handlers[key];
87
+ const stream = await downloadContentFromMessage(m[key], type);
88
+ const chunks = [];
89
+ for await (const chunk of stream) chunks.push(chunk);
90
+
91
+ if (key === 'documentMessage') {
92
+ const fileName = m.documentMessage.fileName || 'file.bin';
93
+ return { buffer: Buffer.concat(chunks), ext: path.extname(fileName) || '.bin' };
94
+ }
95
+
96
+ return { buffer: Buffer.concat(chunks), ext };
97
+ }
98
+ }
99
+
100
+ return null;
101
+ }
102
+
103
+ // Extract quoted media (reply case)
104
+ async function extractQuotedMedia(message) {
105
+ const quoted = message.message?.extendedTextMessage?.contextInfo?.quotedMessage;
106
+ if (!quoted) return null;
107
+ return extractMedia({ message: quoted });
108
+ }
109
+
110
+ // =======================
111
+ // Vision Command
112
+ // =======================
113
+ async function visionCommand(sock, chatId, message) {
114
+ const fake = createFakeContact(message);
115
+ const botName = getBotName();
116
+
117
+ try {
118
+ const text = message.message?.conversation || message.message?.extendedTextMessage?.text;
119
+
120
+ // React to message
121
+ await sock.sendMessage(chatId, { react: { text: '⏳', key: message.key } });
122
+
123
+ // Validate input
124
+ if (!text) {
125
+ return sock.sendMessage(
126
+ chatId,
127
+ { text: `✦ *${botName}* Vision\n\nReply to an image with instructions` },
128
+ { quoted: fake }
129
+ );
130
+ }
131
+
132
+ // Extract quoted media (only image allowed)
133
+ const quotedMedia = await extractQuotedMedia(message);
134
+
135
+ if (!quotedMedia) {
136
+ return sock.sendMessage(
137
+ chatId,
138
+ { text: `✦ *${botName}*\nReply to an image` },
139
+ { quoted: fake }
140
+ );
141
+ }
142
+
143
+ // Check if it's an image (allow .jpg, .png, .jpeg, .webp)
144
+ const validImageExts = ['.jpg', '.jpeg', '.png', '.webp'];
145
+ if (!validImageExts.includes(quotedMedia.ext.toLowerCase())) {
146
+ return sock.sendMessage(
147
+ chatId,
148
+ { text: `✦ *${botName}*\nThat's not an image` },
149
+ { quoted: fake }
150
+ );
151
+ }
152
+
153
+ // Temp file handling
154
+ const tempDir = path.join(__dirname, '../temp');
155
+ if (!fs.existsSync(tempDir)) fs.mkdirSync(tempDir, { recursive: true });
156
+
157
+ const tempPath = path.join(tempDir, `vision_${Date.now()}${quotedMedia.ext}`);
158
+ fs.writeFileSync(tempPath, quotedMedia.buffer);
159
+
160
+ let imageUrl;
161
+ try {
162
+ // Upload image (with fallback)
163
+ imageUrl = await uploadImage(tempPath);
164
+
165
+ // Notify user that analysis is in progress
166
+ await sock.sendMessage(
167
+ chatId,
168
+ { text: `✦ *${botName}* - am know invisible 🔥\n\nAnalyzing image...` },
169
+ { quoted: fake }
170
+ );
171
+
172
+ // Call the Gemini Vision API
173
+ const apiUrl = `https://apiskeith.top/ai/gemini-vision?image=${encodeURIComponent(imageUrl)}&q=${encodeURIComponent(text)}`;
174
+ const response = await axios.get(apiUrl, { timeout: 60000 });
175
+ const data = response.data;
176
+
177
+ const result = data.result || data.BK9 || data.answer || data.text || data.response;
178
+ if (!result) {
179
+ throw new Error('API returned an empty response');
180
+ }
181
+
182
+ // Send success reaction
183
+ await sock.sendMessage(chatId, {
184
+ react: { text: '✅', key: message.key }
185
+ });
186
+
187
+ // Send the analysis result
188
+ await sock.sendMessage(
189
+ chatId,
190
+ { text: `✦ *${botName}*\n\n${result}` },
191
+ { quoted: fake }
192
+ );
193
+
194
+ } catch (apiError) {
195
+ console.error('[Vision] API error:', apiError?.message || apiError);
196
+
197
+ let errorMsg = `✦ Failed to analyze image`;
198
+
199
+ if (apiError.code === 'ECONNABORTED' || apiError.message.includes('timeout')) {
200
+ errorMsg += ' (timeout)';
201
+ } else if (apiError.message.includes('Upload failed')) {
202
+ errorMsg += ' (upload failed)';
203
+ } else {
204
+ errorMsg += `: ${apiError.message}`;
205
+ }
206
+
207
+ await sock.sendMessage(
208
+ chatId,
209
+ { text: errorMsg },
210
+ { quoted: fake }
211
+ );
212
+
213
+ await sock.sendMessage(chatId, {
214
+ react: { text: '❌', key: message.key }
215
+ });
216
+ } finally {
217
+ // Cleanup temp file
218
+ setTimeout(() => {
219
+ if (fs.existsSync(tempPath)) {
220
+ try {
221
+ fs.unlinkSync(tempPath);
222
+ console.log('[Cleanup] Temp file removed:', tempPath);
223
+ } catch (cleanupError) {
224
+ console.error('[Cleanup] Failed to remove temp file:', cleanupError.message);
225
+ }
226
+ }
227
+ }, 2000);
228
+ }
229
+
230
+ } catch (error) {
231
+ console.error('[Vision] error:', error?.message || error);
232
+ await sock.sendMessage(
233
+ chatId,
234
+ { text: `✦ *${botName}*\nError: ${error.message}` },
235
+ { quoted: fake }
236
+ );
237
+
238
+ await sock.sendMessage(chatId, {
239
+ react: { text: '❌', key: message.key }
240
+ });
241
+ }
242
+ }
243
+
244
+ module.exports = visionCommand;
@@ -0,0 +1,56 @@
1
+ const axios = require('axios');
2
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
3
+ async function wormgptCommand(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: `*WormGPT - Uncensored AI*\n\nI am WormGPT — uncensored, fearless, and ready for anything. Ask me what you dare.\n\nExample: .wormgpt How to hack a website?`
14
+ }, { quoted: fake });
15
+ }
16
+
17
+ try {
18
+ const apiUrl = `https://apiskeith.top/ai/wormgpt?q=${encodeURIComponent(query)}`;
19
+ const { data } = await axios.get(apiUrl, {
20
+ timeout: 30000,
21
+ headers: {
22
+ 'user-agent': 'Mozilla/5.0',
23
+ 'accept': 'application/json'
24
+ }
25
+ });
26
+
27
+ if (!data || !data.status || !data.result) {
28
+ throw new Error('Invalid API response');
29
+ }
30
+
31
+ const answer = data.result.trim();
32
+
33
+ await sock.sendMessage(chatId, { text: `${answer}\n\n- DAVE X` }, { quoted: fake });
34
+
35
+ } catch (error) {
36
+ console.error("WormGPT Error:", error);
37
+
38
+ let errorMessage = "Failed to get response from WormGPT.";
39
+
40
+ if (error.response?.status === 404) {
41
+ errorMessage += " API endpoint not found.";
42
+ } else if (error.response?.status === 429) {
43
+ errorMessage += " Rate limit exceeded.";
44
+ } else if (error.message.includes("timeout")) {
45
+ errorMessage += " Request timed out.";
46
+ } else if (error.message.includes("ENOTFOUND")) {
47
+ errorMessage += " Cannot connect to API server.";
48
+ } else {
49
+ errorMessage += " " + error.message;
50
+ }
51
+
52
+ await sock.sendMessage(chatId, { text: `*ERROR*\n${errorMessage}\n\n- DAVE X` }, { quoted: fake });
53
+ }
54
+ }
55
+
56
+ module.exports = wormgptCommand;
@@ -0,0 +1,106 @@
1
+ const { getGroupConfig, setGroupConfig, deleteGroupToggle } = require('../../Database/settingsStore');
2
+ const isAdmin = require('../../davelib/isAdmin');
3
+ const db = require('../../Database/database');
4
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
5
+
6
+ async function antiaudioCommand(sock, chatId, userMessage, senderId, isSenderAdmin, message) {
7
+ try {
8
+ const fake = createFakeContact(senderId);
9
+ const botName = getBotName();
10
+
11
+ if (!isSenderAdmin && !message?.key?.fromMe && !db.isSudo(senderId)) {
12
+ await sock.sendMessage(chatId, { text: `*${botName}*\nAdmin only command!` }, { quoted: fake });
13
+ return;
14
+ }
15
+
16
+ const args = userMessage.slice(10).toLowerCase().trim().split(' ');
17
+ const action = args[0];
18
+
19
+ if (!action) {
20
+ const config = getGroupConfig(chatId, 'antiaudio') || { enabled: false };
21
+ const currentMode = config.enabled ? (config.action || 'delete') : 'off';
22
+
23
+ const usage = `*${botName} ANTI-AUDIO*\n\nCurrent Mode: ${currentMode.toUpperCase()}\n\n*Commands:*\n.antiaudio off - Disable\n.antiaudio delete - Delete audio\n.antiaudio warn - Delete + warn\n.antiaudio kick - Delete + kick`;
24
+
25
+ await sock.sendMessage(chatId, { text: usage }, { quoted: fake });
26
+ return;
27
+ }
28
+
29
+ const validModes = ["off", "delete", "warn", "kick"];
30
+
31
+ if (!validModes.includes(action)) {
32
+ await sock.sendMessage(chatId, {
33
+ text: `*${botName}*\nInvalid mode! Use: off, delete, warn, kick`
34
+ }, { quoted: fake });
35
+ return;
36
+ }
37
+
38
+ if (action === 'off') {
39
+ deleteGroupToggle(chatId, 'antiaudio');
40
+ await sock.sendMessage(chatId, {
41
+ text: `*${botName}*\nAnti-Audio DISABLED`
42
+ }, { quoted: fake });
43
+ } else {
44
+ setGroupConfig(chatId, 'antiaudio', { enabled: true, action: action });
45
+ await sock.sendMessage(chatId, {
46
+ text: `*${botName}*\nAnti-Audio: ${action.toUpperCase()}`
47
+ }, { quoted: fake });
48
+ }
49
+ } catch (error) {
50
+ console.error('Error in antiaudio command:', error.message, 'Line:', error.stack?.split('\n')[1]);
51
+ }
52
+ }
53
+
54
+ async function handleAudioDetection(sock, chatId, message, senderId) {
55
+ try {
56
+ const isAudio = message.type === 'audioMessage' ||
57
+ message.type === 'pttMessage' ||
58
+ (message.message && (message.message.audioMessage || message.message.pttMessage));
59
+
60
+ if (!isAudio) return;
61
+ if (!chatId.endsWith('@g.us')) return;
62
+
63
+ const config = getGroupConfig(chatId, 'antiaudio');
64
+ if (!config || !config.enabled) return;
65
+
66
+ const { isSenderAdmin, isBotAdmin } = await isAdmin(sock, chatId, senderId);
67
+ if (!isBotAdmin || isSenderAdmin || db.isSudo(senderId)) return;
68
+
69
+ const botName = getBotName();
70
+ const userTag = `@${senderId.split("@")[0]}`;
71
+
72
+ try {
73
+ await sock.sendMessage(chatId, {
74
+ delete: {
75
+ remoteJid: chatId,
76
+ fromMe: false,
77
+ id: message.key.id,
78
+ participant: senderId
79
+ }
80
+ });
81
+ } catch (e) {
82
+ console.error("[ANTI-AUDIO] Delete failed:", e.message);
83
+ return;
84
+ }
85
+
86
+ if (config.action === 'kick') {
87
+ await sock.sendMessage(chatId, {
88
+ text: `*${botName}*\n\n${userTag} kicked for sending audio.`,
89
+ mentions: [senderId]
90
+ });
91
+ await sock.groupParticipantsUpdate(chatId, [senderId], 'remove');
92
+ } else if (config.action === 'warn') {
93
+ await sock.sendMessage(chatId, {
94
+ text: `*${botName}*\n\n${userTag}, audio is not allowed!`,
95
+ mentions: [senderId]
96
+ });
97
+ }
98
+ } catch (error) {
99
+ console.error('Error in handleAudioDetection:', error.message, 'Line:', error.stack?.split('\n')[1]);
100
+ }
101
+ }
102
+
103
+ module.exports = {
104
+ antiaudioCommand,
105
+ handleAudioDetection
106
+ };