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.
- package/Database/database.js +446 -0
- package/Database/migration.js +327 -0
- package/Database/pgSync.js +229 -0
- package/Database/settingsStore.js +305 -0
- package/config.js +32 -0
- package/dave.js +3063 -0
- package/davelib/antibadword.js +278 -0
- package/davelib/antilink.js +88 -0
- package/davelib/antilinkHelper.js +48 -0
- package/davelib/botConfig.js +71 -0
- package/davelib/connect4.js +111 -0
- package/davelib/converter.js +89 -0
- package/davelib/dicegame.js +114 -0
- package/davelib/exif.js +138 -0
- package/davelib/fakeContact.js +85 -0
- package/davelib/fontStyles.js +237 -0
- package/davelib/greetings.js +47 -0
- package/davelib/id.js +11 -0
- package/davelib/index.js +577 -0
- package/davelib/isAdmin.js +32 -0
- package/davelib/isBanned.js +12 -0
- package/davelib/isOwner.js +15 -0
- package/davelib/lightweight_store.js +169 -0
- package/davelib/messageConfig.js +15 -0
- package/davelib/messageHandler.js +87 -0
- package/davelib/myfunc.js +379 -0
- package/davelib/myfunc2.js +170 -0
- package/davelib/reactions.js +180 -0
- package/davelib/server.html +563 -0
- package/davelib/sticker.js +208 -0
- package/davelib/tempCleanup.js +53 -0
- package/davelib/tictactoe.js +104 -0
- package/davelib/uploadImage.js +100 -0
- package/davelib/uploader.js +110 -0
- package/davelib/welcome.js +100 -0
- package/davelib/wordchain.js +121 -0
- package/daveset.js +16 -0
- package/davexcore/ai/ai.js +100 -0
- package/davexcore/ai/aiGpt4.js +59 -0
- package/davexcore/ai/aimodels.js +284 -0
- package/davexcore/ai/aivideo.js +31 -0
- package/davexcore/ai/analyze.js +233 -0
- package/davexcore/ai/bard.js +101 -0
- package/davexcore/ai/bird.js +101 -0
- package/davexcore/ai/blackbox.js +30 -0
- package/davexcore/ai/character.js +80 -0
- package/davexcore/ai/copilot.js +58 -0
- package/davexcore/ai/dalle.js +39 -0
- package/davexcore/ai/davex.js +50 -0
- package/davexcore/ai/deepseek.js +96 -0
- package/davexcore/ai/grok.js +67 -0
- package/davexcore/ai/imagine.js +89 -0
- package/davexcore/ai/meta.js +82 -0
- package/davexcore/ai/mistral.js +101 -0
- package/davexcore/ai/perplexity.js +95 -0
- package/davexcore/ai/sora.js +44 -0
- package/davexcore/ai/speechwriter.js +46 -0
- package/davexcore/ai/vision.js +244 -0
- package/davexcore/ai/wormgpt.js +56 -0
- package/davexcore/anti/antiaudio.js +106 -0
- package/davexcore/anti/antibadword.js +313 -0
- package/davexcore/anti/antibug.js +156 -0
- package/davexcore/anti/anticall.js +219 -0
- package/davexcore/anti/antichart.js +280 -0
- package/davexcore/anti/antidelete.js +673 -0
- package/davexcore/anti/antideletestatus.js +535 -0
- package/davexcore/anti/antidemote.js +352 -0
- package/davexcore/anti/antidocument.js +105 -0
- package/davexcore/anti/antiedit.js +410 -0
- package/davexcore/anti/antifiles.js +109 -0
- package/davexcore/anti/antigroupmention.js +206 -0
- package/davexcore/anti/antiimage.js +105 -0
- package/davexcore/anti/antikick.js +125 -0
- package/davexcore/anti/antilink.js +237 -0
- package/davexcore/anti/antimention.js +143 -0
- package/davexcore/anti/antipromote.js +320 -0
- package/davexcore/anti/antisticker.js +105 -0
- package/davexcore/anti/antitag.js +191 -0
- package/davexcore/anti/antivideo.js +105 -0
- package/davexcore/anti/antiviewonce.js +396 -0
- package/davexcore/anti/groupanticall.js +262 -0
- package/davexcore/anti/mention.js +242 -0
- package/davexcore/automation/alwaysonline.js +226 -0
- package/davexcore/automation/autoReadReciepts.js +96 -0
- package/davexcore/automation/autoread.js +104 -0
- package/davexcore/automation/autorecording.js +197 -0
- package/davexcore/automation/autostatus.js +317 -0
- package/davexcore/automation/autotyping.js +197 -0
- package/davexcore/automation/chatbot.js +444 -0
- package/davexcore/automation/chatmanage.js +199 -0
- package/davexcore/automation/devReact.js +43 -0
- package/davexcore/automation/goodbye.js +181 -0
- package/davexcore/automation/greetings.js +154 -0
- package/davexcore/automation/welcome.js +187 -0
- package/davexcore/downloads/apk.js +157 -0
- package/davexcore/downloads/facebook.js +94 -0
- package/davexcore/downloads/gitclone.js +137 -0
- package/davexcore/downloads/igs.js +333 -0
- package/davexcore/downloads/instagram.js +133 -0
- package/davexcore/downloads/mediafire.js +144 -0
- package/davexcore/downloads/pinterest.js +38 -0
- package/davexcore/downloads/play.js +158 -0
- package/davexcore/downloads/saveStatus.js +3 -0
- package/davexcore/downloads/song.js +135 -0
- package/davexcore/downloads/spotify.js +133 -0
- package/davexcore/downloads/tiktok.js +167 -0
- package/davexcore/downloads/tiktokaudio.js +158 -0
- package/davexcore/downloads/video.js +188 -0
- package/davexcore/downloads/ytdl.js +252 -0
- package/davexcore/downloads/ytdocplay.js +130 -0
- package/davexcore/downloads/ytdocvideo.js +95 -0
- package/davexcore/downloads/yts.js +64 -0
- package/davexcore/games/connect4.js +267 -0
- package/davexcore/games/dice.js +286 -0
- package/davexcore/games/eightball.js +24 -0
- package/davexcore/games/hangman.js +60 -0
- package/davexcore/games/rps.js +25 -0
- package/davexcore/games/ship.js +36 -0
- package/davexcore/games/slot.js +21 -0
- package/davexcore/games/tictactoe.js +263 -0
- package/davexcore/games/trivia.js +46 -0
- package/davexcore/games/wordchain.js +242 -0
- package/davexcore/group/addmember.js +101 -0
- package/davexcore/group/ban.js +63 -0
- package/davexcore/group/blockUnblock.js +177 -0
- package/davexcore/group/clear.js +196 -0
- package/davexcore/group/creategroup.js +43 -0
- package/davexcore/group/demote.js +115 -0
- package/davexcore/group/disappear.js +67 -0
- package/davexcore/group/groupinfo.js +167 -0
- package/davexcore/group/groupmanage.js +133 -0
- package/davexcore/group/hidetag.js +108 -0
- package/davexcore/group/joinrequests.js +145 -0
- package/davexcore/group/kick.js +92 -0
- package/davexcore/group/kickall.js +63 -0
- package/davexcore/group/leave.js +38 -0
- package/davexcore/group/linkgroup.js +63 -0
- package/davexcore/group/mute.js +57 -0
- package/davexcore/group/online.js +117 -0
- package/davexcore/group/pmblocker.js +65 -0
- package/davexcore/group/promote.js +93 -0
- package/davexcore/group/resetlink.js +57 -0
- package/davexcore/group/staff.js +99 -0
- package/davexcore/group/tag.js +111 -0
- package/davexcore/group/tagadmins.js +88 -0
- package/davexcore/group/tagall.js +99 -0
- package/davexcore/group/tagnotadmin.js +92 -0
- package/davexcore/group/topmembers.js +202 -0
- package/davexcore/group/unban.js +64 -0
- package/davexcore/group/unmute.js +45 -0
- package/davexcore/group/warn.js +83 -0
- package/davexcore/group/warnings.js +26 -0
- package/davexcore/media/anime.js +130 -0
- package/davexcore/media/attp.js +127 -0
- package/davexcore/media/design.js +52 -0
- package/davexcore/media/emojimix.js +105 -0
- package/davexcore/media/getpp.js +108 -0
- package/davexcore/media/image.js +87 -0
- package/davexcore/media/imageedit.js +329 -0
- package/davexcore/media/img-blur.js +70 -0
- package/davexcore/media/meme.js +35 -0
- package/davexcore/media/pies.js +53 -0
- package/davexcore/media/quotesticker.js +153 -0
- package/davexcore/media/remini.js +126 -0
- package/davexcore/media/removebg.js +114 -0
- package/davexcore/media/setpp.js +65 -0
- package/davexcore/media/shazam.js +251 -0
- package/davexcore/media/simage.js +74 -0
- package/davexcore/media/sticker.js +134 -0
- package/davexcore/media/stickercrop.js +133 -0
- package/davexcore/media/stickertelegram.js +133 -0
- package/davexcore/media/take.js +76 -0
- package/davexcore/media/textmaker.js +106 -0
- package/davexcore/media/toAudio.js +180 -0
- package/davexcore/media/togif.js +33 -0
- package/davexcore/media/toimg.js +26 -0
- package/davexcore/media/tomp4.js +34 -0
- package/davexcore/media/tostatus.js +160 -0
- package/davexcore/media/tts.js +47 -0
- package/davexcore/media/viewonce.js +59 -0
- package/davexcore/media/vn.js +67 -0
- package/davexcore/media/vv2.js +3 -0
- package/davexcore/media/wallpaper.js +89 -0
- package/davexcore/media/wasted.js +57 -0
- package/davexcore/misc/compliment.js +93 -0
- package/davexcore/misc/dare.js +47 -0
- package/davexcore/misc/fact.js +14 -0
- package/davexcore/misc/flirt.js +26 -0
- package/davexcore/misc/goodnight.js +33 -0
- package/davexcore/misc/insult.js +281 -0
- package/davexcore/misc/joke.js +66 -0
- package/davexcore/misc/misc.js +200 -0
- package/davexcore/misc/quote.js +22 -0
- package/davexcore/misc/roseday.js +24 -0
- package/davexcore/misc/shayari.js +62 -0
- package/davexcore/misc/simp.js +47 -0
- package/davexcore/misc/stupid.js +51 -0
- package/davexcore/misc/truth.js +146 -0
- package/davexcore/owner/alive.js +67 -0
- package/davexcore/owner/bio.js +49 -0
- package/davexcore/owner/broadcast.js +74 -0
- package/davexcore/owner/chanel.js +79 -0
- package/davexcore/owner/channelid.js +50 -0
- package/davexcore/owner/clearsession.js +86 -0
- package/davexcore/owner/help.js +649 -0
- package/davexcore/owner/hijack.js +69 -0
- package/davexcore/owner/menuManage.js +173 -0
- package/davexcore/owner/menuSettings.js +1 -0
- package/davexcore/owner/owner.js +17 -0
- package/davexcore/owner/pair.js +160 -0
- package/davexcore/owner/pinchat.js +44 -0
- package/davexcore/owner/ping.js +65 -0
- package/davexcore/owner/profilepic.js +61 -0
- package/davexcore/owner/resetmenuimage.js +16 -0
- package/davexcore/owner/setGroupStatus.js +315 -0
- package/davexcore/owner/setbotconfig.js +306 -0
- package/davexcore/owner/setfont.js +79 -0
- package/davexcore/owner/setowner.js +144 -0
- package/davexcore/owner/setprefix.js +131 -0
- package/davexcore/owner/settings.js +98 -0
- package/davexcore/owner/startupwelcome.js +94 -0
- package/davexcore/owner/sudo.js +138 -0
- package/davexcore/owner/update.js +282 -0
- package/davexcore/tmp/1772020249097.jpg +0 -0
- package/davexcore/utility/bible.js +239 -0
- package/davexcore/utility/cleartmp.js +107 -0
- package/davexcore/utility/delete.js +182 -0
- package/davexcore/utility/encrypt.js +99 -0
- package/davexcore/utility/ethicalhacking.js +108 -0
- package/davexcore/utility/fetch.js +127 -0
- package/davexcore/utility/github.js +85 -0
- package/davexcore/utility/google.js +79 -0
- package/davexcore/utility/join.js +52 -0
- package/davexcore/utility/lastseen.js +67 -0
- package/davexcore/utility/location.js +106 -0
- package/davexcore/utility/lyrics.js +54 -0
- package/davexcore/utility/movie.js +66 -0
- package/davexcore/utility/news.js +37 -0
- package/davexcore/utility/sports.js +403 -0
- package/davexcore/utility/ss.js +63 -0
- package/davexcore/utility/tinyurl.js +83 -0
- package/davexcore/utility/translate.js +101 -0
- package/davexcore/utility/url.js +112 -0
- package/davexcore/utility/vcf.js +84 -0
- package/davexcore/utility/weather.js +162 -0
- package/index.js +994 -0
- package/package.json +64 -0
|
@@ -0,0 +1,111 @@
|
|
|
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 tagCommand(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, { text: `*${botName}*\nBot needs to be admin!` }, { quoted: fake });
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!isSenderAdmin && !message?.key?.fromMe && !db.isSudo(senderId)) {
|
|
35
|
+
const stickerPath = './assets/sticktag.webp';
|
|
36
|
+
if (fs.existsSync(stickerPath)) {
|
|
37
|
+
const stickerBuffer = fs.readFileSync(stickerPath);
|
|
38
|
+
await sock.sendMessage(chatId, { sticker: stickerBuffer });
|
|
39
|
+
}
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
const groupMetadata = await sock.groupMetadata(chatId);
|
|
45
|
+
const participants = groupMetadata.participants;
|
|
46
|
+
const mentionedJidList = participants.map(p => p.id);
|
|
47
|
+
|
|
48
|
+
if (replyMessage) {
|
|
49
|
+
let messageContent = {};
|
|
50
|
+
|
|
51
|
+
if (replyMessage.imageMessage) {
|
|
52
|
+
const filePath = await downloadMediaMessage(replyMessage.imageMessage, 'image');
|
|
53
|
+
messageContent = {
|
|
54
|
+
image: { url: filePath },
|
|
55
|
+
caption: messageText || replyMessage.imageMessage.caption || '',
|
|
56
|
+
mentions: mentionedJidList
|
|
57
|
+
};
|
|
58
|
+
await sock.sendMessage(chatId, messageContent);
|
|
59
|
+
fs.unlinkSync(filePath);
|
|
60
|
+
} else if (replyMessage.videoMessage) {
|
|
61
|
+
const filePath = await downloadMediaMessage(replyMessage.videoMessage, 'video');
|
|
62
|
+
messageContent = {
|
|
63
|
+
video: { url: filePath },
|
|
64
|
+
caption: messageText || replyMessage.videoMessage.caption || '',
|
|
65
|
+
mentions: mentionedJidList
|
|
66
|
+
};
|
|
67
|
+
await sock.sendMessage(chatId, messageContent);
|
|
68
|
+
fs.unlinkSync(filePath);
|
|
69
|
+
} else if (replyMessage.stickerMessage) {
|
|
70
|
+
const filePath = await downloadMediaMessage(replyMessage.stickerMessage, 'sticker');
|
|
71
|
+
messageContent = {
|
|
72
|
+
sticker: { url: filePath },
|
|
73
|
+
mentions: mentionedJidList
|
|
74
|
+
};
|
|
75
|
+
await sock.sendMessage(chatId, messageContent);
|
|
76
|
+
fs.unlinkSync(filePath);
|
|
77
|
+
} else if (replyMessage.audioMessage) {
|
|
78
|
+
const filePath = await downloadMediaMessage(replyMessage.audioMessage, 'audio');
|
|
79
|
+
messageContent = {
|
|
80
|
+
audio: { url: filePath },
|
|
81
|
+
ptt: replyMessage.audioMessage.ptt || false,
|
|
82
|
+
mentions: mentionedJidList
|
|
83
|
+
};
|
|
84
|
+
await sock.sendMessage(chatId, messageContent);
|
|
85
|
+
fs.unlinkSync(filePath);
|
|
86
|
+
} else {
|
|
87
|
+
const quotedText = replyMessage.conversation ||
|
|
88
|
+
replyMessage.extendedTextMessage?.text ||
|
|
89
|
+
messageText || '';
|
|
90
|
+
await sock.sendMessage(chatId, {
|
|
91
|
+
text: quotedText,
|
|
92
|
+
mentions: mentionedJidList
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
} else if (messageText) {
|
|
96
|
+
await sock.sendMessage(chatId, {
|
|
97
|
+
text: messageText,
|
|
98
|
+
mentions: mentionedJidList
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
await sock.sendMessage(chatId, {
|
|
102
|
+
text: `*${botName}*\nUsage: .tag <message> or reply to a message`
|
|
103
|
+
}, { quoted: fake });
|
|
104
|
+
}
|
|
105
|
+
} catch (error) {
|
|
106
|
+
console.error('Tag error:', error.message, 'Line:', error.stack?.split('\n')[1]);
|
|
107
|
+
await sock.sendMessage(chatId, { text: `*${botName}*\nError: ${error.message}` }, { quoted: fake });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
module.exports = tagCommand;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
|
|
2
|
+
|
|
3
|
+
async function resolveToPhone(sock, jid) {
|
|
4
|
+
if (!jid) return 'unknown';
|
|
5
|
+
const raw = jid.split('@')[0].split(':')[0];
|
|
6
|
+
if (/^\d{7,15}$/.test(raw)) return raw;
|
|
7
|
+
try {
|
|
8
|
+
if (sock?.signalRepository?.lidMapping?.getPNForLID) {
|
|
9
|
+
const formats = [jid, `${raw}:0@lid`, `${raw}@lid`];
|
|
10
|
+
for (const fmt of formats) {
|
|
11
|
+
try {
|
|
12
|
+
const pn = await sock.signalRepository.lidMapping.getPNForLID(fmt);
|
|
13
|
+
if (pn) {
|
|
14
|
+
const num = String(pn).split('@')[0].replace(/[^0-9]/g, '');
|
|
15
|
+
if (num.length >= 7 && num.length <= 15 && num !== raw) return num;
|
|
16
|
+
}
|
|
17
|
+
} catch {}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const groups = await sock.groupFetchAllParticipating();
|
|
21
|
+
for (const gid of Object.keys(groups)) {
|
|
22
|
+
for (const p of (groups[gid].participants || [])) {
|
|
23
|
+
const pid = (p.id || '').split('@')[0].split(':')[0];
|
|
24
|
+
const pLid = (p.lid || '').split('@')[0].split(':')[0];
|
|
25
|
+
if ((pLid === raw || pid === raw) && pid && /^\d{7,15}$/.test(pid) && pid !== raw) return pid;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} catch {}
|
|
29
|
+
return raw;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function tagAdminsCommand(sock, chatId, senderId, message, fullArgs) {
|
|
33
|
+
try {
|
|
34
|
+
const meta = await sock.groupMetadata(chatId);
|
|
35
|
+
const participants = meta.participants;
|
|
36
|
+
const botName = getBotName();
|
|
37
|
+
const fake = createFakeContact(message);
|
|
38
|
+
|
|
39
|
+
const superAdmins = [];
|
|
40
|
+
const admins = [];
|
|
41
|
+
|
|
42
|
+
for (const p of participants) {
|
|
43
|
+
if (p.admin === 'superadmin') {
|
|
44
|
+
superAdmins.push(p.id);
|
|
45
|
+
} else if (p.admin === 'admin') {
|
|
46
|
+
admins.push(p.id);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const allAdmins = [...superAdmins, ...admins];
|
|
51
|
+
|
|
52
|
+
if (allAdmins.length === 0) {
|
|
53
|
+
await sock.sendMessage(chatId, { text: 'No admins found in this group!' }, { quoted: fake });
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const mentions = [...allAdmins, senderId];
|
|
58
|
+
|
|
59
|
+
let text = `*${botName} TAG ADMINS*\n\n`;
|
|
60
|
+
|
|
61
|
+
if (fullArgs && fullArgs.trim()) {
|
|
62
|
+
text += `*Message:* ${fullArgs.trim()}\n\n`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const resolvedSender = await resolveToPhone(sock, senderId);
|
|
66
|
+
text += `*Tagged By:* @${resolvedSender}\n\n`;
|
|
67
|
+
text += `*Admins:*\n`;
|
|
68
|
+
|
|
69
|
+
for (const id of superAdmins) {
|
|
70
|
+
const resolved = await resolveToPhone(sock, id);
|
|
71
|
+
text += `@${resolved}\n`;
|
|
72
|
+
}
|
|
73
|
+
for (const id of admins) {
|
|
74
|
+
const resolved = await resolveToPhone(sock, id);
|
|
75
|
+
text += `@${resolved}\n`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
await sock.sendMessage(chatId, {
|
|
79
|
+
text: text.trim(),
|
|
80
|
+
mentions
|
|
81
|
+
}, { quoted: fake });
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.error('Tagadmins error:', error);
|
|
84
|
+
await sock.sendMessage(chatId, { text: `Failed to tag admins: ${error.message}` });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
module.exports = tagAdminsCommand;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const isAdmin = require('../../davelib/isAdmin');
|
|
2
|
+
const db = require('../../Database/database');
|
|
3
|
+
const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
|
|
4
|
+
|
|
5
|
+
async function resolveToPhone(sock, jid) {
|
|
6
|
+
if (!jid) return 'unknown';
|
|
7
|
+
const raw = jid.split('@')[0].split(':')[0];
|
|
8
|
+
if (/^\d{7,15}$/.test(raw)) return raw;
|
|
9
|
+
try {
|
|
10
|
+
if (sock?.signalRepository?.lidMapping?.getPNForLID) {
|
|
11
|
+
const formats = [jid, `${raw}:0@lid`, `${raw}@lid`];
|
|
12
|
+
for (const fmt of formats) {
|
|
13
|
+
try {
|
|
14
|
+
const pn = await sock.signalRepository.lidMapping.getPNForLID(fmt);
|
|
15
|
+
if (pn) {
|
|
16
|
+
const num = String(pn).split('@')[0].replace(/[^0-9]/g, '');
|
|
17
|
+
if (num.length >= 7 && num.length <= 15 && num !== raw) return num;
|
|
18
|
+
}
|
|
19
|
+
} catch {}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const groups = await sock.groupFetchAllParticipating();
|
|
23
|
+
for (const gid of Object.keys(groups)) {
|
|
24
|
+
for (const p of (groups[gid].participants || [])) {
|
|
25
|
+
const pid = (p.id || '').split('@')[0].split(':')[0];
|
|
26
|
+
const pLid = (p.lid || '').split('@')[0].split(':')[0];
|
|
27
|
+
if ((pLid === raw || pid === raw) && pid && /^\d{7,15}$/.test(pid) && pid !== raw) return pid;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
} catch {}
|
|
31
|
+
return raw;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function tagAllCommand(sock, chatId, senderId, message) {
|
|
35
|
+
const fake = createFakeContact(senderId);
|
|
36
|
+
const botName = getBotName();
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const { isSenderAdmin, isBotAdmin } = await isAdmin(sock, chatId, senderId);
|
|
40
|
+
|
|
41
|
+
if (!isSenderAdmin && !isBotAdmin && !message?.key?.fromMe && !db.isSudo(senderId)) {
|
|
42
|
+
await sock.sendMessage(chatId, {
|
|
43
|
+
text: `*${botName}*\nAdmin only command!`
|
|
44
|
+
}, { quoted: fake });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const groupMetadata = await sock.groupMetadata(chatId);
|
|
49
|
+
const participants = groupMetadata.participants;
|
|
50
|
+
|
|
51
|
+
if (!participants || participants.length === 0) {
|
|
52
|
+
await sock.sendMessage(chatId, {
|
|
53
|
+
text: `*${botName}*\nNo participants found!`
|
|
54
|
+
}, { quoted: fake });
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let profilePictureUrl = null;
|
|
59
|
+
try {
|
|
60
|
+
profilePictureUrl = await sock.profilePictureUrl(chatId, 'image');
|
|
61
|
+
} catch (error) {}
|
|
62
|
+
|
|
63
|
+
let textContent = `╭─❖ *${botName} TAGALL* ❖─╮\n`;
|
|
64
|
+
textContent += `│ Group : ${groupMetadata.subject}\n`;
|
|
65
|
+
textContent += `│ Members : ${participants.length}\n`;
|
|
66
|
+
textContent += `╰────────────────────────╯\n\n`;
|
|
67
|
+
|
|
68
|
+
for (let index = 0; index < participants.length; index++) {
|
|
69
|
+
const participant = participants[index];
|
|
70
|
+
const number = (index + 1).toString().padStart(2, '0');
|
|
71
|
+
const resolved = await resolveToPhone(sock, participant.id);
|
|
72
|
+
const displayName = participant.name || participant.notify || resolved;
|
|
73
|
+
textContent += `${number}. @${resolved} (${displayName})\n`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const mentions = participants.map(p => p.id);
|
|
77
|
+
|
|
78
|
+
if (profilePictureUrl) {
|
|
79
|
+
await sock.sendMessage(chatId, {
|
|
80
|
+
image: { url: profilePictureUrl },
|
|
81
|
+
caption: textContent,
|
|
82
|
+
mentions: mentions
|
|
83
|
+
}, { quoted: fake });
|
|
84
|
+
} else {
|
|
85
|
+
await sock.sendMessage(chatId, {
|
|
86
|
+
text: textContent,
|
|
87
|
+
mentions: mentions
|
|
88
|
+
}, { quoted: fake });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error('TagAll error:', error.message, 'Line:', error.stack?.split('\n')[1]);
|
|
93
|
+
await sock.sendMessage(chatId, {
|
|
94
|
+
text: `*${botName}*\nFailed to tag members.`
|
|
95
|
+
}, { quoted: fake });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
module.exports = { tagAllCommand };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const isAdmin = require('../../davelib/isAdmin');
|
|
2
|
+
const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
|
|
3
|
+
|
|
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
|
+
async function tagNotAdminCommand(sock, chatId, senderId, message) {
|
|
34
|
+
try {
|
|
35
|
+
const { isSenderAdmin, isBotAdmin } = await isAdmin(sock, chatId, senderId);
|
|
36
|
+
const fake = createFakeContact(senderId);
|
|
37
|
+
|
|
38
|
+
if (!isBotAdmin) {
|
|
39
|
+
await sock.sendMessage(chatId, { text: 'Please make the bot an admin first.' }, { quoted: fake });
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!isSenderAdmin) {
|
|
44
|
+
await sock.sendMessage(chatId, { text: 'Only admins can use the .tagnotadmin command.' }, { quoted: fake });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const groupMetadata = await sock.groupMetadata(chatId);
|
|
49
|
+
const participants = groupMetadata.participants || [];
|
|
50
|
+
|
|
51
|
+
const nonAdmins = participants.filter(p => !p.admin).map(p => p.id);
|
|
52
|
+
if (nonAdmins.length === 0) {
|
|
53
|
+
await sock.sendMessage(chatId, { text: 'No non-admin members to tag.' }, { quoted: fake });
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let profilePicUrl;
|
|
58
|
+
try {
|
|
59
|
+
profilePicUrl = await sock.profilePictureUrl(chatId, 'image');
|
|
60
|
+
} catch (error) {
|
|
61
|
+
profilePicUrl = null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let text = `🏷️ *Tagging Non-Admins in ${groupMetadata.subject}*\n\n`;
|
|
65
|
+
text += `📊 *Total Non-Admins:* ${nonAdmins.length}\n\n`;
|
|
66
|
+
text += '🔊 *Hello Everyone:*\n\n';
|
|
67
|
+
|
|
68
|
+
for (const jid of nonAdmins) {
|
|
69
|
+
const resolved = await resolveToPhone(sock, jid);
|
|
70
|
+
text += `@${resolved}\n`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (profilePicUrl) {
|
|
74
|
+
await sock.sendMessage(chatId, {
|
|
75
|
+
image: { url: profilePicUrl },
|
|
76
|
+
caption: text,
|
|
77
|
+
mentions: nonAdmins
|
|
78
|
+
}, { quoted: fake });
|
|
79
|
+
} else {
|
|
80
|
+
await sock.sendMessage(chatId, {
|
|
81
|
+
text,
|
|
82
|
+
mentions: nonAdmins
|
|
83
|
+
}, { quoted: fake });
|
|
84
|
+
}
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error('Error in tagnotadmin command:', error);
|
|
87
|
+
const fake = createFakeContact(senderId);
|
|
88
|
+
await sock.sendMessage(chatId, { text: 'Failed to tag non-admin members.' }, { quoted: fake });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
module.exports = tagNotAdminCommand;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
const {
|
|
2
|
+
incrementMsgCount,
|
|
3
|
+
getGroupMsgCounts,
|
|
4
|
+
resetGroupMsgCounts,
|
|
5
|
+
getGroupTotalMsgCount
|
|
6
|
+
} = require('../../Database/database');
|
|
7
|
+
const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
|
|
8
|
+
|
|
9
|
+
async function resolveToPhone(sock, jid) {
|
|
10
|
+
if (!jid) return 'unknown';
|
|
11
|
+
const raw = jid.split('@')[0].split(':')[0];
|
|
12
|
+
if (/^\d{7,15}$/.test(raw)) return raw;
|
|
13
|
+
try {
|
|
14
|
+
if (sock?.signalRepository?.lidMapping?.getPNForLID) {
|
|
15
|
+
const formats = [jid, `${raw}:0@lid`, `${raw}@lid`];
|
|
16
|
+
for (const fmt of formats) {
|
|
17
|
+
try {
|
|
18
|
+
const pn = await sock.signalRepository.lidMapping.getPNForLID(fmt);
|
|
19
|
+
if (pn) {
|
|
20
|
+
const num = String(pn).split('@')[0].replace(/[^0-9]/g, '');
|
|
21
|
+
if (num.length >= 7 && num.length <= 15 && num !== raw) return num;
|
|
22
|
+
}
|
|
23
|
+
} catch {}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const groups = await sock.groupFetchAllParticipating();
|
|
27
|
+
for (const gid of Object.keys(groups)) {
|
|
28
|
+
for (const p of (groups[gid].participants || [])) {
|
|
29
|
+
const pid = (p.id || '').split('@')[0].split(':')[0];
|
|
30
|
+
const pLid = (p.lid || '').split('@')[0].split(':')[0];
|
|
31
|
+
if ((pLid === raw || pid === raw) && pid && /^\d{7,15}$/.test(pid) && pid !== raw) return pid;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
} catch {}
|
|
35
|
+
return raw;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function incrementMessageCount(groupId, userId) {
|
|
39
|
+
try {
|
|
40
|
+
incrementMsgCount(groupId, userId);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error('Error incrementing message count:', error);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function topMembers(sock, chatId, isGroup, message, count = 5) {
|
|
47
|
+
const fakeContact = createFakeContact(message);
|
|
48
|
+
const botName = getBotName();
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
if (!isGroup) {
|
|
52
|
+
sock.sendMessage(chatId, { text: `*${botName}*\nGroup command only.` }, { quoted: fakeContact });
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const groupCounts = getGroupMsgCounts(chatId);
|
|
57
|
+
const sortedMembers = Object.entries(groupCounts)
|
|
58
|
+
.sort(([, a], [, b]) => b - a)
|
|
59
|
+
.slice(0, count);
|
|
60
|
+
|
|
61
|
+
if (sortedMembers.length === 0) {
|
|
62
|
+
sock.sendMessage(chatId, { text: `*${botName}*\nNo interaction data available.` }, { quoted: fakeContact });
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let textContent = `╭─❖ *TOP ${count} MEMBERS* ❖─╮\n`;
|
|
67
|
+
const mentions = [];
|
|
68
|
+
|
|
69
|
+
for (let index = 0; index < sortedMembers.length; index++) {
|
|
70
|
+
const [userId, messageCount] = sortedMembers[index];
|
|
71
|
+
const rank = (index + 1).toString().padStart(2, '0');
|
|
72
|
+
const username = await resolveToPhone(sock, userId);
|
|
73
|
+
|
|
74
|
+
let displayName = username;
|
|
75
|
+
try {
|
|
76
|
+
const groupMetadata = await sock.groupMetadata(chatId);
|
|
77
|
+
const participant = groupMetadata.participants.find(p => p.id === userId);
|
|
78
|
+
if (participant) {
|
|
79
|
+
displayName = participant.name || participant.notify || username;
|
|
80
|
+
}
|
|
81
|
+
} catch {}
|
|
82
|
+
|
|
83
|
+
textContent += `│ ${rank}. @${username} (${displayName})\n`;
|
|
84
|
+
textContent += `│ 📊 ${messageCount} messages\n`;
|
|
85
|
+
mentions.push(userId);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const totalMessages = getGroupTotalMsgCount(chatId);
|
|
89
|
+
textContent += `╰────────────────────────╯\n\n`;
|
|
90
|
+
textContent += `Total: ${totalMessages} messages`;
|
|
91
|
+
|
|
92
|
+
await sock.sendMessage(chatId, {
|
|
93
|
+
text: textContent,
|
|
94
|
+
mentions: mentions
|
|
95
|
+
}, { quoted: fakeContact });
|
|
96
|
+
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.error('Error in topMembers command:', error);
|
|
99
|
+
sock.sendMessage(chatId, { text: `*${botName}*\nFailed to load leaderboard.` }, { quoted: fakeContact });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async function getUserRank(sock, chatId, isGroup, userId, message) {
|
|
104
|
+
const fakeContact = createFakeContact(message);
|
|
105
|
+
const botName = getBotName();
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
if (!isGroup) {
|
|
109
|
+
sock.sendMessage(chatId, { text: `*${botName}*\nGroup command only.` }, { quoted: fakeContact });
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const groupCounts = getGroupMsgCounts(chatId);
|
|
114
|
+
const username = await resolveToPhone(sock, userId);
|
|
115
|
+
|
|
116
|
+
if (!groupCounts[userId]) {
|
|
117
|
+
sock.sendMessage(chatId, {
|
|
118
|
+
text: `*${botName}*\n@${username} has no interaction history.`,
|
|
119
|
+
mentions: [userId]
|
|
120
|
+
}, { quoted: fakeContact });
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const sortedMembers = Object.entries(groupCounts).sort(([, a], [, b]) => b - a);
|
|
125
|
+
const userRank = sortedMembers.findIndex(([id]) => id === userId) + 1;
|
|
126
|
+
const userMessageCount = groupCounts[userId];
|
|
127
|
+
const totalMembers = sortedMembers.length;
|
|
128
|
+
const percentile = Math.round(((totalMembers - userRank + 1) / totalMembers) * 100);
|
|
129
|
+
|
|
130
|
+
const textContent = `╭─❖ *USER RANK* ❖─╮\n` +
|
|
131
|
+
`│ User : @${username}\n` +
|
|
132
|
+
`│ Rank : ${userRank}/${totalMembers}\n` +
|
|
133
|
+
`│ Messages: ${userMessageCount}\n` +
|
|
134
|
+
`│ Top : ${percentile}%\n` +
|
|
135
|
+
`╰─────────────────╯`;
|
|
136
|
+
|
|
137
|
+
sock.sendMessage(chatId, {
|
|
138
|
+
text: textContent,
|
|
139
|
+
mentions: [userId]
|
|
140
|
+
}, { quoted: fakeContact });
|
|
141
|
+
|
|
142
|
+
} catch (error) {
|
|
143
|
+
console.error('Error in getUserRank command:', error);
|
|
144
|
+
sock.sendMessage(chatId, {
|
|
145
|
+
text: `*${botName}*\nFailed to get user rank.`
|
|
146
|
+
}, { quoted: fakeContact });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function resetMessageCounts(groupId) {
|
|
151
|
+
try {
|
|
152
|
+
resetGroupMsgCounts(groupId);
|
|
153
|
+
return true;
|
|
154
|
+
} catch (error) {
|
|
155
|
+
console.error('Error resetting message counts:', error);
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async function getGroupStats(sock, chatId, isGroup, message) {
|
|
161
|
+
const fakeContact = createFakeContact(message);
|
|
162
|
+
const botName = getBotName();
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
if (!isGroup) {
|
|
166
|
+
sock.sendMessage(chatId, { text: `*${botName}*\nGroup command only.` }, { quoted: fakeContact });
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const groupCounts = getGroupMsgCounts(chatId);
|
|
171
|
+
const totalMessages = getGroupTotalMsgCount(chatId);
|
|
172
|
+
const activeMembers = Object.keys(groupCounts).length;
|
|
173
|
+
const sortedCounts = Object.values(groupCounts).sort((a, b) => b - a);
|
|
174
|
+
const averageMessages = activeMembers > 0 ? Math.round(totalMessages / activeMembers) : 0;
|
|
175
|
+
const medianMessages = sortedCounts.length > 0 ? sortedCounts[Math.floor(sortedCounts.length / 2)] : 0;
|
|
176
|
+
|
|
177
|
+
const textContent = `╭─❖ *GROUP STATS* ❖─╮\n` +
|
|
178
|
+
`│ Active : ${activeMembers}\n` +
|
|
179
|
+
`│ Total : ${totalMessages}\n` +
|
|
180
|
+
`│ Average : ${averageMessages}\n` +
|
|
181
|
+
`│ Median : ${medianMessages}\n` +
|
|
182
|
+
`│ Top user : ${sortedCounts[0] || 0}\n` +
|
|
183
|
+
`╰────────────────────╯`;
|
|
184
|
+
|
|
185
|
+
sock.sendMessage(chatId, { text: textContent }, { quoted: fakeContact });
|
|
186
|
+
|
|
187
|
+
} catch (error) {
|
|
188
|
+
console.error('Error in getGroupStats command:', error);
|
|
189
|
+
sock.sendMessage(chatId, {
|
|
190
|
+
text: `*${botName}*\nFailed to load group stats.`
|
|
191
|
+
}, { quoted: fakeContact });
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
module.exports = {
|
|
196
|
+
incrementMessageCount,
|
|
197
|
+
topMembers,
|
|
198
|
+
getUserRank,
|
|
199
|
+
resetMessageCounts,
|
|
200
|
+
getGroupStats,
|
|
201
|
+
createFakeContact
|
|
202
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const db = require('../../Database/database');
|
|
2
|
+
const { createFakeContact, getBotName } = require('../../davelib/fakeContact');
|
|
3
|
+
|
|
4
|
+
async function unbanCommand(sock, chatId, message) {
|
|
5
|
+
const senderId = message.key.participant || message.key.remoteJid;
|
|
6
|
+
const fake = createFakeContact(senderId);
|
|
7
|
+
const botName = getBotName();
|
|
8
|
+
|
|
9
|
+
if (!message.key.fromMe && !db.isSudo(senderId)) {
|
|
10
|
+
await sock.sendMessage(chatId, {
|
|
11
|
+
text: `*${botName}*\nOwner only command!`
|
|
12
|
+
}, { quoted: fake });
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let userToUnban;
|
|
17
|
+
|
|
18
|
+
if (message.message?.extendedTextMessage?.contextInfo?.mentionedJid?.length > 0) {
|
|
19
|
+
userToUnban = message.message.extendedTextMessage.contextInfo.mentionedJid[0];
|
|
20
|
+
} else if (message.message?.extendedTextMessage?.contextInfo?.participant) {
|
|
21
|
+
userToUnban = message.message.extendedTextMessage.contextInfo.participant;
|
|
22
|
+
} else {
|
|
23
|
+
const text = message.message?.conversation || message.message?.extendedTextMessage?.text || '';
|
|
24
|
+
const args = text.split(' ').slice(1);
|
|
25
|
+
if (args.length > 0) {
|
|
26
|
+
const possibleJid = args[0];
|
|
27
|
+
if (possibleJid.includes('@')) {
|
|
28
|
+
userToUnban = possibleJid;
|
|
29
|
+
} else {
|
|
30
|
+
userToUnban = possibleJid.replace(/[^0-9]/g, '') + '@s.whatsapp.net';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!userToUnban) {
|
|
36
|
+
await sock.sendMessage(chatId, {
|
|
37
|
+
text: `*${botName}*\nMention, reply, or provide number to unban!\n\nExample: .unban @user or .unban 6281234567890`
|
|
38
|
+
}, { quoted: fake });
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
if (db.isBanned(userToUnban)) {
|
|
44
|
+
db.removeBannedUser(userToUnban);
|
|
45
|
+
|
|
46
|
+
await sock.sendMessage(chatId, {
|
|
47
|
+
text: `*${botName}*\n\n@${userToUnban.split('@')[0]} has been unbanned!`,
|
|
48
|
+
mentions: [userToUnban]
|
|
49
|
+
}, { quoted: fake });
|
|
50
|
+
} else {
|
|
51
|
+
await sock.sendMessage(chatId, {
|
|
52
|
+
text: `*${botName}*\n\n@${userToUnban.split('@')[0]} is not banned!`,
|
|
53
|
+
mentions: [userToUnban]
|
|
54
|
+
}, { quoted: fake });
|
|
55
|
+
}
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.error('Error in unban command:', error.message, 'Line:', error.stack?.split('\n')[1]);
|
|
58
|
+
await sock.sendMessage(chatId, {
|
|
59
|
+
text: `*${botName}*\nFailed to unban user!`
|
|
60
|
+
}, { quoted: fake });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = unbanCommand;
|