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,167 @@
1
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
2
+ async function groupInfoCommand(sock, chatId, msg) {
3
+ try {
4
+ async function resolveToPhone(sock, jid) {
5
+ if (!jid) return 'unknown';
6
+ const raw = jid.split('@')[0].split(':')[0];
7
+ if (/^\d{7,15}$/.test(raw)) return raw;
8
+ try {
9
+ if (sock?.signalRepository?.lidMapping?.getPNForLID) {
10
+ const formats = [jid, `${raw}:0@lid`, `${raw}@lid`];
11
+ for (const fmt of formats) {
12
+ try {
13
+ const pn = await sock.signalRepository.lidMapping.getPNForLID(fmt);
14
+ if (pn) {
15
+ const num = String(pn).split('@')[0].replace(/[^0-9]/g, '');
16
+ if (num.length >= 7 && num.length <= 15 && num !== raw) return num;
17
+ }
18
+ } catch {}
19
+ }
20
+ }
21
+ const groups = await sock.groupFetchAllParticipating();
22
+ for (const gid of Object.keys(groups)) {
23
+ for (const p of (groups[gid].participants || [])) {
24
+ const pid = (p.id || '').split('@')[0].split(':')[0];
25
+ const pLid = (p.lid || '').split('@')[0].split(':')[0];
26
+ if ((pLid === raw || pid === raw) && pid && /^\d{7,15}$/.test(pid) && pid !== raw) return pid;
27
+ }
28
+ }
29
+ } catch {}
30
+ return raw;
31
+ }
32
+
33
+ const fake = createFakeContact(msg);
34
+
35
+ if (!chatId.endsWith('@g.us')) {
36
+ await sock.sendMessage(chatId, {
37
+ text: 'This command can only be used in groups!'
38
+ }, { quoted: fake });
39
+ return;
40
+ }
41
+
42
+ const groupMetadata = await Promise.race([
43
+ sock.groupMetadata(chatId),
44
+ new Promise((_, reject) =>
45
+ setTimeout(() => reject(new Error('Timeout fetching group metadata')), 10000)
46
+ )
47
+ ]);
48
+
49
+ if (!groupMetadata) {
50
+ throw new Error('Failed to retrieve group metadata');
51
+ }
52
+
53
+ let pp;
54
+ let ppError = false;
55
+ try {
56
+ pp = await sock.profilePictureUrl(chatId, 'image');
57
+ if (!pp || typeof pp !== 'string') {
58
+ throw new Error('Invalid profile picture URL');
59
+ }
60
+ } catch (error) {
61
+ console.log('Profile picture error:', error.message);
62
+ pp = 'https://i.imgur.com/2wzGhpF.jpeg';
63
+ ppError = true;
64
+ }
65
+
66
+ const participants = groupMetadata.participants || [];
67
+ const totalMembers = participants.length;
68
+
69
+ const groupAdmins = participants.filter(p =>
70
+ p.admin && (p.admin === 'admin' || p.admin === 'superadmin')
71
+ );
72
+
73
+ const owner = groupMetadata.owner ||
74
+ groupAdmins.find(p => p.admin === 'superadmin')?.id ||
75
+ participants.find(p => p.admin === 'superadmin')?.id ||
76
+ 'Unknown';
77
+
78
+ const adminLines = [];
79
+ for (let i = 0; i < groupAdmins.length; i++) {
80
+ const resolved = await resolveToPhone(sock, groupAdmins[i].id);
81
+ adminLines.push(`${i + 1}. @${resolved}`);
82
+ }
83
+ const listAdmin = adminLines.length > 0
84
+ ? adminLines.join('\n')
85
+ : 'No admins found';
86
+
87
+ const creationDate = groupMetadata.creation ?
88
+ new Date(groupMetadata.creation * 1000).toLocaleDateString() :
89
+ 'Unknown';
90
+
91
+ const description = groupMetadata.desc
92
+ ? groupMetadata.desc.toString().trim()
93
+ : 'No description';
94
+
95
+ const maxDescLength = 500;
96
+ const truncatedDesc = description.length > maxDescLength
97
+ ? description.substring(0, maxDescLength) + '...'
98
+ : description;
99
+
100
+ const isAnnounce = groupMetadata.announce === true || groupMetadata.restrict === true;
101
+ const groupMode = isAnnounce ? 'Restricted (Only admins can send messages)' : 'Everyone can send messages';
102
+
103
+ const resolvedOwner = owner !== 'Unknown' ? await resolveToPhone(sock, owner) : 'Unknown';
104
+
105
+ const text = `GROUP INFORMATION
106
+
107
+ Basic Info:
108
+ Name: ${groupMetadata.subject || 'Unnamed Group'}
109
+ ID: ${groupMetadata.id || 'Unknown'}
110
+ Created: ${creationDate}
111
+ Total Members: ${totalMembers}
112
+ Admins: ${groupAdmins.length}
113
+ Group Mode: ${groupMode}
114
+
115
+ Ownership:
116
+ Owner: @${resolvedOwner}
117
+
118
+ Administrators:
119
+ ${listAdmin}
120
+
121
+ Description:
122
+ ${truncatedDesc}
123
+
124
+ 'You miss 100% of the shots you dont take' - Wayne Gretzky
125
+
126
+ ${ppError ? 'Note: Using default group image' : ''}`.trim();
127
+
128
+ const mentions = [];
129
+ if (owner && owner !== 'Unknown') {
130
+ mentions.push(owner);
131
+ }
132
+
133
+ groupAdmins.forEach(admin => {
134
+ if (admin.id && !mentions.includes(admin.id) && admin.id !== owner) {
135
+ mentions.push(admin.id);
136
+ }
137
+ });
138
+
139
+ await sock.sendMessage(chatId, {
140
+ image: { url: pp },
141
+ caption: text,
142
+ mentions: mentions
143
+ }, { quoted: fake });
144
+
145
+ console.log(`Group info command executed successfully for group: ${groupMetadata.subject}`);
146
+
147
+ } catch (error) {
148
+ console.error('Error in groupinfo command:', error);
149
+
150
+ let errorMessage = 'Failed to get group info!';
151
+
152
+ if (error.message.includes('Timeout')) {
153
+ errorMessage = 'Request timeout. Please try again.';
154
+ } else if (error.message.includes('not in group')) {
155
+ errorMessage = 'Bot is not in this group or group not found.';
156
+ } else if (error.message.includes('401')) {
157
+ errorMessage = 'Unauthorized access to group information.';
158
+ }
159
+
160
+ const fake = createFakeContact(msg);
161
+ await sock.sendMessage(chatId, {
162
+ text: errorMessage
163
+ }, { quoted: fake });
164
+ }
165
+ }
166
+
167
+ module.exports = groupInfoCommand;
@@ -0,0 +1,133 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const { downloadContentFromMessage } = require('@whiskeysockets/baileys');
4
+ const db = require('../../Database/database');
5
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
6
+
7
+ async function ensureGroupAndAdmin(sock, chatId, senderId, message) {
8
+ const isGroup = chatId.endsWith('@g.us');
9
+ if (!isGroup) {
10
+ return { ok: false };
11
+ }
12
+ const isAdmin = require('../../davelib/isAdmin');
13
+ const adminStatus = await isAdmin(sock, chatId, senderId);
14
+ if (!adminStatus.isBotAdmin) {
15
+ return { ok: false };
16
+ }
17
+ if (!adminStatus.isSenderAdmin && !message?.key?.fromMe && !db.isSudo(senderId)) {
18
+ return { ok: false };
19
+ }
20
+ return { ok: true };
21
+ }
22
+
23
+ async function setGroupDescription(sock, chatId, senderId, text, message) {
24
+ const fake = createFakeContact(senderId);
25
+ const botName = getBotName();
26
+ const check = await ensureGroupAndAdmin(sock, chatId, senderId, message);
27
+ if (!check.ok) {
28
+ await sock.sendMessage(chatId, { text: `*${botName}*\nAdmin only command!` }, { quoted: fake });
29
+ return;
30
+ }
31
+ const desc = (text || '').trim();
32
+ if (!desc) {
33
+ await sock.sendMessage(chatId, { text: `*${botName}*\nUsage: .setgdesc <text>` }, { quoted: fake });
34
+ return;
35
+ }
36
+ try {
37
+ await sock.groupUpdateDescription(chatId, desc);
38
+ await sock.sendMessage(chatId, { text: `*${botName}*\nGroup description updated!` }, { quoted: fake });
39
+ } catch (error) {
40
+ console.error('Set group description error:', error.message, 'Line:', error.stack?.split('\n')[1]);
41
+ await sock.sendMessage(chatId, { text: `*${botName}*\nFailed to update description` }, { quoted: fake });
42
+ }
43
+ }
44
+
45
+ async function setGroupName(sock, chatId, senderId, text, message) {
46
+ const fake = createFakeContact(senderId);
47
+ const botName = getBotName();
48
+ const check = await ensureGroupAndAdmin(sock, chatId, senderId, message);
49
+ if (!check.ok) {
50
+ await sock.sendMessage(chatId, { text: `*${botName}*\nAdmin only command!` }, { quoted: fake });
51
+ return;
52
+ }
53
+ const name = (text || '').trim();
54
+ if (!name) {
55
+ await sock.sendMessage(chatId, { text: `*${botName}*\nUsage: .setgname <name>` }, { quoted: fake });
56
+ return;
57
+ }
58
+ try {
59
+ await sock.groupUpdateSubject(chatId, name);
60
+ await sock.sendMessage(chatId, { text: `*${botName}*\nGroup name updated!` }, { quoted: fake });
61
+ } catch (error) {
62
+ console.error('Set group name error:', error.message, 'Line:', error.stack?.split('\n')[1]);
63
+ await sock.sendMessage(chatId, { text: `*${botName}*\nFailed to update name` }, { quoted: fake });
64
+ }
65
+ }
66
+
67
+ async function setGroupIcon(sock, chatId, senderId, quotedMessage, message) {
68
+ const fake = createFakeContact(senderId);
69
+ const botName = getBotName();
70
+ const check = await ensureGroupAndAdmin(sock, chatId, senderId, message);
71
+ if (!check.ok) {
72
+ await sock.sendMessage(chatId, { text: `*${botName}*\nAdmin only command!` }, { quoted: fake });
73
+ return;
74
+ }
75
+ if (!quotedMessage?.imageMessage) {
76
+ await sock.sendMessage(chatId, { text: `*${botName}*\nReply to an image to set as group icon` }, { quoted: fake });
77
+ return;
78
+ }
79
+ try {
80
+ const stream = await downloadContentFromMessage(quotedMessage.imageMessage, 'image');
81
+ let buffer = Buffer.from([]);
82
+ for await (const chunk of stream) {
83
+ buffer = Buffer.concat([buffer, chunk]);
84
+ }
85
+ await sock.updateProfilePicture(chatId, buffer);
86
+ await sock.sendMessage(chatId, { text: `*${botName}*\nGroup icon updated!` }, { quoted: fake });
87
+ } catch (error) {
88
+ console.error('Set group icon error:', error.message, 'Line:', error.stack?.split('\n')[1]);
89
+ await sock.sendMessage(chatId, { text: `*${botName}*\nFailed to update icon` }, { quoted: fake });
90
+ }
91
+ }
92
+
93
+ async function groupLink(sock, chatId, senderId, message) {
94
+ const fake = createFakeContact(senderId);
95
+ const botName = getBotName();
96
+ const check = await ensureGroupAndAdmin(sock, chatId, senderId, message);
97
+ if (!check.ok) {
98
+ await sock.sendMessage(chatId, { text: `*${botName}*\nAdmin only command!` }, { quoted: fake });
99
+ return;
100
+ }
101
+ try {
102
+ const code = await sock.groupInviteCode(chatId);
103
+ await sock.sendMessage(chatId, { text: `*${botName}*\n\nGroup Link:\nhttps://chat.whatsapp.com/${code}` }, { quoted: fake });
104
+ } catch (error) {
105
+ console.error('Group link error:', error.message, 'Line:', error.stack?.split('\n')[1]);
106
+ await sock.sendMessage(chatId, { text: `*${botName}*\nFailed to get link` }, { quoted: fake });
107
+ }
108
+ }
109
+
110
+ async function revokeGroupLink(sock, chatId, senderId, message) {
111
+ const fake = createFakeContact(senderId);
112
+ const botName = getBotName();
113
+ const check = await ensureGroupAndAdmin(sock, chatId, senderId, message);
114
+ if (!check.ok) {
115
+ await sock.sendMessage(chatId, { text: `*${botName}*\nAdmin only command!` }, { quoted: fake });
116
+ return;
117
+ }
118
+ try {
119
+ await sock.groupRevokeInvite(chatId);
120
+ await sock.sendMessage(chatId, { text: `*${botName}*\nGroup link revoked!` }, { quoted: fake });
121
+ } catch (error) {
122
+ console.error('Revoke link error:', error.message, 'Line:', error.stack?.split('\n')[1]);
123
+ await sock.sendMessage(chatId, { text: `*${botName}*\nFailed to revoke link` }, { quoted: fake });
124
+ }
125
+ }
126
+
127
+ module.exports = {
128
+ setGroupDescription,
129
+ setGroupName,
130
+ setGroupIcon,
131
+ groupLink,
132
+ revokeGroupLink
133
+ };
@@ -0,0 +1,108 @@
1
+ const isAdmin = require('../../davelib/isAdmin');
2
+ const { downloadContentFromMessage } = require('@whiskeysockets/baileys');
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const db = require('../../Database/database');
6
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
7
+
8
+ async function downloadMediaMessage(message, mediaType) {
9
+ const stream = await downloadContentFromMessage(message, mediaType);
10
+ let buffer = Buffer.from([]);
11
+ for await (const chunk of stream) {
12
+ buffer = Buffer.concat([buffer, chunk]);
13
+ }
14
+ const tempDir = path.join(__dirname, '../temp/');
15
+ if (!fs.existsSync(tempDir)) {
16
+ fs.mkdirSync(tempDir, { recursive: true });
17
+ }
18
+ const filePath = path.join(tempDir, `${Date.now()}.${mediaType}`);
19
+ fs.writeFileSync(filePath, buffer);
20
+ return filePath;
21
+ }
22
+
23
+ async function hideTagCommand(sock, chatId, senderId, messageText, replyMessage, message) {
24
+ const fake = createFakeContact(senderId);
25
+ const botName = getBotName();
26
+
27
+ const { isSenderAdmin, isBotAdmin } = await isAdmin(sock, chatId, senderId);
28
+
29
+ if (!isBotAdmin) {
30
+ await sock.sendMessage(chatId, {
31
+ text: `*${botName}*\nBot needs to be admin!`
32
+ }, { quoted: fake });
33
+ return;
34
+ }
35
+
36
+ if (!isSenderAdmin && !message.key.fromMe && !db.isSudo(senderId)) {
37
+ await sock.sendMessage(chatId, {
38
+ text: `*${botName}*\nAdmin only command!`
39
+ }, { quoted: fake });
40
+ return;
41
+ }
42
+
43
+ try {
44
+ const groupMetadata = await sock.groupMetadata(chatId);
45
+ const participants = groupMetadata.participants.map(p => p.id);
46
+
47
+ if (replyMessage) {
48
+ const quotedMsg = message.message?.extendedTextMessage?.contextInfo?.quotedMessage;
49
+
50
+ if (quotedMsg?.imageMessage) {
51
+ const filePath = await downloadMediaMessage(quotedMsg.imageMessage, 'image');
52
+ await sock.sendMessage(chatId, {
53
+ image: fs.readFileSync(filePath),
54
+ caption: quotedMsg.imageMessage.caption || '',
55
+ mentions: participants
56
+ });
57
+ fs.unlinkSync(filePath);
58
+ } else if (quotedMsg?.videoMessage) {
59
+ const filePath = await downloadMediaMessage(quotedMsg.videoMessage, 'video');
60
+ await sock.sendMessage(chatId, {
61
+ video: fs.readFileSync(filePath),
62
+ caption: quotedMsg.videoMessage.caption || '',
63
+ mentions: participants
64
+ });
65
+ fs.unlinkSync(filePath);
66
+ } else if (quotedMsg?.stickerMessage) {
67
+ const filePath = await downloadMediaMessage(quotedMsg.stickerMessage, 'sticker');
68
+ await sock.sendMessage(chatId, {
69
+ sticker: fs.readFileSync(filePath),
70
+ mentions: participants
71
+ });
72
+ fs.unlinkSync(filePath);
73
+ } else if (quotedMsg?.audioMessage) {
74
+ const filePath = await downloadMediaMessage(quotedMsg.audioMessage, 'audio');
75
+ await sock.sendMessage(chatId, {
76
+ audio: fs.readFileSync(filePath),
77
+ ptt: quotedMsg.audioMessage.ptt || false,
78
+ mentions: participants
79
+ });
80
+ fs.unlinkSync(filePath);
81
+ } else {
82
+ const quotedText = quotedMsg?.conversation ||
83
+ quotedMsg?.extendedTextMessage?.text ||
84
+ replyMessage;
85
+ await sock.sendMessage(chatId, {
86
+ text: quotedText,
87
+ mentions: participants
88
+ });
89
+ }
90
+ } else if (messageText) {
91
+ await sock.sendMessage(chatId, {
92
+ text: messageText,
93
+ mentions: participants
94
+ });
95
+ } else {
96
+ await sock.sendMessage(chatId, {
97
+ text: `*${botName}*\nUsage: .hidetag <message> or reply to a message`
98
+ }, { quoted: fake });
99
+ }
100
+ } catch (error) {
101
+ console.error('Hidetag error:', error.message, 'Line:', error.stack?.split('\n')[1]);
102
+ await sock.sendMessage(chatId, {
103
+ text: `*${botName}*\nError: ${error.message}`
104
+ }, { quoted: fake });
105
+ }
106
+ }
107
+
108
+ module.exports = hideTagCommand;
@@ -0,0 +1,145 @@
1
+ const { getBotName, createFakeContact } = require('../../davelib/fakeContact');
2
+
3
+ async function acceptCommand(sock, chatId, senderId, args, message, fake) {
4
+ const botName = getBotName();
5
+ try {
6
+ if (!chatId.endsWith('@g.us')) {
7
+ return sock.sendMessage(chatId, {
8
+ text: `✦ *${botName}* | This command only works in groups.`
9
+ }, { quoted: fake });
10
+ }
11
+
12
+ const pendingRequests = await sock.groupRequestParticipantsList(chatId);
13
+
14
+ if (!pendingRequests || pendingRequests.length === 0) {
15
+ return sock.sendMessage(chatId, {
16
+ text: `✦ *${botName}* | No pending join requests in this group.`
17
+ }, { quoted: fake });
18
+ }
19
+
20
+ if (args && args.trim()) {
21
+ const number = args.replace(/[^0-9]/g, '');
22
+ const userJid = `${number}@s.whatsapp.net`;
23
+ const isPending = pendingRequests.some(r => r.jid === userJid || r.jid.startsWith(number));
24
+ if (!isPending) {
25
+ return sock.sendMessage(chatId, {
26
+ text: `✦ *${botName}* | No pending request found for +${number}.`
27
+ }, { quoted: fake });
28
+ }
29
+ await sock.groupRequestParticipantsUpdate(chatId, [userJid], 'approve');
30
+ return sock.sendMessage(chatId, {
31
+ text: `✦ *${botName}* | ✅ Approved @${number}'s join request!`,
32
+ mentions: [userJid]
33
+ }, { quoted: fake });
34
+ }
35
+
36
+ const jids = pendingRequests.map(r => r.jid);
37
+ await sock.groupRequestParticipantsUpdate(chatId, jids, 'approve');
38
+
39
+ const names = pendingRequests.slice(0, 10).map(r => `+${r.jid.split('@')[0]}`).join(', ');
40
+ const extra = jids.length > 10 ? ` and ${jids.length - 10} more` : '';
41
+
42
+ await sock.sendMessage(chatId, {
43
+ text: `✦ *${botName}* | ✅ Approved *${jids.length}* pending request(s)!\n\n${names}${extra}`
44
+ }, { quoted: fake });
45
+
46
+ } catch (error) {
47
+ console.error('acceptCommand error:', error.message);
48
+ await sock.sendMessage(chatId, {
49
+ text: `✦ *${botName}* | ❌ Failed to approve: ${error.message}`
50
+ }, { quoted: fake });
51
+ }
52
+ }
53
+
54
+ async function rejectCommand(sock, chatId, senderId, args, message, fake) {
55
+ const botName = getBotName();
56
+ try {
57
+ if (!chatId.endsWith('@g.us')) {
58
+ return sock.sendMessage(chatId, {
59
+ text: `✦ *${botName}* | This command only works in groups.`
60
+ }, { quoted: fake });
61
+ }
62
+
63
+ const pendingRequests = await sock.groupRequestParticipantsList(chatId);
64
+
65
+ if (!pendingRequests || pendingRequests.length === 0) {
66
+ return sock.sendMessage(chatId, {
67
+ text: `✦ *${botName}* | No pending join requests in this group.`
68
+ }, { quoted: fake });
69
+ }
70
+
71
+ if (args && args.trim()) {
72
+ const number = args.replace(/[^0-9]/g, '');
73
+ const userJid = `${number}@s.whatsapp.net`;
74
+ const isPending = pendingRequests.some(r => r.jid === userJid || r.jid.startsWith(number));
75
+ if (!isPending) {
76
+ return sock.sendMessage(chatId, {
77
+ text: `✦ *${botName}* | No pending request found for +${number}.`
78
+ }, { quoted: fake });
79
+ }
80
+ await sock.groupRequestParticipantsUpdate(chatId, [userJid], 'reject');
81
+ return sock.sendMessage(chatId, {
82
+ text: `✦ *${botName}* | ❌ Rejected @${number}'s join request.`,
83
+ mentions: [userJid]
84
+ }, { quoted: fake });
85
+ }
86
+
87
+ const jids = pendingRequests.map(r => r.jid);
88
+ await sock.groupRequestParticipantsUpdate(chatId, jids, 'reject');
89
+
90
+ await sock.sendMessage(chatId, {
91
+ text: `✦ *${botName}* | ❌ Rejected all *${jids.length}* pending request(s).`
92
+ }, { quoted: fake });
93
+
94
+ } catch (error) {
95
+ console.error('rejectCommand error:', error.message);
96
+ await sock.sendMessage(chatId, {
97
+ text: `✦ *${botName}* | ❌ Failed to reject: ${error.message}`
98
+ }, { quoted: fake });
99
+ }
100
+ }
101
+
102
+ async function acceptAllCommand(sock, chatId, senderId, message, fake) {
103
+ return acceptCommand(sock, chatId, senderId, '', message, fake);
104
+ }
105
+
106
+ async function rejectAllCommand(sock, chatId, senderId, message, fake) {
107
+ return rejectCommand(sock, chatId, senderId, '', message, fake);
108
+ }
109
+
110
+ async function listRequestsCommand(sock, chatId, senderId, message, fake) {
111
+ const botName = getBotName();
112
+ try {
113
+ const pendingRequests = await sock.groupRequestParticipantsList(chatId);
114
+
115
+ if (!pendingRequests || pendingRequests.length === 0) {
116
+ return sock.sendMessage(chatId, {
117
+ text: `✦ *${botName}* | No pending join requests.`
118
+ }, { quoted: fake });
119
+ }
120
+
121
+ const requestList = pendingRequests.map((r, i) => {
122
+ const number = r.jid.split('@')[0];
123
+ return `${i + 1}. @${number}`;
124
+ }).join('\n');
125
+
126
+ const mentions = pendingRequests.map(r => r.jid);
127
+
128
+ await sock.sendMessage(chatId, {
129
+ text: `✦ *${botName}* | Pending Join Requests\n\nTotal: *${pendingRequests.length}*\n\n${requestList}\n\n_Use .accept or .acceptall to approve all_\n_Use .accept <number> to approve one_`,
130
+ mentions
131
+ }, { quoted: fake });
132
+ } catch (error) {
133
+ await sock.sendMessage(chatId, {
134
+ text: `✦ *${botName}* | ❌ Failed to list requests: ${error.message}`
135
+ }, { quoted: fake });
136
+ }
137
+ }
138
+
139
+ module.exports = {
140
+ acceptCommand,
141
+ rejectCommand,
142
+ acceptAllCommand,
143
+ rejectAllCommand,
144
+ listRequestsCommand,
145
+ };
@@ -0,0 +1,92 @@
1
+ const isAdmin = require('../../davelib/isAdmin');
2
+ const db = require('../../Database/database');
3
+ const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
4
+
5
+ async function kickCommand(sock, chatId, senderId, mentionedJids, message) {
6
+ try {
7
+ const fake = createFakeContact(senderId);
8
+ const botName = getBotName();
9
+
10
+ if (!chatId.endsWith('@g.us')) {
11
+ await sock.sendMessage(chatId, {
12
+ text: `*${botName}*\nGroup command only!`
13
+ }, { quoted: fake });
14
+ return;
15
+ }
16
+
17
+ const { isSenderAdmin, isBotAdmin } = await isAdmin(sock, chatId, senderId);
18
+
19
+ if (!isBotAdmin) {
20
+ await sock.sendMessage(chatId, {
21
+ text: `*${botName}*\nBot needs to be admin!`
22
+ }, { quoted: fake });
23
+ return;
24
+ }
25
+
26
+ if (!isSenderAdmin && !message.key.fromMe && !db.isSudo(senderId)) {
27
+ await sock.sendMessage(chatId, {
28
+ text: `*${botName}*\nAdmin only command!`
29
+ }, { quoted: fake });
30
+ return;
31
+ }
32
+
33
+ let usersToKick = [];
34
+
35
+ if (mentionedJids && mentionedJids.length > 0) {
36
+ usersToKick = mentionedJids;
37
+ } else if (message.message?.extendedTextMessage?.contextInfo?.participant) {
38
+ usersToKick = [message.message.extendedTextMessage.contextInfo.participant];
39
+ }
40
+
41
+ if (usersToKick.length === 0) {
42
+ await sock.sendMessage(chatId, {
43
+ text: `*${botName}*\nMention or reply to user(s) to kick.\n\nUsage: .kick @user`
44
+ }, { quoted: fake });
45
+ return;
46
+ }
47
+
48
+ const botId = sock.user?.id?.split(':')[0] + '@s.whatsapp.net';
49
+
50
+ if (usersToKick.includes(botId) || usersToKick.includes(sock.user?.id)) {
51
+ await sock.sendMessage(chatId, {
52
+ text: `*${botName}*\nI cannot kick myself!`
53
+ }, { quoted: fake });
54
+ return;
55
+ }
56
+
57
+ for (const user of usersToKick) {
58
+ const targetAdmin = await isAdmin(sock, chatId, user);
59
+ if (targetAdmin.isSenderAdmin) {
60
+ await sock.sendMessage(chatId, {
61
+ text: `*${botName}*\nCannot kick @${user.split('@')[0]} - they are admin!`,
62
+ mentions: [user]
63
+ }, { quoted: fake });
64
+ usersToKick = usersToKick.filter(u => u !== user);
65
+ }
66
+ }
67
+
68
+ if (usersToKick.length === 0) {
69
+ return;
70
+ }
71
+
72
+ try {
73
+ await sock.groupParticipantsUpdate(chatId, usersToKick, "remove");
74
+
75
+ const userTags = usersToKick.map(jid => `@${jid.split('@')[0]}`).join(', ');
76
+
77
+ await sock.sendMessage(chatId, {
78
+ text: `*${botName}*\n\n${userTags} kicked from the group!`,
79
+ mentions: usersToKick
80
+ }, { quoted: fake });
81
+ } catch (kickError) {
82
+ console.error('Kick error:', kickError.message, 'Line:', kickError.stack?.split('\n')[1]);
83
+ await sock.sendMessage(chatId, {
84
+ text: `*${botName}*\nFailed to kick user(s): ${kickError.message}`
85
+ }, { quoted: fake });
86
+ }
87
+ } catch (error) {
88
+ console.error('Error in kick command:', error.message, 'Line:', error.stack?.split('\n')[1]);
89
+ }
90
+ }
91
+
92
+ module.exports = kickCommand;