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,278 @@
1
+ const { getGroupConfig, setGroupConfig } = require('../Database/settingsStore');
2
+ const db = require('../Database/database');
3
+ const { getBotName } = require('./botConfig');
4
+
5
+ function createFakeContact(participantId = '0') {
6
+ const botName = getBotName();
7
+ const cleanId = String(participantId).split('@')[0] || '0';
8
+
9
+ return {
10
+ key: {
11
+ participants: "0@s.whatsapp.net",
12
+ remoteJid: "0@s.whatsapp.net",
13
+ fromMe: false
14
+ },
15
+ message: {
16
+ contactMessage: {
17
+ displayName: botName,
18
+ vcard: `BEGIN:VCARD\nVERSION:3.0\nN:;${botName};;;\nFN:${botName}\nitem1.TEL;waid=${cleanId}:${cleanId}\nitem1.X-ABLabel:Phone\nEND:VCARD`
19
+ }
20
+ },
21
+ participant: "0@s.whatsapp.net"
22
+ };
23
+ }
24
+
25
+ const DEFAULT_BAD_WORDS = [
26
+ 'gandu', 'madarchod', 'bhosdike', 'bsdk', 'fucker', 'bhosda',
27
+ 'lauda', 'laude', 'betichod', 'chutiya', 'behenchod',
28
+ 'randi', 'chuchi', 'boobs', 'idiot', 'nigga', 'fuck',
29
+ 'dick', 'bitch', 'bastard', 'asshole', 'lund', 'mc', 'lodu',
30
+ 'shit', 'damn', 'piss', 'crap', 'slut', 'whore', 'prick',
31
+ 'motherfucker', 'cock', 'cunt', 'pussy', 'twat', 'wanker',
32
+ 'chut', 'harami', 'kameena', 'haramzada'
33
+ ];
34
+
35
+ async function handleAntiBadwordCommand(sock, chatId, message, match) {
36
+ const senderId = message.key.participant || message.key.remoteJid;
37
+ const botName = getBotName();
38
+ const fake = createFakeContact(senderId);
39
+ const config = getGroupConfig(chatId, 'antibadword') || {};
40
+
41
+ if (!match) {
42
+ const customWords = config.words || [];
43
+ return sock.sendMessage(chatId, {
44
+ text: `*${botName} ANTIBADWORD*\n\n` +
45
+ `Status: ${config.enabled ? 'ON' : 'OFF'}\n` +
46
+ `Action: ${config.action || 'delete'}\n` +
47
+ `Max Warnings: ${config.maxWarnings || 3}\n` +
48
+ `Custom Words: ${customWords.length}\n\n` +
49
+ `*Commands:*\n` +
50
+ `.antibadword on - Enable\n` +
51
+ `.antibadword off - Disable\n` +
52
+ `.antibadword set <action> - delete/kick/warn\n` +
53
+ `.antibadword add <word1, word2> - Add bad words\n` +
54
+ `.antibadword remove <word> - Remove a word\n` +
55
+ `.antibadword list - List custom words\n` +
56
+ `.antibadword reset - Reset to default words`
57
+ }, { quoted: fake });
58
+ }
59
+
60
+ if (match === 'on') {
61
+ if (config?.enabled) {
62
+ return sock.sendMessage(chatId, { text: `*${botName}*\nAntiBadword already enabled!` }, { quoted: fake });
63
+ }
64
+ setGroupConfig(chatId, 'antibadword', { ...config, enabled: true, action: config.action || 'delete' });
65
+ return sock.sendMessage(chatId, { text: `*${botName}*\nAntiBadword ENABLED!` }, { quoted: fake });
66
+ }
67
+
68
+ if (match === 'off') {
69
+ if (!config?.enabled) {
70
+ return sock.sendMessage(chatId, { text: `*${botName}*\nAntiBadword already disabled!` }, { quoted: fake });
71
+ }
72
+ setGroupConfig(chatId, 'antibadword', { ...config, enabled: false });
73
+ return sock.sendMessage(chatId, { text: `*${botName}*\nAntiBadword DISABLED!` }, { quoted: fake });
74
+ }
75
+
76
+ if (match.startsWith('set ')) {
77
+ const action = match.split(' ')[1];
78
+ if (!action || !['delete', 'kick', 'warn'].includes(action)) {
79
+ return sock.sendMessage(chatId, { text: `*${botName}*\nInvalid action!\nChoose: delete, kick, or warn` }, { quoted: fake });
80
+ }
81
+ setGroupConfig(chatId, 'antibadword', { ...config, enabled: true, action });
82
+ return sock.sendMessage(chatId, { text: `*${botName}*\nAction set to: ${action}` }, { quoted: fake });
83
+ }
84
+
85
+ if (match.startsWith('add ')) {
86
+ const wordsInput = match.slice(4).trim();
87
+ if (!wordsInput) {
88
+ return sock.sendMessage(chatId, { text: `*${botName}*\nProvide words to add!\nExample: .antibadword add word1, word2, word3` }, { quoted: fake });
89
+ }
90
+ const newWords = wordsInput.split(/[,\s]+/).map(w => w.trim().toLowerCase()).filter(w => w.length > 0);
91
+ if (newWords.length === 0) {
92
+ return sock.sendMessage(chatId, { text: `*${botName}*\nNo valid words provided!` }, { quoted: fake });
93
+ }
94
+ const currentWords = config.words || [...DEFAULT_BAD_WORDS];
95
+ const addedWords = [];
96
+ for (const word of newWords) {
97
+ if (!currentWords.includes(word)) {
98
+ currentWords.push(word);
99
+ addedWords.push(word);
100
+ }
101
+ }
102
+ setGroupConfig(chatId, 'antibadword', { ...config, words: currentWords, enabled: true });
103
+ return sock.sendMessage(chatId, {
104
+ text: `*${botName}*\nAdded ${addedWords.length} word(s): ${addedWords.join(', ')}\nTotal words: ${currentWords.length}`
105
+ }, { quoted: fake });
106
+ }
107
+
108
+ if (match.startsWith('remove ')) {
109
+ const wordToRemove = match.slice(7).trim().toLowerCase();
110
+ if (!wordToRemove) {
111
+ return sock.sendMessage(chatId, { text: `*${botName}*\nProvide a word to remove!` }, { quoted: fake });
112
+ }
113
+ const currentWords = config.words || [...DEFAULT_BAD_WORDS];
114
+ const idx = currentWords.indexOf(wordToRemove);
115
+ if (idx === -1) {
116
+ return sock.sendMessage(chatId, { text: `*${botName}*\nWord "${wordToRemove}" not found in list!` }, { quoted: fake });
117
+ }
118
+ currentWords.splice(idx, 1);
119
+ setGroupConfig(chatId, 'antibadword', { ...config, words: currentWords });
120
+ return sock.sendMessage(chatId, { text: `*${botName}*\nRemoved "${wordToRemove}"\nTotal words: ${currentWords.length}` }, { quoted: fake });
121
+ }
122
+
123
+ if (match === 'list') {
124
+ const currentWords = config.words || DEFAULT_BAD_WORDS;
125
+ const wordList = currentWords.join(', ');
126
+ return sock.sendMessage(chatId, {
127
+ text: `*${botName} BAD WORDS LIST*\n\n${currentWords.length} words:\n${wordList}`
128
+ }, { quoted: fake });
129
+ }
130
+
131
+ if (match === 'reset') {
132
+ setGroupConfig(chatId, 'antibadword', { ...config, words: [...DEFAULT_BAD_WORDS] });
133
+ return sock.sendMessage(chatId, {
134
+ text: `*${botName}*\nBad words reset to defaults (${DEFAULT_BAD_WORDS.length} words)`
135
+ }, { quoted: fake });
136
+ }
137
+
138
+ return sock.sendMessage(chatId, { text: `*${botName}*\nInvalid command!\nUse .antibadword for help` }, { quoted: fake });
139
+ }
140
+
141
+ async function handleBadwordDetection(sock, chatId, message, userMessage, senderId) {
142
+ try {
143
+ if (!chatId.endsWith('@g.us')) return;
144
+ if (message.key.fromMe) return;
145
+
146
+ const config = getGroupConfig(chatId, 'antibadword');
147
+ if (!config?.enabled) return;
148
+
149
+ const groupMetadata = await sock.groupMetadata(chatId);
150
+ const botId = sock.user.id.split(':')[0] + '@s.whatsapp.net';
151
+ const bot = groupMetadata.participants.find(p => p.id === botId);
152
+ if (!bot?.admin) return;
153
+
154
+ const participant = groupMetadata.participants.find(p => p.id === senderId);
155
+ if (participant?.admin) return;
156
+ if (db.isSudo(senderId)) return;
157
+
158
+ const cleanMessage = userMessage.toLowerCase()
159
+ .replace(/[^\w\s]/g, ' ')
160
+ .replace(/\s+/g, ' ')
161
+ .trim();
162
+
163
+ const badWords = config.words?.length > 0 ? config.words : DEFAULT_BAD_WORDS;
164
+ const messageWords = cleanMessage.split(' ');
165
+ let containsBadWord = false;
166
+
167
+ for (const word of messageWords) {
168
+ if (word.length < 2) continue;
169
+ if (badWords.includes(word)) {
170
+ containsBadWord = true;
171
+ break;
172
+ }
173
+ }
174
+
175
+ for (const badWord of badWords) {
176
+ if (badWord.includes(' ') && cleanMessage.includes(badWord)) {
177
+ containsBadWord = true;
178
+ break;
179
+ }
180
+ }
181
+
182
+ if (!containsBadWord) return;
183
+
184
+ const botName = getBotName();
185
+ const fake = createFakeContact(senderId);
186
+
187
+ try {
188
+ await sock.sendMessage(chatId, { delete: message.key });
189
+ } catch (err) {
190
+ console.error('Error deleting message:', err.message);
191
+ return;
192
+ }
193
+
194
+ const action = config.action || 'delete';
195
+ const senderNumber = senderId.split('@')[0];
196
+ const maxWarnings = config.maxWarnings || 3;
197
+
198
+ switch (action) {
199
+ case 'delete':
200
+ await sock.sendMessage(chatId, {
201
+ text: `*${botName}*\n@${senderNumber}, bad words not allowed!\nMessage deleted.`,
202
+ mentions: [senderId]
203
+ }, { quoted: fake });
204
+ break;
205
+
206
+ case 'kick':
207
+ try {
208
+ await sock.groupParticipantsUpdate(chatId, [senderId], 'remove');
209
+ await sock.sendMessage(chatId, {
210
+ text: `*${botName}*\n@${senderNumber} kicked for bad words!`,
211
+ mentions: [senderId]
212
+ }, { quoted: fake });
213
+ } catch (error) {
214
+ console.error('Error kicking user:', error.message);
215
+ }
216
+ break;
217
+
218
+ case 'warn':
219
+ const warningCount = db.incrementWarning(chatId, senderId);
220
+ if (warningCount >= maxWarnings) {
221
+ try {
222
+ await sock.groupParticipantsUpdate(chatId, [senderId], 'remove');
223
+ db.resetWarning(chatId, senderId);
224
+ await sock.sendMessage(chatId, {
225
+ text: `*${botName}*\n@${senderNumber} kicked after ${maxWarnings} warnings!`,
226
+ mentions: [senderId]
227
+ }, { quoted: fake });
228
+ } catch (error) {
229
+ console.error('Error kicking user after warnings:', error.message);
230
+ }
231
+ } else {
232
+ await sock.sendMessage(chatId, {
233
+ text: `*${botName}*\n@${senderNumber} warning ${warningCount}/${maxWarnings}!\nBad words not allowed.`,
234
+ mentions: [senderId]
235
+ }, { quoted: fake });
236
+ }
237
+ break;
238
+ }
239
+ } catch (err) {
240
+ console.error('Error in handleBadwordDetection:', err.message, 'Line:', err.stack?.split('\n')[1]);
241
+ }
242
+ }
243
+
244
+ async function setAntiBadword(groupId, type, action) {
245
+ setGroupConfig(groupId, 'antibadword', {
246
+ enabled: type === 'on',
247
+ action: action || 'delete'
248
+ });
249
+ return true;
250
+ }
251
+
252
+ async function getAntiBadword(groupId) {
253
+ return getGroupConfig(groupId, 'antibadword');
254
+ }
255
+
256
+ async function removeAntiBadword(groupId) {
257
+ setGroupConfig(groupId, 'antibadword', { enabled: false, action: 'delete' });
258
+ return true;
259
+ }
260
+
261
+ function incrementWarningCount(groupId, userId) {
262
+ return db.incrementWarning(groupId, userId);
263
+ }
264
+
265
+ function resetWarningCount(groupId, userId) {
266
+ db.resetWarning(groupId, userId);
267
+ return true;
268
+ }
269
+
270
+ module.exports = {
271
+ handleAntiBadwordCommand,
272
+ handleBadwordDetection,
273
+ setAntiBadword,
274
+ getAntiBadword,
275
+ removeAntiBadword,
276
+ incrementWarningCount,
277
+ resetWarningCount
278
+ };
@@ -0,0 +1,88 @@
1
+ const { isJidGroup } = require('@whiskeysockets/baileys');
2
+ const { getAntilink, incrementWarningCount, resetWarningCount, isSudo } = require('../davelib/index');
3
+ const config = require('../config');
4
+
5
+ const WARN_COUNT = config.WARN_COUNT || 3;
6
+
7
+ /**
8
+ * Checks if a string contains a URL.
9
+ *
10
+ * @param {string} str - The string to check.
11
+ * @returns {boolean} - True if the string contains a URL, otherwise false.
12
+ */
13
+ function containsURL(str) {
14
+ const urlRegex = /(https?:\/\/)?([a-z0-9-]+\.)+[a-z]{2,}(\/[^\s]*)?/i;
15
+ return urlRegex.test(str);
16
+ }
17
+
18
+ /**
19
+ * Handles the Antilink functionality for group chats.
20
+ *
21
+ * @param {object} msg - The message object to process.
22
+ * @param {object} sock - The socket object to use for sending messages.
23
+ */
24
+ async function Antilink(msg, sock) {
25
+ const jid = msg.key.remoteJid;
26
+ if (!isJidGroup(jid)) return;
27
+
28
+ const SenderMessage = msg.message?.conversation ||
29
+ msg.message?.extendedTextMessage?.text || '';
30
+ if (!SenderMessage || typeof SenderMessage !== 'string') return;
31
+
32
+ const sender = msg.key.participant;
33
+ if (!sender) return;
34
+
35
+ // Skip if sender is admin or sudo
36
+ const isAdmin = await isSudo(sender);
37
+ if (isAdmin) return;
38
+
39
+ if (!containsURL(SenderMessage.trim())) return;
40
+
41
+ const antilinkConfig = await getAntilink(jid, 'on');
42
+ if (!antilinkConfig) return;
43
+
44
+ const action = antilinkConfig.action;
45
+
46
+ try {
47
+ // Delete message first
48
+ await sock.sendMessage(jid, { delete: msg.key });
49
+
50
+ switch (action) {
51
+ case 'delete':
52
+ await sock.sendMessage(jid, {
53
+ text: `\`\`\`@${sender.split('@')[0]} link are not allowed here\`\`\``,
54
+ mentions: [sender]
55
+ });
56
+ break;
57
+
58
+ case 'kick':
59
+ await sock.groupParticipantsUpdate(jid, [sender], 'remove');
60
+ await sock.sendMessage(jid, {
61
+ text: `\`\`\`@${sender.split('@')[0]} has been kicked for sending links\`\`\``,
62
+ mentions: [sender]
63
+ });
64
+ break;
65
+
66
+ case 'warn':
67
+ const warningCount = await incrementWarningCount(jid, sender);
68
+ if (warningCount >= WARN_COUNT) {
69
+ await sock.groupParticipantsUpdate(jid, [sender], 'remove');
70
+ await resetWarningCount(jid, sender);
71
+ await sock.sendMessage(jid, {
72
+ text: `\`\`\`@${sender.split('@')[0]} has been kicked after ${WARN_COUNT} warnings\`\`\``,
73
+ mentions: [sender]
74
+ });
75
+ } else {
76
+ await sock.sendMessage(jid, {
77
+ text: `\`\`\`@${sender.split('@')[0]} warning ${warningCount}/${WARN_COUNT} for sending links\`\`\``,
78
+ mentions: [sender]
79
+ });
80
+ }
81
+ break;
82
+ }
83
+ } catch (error) {
84
+ console.error('Error in Antilink:', error);
85
+ }
86
+ }
87
+
88
+ module.exports = { Antilink };
@@ -0,0 +1,48 @@
1
+ const { getGroupConfig, setGroupConfig } = require('../Database/settingsStore');
2
+
3
+ function getAntilinkSetting(groupId) {
4
+ try {
5
+ const config = getGroupConfig(groupId, 'antilink');
6
+ if (!config || !config.enabled) return 'off';
7
+ return config.action || 'delete';
8
+ } catch (error) {
9
+ console.error('Error getting antilink setting:', error.message, 'Line:', error.stack?.split('\n')[1]);
10
+ return 'off';
11
+ }
12
+ }
13
+
14
+ function setAntilinkSetting(groupId, type) {
15
+ try {
16
+ if (type === 'off') {
17
+ setGroupConfig(groupId, 'antilink', { enabled: false, action: 'delete' });
18
+ } else {
19
+ setGroupConfig(groupId, 'antilink', { enabled: true, action: type });
20
+ }
21
+ } catch (error) {
22
+ console.error('Error setting antilink setting:', error.message, 'Line:', error.stack?.split('\n')[1]);
23
+ }
24
+ }
25
+
26
+ function getAntilinkConfig(groupId) {
27
+ try {
28
+ return getGroupConfig(groupId, 'antilink') || { enabled: false, action: 'delete', warnCount: 3 };
29
+ } catch (error) {
30
+ console.error('Error getting antilink config:', error.message, 'Line:', error.stack?.split('\n')[1]);
31
+ return { enabled: false, action: 'delete', warnCount: 3 };
32
+ }
33
+ }
34
+
35
+ function setAntilinkConfig(groupId, config) {
36
+ try {
37
+ setGroupConfig(groupId, 'antilink', config);
38
+ } catch (error) {
39
+ console.error('Error setting antilink config:', error.message, 'Line:', error.stack?.split('\n')[1]);
40
+ }
41
+ }
42
+
43
+ module.exports = {
44
+ setAntilinkSetting,
45
+ getAntilinkSetting,
46
+ getAntilinkConfig,
47
+ setAntilinkConfig
48
+ };
@@ -0,0 +1,71 @@
1
+ const { getOwnerConfig, setOwnerConfig } = require('../Database/settingsStore');
2
+
3
+ const defaultConfig = {
4
+ botName: 'DAVE-X',
5
+ menuImage: '',
6
+ menuVideo: '',
7
+ ownerName: 'Dave',
8
+ welcomeMessage: 'Welcome to the group!',
9
+ goodbyeMessage: 'Goodbye!',
10
+ antideletePrivate: true,
11
+ botFont: 'none'
12
+ };
13
+
14
+ function getConfig() {
15
+ try {
16
+ const stored = getOwnerConfig('botconfig');
17
+ return { ...defaultConfig, ...(stored || {}) };
18
+ } catch (error) {
19
+ console.error('Error getting bot config:', error.message, 'Line:', error.stack?.split('\n')[1]);
20
+ return defaultConfig;
21
+ }
22
+ }
23
+
24
+ function saveConfig(config) {
25
+ try {
26
+ setOwnerConfig('botconfig', config);
27
+ } catch (error) {
28
+ console.error('Error saving bot config:', error.message, 'Line:', error.stack?.split('\n')[1]);
29
+ }
30
+ }
31
+
32
+ function getBotName() { return getConfig().botName; }
33
+ function setBotName(name) { const c = getConfig(); c.botName = name; saveConfig(c); }
34
+
35
+ function getMenuImage() { return getConfig().menuImage; }
36
+ function setMenuImage(url) { const c = getConfig(); c.menuImage = url; saveConfig(c); }
37
+
38
+ function getMenuVideo() { return getConfig().menuVideo || ''; }
39
+ function setMenuVideo(url) { const c = getConfig(); c.menuVideo = url; saveConfig(c); }
40
+
41
+ function getOwnerName() { return getConfig().ownerName; }
42
+ function setOwnerName(name) { const c = getConfig(); c.ownerName = name; saveConfig(c); }
43
+
44
+ function isAntideletePrivateEnabled() { return getConfig().antideletePrivate !== false; }
45
+ function setAntideletePrivate(enabled) { const c = getConfig(); c.antideletePrivate = enabled; saveConfig(c); }
46
+
47
+ function getBotFont() { return getConfig().botFont || 'none'; }
48
+ function setBotFont(font) { const c = getConfig(); c.botFont = font; saveConfig(c); }
49
+
50
+ function updateConfig(updates) {
51
+ const config = getConfig();
52
+ Object.assign(config, updates);
53
+ saveConfig(config);
54
+ }
55
+
56
+ module.exports = {
57
+ getBotName,
58
+ setBotName,
59
+ getMenuImage,
60
+ setMenuImage,
61
+ getMenuVideo,
62
+ setMenuVideo,
63
+ getOwnerName,
64
+ setOwnerName,
65
+ isAntideletePrivateEnabled,
66
+ setAntideletePrivate,
67
+ getBotFont,
68
+ setBotFont,
69
+ getConfig,
70
+ updateConfig
71
+ };
@@ -0,0 +1,111 @@
1
+ class ConnectFour {
2
+ constructor(playerRed, playerYellow) {
3
+ this.rows = 6;
4
+ this.cols = 7;
5
+ this.board = Array(this.rows).fill().map(() => Array(this.cols).fill(null));
6
+ this.playerRed = playerRed;
7
+ this.playerYellow = playerYellow;
8
+ this.currentTurn = playerRed; // Red starts
9
+ this.moves = 0;
10
+ this.winner = null;
11
+ this.lastMove = null;
12
+ }
13
+
14
+ dropDisc(isYellow, col) {
15
+ // Validate column
16
+ if (col < 0 || col >= this.cols) return false;
17
+ if (this.winner) return false;
18
+
19
+ // Find first empty row from bottom
20
+ for (let row = this.rows - 1; row >= 0; row--) {
21
+ if (this.board[row][col] === null) {
22
+ this.board[row][col] = isYellow ? 'Y' : 'R';
23
+ this.moves++;
24
+ this.lastMove = {row, col};
25
+
26
+ // Check for win
27
+ if (this.checkWin(row, col)) {
28
+ this.winner = isYellow ? this.playerYellow : this.playerRed;
29
+ }
30
+
31
+ // Switch turn
32
+ this.currentTurn = isYellow ? this.playerRed : this.playerYellow;
33
+ return true;
34
+ }
35
+ }
36
+ return false; // Column is full
37
+ }
38
+
39
+ checkWin(row, col) {
40
+ const player = this.board[row][col];
41
+ if (!player) return false;
42
+
43
+ // Directions: horizontal, vertical, diagonal down-right, diagonal up-right
44
+ const directions = [
45
+ [0, 1], // right
46
+ [1, 0], // down
47
+ [1, 1], // down-right
48
+ [-1, 1] // up-right
49
+ ];
50
+
51
+ for (const [dr, dc] of directions) {
52
+ let count = 1;
53
+
54
+ // Check positive direction
55
+ for (let i = 1; i < 4; i++) {
56
+ const newRow = row + dr * i;
57
+ const newCol = col + dc * i;
58
+ if (newRow < 0 || newRow >= this.rows || newCol < 0 || newCol >= this.cols) break;
59
+ if (this.board[newRow][newCol] === player) count++;
60
+ else break;
61
+ }
62
+
63
+ // Check negative direction
64
+ for (let i = 1; i < 4; i++) {
65
+ const newRow = row - dr * i;
66
+ const newCol = col - dc * i;
67
+ if (newRow < 0 || newRow >= this.rows || newCol < 0 || newCol >= this.cols) break;
68
+ if (this.board[newRow][newCol] === player) count++;
69
+ else break;
70
+ }
71
+
72
+ if (count >= 4) return true;
73
+ }
74
+
75
+ return false;
76
+ }
77
+
78
+ isDraw() {
79
+ return this.moves === this.rows * this.cols && !this.winner;
80
+ }
81
+
82
+ render() {
83
+ let boardStr = '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯\n';
84
+
85
+ // Top column numbers
86
+ boardStr += '1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣\n';
87
+ boardStr += '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯\n';
88
+
89
+ // Board
90
+ for (let row = 0; row < this.rows; row++) {
91
+ for (let col = 0; col < this.cols; col++) {
92
+ const cell = this.board[row][col];
93
+ if (cell === 'R') boardStr += '🔴';
94
+ else if (cell === 'Y') boardStr += '🟡';
95
+ else boardStr += '⚪';
96
+ }
97
+ boardStr += '\n';
98
+ }
99
+
100
+ // Bottom border
101
+ boardStr += '⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯\n';
102
+
103
+ return boardStr;
104
+ }
105
+
106
+ getBoard() {
107
+ return this.board.map(row => [...row]);
108
+ }
109
+ }
110
+
111
+ module.exports = ConnectFour;
@@ -0,0 +1,89 @@
1
+ const fs = require('fs')
2
+ const path = require('path')
3
+ const { spawn } = require('child_process')
4
+
5
+ function ffmpeg(buffer, args = [], ext = '', ext2 = '') {
6
+ return new Promise(async (resolve, reject) => {
7
+ try {
8
+ const tempDir = path.join(__dirname, '../temp')
9
+ if (!fs.existsSync(tempDir)) {
10
+ fs.mkdirSync(tempDir, { recursive: true })
11
+ }
12
+ let tmp = path.join(tempDir, Date.now() + '.' + ext)
13
+ let out = tmp + '.' + ext2
14
+ await fs.promises.writeFile(tmp, buffer)
15
+ spawn('ffmpeg', [
16
+ '-y',
17
+ '-i', tmp,
18
+ ...args,
19
+ out
20
+ ])
21
+ .on('error', reject)
22
+ .on('close', async (code) => {
23
+ try {
24
+ await fs.promises.unlink(tmp)
25
+ if (code !== 0) return reject(code)
26
+ resolve(await fs.promises.readFile(out))
27
+ await fs.promises.unlink(out)
28
+ } catch (e) {
29
+ reject(e)
30
+ }
31
+ })
32
+ } catch (e) {
33
+ reject(e)
34
+ }
35
+ })
36
+ }
37
+
38
+ /**
39
+ * Convert Audio to Playable WhatsApp Audio
40
+ * @param {Buffer} buffer Audio Buffer
41
+ * @param {String} ext File Extension
42
+ */
43
+ function toAudio(buffer, ext) {
44
+ return ffmpeg(buffer, [
45
+ '-vn',
46
+ '-ac', '2',
47
+ '-b:a', '128k',
48
+ '-ar', '44100',
49
+ '-f', 'mp3'
50
+ ], ext, 'mp3')
51
+ }
52
+
53
+ /**
54
+ * Convert Audio to Playable WhatsApp PTT
55
+ * @param {Buffer} buffer Audio Buffer
56
+ * @param {String} ext File Extension
57
+ */
58
+ function toPTT(buffer, ext) {
59
+ return ffmpeg(buffer, [
60
+ '-vn',
61
+ '-c:a', 'libopus',
62
+ '-b:a', '128k',
63
+ '-vbr', 'on',
64
+ '-compression_level', '10'
65
+ ], ext, 'opus')
66
+ }
67
+
68
+ /**
69
+ * Convert Audio to Playable WhatsApp Video
70
+ * @param {Buffer} buffer Video Buffer
71
+ * @param {String} ext File Extension
72
+ */
73
+ function toVideo(buffer, ext) {
74
+ return ffmpeg(buffer, [
75
+ '-c:v', 'libx264',
76
+ '-c:a', 'aac',
77
+ '-ab', '128k',
78
+ '-ar', '44100',
79
+ '-crf', '32',
80
+ '-preset', 'slow'
81
+ ], ext, 'mp4')
82
+ }
83
+
84
+ module.exports = {
85
+ toAudio,
86
+ toPTT,
87
+ toVideo,
88
+ ffmpeg,
89
+ }