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