Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Commit debbfa4

Browse files
authored
Minor updates (#18)
* fix: ig command. * fix: auth fail * Update config.js * hide online presence * update: greetings * fix: userid * add: sticker support for tagall command. * fix * fix(ig): download multiple post * remove: threads command. * build(g-i-s): toxic-devil/g-i-s * fix crash
1 parent ce23b0a commit debbfa4

File tree

9 files changed

+53
-46
lines changed

9 files changed

+53
-46
lines changed

commands/ig.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ module.exports = {
88
if (!text) return await msg.reply({ text: '*Please enter instagram post, or reels url!*' });
99
await instagram(text)
1010
.then(async (result) => {
11-
if (!result) return await msg.reply({ text: '*Invalid url, Please enter a valid instagram post/reels url!*' });
11+
if (!result || result.data.length < 1) return await msg.reply({ text: '*Invalid url, Please enter a valid instagram post/reels url!*' });
1212
for (let data of result.data) {
13-
return await msg.reply({
13+
await msg.reply({
1414
[(data.match(/jpg|png|jpeg/) ? 'image' : 'video')]: {
1515
url: data
1616
}

commands/song.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ module.exports = {
1616
let video = json.result.filter((v) => v.type == 'video')[0].url;
1717
res = video.split('/').slice(-1)[0].replace('watch?v=', '');
1818
} catch (e) {
19-
throw e;
2019
return await msg.reply({ edit: { key: mesaj.key, text: '*Unable to find any song in this lyric!*' } });
2120
}
2221
let file = './' + res + '.mp3'
@@ -32,7 +31,6 @@ module.exports = {
3231
});
3332
audio.on('error', async (e) => {
3433
await msg.reply({ text: '*Unable to download the song!*' });
35-
throw e;
3634
});
3735
}
3836
};

commands/tagall.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ module.exports = {
3333
ptt: msg.replied.audio?.ptt || false,
3434
mentions
3535
});
36+
} else if (msg.replied && msg.replied.sticker) {
37+
let webp = await msg.load(msg.replied.sticker);
38+
return await msg.reply({
39+
sticker: webp,
40+
isAnimated: msg.replied.sticker?.isAnimated || false,
41+
mentions
42+
});
3643
} else if (msg.replied && msg.replied.document) {
3744
let doc = await msg.load(msg.replied.document);
3845
return await msg.reply({

commands/threads.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module.exports = {
55
DEBUG: process.env['DEBUG'] || false,
66
MODE: process.env['MODE'] || 'private',
77
PREFIX: process.env['PREFIX'] || '!',
8+
ONLINE: process.env['ONLINE'] || true,
89
PLATFORM: process.env['PLATFORM'] || 'heroku',
910
RBG_APIKEY: process.env['RBG_APIKEY'] || false,
1011
};

helpers/ig.js

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,45 @@
1-
const axios = require('axios');
2-
const cheerio = require('cheerio');
1+
const CryptoJS = require('crypto-js');
32

43
async function instagram(url) {
54
try {
6-
let response = await axios.post(
7-
'https://v3.saveig.app/api/ajaxSearch', `q=${encodeURIComponent(url)}&t=media&lang=en`, {
8-
headers: {
9-
"Content-Type": "application/x-www-form-urlencoded",
10-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36",
11-
"X-Requested-With": "XMLHttpRequest",
12-
}
13-
}
14-
);
15-
let $ = cheerio.load(response.data.data);
16-
let result = $('.download-items__btn > a').map((_, a) => $(a).attr('href')).get();
17-
5+
let headers = { 'url': encryptUrl(url) };
6+
const response = await fetch('https://backend.instavideosave.com/allinone', {
7+
method: 'GET',
8+
headers,
9+
});
10+
let data = await response.json();
11+
if (!data) return false;
12+
let result = [];
13+
if (data.image) {
14+
data.image.map(image => {
15+
result.push(image);
16+
});
17+
}
18+
else if (data.video) {
19+
data.video.forEach(v => {
20+
if (v.video) result.push(v.video);
21+
});
22+
}
23+
else {
24+
result = false;
25+
}
1826
return { data: result };
1927
} catch (e) {
2028
console.log(e);
2129
return false;
2230
}
2331
};
2432

33+
function encryptUrl(input) {
34+
const key = CryptoJS.enc.Utf8.parse('qwertyuioplkjhgf');
35+
const iv = CryptoJS.lib.WordArray.random(16);
36+
const encrypted = CryptoJS.AES.encrypt(input, key, {
37+
iv: iv,
38+
mode: CryptoJS.mode.ECB,
39+
padding: CryptoJS.pad.Pkcs7,
40+
});
41+
const encryptedHex = encrypted.ciphertext.toString(CryptoJS.enc.Hex);
42+
return encryptedHex;
43+
};
44+
2545
module.exports = { instagram };

index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { Sequelize, DataTypes } = require('sequelize');
44
const { list, uninstall } = require('./helpers/database/commands');
55
const { parseJson } = require('./helpers/utils');
66
const { database } = require('./helpers/database.js');
7-
const { SESSION, ADMINS, MODE, PREFIX, PLATFORM, DEBUG } = require('./config');
7+
const { SESSION, ADMINS, MODE, PREFIX, ONLINE, PLATFORM, DEBUG } = require('./config');
88
const Greetings = require('./helpers/database/greetings');
99
const axios = require('axios');
1010
const pino = require('pino');
@@ -119,14 +119,14 @@ async function Connect() {
119119
if (info.action == 'add') {
120120
let wtext = await Greetings.getMessage('welcome', info.id);
121121
if (wtext !== false) await sock.sendMessage(info.id, {
122-
text: wtext.replace(/{subject}/g, subject).replace(/{version}/g, require('./package.json').version).replace(/{size}/g, size).replace(/{owner}/g, '@'+owner.split('@')[0]),
123-
mentions: [owner]
122+
text: wtext.replace(/{subject}/g, subject).replace(/{version}/g, require('./package.json').version).replace(/{size}/g, size).replace(/{user}/g, '@'+info.participants[0].split('@')[0]).replace(/{owner}/g, '@'+owner.split('@')[0]),
123+
mentions: [owner, ...info.participants]
124124
});
125125
} else if (info.action == 'remove') {
126126
let gtext = await Greetings.getMessage('goodbye', info.id);
127127
if (gtext !== false) await sock.sendMessage(info.id, {
128-
text: gtext.replace(/{subject}/g, subject).replace(/{version}/g, require('./package.json').version).replace(/{size}/g, size).replace(/{owner}/g, '@'+owner.split('@')[0]),
129-
mentions: [owner]
128+
text: gtext.replace(/{subject}/g, subject).replace(/{version}/g, require('./package.json').version).replace(/{size}/g, size).replace(/{user}/g, '@'+info.participants[0].split('@')[0]).replace(/{owner}/g, '@'+owner.split('@')[0]),
129+
mentions: [owner, ...info.participants]
130130
});
131131
}
132132
});
@@ -136,6 +136,7 @@ async function Connect() {
136136
if (!msg.message) return;
137137
msg = await require('./helpers/message')(msg, sock, store);
138138
if (msg.chat === 'status@broadcast') return;
139+
if (ONLINE !== true) await sock.sendPresenceUpdate('unavailable', msg.chat);
139140

140141
try {
141142
if (allCommands(msg.command) || msg.isPrivate) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"colors": "^1.4.0",
2222
"form-data": "^4.0.0",
2323
"fluent-ffmpeg": "^2.1.2",
24-
"g-i-s": "^2.1.7",
24+
"g-i-s": "github:TOXIC-DEVIL/g-i-s",
2525
"google-tts-api": "^2.0.2",
2626
"http": "^0.0.1-security",
2727
"jimp": "^0.16.13",

string_session.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ try {
7676
} catch {}
7777

7878
async function Leon(qr) {
79-
let { version } = await fetchLatestBaileysVersion();
79+
// let { version } = await fetchLatestBaileysVersion();
8080
let { state, saveCreds } = await useMultiFileAuthState('./session/');
8181
let sock = makeWASocket({
8282
logger: pino({ level: 'silent' }),
8383
printQRInTerminal: qr,
8484
markOnlineOnConnect: false,
8585
browser: ['Ubuntu', 'Chrome', '20.0.04'],
8686
auth: state,
87-
version: version,
87+
version: [2, 3000, 1015901307],
8888
getMessage: async (key) => {
8989
let jid = jidNormalizedUser(key.remoteJid);
9090
let msg = await store.loadMessage(jid, key.id);

0 commit comments

Comments
 (0)