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,153 @@
1
+ const axios = require('axios');
2
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
3
+ async function qcCommand(sock, chatId, message, text, prefix) {
4
+ try {
5
+ const fake = createFakeContact(message);
6
+
7
+ if (!text) {
8
+ await sock.sendMessage(chatId, {
9
+ text: `*Quote Sticker Creator*\n\n` +
10
+ `Usage: *${prefix}qc <color> <text>*\n` +
11
+ `Example: *${prefix}qc blue Hello World*\n\n` +
12
+ `*Available Colors:*\n` +
13
+ `white, black, blue, red, green, yellow, purple, pink,\n` +
14
+ `orange, teal, cyan, gold, silver, and many more...\n\n` +
15
+ `Max 80 characters.`
16
+ }, { quoted: fake });
17
+ return;
18
+ }
19
+
20
+ const args = text.trim().split(' ');
21
+ if (args.length < 2) {
22
+ await sock.sendMessage(chatId, {
23
+ text: `āŒ Format: *${prefix}qc <color> <text>*\n` +
24
+ `Example: *${prefix}qc blue Hello World*`
25
+ }, { quoted: fake });
26
+ return;
27
+ }
28
+
29
+ const [color, ...messageParts] = args;
30
+ const messageText = messageParts.join(' ');
31
+
32
+ if (messageText.length > 80) {
33
+ await sock.sendMessage(chatId, {
34
+ text: 'āŒ Maximum 80 characters allowed!'
35
+ }, { quoted: fake });
36
+ return;
37
+ }
38
+
39
+ // Color mapping
40
+ const colorMap = {
41
+ 'pink': '#f68ac9',
42
+ 'blue': '#6cace4',
43
+ 'red': '#f44336',
44
+ 'green': '#4caf50',
45
+ 'yellow': '#ffeb3b',
46
+ 'purple': '#9c27b0',
47
+ 'darkblue': '#0d47a1',
48
+ 'lightblue': '#03a9f4',
49
+ 'ash': '#9e9e9e',
50
+ 'orange': '#ff9800',
51
+ 'black': '#000000',
52
+ 'white': '#ffffff',
53
+ 'teal': '#008080',
54
+ 'lightpink': '#FFC0CB',
55
+ 'chocolate': '#A52A2A',
56
+ 'salmon': '#FFA07A',
57
+ 'magenta': '#FF00FF',
58
+ 'tan': '#D2B48C',
59
+ 'wheat': '#F5DEB3',
60
+ 'deeppink': '#FF1493',
61
+ 'fire': '#B22222',
62
+ 'skyblue': '#00BFFF',
63
+ 'brightskyblue': '#1E90FF',
64
+ 'hotpink': '#FF69B4',
65
+ 'lightskyblue': '#87CEEB',
66
+ 'seagreen': '#20B2AA',
67
+ 'darkred': '#8B0000',
68
+ 'orangered': '#FF4500',
69
+ 'cyan': '#48D1CC',
70
+ 'violet': '#BA55D3',
71
+ 'mossgreen': '#00FF7F',
72
+ 'darkgreen': '#008000',
73
+ 'navyblue': '#191970',
74
+ 'darkorange': '#FF8C00',
75
+ 'darkpurple': '#9400D3',
76
+ 'fuchsia': '#FF00FF',
77
+ 'darkmagenta': '#8B008B',
78
+ 'darkgray': '#2F4F4F',
79
+ 'peachpuff': '#FFDAB9',
80
+ 'darkishgreen': '#BDB76B',
81
+ 'darkishred': '#DC143C',
82
+ 'goldenrod': '#DAA520',
83
+ 'darkishgray': '#696969',
84
+ 'darkishpurple': '#483D8B',
85
+ 'gold': '#FFD700',
86
+ 'silver': '#C0C0C0'
87
+ };
88
+
89
+ const backgroundColor = colorMap[color.toLowerCase()];
90
+ if (!backgroundColor) {
91
+ await sock.sendMessage(chatId, {
92
+ text: 'āŒ Invalid color! Use .qc to see available colors.'
93
+ }, { quoted: fake });
94
+ return;
95
+ }
96
+
97
+ // Get user info
98
+ const username = message.pushName || 'User';
99
+ let avatar;
100
+ try {
101
+ avatar = await sock.profilePictureUrl(message.sender, 'image');
102
+ } catch {
103
+ avatar = 'https://files.catbox.moe/nwvkbt.png';
104
+ }
105
+
106
+ const json = {
107
+ type: 'quote',
108
+ format: 'png',
109
+ backgroundColor,
110
+ width: 512,
111
+ height: 768,
112
+ scale: 2,
113
+ messages: [{
114
+ entities: [],
115
+ avatar: true,
116
+ from: {
117
+ id: 1,
118
+ name: username,
119
+ photo: {
120
+ url: avatar
121
+ }
122
+ },
123
+ text: messageText,
124
+ replyMessage: {}
125
+ }]
126
+ };
127
+
128
+ const response = await axios.post('https://bot.lyo.su/quote/generate', json, {
129
+ headers: {
130
+ 'Content-Type': 'application/json'
131
+ }
132
+ });
133
+
134
+ const buffer = Buffer.from(response.data.result.image, 'base64');
135
+
136
+ // Send as sticker
137
+ await sock.sendMessage(chatId, {
138
+ sticker: buffer,
139
+ mimetype: 'image/webp'
140
+ }, { quoted: fake });
141
+
142
+ } catch (error) {
143
+ console.error('QC command error:', error);
144
+ const fake = createFakeContact(message);
145
+ await sock.sendMessage(chatId, {
146
+ text: 'āŒ Failed to create quote sticker. Please try again.'
147
+ }, { quoted: fake });
148
+ }
149
+ }
150
+
151
+ module.exports = {
152
+ qcCommand
153
+ };
@@ -0,0 +1,126 @@
1
+ const axios = require('axios');
2
+ const { downloadContentFromMessage } = require('@whiskeysockets/baileys');
3
+ const { uploadImage } = require('../../davelib/uploadImage');
4
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
5
+
6
+ async function getQuotedOrOwnImageUrl(sock, message) {
7
+ // 1) Quoted image (highest priority)
8
+ const quoted = message.message?.extendedTextMessage?.contextInfo?.quotedMessage;
9
+ if (quoted?.imageMessage) {
10
+ const stream = await downloadContentFromMessage(quoted.imageMessage, 'image');
11
+ const chunks = [];
12
+ for await (const chunk of stream) chunks.push(chunk);
13
+ const buffer = Buffer.concat(chunks);
14
+ return await uploadImage(buffer);
15
+ }
16
+
17
+ // 2) Image in the current message
18
+ if (message.message?.imageMessage) {
19
+ const stream = await downloadContentFromMessage(message.message.imageMessage, 'image');
20
+ const chunks = [];
21
+ for await (const chunk of stream) chunks.push(chunk);
22
+ const buffer = Buffer.concat(chunks);
23
+ return await uploadImage(buffer);
24
+ }
25
+
26
+ return null;
27
+ }
28
+
29
+ async function reminiCommand(sock, chatId, message, args) {
30
+ try {
31
+ let imageUrl = null;
32
+
33
+ // Check if args contain a URL
34
+ if (args.length > 0) {
35
+ const url = args.join(' ');
36
+ if (isValidUrl(url)) {
37
+ imageUrl = url;
38
+ } else {
39
+ return sock.sendMessage(chatId, {
40
+ text: 'āŒ Invalid URL provided.\n\nUsage: `.remini https://example.com/image.jpg`'
41
+ }, { quoted: fakeContact });
42
+ }
43
+ } else {
44
+ // Try to get image from message or quoted message
45
+ imageUrl = await getQuotedOrOwnImageUrl(sock, message);
46
+
47
+ if (!imageUrl) {
48
+ return sock.sendMessage(chatId, {
49
+ text: 'šŸ“ø *Remini AI Enhancement Command*\n\nUsage:\n• `.remini <image_url>`\n• Reply to an image with `.remini`\n• Send image with `.remini`\n\nExample: `.remini https://example.com/image.jpg`'
50
+ }, { quoted: fakeContact });
51
+ }
52
+ }
53
+
54
+ // Call the Remini API
55
+ const apiUrl = `https://api.princetechn.com/api/tools/remini?apikey=prince&url=${encodeURIComponent(imageUrl)}`;
56
+
57
+ const response = await axios.get(apiUrl, {
58
+ timeout: 60000, // 60 second timeout (AI processing takes longer)
59
+ headers: {
60
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
61
+ }
62
+ });
63
+
64
+
65
+ if (response.data && response.data.success && response.data.result) {
66
+ const result = response.data.result;
67
+
68
+ if (result.image_url) {
69
+ // Download the enhanced image
70
+ const imageResponse = await axios.get(result.image_url, {
71
+ responseType: 'arraybuffer',
72
+ timeout: 30000
73
+ });
74
+
75
+ if (imageResponse.status === 200 && imageResponse.data) {
76
+ // Send the enhanced image
77
+ await sock.sendMessage(chatId, {
78
+ image: imageResponse.data,
79
+ caption: '✨ *Image enhanced successfully!*\n\nš—˜š—”š—›š—”š—”š—–š—˜š—— š—•š—¬ š—žš—”š—œš—šš—›š—§-š—•š—¢š—§'
80
+ }, { quoted: fakeContact });
81
+ } else {
82
+ throw new Error('Failed to download enhanced image');
83
+ }
84
+ } else {
85
+ throw new Error(result.message || 'Failed to enhance image');
86
+ }
87
+ } else {
88
+ throw new Error('API returned invalid response');
89
+ }
90
+
91
+ } catch (error) {
92
+ console.error('Remini Error:', error.message);
93
+
94
+ let errorMessage = 'āŒ Failed to enhance image.';
95
+
96
+ if (error.response?.status === 429) {
97
+ errorMessage = 'ā° Rate limit exceeded. Please try again later.';
98
+ } else if (error.response?.status === 400) {
99
+ errorMessage = 'āŒ Invalid image URL or format.';
100
+ } else if (error.response?.status === 500) {
101
+ errorMessage = 'šŸ”§ Server error. Please try again later.';
102
+ } else if (error.code === 'ECONNABORTED') {
103
+ errorMessage = 'ā° Request timeout. Please try again.';
104
+ } else if (error.message.includes('ENOTFOUND') || error.message.includes('ECONNREFUSED')) {
105
+ errorMessage = '🌐 Network error. Please check your connection.';
106
+ } else if (error.message.includes('Error processing image')) {
107
+ errorMessage = 'āŒ Image processing failed. Please try with a different image.';
108
+ }
109
+
110
+ await sock.sendMessage(chatId, {
111
+ text: errorMessage
112
+ }, { quoted: fakeContact });
113
+ }
114
+ }
115
+
116
+ // Helper function to validate URL
117
+ function isValidUrl(string) {
118
+ try {
119
+ new URL(string);
120
+ return true;
121
+ } catch (_) {
122
+ return false;
123
+ }
124
+ }
125
+
126
+ module.exports = { reminiCommand };
@@ -0,0 +1,114 @@
1
+ const axios = require('axios');
2
+ const { downloadContentFromMessage } = require('@whiskeysockets/baileys');
3
+ const { uploadImage } = require('../../davelib/uploadImage');
4
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
5
+
6
+ async function getQuotedOrOwnImageUrl(sock, message) {
7
+ // 1) Quoted image (highest priority)
8
+ const quoted = message.message?.extendedTextMessage?.contextInfo?.quotedMessage;
9
+ if (quoted?.imageMessage) {
10
+ const stream = await downloadContentFromMessage(quoted.imageMessage, 'image');
11
+ const chunks = [];
12
+ for await (const chunk of stream) chunks.push(chunk);
13
+ const buffer = Buffer.concat(chunks);
14
+ return await uploadImage(buffer);
15
+ }
16
+
17
+ // 2) Image in the current message
18
+ if (message.message?.imageMessage) {
19
+ const stream = await downloadContentFromMessage(message.message.imageMessage, 'image');
20
+ const chunks = [];
21
+ for await (const chunk of stream) chunks.push(chunk);
22
+ const buffer = Buffer.concat(chunks);
23
+ return await uploadImage(buffer);
24
+ }
25
+
26
+ return null;
27
+ }
28
+
29
+ module.exports = {
30
+ name: 'removebg',
31
+ alias: ['rmbg', 'nobg'],
32
+ category: 'general',
33
+ desc: 'Remove background from images',
34
+ async exec(sock, message, args) {
35
+ try {
36
+ const chatId = message.key.remoteJid;
37
+ let imageUrl = null;
38
+
39
+ // Check if args contain a URL
40
+ if (args.length > 0) {
41
+ const url = args.join(' ');
42
+ if (isValidUrl(url)) {
43
+ imageUrl = url;
44
+ } else {
45
+ return sock.sendMessage(chatId, {
46
+ text: 'āŒ Invalid URL provided.\n\nUsage: `.removebg https://example.com/image.jpg`'
47
+ }, { quoted: fakeContact });
48
+ }
49
+ } else {
50
+ // Try to get image from message or quoted message
51
+ imageUrl = await getQuotedOrOwnImageUrl(sock, message);
52
+
53
+ if (!imageUrl) {
54
+ return sock.sendMessage(chatId, {
55
+ text: 'šŸ“ø *Remove Background Command*\n\nUsage:\n• `.removebg <image_url>`\n• Reply to an image with `.removebg`\n• Send image with `.removebg`\n\nExample: `.removebg https://example.com/image.jpg`'
56
+ }, { quoted: fakeContact });
57
+ }
58
+ }
59
+
60
+
61
+ // Call the remove background API
62
+ const apiUrl = `https://api.siputzx.my.id/api/iloveimg/removebg?image=${encodeURIComponent(imageUrl)}`;
63
+
64
+ const response = await axios.get(apiUrl, {
65
+ responseType: 'arraybuffer',
66
+ timeout: 30000, // 30 second timeout
67
+ headers: {
68
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
69
+ }
70
+ });
71
+
72
+ if (response.status === 200 && response.data) {
73
+ // Send the processed image
74
+ await sock.sendMessage(chatId, {
75
+ image: response.data,
76
+ caption: '✨ *Background removed successfully!*\n\nš—£š—„š—¢š—–š—˜š—¦š—¦š—˜š—— š—•š—¬ š—žš—”š—œš—šš—›š—§-š—•š—¢š—§'
77
+ }, { quoted: fakeContact });
78
+ } else {
79
+ throw new Error('Failed to process image');
80
+ }
81
+
82
+ } catch (error) {
83
+ console.error('RemoveBG Error:', error.message);
84
+
85
+ let errorMessage = 'āŒ Failed to remove background.';
86
+
87
+ if (error.response?.status === 429) {
88
+ errorMessage = 'ā° Rate limit exceeded. Please try again later.';
89
+ } else if (error.response?.status === 400) {
90
+ errorMessage = 'āŒ Invalid image URL or format.';
91
+ } else if (error.response?.status === 500) {
92
+ errorMessage = 'šŸ”§ Server error. Please try again later.';
93
+ } else if (error.code === 'ECONNABORTED') {
94
+ errorMessage = 'ā° Request timeout. Please try again.';
95
+ } else if (error.message.includes('ENOTFOUND') || error.message.includes('ECONNREFUSED')) {
96
+ errorMessage = '🌐 Network error. Please check your connection.';
97
+ }
98
+
99
+ await sock.sendMessage(chatId, {
100
+ text: errorMessage
101
+ }, { quoted: fakeContact });
102
+ }
103
+ }
104
+ };
105
+
106
+ // Helper function to validate URL
107
+ function isValidUrl(string) {
108
+ try {
109
+ new URL(string);
110
+ return true;
111
+ } catch (_) {
112
+ return false;
113
+ }
114
+ }
@@ -0,0 +1,65 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const { downloadContentFromMessage } = require('@whiskeysockets/baileys');
4
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
5
+
6
+ async function setProfilePicture(sock, chatId, msg) {
7
+ const fakeContact = createFakeContact(msg);
8
+ const botName = getBotName();
9
+
10
+ try {
11
+ if (!msg.key.fromMe) {
12
+ await sock.sendMessage(chatId, {
13
+ text: `✦ Owner only command`
14
+ }, { quoted: fakeContact });
15
+ return;
16
+ }
17
+
18
+ const quotedMessage = msg.message?.extendedTextMessage?.contextInfo?.quotedMessage;
19
+ if (!quotedMessage) {
20
+ await sock.sendMessage(chatId, {
21
+ text: `✦ Reply to an image with .setpicture`
22
+ }, { quoted: fakeContact });
23
+ return;
24
+ }
25
+
26
+ const imageMessage = quotedMessage.imageMessage || quotedMessage.stickerMessage;
27
+ if (!imageMessage) {
28
+ await sock.sendMessage(chatId, {
29
+ text: `✦ Reply must be image or sticker`
30
+ }, { quoted: fakeContact });
31
+ return;
32
+ }
33
+
34
+ const tmpDir = path.join(process.cwd(), 'tmp');
35
+ if (!fs.existsSync(tmpDir)) {
36
+ fs.mkdirSync(tmpDir, { recursive: true });
37
+ }
38
+
39
+ const stream = await downloadContentFromMessage(imageMessage, 'image');
40
+ let buffer = Buffer.from([]);
41
+
42
+ for await (const chunk of stream) {
43
+ buffer = Buffer.concat([buffer, chunk]);
44
+ }
45
+
46
+ const imagePath = path.join(tmpDir, `profile_${Date.now()}.jpg`);
47
+ fs.writeFileSync(imagePath, buffer);
48
+
49
+ await sock.updateProfilePicture(sock.user.id, { url: imagePath });
50
+
51
+ fs.unlinkSync(imagePath);
52
+
53
+ await sock.sendMessage(chatId, {
54
+ text: `✦ Profile picture updated`
55
+ }, { quoted: fakeContact });
56
+
57
+ } catch (error) {
58
+ console.error('Error in setpicture command:', error);
59
+ await sock.sendMessage(chatId, {
60
+ text: `✦ Failed to update profile picture`
61
+ }, { quoted: fakeContact });
62
+ }
63
+ }
64
+
65
+ module.exports = setProfilePicture;