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,87 @@
1
+ const axios = require('axios');
2
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
3
+
4
+ // Track processed message IDs to prevent duplicate handling
5
+ const processedMessages = new Set();
6
+ async function imageCommand(sock, chatId, message) {
7
+ const fkontak = createFakeContact(message);
8
+
9
+ try {
10
+ const msgId = message?.key?.id;
11
+ if (!msgId) return;
12
+
13
+ // Prevent duplicate processing
14
+ if (processedMessages.has(msgId)) return;
15
+ processedMessages.add(msgId);
16
+ setTimeout(() => processedMessages.delete(msgId), 5 * 60 * 1000);
17
+
18
+ // Extract text content
19
+ const text = message.message?.conversation || message.message?.extendedTextMessage?.text;
20
+ if (!text) {
21
+ return sock.sendMessage(chatId, {
22
+ text: "Please provide a search term."
23
+ }, { quoted: fkontak });
24
+ }
25
+
26
+ // Parse query
27
+ const query = text.split(' ').slice(1).join(' ').trim();
28
+ if (!query) {
29
+ return sock.sendMessage(chatId, {
30
+ text: "Please provide a search term."
31
+ }, { quoted: fkontak });
32
+ }
33
+
34
+ // React indicator
35
+ await sock.sendMessage(chatId, { react: { text: '🔍', key: message.key } });
36
+
37
+ // API call
38
+ const apiUrl = `https://iamtkm.vercel.app/downloaders/img?apikey=tkm&text=${encodeURIComponent(query)}`;
39
+ let apiResponse;
40
+ try {
41
+ apiResponse = await axios.get(apiUrl);
42
+ } catch (err) {
43
+ console.error("Image API error:", err.message);
44
+ return sock.sendMessage(chatId, {
45
+ text: "Image service unavailable."
46
+ }, { quoted: fkontak });
47
+ }
48
+
49
+ const data = apiResponse?.data;
50
+ const imageUrls = Array.isArray(data?.result) ? data.result.slice(0, 10) : [];
51
+
52
+ if (data?.status && imageUrls.length > 0) {
53
+ // Send first image with caption
54
+ await sock.sendMessage(chatId, {
55
+ image: { url: imageUrls[0] },
56
+ caption: `Results for: ${query}`
57
+ }, { quoted: fkontak });
58
+
59
+ // Send remaining images without captions
60
+ for (let i = 1; i < imageUrls.length; i++) {
61
+ try {
62
+ await sock.sendMessage(chatId, {
63
+ image: { url: imageUrls[i] }
64
+ });
65
+ if (i < imageUrls.length - 1) {
66
+ await new Promise(res => setTimeout(res, 500));
67
+ }
68
+ } catch (imgErr) {
69
+ console.error(`Image error ${i + 1}:`, imgErr.message);
70
+ }
71
+ }
72
+
73
+ } else {
74
+ await sock.sendMessage(chatId, {
75
+ text: `No images for: ${query}`
76
+ }, { quoted: fkontak });
77
+ }
78
+
79
+ } catch (error) {
80
+ console.error("Image command error:", error.message);
81
+ await sock.sendMessage(chatId, {
82
+ text: "Failed to search images."
83
+ }, { quoted: fkontak });
84
+ }
85
+ }
86
+
87
+ module.exports = imageCommand;
@@ -0,0 +1,329 @@
1
+ const { GoogleGenerativeAI } = require('@google/generative-ai');
2
+ const { downloadContentFromMessage } = require('@whiskeysockets/baileys');
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
6
+
7
+ async function downloadMedia(message) {
8
+ try {
9
+ const stream = await downloadContentFromMessage(message, 'image');
10
+ let buffer = Buffer.from([]);
11
+ for await (const chunk of stream) {
12
+ buffer = Buffer.concat([buffer, chunk]);
13
+ }
14
+ return buffer;
15
+ } catch (error) {
16
+ console.error('Download error:', error);
17
+ throw error;
18
+ }
19
+ }
20
+
21
+ async function nightCommand(sock, chatId, message, text) {
22
+ const fake = createFakeContact(message);
23
+ const botName = getBotName();
24
+
25
+ try {
26
+ const quoted = message.message?.extendedTextMessage?.contextInfo?.quotedMessage;
27
+ if (!quoted) {
28
+ await sock.sendMessage(chatId, {
29
+ text: `✦ *${botName}* Night\n\nReply to an image with .night`
30
+ }, { quoted: fake });
31
+ return;
32
+ }
33
+
34
+ const imageMessage = quoted.imageMessage;
35
+ if (!imageMessage) {
36
+ await sock.sendMessage(chatId, {
37
+ text: `✦ *${botName}*\nReply to an image`
38
+ }, { quoted: fake });
39
+ return;
40
+ }
41
+
42
+ const mimeType = imageMessage.mimetype;
43
+ if (!mimeType || !/image\/(jpe?g|png)/.test(mimeType)) {
44
+ await sock.sendMessage(chatId, {
45
+ text: `✦ *${botName}*\nOnly JPEG/PNG images supported`
46
+ }, { quoted: fake });
47
+ return;
48
+ }
49
+
50
+ await sock.sendMessage(chatId, {
51
+ text: `✦ *${botName}* - am know invisible 🔥\n\nProcessing image...`
52
+ }, { quoted: fake });
53
+
54
+ // Download the image
55
+ const buffer = await downloadMedia(imageMessage);
56
+ const base64Image = buffer.toString('base64');
57
+ const promptText = text || "ubah jadi malam hari";
58
+
59
+ const genAI = new GoogleGenerativeAI("AIzaSyDE7R-5gnjgeqYGSMGiZVjA5VkSrQvile8");
60
+
61
+ const contents = [
62
+ { text: promptText },
63
+ {
64
+ inlineData: {
65
+ mimeType: mimeType,
66
+ data: base64Image
67
+ }
68
+ }
69
+ ];
70
+
71
+ const model = genAI.getGenerativeModel({
72
+ model: "gemini-2.0-flash-exp-image-generation",
73
+ generationConfig: {
74
+ responseModalities: ["Text", "Image"]
75
+ },
76
+ });
77
+
78
+ const response = await model.generateContent(contents);
79
+
80
+ let resultImage = null;
81
+
82
+ for (const part of response.response.candidates[0].content.parts) {
83
+ if (part.inlineData) {
84
+ const imageData = part.inlineData.data;
85
+ resultImage = Buffer.from(imageData, "base64");
86
+ break;
87
+ }
88
+ }
89
+
90
+ if (resultImage) {
91
+ const tempPath = path.join(process.cwd(), "temp", `night_${Date.now()}.png`);
92
+
93
+ if (!fs.existsSync(path.join(process.cwd(), "temp"))) {
94
+ fs.mkdirSync(path.join(process.cwd(), "temp"), { recursive: true });
95
+ }
96
+
97
+ fs.writeFileSync(tempPath, resultImage);
98
+
99
+ await sock.sendMessage(chatId, {
100
+ image: { url: tempPath },
101
+ caption: `✦ *${botName}* - am know invisible 🔥`
102
+ }, { quoted: fake });
103
+
104
+ setTimeout(() => {
105
+ try {
106
+ if (fs.existsSync(tempPath)) fs.unlinkSync(tempPath);
107
+ } catch (e) {}
108
+ }, 30000);
109
+ } else {
110
+ await sock.sendMessage(chatId, {
111
+ text: `✦ *${botName}*\nFailed to edit image`
112
+ }, { quoted: fake });
113
+ }
114
+
115
+ } catch (error) {
116
+ console.error('Error in night command:', error);
117
+ await sock.sendMessage(chatId, {
118
+ text: `✦ *${botName}*\nError processing image`
119
+ }, { quoted: fake });
120
+ }
121
+ }
122
+
123
+ async function prettyCommand(sock, chatId, message, text) {
124
+ const fake = createFakeContact(message);
125
+ const botName = getBotName();
126
+
127
+ try {
128
+ const quoted = message.message?.extendedTextMessage?.contextInfo?.quotedMessage;
129
+ if (!quoted) {
130
+ await sock.sendMessage(chatId, {
131
+ text: `✦ *${botName}* Pretty\n\nReply to an image with .pretty`
132
+ }, { quoted: fake });
133
+ return;
134
+ }
135
+
136
+ const imageMessage = quoted.imageMessage;
137
+ if (!imageMessage) {
138
+ await sock.sendMessage(chatId, {
139
+ text: `✦ *${botName}*\nReply to an image`
140
+ }, { quoted: fake });
141
+ return;
142
+ }
143
+
144
+ const mimeType = imageMessage.mimetype;
145
+ if (!mimeType || !/image\/(jpe?g|png)/.test(mimeType)) {
146
+ await sock.sendMessage(chatId, {
147
+ text: `✦ *${botName}*\nOnly JPEG/PNG images supported`
148
+ }, { quoted: fake });
149
+ return;
150
+ }
151
+
152
+ await sock.sendMessage(chatId, {
153
+ text: `✦ *${botName}* - am know invisible 🔥\n\nProcessing image...`
154
+ }, { quoted: fake });
155
+
156
+ const buffer = await downloadMedia(imageMessage);
157
+ const base64Image = buffer.toString('base64');
158
+ const promptText = text || "edit wajah karakter menjadi wajah orang Korea";
159
+
160
+ const genAI = new GoogleGenerativeAI("AIzaSyDE7R-5gnjgeqYGSMGiZVjA5VkSrQvile8");
161
+
162
+ const contents = [
163
+ { text: promptText },
164
+ {
165
+ inlineData: {
166
+ mimeType: mimeType,
167
+ data: base64Image
168
+ }
169
+ }
170
+ ];
171
+
172
+ const model = genAI.getGenerativeModel({
173
+ model: "gemini-2.0-flash-exp-image-generation",
174
+ generationConfig: {
175
+ responseModalities: ["Text", "Image"]
176
+ },
177
+ });
178
+
179
+ const response = await model.generateContent(contents);
180
+
181
+ let resultImage = null;
182
+
183
+ for (const part of response.response.candidates[0].content.parts) {
184
+ if (part.inlineData) {
185
+ const imageData = part.inlineData.data;
186
+ resultImage = Buffer.from(imageData, "base64");
187
+ break;
188
+ }
189
+ }
190
+
191
+ if (resultImage) {
192
+ const tempPath = path.join(process.cwd(), "temp", `pretty_${Date.now()}.png`);
193
+
194
+ if (!fs.existsSync(path.join(process.cwd(), "temp"))) {
195
+ fs.mkdirSync(path.join(process.cwd(), "temp"), { recursive: true });
196
+ }
197
+
198
+ fs.writeFileSync(tempPath, resultImage);
199
+
200
+ await sock.sendMessage(chatId, {
201
+ image: { url: tempPath },
202
+ caption: `✦ *${botName}* - am know invisible 🔥`
203
+ }, { quoted: fake });
204
+
205
+ setTimeout(() => {
206
+ try {
207
+ if (fs.existsSync(tempPath)) fs.unlinkSync(tempPath);
208
+ } catch (e) {}
209
+ }, 30000);
210
+ } else {
211
+ await sock.sendMessage(chatId, {
212
+ text: `✦ *${botName}*\nFailed to edit image`
213
+ }, { quoted: fake });
214
+ }
215
+
216
+ } catch (error) {
217
+ console.error('Error in pretty command:', error);
218
+ await sock.sendMessage(chatId, {
219
+ text: `✦ *${botName}*\nError processing image`
220
+ }, { quoted: fake });
221
+ }
222
+ }
223
+
224
+ async function uglyCommand(sock, chatId, message, text) {
225
+ const fake = createFakeContact(message);
226
+ const botName = getBotName();
227
+
228
+ try {
229
+ const quoted = message.message?.extendedTextMessage?.contextInfo?.quotedMessage;
230
+ if (!quoted) {
231
+ await sock.sendMessage(chatId, {
232
+ text: `✦ *${botName}* Ugly\n\nReply to an image with .ugly`
233
+ }, { quoted: fake });
234
+ return;
235
+ }
236
+
237
+ const imageMessage = quoted.imageMessage;
238
+ if (!imageMessage) {
239
+ await sock.sendMessage(chatId, {
240
+ text: `✦ *${botName}*\nReply to an image`
241
+ }, { quoted: fake });
242
+ return;
243
+ }
244
+
245
+ const mimeType = imageMessage.mimetype;
246
+ if (!mimeType || !/image\/(jpe?g|png)/.test(mimeType)) {
247
+ await sock.sendMessage(chatId, {
248
+ text: `✦ *${botName}*\nOnly JPEG/PNG images supported`
249
+ }, { quoted: fake });
250
+ return;
251
+ }
252
+
253
+ await sock.sendMessage(chatId, {
254
+ text: `✦ *${botName}* - am know invisible 🔥\n\nProcessing image...`
255
+ }, { quoted: fake });
256
+
257
+ const buffer = await downloadMedia(imageMessage);
258
+ const base64Image = buffer.toString('base64');
259
+ const promptText = text || "edit wajah karakter menjadi jelek";
260
+
261
+ const genAI = new GoogleGenerativeAI("AIzaSyDE7R-5gnjgeqYGSMGiZVjA5VkSrQvile8");
262
+
263
+ const contents = [
264
+ { text: promptText },
265
+ {
266
+ inlineData: {
267
+ mimeType: mimeType,
268
+ data: base64Image
269
+ }
270
+ }
271
+ ];
272
+
273
+ const model = genAI.getGenerativeModel({
274
+ model: "gemini-2.0-flash-exp-image-generation",
275
+ generationConfig: {
276
+ responseModalities: ["Text", "Image"]
277
+ },
278
+ });
279
+
280
+ const response = await model.generateContent(contents);
281
+
282
+ let resultImage = null;
283
+
284
+ for (const part of response.response.candidates[0].content.parts) {
285
+ if (part.inlineData) {
286
+ const imageData = part.inlineData.data;
287
+ resultImage = Buffer.from(imageData, "base64");
288
+ break;
289
+ }
290
+ }
291
+
292
+ if (resultImage) {
293
+ const tempPath = path.join(process.cwd(), "temp", `ugly_${Date.now()}.png`);
294
+
295
+ if (!fs.existsSync(path.join(process.cwd(), "temp"))) {
296
+ fs.mkdirSync(path.join(process.cwd(), "temp"), { recursive: true });
297
+ }
298
+
299
+ fs.writeFileSync(tempPath, resultImage);
300
+
301
+ await sock.sendMessage(chatId, {
302
+ image: { url: tempPath },
303
+ caption: `✦ *${botName}* - am know invisible 🔥`
304
+ }, { quoted: fake });
305
+
306
+ setTimeout(() => {
307
+ try {
308
+ if (fs.existsSync(tempPath)) fs.unlinkSync(tempPath);
309
+ } catch (e) {}
310
+ }, 30000);
311
+ } else {
312
+ await sock.sendMessage(chatId, {
313
+ text: `✦ *${botName}*\nFailed to edit image`
314
+ }, { quoted: fake });
315
+ }
316
+
317
+ } catch (error) {
318
+ console.error('Error in ugly command:', error);
319
+ await sock.sendMessage(chatId, {
320
+ text: `✦ *${botName}*\nError processing image`
321
+ }, { quoted: fake });
322
+ }
323
+ }
324
+
325
+ module.exports = {
326
+ nightCommand,
327
+ prettyCommand,
328
+ uglyCommand
329
+ };
@@ -0,0 +1,70 @@
1
+ const { downloadMediaMessage } = require('@whiskeysockets/baileys');
2
+ const Jimp = require('jimp');
3
+ const webp = require('webp-converter');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
7
+
8
+ // Fake contact creator 😜
9
+ async function blurCommand(sock, chatId, message, quotedMessage) {
10
+ const inputPath = path.resolve('./temp_input.jpg');
11
+ const lowQualityPath = path.resolve('./temp_low.webp');
12
+ const finalPath = path.resolve('./temp_blur.jpg');
13
+
14
+ const fkontak = createFakeContact(message);
15
+
16
+ try {
17
+ // ==== Step 1: Extract image buffer ====
18
+ let imageBuffer;
19
+ if (quotedMessage?.imageMessage) {
20
+ const quoted = { message: { imageMessage: quotedMessage.imageMessage } };
21
+ imageBuffer = await downloadMediaMessage(quoted, 'buffer', {}, {});
22
+ } else if (message?.message?.imageMessage) {
23
+ imageBuffer = await downloadMediaMessage(message, 'buffer', {}, {});
24
+ } else {
25
+ return sock.sendMessage(chatId, {
26
+ text: 'Reply to an image or send an image with caption .blur'
27
+ }, { quoted: fkontak });
28
+ }
29
+
30
+ // Defensive check
31
+ if (!imageBuffer) {
32
+ throw new Error('No image buffer retrieved');
33
+ }
34
+
35
+ // ==== Step 2: Save original buffer ====
36
+ fs.writeFileSync(inputPath, imageBuffer);
37
+
38
+ // ==== Step 3: Convert to low-quality WebP (blur effect) ====
39
+ await webp.cwebp(inputPath, lowQualityPath, "-q 20", "-v");
40
+
41
+ // ==== Step 4: Convert back to JPG with reduced quality ====
42
+ const blurryImage = await Jimp.read(lowQualityPath);
43
+ await blurryImage.quality(70).writeAsync(finalPath);
44
+
45
+ const finalBuffer = fs.readFileSync(finalPath);
46
+
47
+ // ==== Step 5: Send blurred image ====
48
+ await sock.sendMessage(chatId, {
49
+ image: finalBuffer,
50
+ caption: 'Image blurred successfully'
51
+ }, { quoted: fkontak });
52
+
53
+ } catch (error) {
54
+ console.error("BLUR ERROR:", error);
55
+ await sock.sendMessage(chatId, {
56
+ text: 'Failed to blur image.'
57
+ }, { quoted: fkontak });
58
+ } finally {
59
+ // ==== Cleanup temp files safely ====
60
+ [inputPath, lowQualityPath, finalPath].forEach(file => {
61
+ if (fs.existsSync(file)) {
62
+ try { fs.unlinkSync(file); } catch (err) {
63
+ console.warn(`Failed to delete ${file}:`, err);
64
+ }
65
+ }
66
+ });
67
+ }
68
+ }
69
+
70
+ module.exports = blurCommand;
@@ -0,0 +1,35 @@
1
+ const fetch = require('node-fetch');
2
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
3
+
4
+ async function memeCommand(sock, chatId, message) {
5
+ try {
6
+ const response = await fetch('https://shizoapi.onrender.com/api/memes/cheems?apikey=shizo');
7
+
8
+ // Check if response is an image
9
+ const contentType = response.headers.get('content-type');
10
+ if (contentType && contentType.includes('image')) {
11
+ const imageBuffer = await response.buffer();
12
+
13
+ const buttons = [
14
+ { buttonId: '.meme', buttonText: { displayText: '🎭 Another Meme' }, type: 1 },
15
+ { buttonId: '.joke', buttonText: { displayText: '😄 Joke' }, type: 1 }
16
+ ];
17
+
18
+ await sock.sendMessage(chatId, {
19
+ image: imageBuffer,
20
+ caption: "_Here's your meme! 💀_",
21
+ buttons: buttons,
22
+ headerType: 1
23
+ },{ quoted: fakeContact });
24
+ } else {
25
+ throw new Error('Invalid response type from API');
26
+ }
27
+ } catch (error) {
28
+ console.error('Error in meme command:', error);
29
+ await sock.sendMessage(chatId, {
30
+ text: '❌ Failed to fetch meme. Please try again later.'
31
+ });
32
+ }
33
+ }
34
+
35
+ module.exports = memeCommand;
@@ -0,0 +1,53 @@
1
+ const fetch = require('node-fetch');
2
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
3
+
4
+ const BASE = 'https://shizoapi.onrender.com/api/pies';
5
+ const VALID_COUNTRIES = ['china', 'indonesia', 'japan', 'korea', 'hijab'];
6
+
7
+ async function fetchPiesImageBuffer(country) {
8
+ const url = `${BASE}/${country}?apikey=shizo`;
9
+ const res = await fetch(url);
10
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
11
+ const contentType = res.headers.get('content-type') || '';
12
+ if (!contentType.includes('image')) throw new Error('API did not return an image');
13
+ return res.buffer();
14
+ }
15
+
16
+ async function piesCommand(sock, chatId, message, args) {
17
+ const sub = (args && args[0] ? args[0] : '').toLowerCase();
18
+ if (!sub) {
19
+ await sock.sendMessage(chatId, { text: `Usage: .pies <country>\nCountries: ${VALID_COUNTRIES.join(', ')}` }, { quoted: fakeContact });
20
+ return;
21
+ }
22
+ if (!VALID_COUNTRIES.includes(sub)) {
23
+ await sock.sendMessage(chatId, { text: `❌ Unsupported country: ${sub}. Try one of: ${VALID_COUNTRIES.join(', ')}` }, { quoted: fakeContact });
24
+ return;
25
+ }
26
+ try {
27
+ const imageBuffer = await fetchPiesImageBuffer(sub);
28
+ await sock.sendMessage(
29
+ chatId,
30
+ { image: imageBuffer, caption: `pies: ${sub}` },
31
+ { quoted: fakeContact }
32
+ );
33
+ } catch (err) {
34
+ console.error('Error in pies command:', err);
35
+ await sock.sendMessage(chatId, { text: '❌ Failed to fetch image. Please try again.' }, { quoted: fakeContact });
36
+ }
37
+ }
38
+
39
+ async function piesAlias(sock, chatId, message, country) {
40
+ try {
41
+ const imageBuffer = await fetchPiesImageBuffer(country);
42
+ await sock.sendMessage(
43
+ chatId,
44
+ { image: imageBuffer, caption: `pies: ${country}` },
45
+ { quoted: fakeContact }
46
+ );
47
+ } catch (err) {
48
+ console.error(`Error in pies alias (${country}) command:`, err);
49
+ await sock.sendMessage(chatId, { text: '❌ Failed to fetch image. Please try again.' }, { quoted: fakeContact });
50
+ }
51
+ }
52
+
53
+ module.exports = { piesCommand, piesAlias, VALID_COUNTRIES };