From 737b5bc658a4e49c0fdf9c2a3e64237305fb58cf Mon Sep 17 00:00:00 2001 From: Silva Tech <163982940+SilvaTechB@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:40:03 +0300 Subject: [PATCH] SILVA MD BOT --- silvaXlab/swsend.js | 30 ++++ silvaXlab/test.js | 23 +++ silvaXlab/textstyle.js | 42 +++++ silvaXlab/tg.js | 20 +++ silvaXlab/tool-dalle.js | 27 ++++ silvaXlab/tool-fetch.js | 33 ++++ silvaXlab/tool-pdf.js | 20 +++ silvaXlab/tool-shorturl.js | 21 +++ silvaXlab/tool-tempmail.js | 64 ++++++++ silvaXlab/tool-whatmusic.js | 36 +++++ silvaXlab/tool-ytcomment.js | 20 +++ silvaXlab/tools-animeinfo.js | 40 +++++ silvaXlab/tools-calc.js | 39 +++++ silvaXlab/tools-carbon.js | 38 +++++ silvaXlab/tools-define.js | 31 ++++ silvaXlab/tools-element.js | 39 +++++ silvaXlab/tools-forward.js | 48 ++++++ silvaXlab/tools-fullpp.js | 67 ++++++++ silvaXlab/tools-getjid.js | 11 ++ silvaXlab/tools-google.js | 79 ++++++++++ silvaXlab/tools-hd.js | 253 +++++++++++++++++++++++++++++++ silvaXlab/tools-itunes.js | 43 ++++++ silvaXlab/tools-lyrics.js | 30 ++++ silvaXlab/tools-movie.js | 57 +++++++ silvaXlab/tools-ndtv.js | 45 ++++++ silvaXlab/tools-ocr.js | 52 +++++++ silvaXlab/tools-pokedex.js | 32 ++++ silvaXlab/tools-randomcourses.js | 36 +++++ silvaXlab/tools-readmore.js | 14 ++ silvaXlab/tools-readviewonce.js | 15 ++ silvaXlab/tools-removebg.js | 49 ++++++ silvaXlab/tools-ssweb.js | 10 ++ silvaXlab/tools-subreddit.js | 45 ++++++ silvaXlab/tools-technews.js | 28 ++++ silvaXlab/tools-tgsticker.js | 56 +++++++ silvaXlab/tools-tourl.js | 48 ++++++ silvaXlab/tools-traceanime.js | 72 +++++++++ silvaXlab/tools-translate.js | 36 +++++ silvaXlab/tools-truecaller.js | 65 ++++++++ silvaXlab/tools-tts.js | 47 ++++++ silvaXlab/tools-wa.js | 24 +++ silvaXlab/tools-weather.js | 23 +++ silvaXlab/tools-wikipedia.js | 25 +++ silvaXlab/ujid.js | 38 +++++ silvaXlab/whatmusic.js | 37 +++++ silvaXlab/xvid.js | 64 ++++++++ silvaXlab/xxdl.js | 45 ++++++ 47 files changed, 2017 insertions(+) create mode 100644 silvaXlab/swsend.js create mode 100644 silvaXlab/test.js create mode 100644 silvaXlab/textstyle.js create mode 100644 silvaXlab/tg.js create mode 100644 silvaXlab/tool-dalle.js create mode 100644 silvaXlab/tool-fetch.js create mode 100644 silvaXlab/tool-pdf.js create mode 100644 silvaXlab/tool-shorturl.js create mode 100644 silvaXlab/tool-tempmail.js create mode 100644 silvaXlab/tool-whatmusic.js create mode 100644 silvaXlab/tool-ytcomment.js create mode 100644 silvaXlab/tools-animeinfo.js create mode 100644 silvaXlab/tools-calc.js create mode 100644 silvaXlab/tools-carbon.js create mode 100644 silvaXlab/tools-define.js create mode 100644 silvaXlab/tools-element.js create mode 100644 silvaXlab/tools-forward.js create mode 100644 silvaXlab/tools-fullpp.js create mode 100644 silvaXlab/tools-getjid.js create mode 100644 silvaXlab/tools-google.js create mode 100644 silvaXlab/tools-hd.js create mode 100644 silvaXlab/tools-itunes.js create mode 100644 silvaXlab/tools-lyrics.js create mode 100644 silvaXlab/tools-movie.js create mode 100644 silvaXlab/tools-ndtv.js create mode 100644 silvaXlab/tools-ocr.js create mode 100644 silvaXlab/tools-pokedex.js create mode 100644 silvaXlab/tools-randomcourses.js create mode 100644 silvaXlab/tools-readmore.js create mode 100644 silvaXlab/tools-readviewonce.js create mode 100644 silvaXlab/tools-removebg.js create mode 100644 silvaXlab/tools-ssweb.js create mode 100644 silvaXlab/tools-subreddit.js create mode 100644 silvaXlab/tools-technews.js create mode 100644 silvaXlab/tools-tgsticker.js create mode 100644 silvaXlab/tools-tourl.js create mode 100644 silvaXlab/tools-traceanime.js create mode 100644 silvaXlab/tools-translate.js create mode 100644 silvaXlab/tools-truecaller.js create mode 100644 silvaXlab/tools-tts.js create mode 100644 silvaXlab/tools-wa.js create mode 100644 silvaXlab/tools-weather.js create mode 100644 silvaXlab/tools-wikipedia.js create mode 100644 silvaXlab/ujid.js create mode 100644 silvaXlab/whatmusic.js create mode 100644 silvaXlab/xvid.js create mode 100644 silvaXlab/xxdl.js diff --git a/silvaXlab/swsend.js b/silvaXlab/swsend.js new file mode 100644 index 0000000..5ec0ff3 --- /dev/null +++ b/silvaXlab/swsend.js @@ -0,0 +1,30 @@ +let handler = async (m, { conn }) => { + // Check if the message is quoting a status broadcast + if (m.quoted?.chat != 'status@broadcast') { + // Do nothing if it's not quoting a status message + return; + } + + try { + // Download the content of the quoted status message + let buffer = await m.quoted.download(); + + // Send the file back to the sender with the quoted message text + await conn.sendFile(m.sender, buffer, '', m.quoted.text || '', null, false, { quoted: m }); + } catch (error) { + // Reply with the quoted text in case of error + m.reply(m.quoted.text || ''); + } +}; + +// Help and tag definitions for the handler +handler.help = ['statussave']; +handler.tags = ['tools']; + +// Regular expression to match custom prefixes +handler.customPrefix = /send(kro|bro|bhai)|bhejo|Send|send(me|bro|share|nitumie)/i; + +// Define the command for the handler (matches all commands) +handler.command = new RegExp; + +export default handler; diff --git a/silvaXlab/test.js b/silvaXlab/test.js new file mode 100644 index 0000000..c514d4e --- /dev/null +++ b/silvaXlab/test.js @@ -0,0 +1,23 @@ +import fs from 'fs' +import fetch from 'node-fetch' +let handler = async (m, { conn, usedPrefix: _p }) => { + let img = 'https://avatars.githubusercontent.com/u/106463398?v=4' + let info = `*π’πˆπ‹π•π€ πŒπƒ ππŽπ“ BOT ACTIVE*` + await conn.reply(m.chat, info, m, { + contextInfo: { + mentionedJid: [m.sender], + forwardingScore: 256, + isForwarded: true, + externalAdReply: { + title: author, + body: botname, + sourceUrl: fgyt, + thumbnail: await conn.getFile(img), + }, + }, + }) +} +handler.customPrefix = /^(tes|tess|test)$/i +handler.command = new RegExp() + +export default handler \ No newline at end of file diff --git a/silvaXlab/textstyle.js b/silvaXlab/textstyle.js new file mode 100644 index 0000000..1bf306b --- /dev/null +++ b/silvaXlab/textstyle.js @@ -0,0 +1,42 @@ +import fetch from 'node-fetch'; +import { JSDOM } from 'jsdom'; + +let handler = async (m, { conn, text }) => { + const inputText = text || "SILVA BOT"; + console.log('Γ°ΕΈβ€œΒ₯ Input text:', inputText); + + const styledText = await stylizeText(inputText); + const entries = Object.entries(styledText); + + let replyText = entries.map(([name, value]) => { + return `*${name}*\n${value}`; + }).join('\n\n'); + + console.log('Γ’Ε“Β¨ Generated styles:'); + console.log(replyText); + + await conn.reply(m.chat, replyText, m); +}; + +handler.help = ['fancy'].map(v => v + ' '); +handler.tags = ['tools']; +handler.command = /^(fancy(text)?)$/i; +handler.exp = 0; + +export default handler; + +async function stylizeText(text) { + const res = await fetch('http://qaz.wtf/u/convert.cgi?text=' + encodeURIComponent(text)); + const html = await res.text(); + const dom = new JSDOM(html); + const table = dom.window.document.querySelector('table').children[0].children; + const obj = {}; + + for (let tr of table) { + let name = tr.querySelector('.aname').innerHTML; + let content = tr.children[1].textContent.replace(/^\n/, '').replace(/\n$/, ''); + obj[name + (obj[name] ? ' Reversed' : '')] = content; + } + + return obj; +} diff --git a/silvaXlab/tg.js b/silvaXlab/tg.js new file mode 100644 index 0000000..e43e028 --- /dev/null +++ b/silvaXlab/tg.js @@ -0,0 +1,20 @@ +let handler = async (m, { conn, text, participants, isAdmin, isOwner, groupMetadata }) => { + let users = participants.map(u => u.id).filter(v => v !== conn.user.jid) + m.reply( + `β–’ Group : *${groupMetadata.subject}*\nβ–’ Members : *${participants.length}*${text ? `\nβ–’ Message : ${text}\n` : ''}\nβ”Œβ”€β”€β”€βŠ· *MENTIONS*\n` + + users.map(v => 'β–’ @' + v.replace(/@.+/, '')).join`\n` + + '\nβ”β”β”β”β”β”β”β”β”β”π’πˆπ‹π•π€ πŒπƒ ππŽπ“β”β”β”β”β”β”β”β”β”β”β”', + null, + { + mentions: users, + } + ) +} + +handler.help = ['tagall'] +handler.tags = ['group'] +handler.command = ['tagall'] +handler.admin = true +handler.group = true + +export default handler diff --git a/silvaXlab/tool-dalle.js b/silvaXlab/tool-dalle.js new file mode 100644 index 0000000..baf2505 --- /dev/null +++ b/silvaXlab/tool-dalle.js @@ -0,0 +1,27 @@ + +import fetch from 'node-fetch'; + +let handler = async (m, { conn, text, usedPrefix, command }) => { + if (!text) throw `*This command generates images from text prompts*\n\n*𝙴xample usage*\n*β—‰ ${usedPrefix + command} Beautiful anime girl*\n*β—‰ ${usedPrefix + command} Elon Musk in pink output*`; + + try { + m.reply(imgs); + + const endpoint = `https://gurugpt.cyclic.app/dalle?prompt=${encodeURIComponent(text)}`; + const response = await fetch(endpoint); + + if (response.ok) { + const imageBuffer = await response.buffer(); + await conn.sendFile(m.chat, imageBuffer, 'image.png', null, m); + } else { + throw '*Image generation failed*'; + } + } catch { + throw '*Oops! Something went wrong while generating images. Please try again later.*'; + } +}; + +handler.help = ['dalle']; +handler.tags = ['AI']; +handler.command = ['dalle', 'gen', 'gimg', 'openai2']; +export default handler; diff --git a/silvaXlab/tool-fetch.js b/silvaXlab/tool-fetch.js new file mode 100644 index 0000000..26fbf33 --- /dev/null +++ b/silvaXlab/tool-fetch.js @@ -0,0 +1,33 @@ + + +import fetch from 'node-fetch' +import { format } from 'util' +let handler = async (m, { text, conn }) => { + if (!text && !(m.quoted && m.quoted.text)) { + if (!/^https?:\/\//.test(text)) throw `✳️ provide a link...` + } + if (!text && m.quoted && m.quoted.text) { + text = m.quoted.text; + } + let _url = new URL(text) + let url = global.API(_url.origin, _url.pathname, Object.fromEntries(_url.searchParams.entries()), 'APIKEY') + let res = await fetch(url) + if (res.headers.get('content-length') > 100 * 1024 * 1024 * 1024) { + // delete res + throw `Content-Length: ${res.headers.get('content-length')}` + } + if (!/text|json/.test(res.headers.get('content-type'))) return conn.sendFile(m.chat, url, 'file', text, m) + let txt = await res.buffer() + try { + txt = format(JSON.parse(txt + '')) + } catch (e) { + txt = txt + '' + } finally { + m.reply(txt.slice(0, 65536) + '') + } +} +handler.help = ['get'] +handler.tags = ['tools'] +handler.command = /^(fetch|get)$/i + +export default handler diff --git a/silvaXlab/tool-pdf.js b/silvaXlab/tool-pdf.js new file mode 100644 index 0000000..dc1dacf --- /dev/null +++ b/silvaXlab/tool-pdf.js @@ -0,0 +1,20 @@ +import uploadImage from '../lib/uploadImage.js' +let handler = async (m, { conn, text, usedPrefix, command, isOwner }) => { + let q = m.quoted ? m.quoted : m + let mime = (q.msg || q).mimetype || '' + if (!mime) throw '*Respond / reply to an image*' + let img = await q.download?.() + let url = await uploadImage(img) + let docname = text ? text : m.pushName || 'Gurubot' + conn.sendFile( + m.chat, + `http://api.lolhuman.xyz/api/convert/imgtopdf?apikey=${lolkeysapi}&img=${url}`, + docname + '.pdf', + '', + m, + false, + { asDocument: true } + ) +} +handler.command = /^topdf$/i +export default handler diff --git a/silvaXlab/tool-shorturl.js b/silvaXlab/tool-shorturl.js new file mode 100644 index 0000000..8cf7e44 --- /dev/null +++ b/silvaXlab/tool-shorturl.js @@ -0,0 +1,21 @@ +import fetch from 'node-fetch' + +let handler = async (m, { conn, args, text }) => { + if (!text) throw '*Please provide a URL or link to shorten.*' + + let shortUrl1 = await (await fetch(`https://tinyurl.com/api-create.php?url=${args[0]}`)).text() + + if (!shortUrl1) throw `*Error: Could not generate a short URL.*` + + let done = + `*π’πˆπ‹π•π€ πŒπƒ ππŽπ“*\n\n*SHORT URL CREATED!!*\n\n*Original Link:*\n${text}\n*Shortened URL:*\n${shortUrl1}`.trim() + + m.reply(done) +} + +handler.help = ['tinyurl', 'shorten'].map(v => v + ' ') +handler.tags = ['tools'] +handler.command = /^(tinyurl|short|acortar|corto)$/i +handler.fail = null + +export default handler \ No newline at end of file diff --git a/silvaXlab/tool-tempmail.js b/silvaXlab/tool-tempmail.js new file mode 100644 index 0000000..9d5b4d0 --- /dev/null +++ b/silvaXlab/tool-tempmail.js @@ -0,0 +1,64 @@ +import { TempMail } from 'tempmail.lol'; + +const tempmail = new TempMail(); + +let handler = async (m, { text, usedPrefix, command }) => { + if (command === 'tempmail') { + try { + const inbox = await tempmail.createInbox(); + const emailMessage = `*Temporary Email Address:*\n\n${inbox.address}\n\nA token for checking this inbox will be sent in the next message. Use it with the .checkmail command.`; + await m.reply(emailMessage); + + // Send the token as a separate, individual message + await m.reply(inbox.token); + + // Send instructions as a third message + await m.reply('Long press and copy the token above to use with the .checkmail command.'); + + } catch (error) { + console.error('Error:', error); + m.reply('Failed to create a temporary email address.'); + } + } else if (command === 'checkmail') { + if (!text) { + m.reply('Please provide the token of the temporary email you want to check.'); + return; + } + + try { + const emails = await tempmail.checkInbox(text); + if (!emails) { + m.reply(`No messages found or the inbox has expired.`); + return; + } + + if (emails.length === 0) { + m.reply(`No messages found in the inbox.`); + return; + } + + const messages = emails.map(email => { + return ` +*From:* ${email.from} +*Subject:* ${email.subject} +*Date:* ${new Date(email.date).toLocaleString()} +*Body:* +${email.body} + `; + }).join('\n\n---\n\n'); + + const replyMessage = `*Messages in inbox:*\n\n${messages}`; + m.reply(replyMessage); + } catch (error) { + console.error('Error:', error); + m.reply(`Failed to check messages.`); + } + } +}; + +handler.help = ['tempmail', 'checkmail ']; +handler.tags = ['tools']; +handler.command = ['tempmail', 'checkmail']; +handler.diamond = false; + +export default handler; \ No newline at end of file diff --git a/silvaXlab/tool-whatmusic.js b/silvaXlab/tool-whatmusic.js new file mode 100644 index 0000000..01bfe06 --- /dev/null +++ b/silvaXlab/tool-whatmusic.js @@ -0,0 +1,36 @@ +import fs from 'fs' +import acrcloud from 'acrcloud' +let acr = new acrcloud({ + host: 'identify-eu-west-1.acrcloud.com', + access_key: 'c33c767d683f78bd17d4bd4991955d81', + access_secret: 'bvgaIAEtADBTbLwiPGYlxupWqkNGIjT7J9Ag2vIu', +}) + +let handler = async m => { + let q = m.quoted ? m.quoted : m + let mime = (q.msg || q).mimetype || '' + if (/audio|video/.test(mime)) { + let media = await q.download() + let ext = mime.split('/')[1] + fs.writeFileSync(`./tmp/${m.sender}.${ext}`, media) + let res = await acr.identify(fs.readFileSync(`./tmp/${m.sender}.${ext}`)) + let { code, msg } = res.status + if (code !== 0) throw msg + let { title, artists, album, genres, release_date } = res.metadata.music[0] + let txt = ` +πšπ™΄πš‚πš„π™»πšƒ π’πˆπ‹π•π€ πŒπƒ ππŽπ“ +β€’ πŸ“Œ *TITLE*: ${title} +β€’ πŸ‘¨β€πŸŽ€ π™°πšπšƒπ™Έπš‚πšƒ: ${artists !== undefined ? artists.map(v => v.name).join(', ') : 'NOT FOUND'} +β€’ πŸ’Ύ π™°π™»π™±πš„π™Ό: ${album.name || 'NOT FOUND'} +β€’ 🌐 π™Άπ™΄π™½π™΄πš: ${genres !== undefined ? genres.map(v => v.name).join(', ') : 'NOT FOUND'} +β€’ πŸ“† RELEASE DATE: ${release_date || 'NOT FOUND'} +`.trim() + fs.unlinkSync(`./tmp/${m.sender}.${ext}`) + m.reply(txt) + } else throw '*πšπ™΄πš‚π™Ώπ™Ύπ™½π™³ π™°πš„π™³π™Έπ™Ύ*' +} + +handler.help = ['shazam'] +handler.tags = ['tools'] +handler.command = /^quemusica|shazam|whatmusic$/i +export default handler diff --git a/silvaXlab/tool-ytcomment.js b/silvaXlab/tool-ytcomment.js new file mode 100644 index 0000000..79b5137 --- /dev/null +++ b/silvaXlab/tool-ytcomment.js @@ -0,0 +1,20 @@ +let handler = async (m, { conn, text }) => { + if (!text) throw 'No Text' + conn.sendFile( + m.chat, + global.API('https://some-random-api.com', '/canvas/misc/youtube-comment', { + avatar: await conn + .profilePictureUrl(m.sender, 'image') + .catch(_ => 'https://telegra.ph/file/24fa902ead26340f3df2c.png'), + comment: text, + username: conn.getName(m.sender), + }), + 'error.png', + '*THANKS FOR COMMENT*', + m + ) +} +handler.help = ['ytcomment '] +handler.tags = ['maker'] +handler.command = /^(ytcomment)$/i +export default handler diff --git a/silvaXlab/tools-animeinfo.js b/silvaXlab/tools-animeinfo.js new file mode 100644 index 0000000..830ad98 --- /dev/null +++ b/silvaXlab/tools-animeinfo.js @@ -0,0 +1,40 @@ +import { translate } from '@vitalets/google-translate-api' +import { Anime } from '@shineiichijo/marika' + +const client = new Anime() + +let handler = async (m, { conn, text, usedPrefix }) => { + if (!text) return m.reply(`*[❗] Please enter the name of an anime to search for.*`) + try { + let anime = await client.searchAnime(text) + let result = anime.data[0] + let resultes = await translate(`${result.background}`, { to: 'en', autoCorrect: true }) + let resultes2 = await translate(`${result.synopsis}`, { to: 'hi', autoCorrect: true }) + let AnimeInfo = ` π’πˆπ‹π•π€ πŒπƒ ππŽπ“ +πŸŽ€ β€’ *Title:* ${result.title} +πŸŽ‹ β€’ *Format:* ${result.type} +πŸ“ˆ β€’ *Status:* ${result.status.toUpperCase().replace(/\_/g, ' ')} +πŸ₯ β€’ *Total Episodes:* ${result.episodes} +🎈 β€’ *Duration: ${result.duration}* +✨ β€’ *Based on:* ${result.source.toUpperCase()} +πŸ’« β€’ *Released:* ${result.aired.from} +πŸŽ— β€’ *Finished:* ${result.aired.to} +🎐 β€’ *Popularity:* ${result.popularity} +🎏 β€’ *Favorites:* ${result.favorites} +πŸŽ‡ β€’ *Rating:* ${result.rating} +πŸ… β€’ *Rank:* ${result.rank} +♦ β€’ *Trailer:* ${result.trailer.url} +🌐 β€’ *URL:* ${result.url} +πŸŽ† β€’ *Background:* ${resultes.text} +❄ β€’ *Synopsis:* ${resultes2.text}` + + conn.sendFile(m.chat, result.images.jpg.image_url, 'error.jpg', AnimeInfo, m) + } catch { + throw `*[❗] ERROR, please try again.*` + } +} + +handler.help = ['anime'] +handler.tags = ['anime'] +handler.command = /^(anime|animeinfo)$/i +export default handler diff --git a/silvaXlab/tools-calc.js b/silvaXlab/tools-calc.js new file mode 100644 index 0000000..8866868 --- /dev/null +++ b/silvaXlab/tools-calc.js @@ -0,0 +1,39 @@ +let handler = async (m, { conn, text }) => { + let id = m.chat + conn.math = conn.math ? conn.math : {} + if (id in conn.math) { + clearTimeout(conn.math[id][3]) + delete conn.math[id] + m.reply('.... ') + } + let val = text + .replace(/[^0-9\-\/+*Γ—Γ·Ο€Ee()piPI/]/g, '') + .replace(/Γ—/g, '*') + .replace(/Γ·/g, '/') + .replace(/Ο€|pi/gi, 'Math.PI') + .replace(/e/gi, 'Math.E') + .replace(/\/+/g, '/') + .replace(/\++/g, '+') + .replace(/-+/g, '-') + let format = val + .replace(/Math\.PI/g, 'Ο€') + .replace(/Math\.E/g, 'e') + .replace(/\//g, 'Γ·') + .replace(/\*Γ—/g, 'Γ—') + try { + console.log(val) + let result = new Function('return ' + val)() + if (!result) throw result + m.reply(`*${format}* = _${result}_`) + } catch (e) { + if (e == undefined) + throw '✳️ enter the equation\n\ncompatible symbols -, +, *, /, Γ—, Γ·, Ο€, e, (, )' + throw 'Incorrect format, only 0-9 and symbol -, +, *, /, Γ—, Γ·, Ο€, e, (, ) what can you use' + } +} +handler.help = ['cal '] +handler.tags = ['tools'] +handler.command = ['cal', 'calc', 'calcular', 'calculadora'] +handler.exp = 5 + +export default handler diff --git a/silvaXlab/tools-carbon.js b/silvaXlab/tools-carbon.js new file mode 100644 index 0000000..6d4eed4 --- /dev/null +++ b/silvaXlab/tools-carbon.js @@ -0,0 +1,38 @@ +import fetch from 'node-fetch' + +let handler = async (m, { conn, args }) => { + if (!args[0]) { + return conn.reply(m.chat, 'Please provide some text to generate the code image.', m) + } + + let codeText = args.join(' ') + + try { + let response = await fetch('https://carbonara.solopov.dev/api/cook', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + code: codeText, + backgroundColor: '#1F816D', + }), + }) + + if (!response.ok) { + throw new Error('Failed to generate the code image.') + } + + let imageBuffer = await response.buffer() + conn.sendFile(m.chat, imageBuffer, 'code.png', 'Here is the code image:', m) + } catch (error) { + console.error(error) + conn.reply(m.chat, 'An error occurred while generating the code image.', m) + } +} + +handler.help = ['.carbon '] +handler.tags = ['tools'] +handler.command = /^carbon$/i + +export default handler diff --git a/silvaXlab/tools-define.js b/silvaXlab/tools-define.js new file mode 100644 index 0000000..ebc9437 --- /dev/null +++ b/silvaXlab/tools-define.js @@ -0,0 +1,31 @@ +import fetch from 'node-fetch' + +let handler = async (m, { conn, text }) => { + if (!text) throw 'Please provide a word to search for.' + + const url = `https://api.urbandictionary.com/v0/define?term=${encodeURIComponent(text)}` + + const response = await fetch(url) + const json = await response.json() + + if (!response.ok) { + throw `An error occurred: ${json.message}` + } + + if (!json.list.length) { + throw 'Word not found in the dictionary.' + } + + const firstEntry = json.list[0] + const definition = firstEntry.definition + const example = firstEntry.example ? `*Example:* ${firstEntry.example}` : '' + + const message = `*Word:* ${text}\n*Definition:* ${definition}\n${example}` + conn.sendMessage(m.chat, { text: message }, 'extendedTextMessage', { quoted: m }) +} + +handler.help = ['define '] +handler.tags = ['tools'] +handler.command = /^define/i + +export default handler diff --git a/silvaXlab/tools-element.js b/silvaXlab/tools-element.js new file mode 100644 index 0000000..82727cb --- /dev/null +++ b/silvaXlab/tools-element.js @@ -0,0 +1,39 @@ +import fetch from 'node-fetch' + +let elementHandler = async (m, { conn, text }) => { + if (!text) throw 'Please provide an element symbol or name' + + try { + let res = await fetch(`https://api.popcat.xyz/periodic-table?element=${text}`) + + if (!res.ok) { + throw new Error(`API request failed with status ${res.status}`) + } + + let buffer = await res.arrayBuffer() + let json = JSON.parse(Buffer.from(buffer).toString()) + + console.log('JSON response:', json) + + let elementInfo = `*Element Information:*\n + β€’ *Name:* ${json.name}\n + β€’ *Symbol:* ${json.symbol}\n + β€’ *Atomic Number:* ${json.atomic_number}\n + β€’ *Atomic Mass:* ${json.atomic_mass}\n + β€’ *Period:* ${json.period}\n + β€’ *Phase:* ${json.phase}\n + β€’ *Discovered By:* ${json.discovered_by}\n + β€’ *Summary:* ${json.summary}` + + conn.sendFile(m.chat, json.image, 'element.jpg', elementInfo, m) + } catch (error) { + console.error(error) + // Handle the error appropriately + } +} + +elementHandler.help = ['element'] +elementHandler.tags = ['tools'] +elementHandler.command = /^(element|ele)$/i + +export default elementHandler diff --git a/silvaXlab/tools-forward.js b/silvaXlab/tools-forward.js new file mode 100644 index 0000000..b716e2c --- /dev/null +++ b/silvaXlab/tools-forward.js @@ -0,0 +1,48 @@ +let handler = async (message, { conn, text, usedPrefix, command, args }) => { + // Check if there are arguments + if (!args.length) { + throw `Usage: ${usedPrefix + command} [text]`; + } + + // Split the arguments into JIDs and message parts + let [targetJids, ...messageParts] = args; + const messageText = messageParts.join(" ").trim(); + + // Check if the target JIDs are provided + if (!targetJids) { + throw `Please specify at least one target JID: ${usedPrefix + command} `; + } + + // Prepare the list of target JIDs + let targetJidArray = targetJids.split(",").map(jid => + jid.includes("@") ? jid : jid + "@s.whatsapp.net" + ); + + // Limit to a maximum of 5000 targets + if (targetJidArray.length > 5000) { + throw "You can only send messages to a maximum of 5000 targets at once."; + } + + // Ensure there is a quoted message + if (!message.quoted) { + throw `You must tag a message to send. Usage: ${usedPrefix + command} [text]`; + } + + // Send the tagged (quoted) message to each JID individually + for (let target of targetJidArray) { + try { + // Forward the quoted message directly to each target without any forwarding indication + await conn.sendMessage(target, { text: messageText }, { quoted: message.quoted }); + } catch (error) { + // Notify the user if there is an issue sending to any JID + await message.reply(`Failed to send message to ${target}: ${error.message}`); + } + } +}; + +// Command metadata +handler.help = ["sendtagged []"]; +handler.tags = ["tools"]; +handler.command = /^(sendtagged)$/i; + +export default handler; diff --git a/silvaXlab/tools-fullpp.js b/silvaXlab/tools-fullpp.js new file mode 100644 index 0000000..6268675 --- /dev/null +++ b/silvaXlab/tools-fullpp.js @@ -0,0 +1,67 @@ +import fs from 'fs'; +import { createRequire } from 'module'; +const require = createRequire(import.meta.url); +const Jimp = require("jimp"); // Using Jimp for image processing + +let handler = async (m, { text, conn, command, usedPrefix }) => { + let message = m.quoted ? m.quoted : m; + let mimeType = (message.msg ? message.msg : message).mimetype ? message.mimetype : message.mediaType || ''; + + if (/image/g.test(mimeType) && !/webp/g.test(mimeType)) { + try { + let downloadedImage = await message.download(); + let botJid = await conn.user.jid; + + // Processing the image using the 'pepe' function + let { img } = await processImage(downloadedImage); + + // Sending the image to the bot's profile + await conn.query({ + tag: 'iq', + attrs: { + to: botJid, + type: 'set', + xmlns: "w:profile:picture" + }, + content: [{ + tag: "picture", + attrs: { + type: "image" + }, + content: img + }] + }); + + m.reply("SilvaBot has successfully updated your profile picture."); + } catch (error) { + console.error(error); + m.reply("An error occurred while processing the image. Please try again later."); + } + } else { + m.reply(`Send an image with the caption "${usedPrefix + command}" or tag an image that has already been sent.`); + } +}; + +handler.help = ['setppbotfull']; +handler.tags = ["owner"]; +handler.command = /^(fullpp)$/i; +handler.owner = true; + +export default handler; + +// Image processing function using Jimp +async function processImage(imageBuffer) { + try { + const image = await Jimp.read(imageBuffer); + const width = image.getWidth(); + const height = image.getHeight(); + + // Cropping and resizing the image + const croppedImage = image.crop(0, 0, width, height); + const img = await croppedImage.scaleToFit(720, 720).getBufferAsync(Jimp.MIME_JPEG); // Resize to 720x720 for profile picture + + return { img }; + } catch (error) { + throw new Error("Failed to process the image."); + } +} diff --git a/silvaXlab/tools-getjid.js b/silvaXlab/tools-getjid.js new file mode 100644 index 0000000..877e551 --- /dev/null +++ b/silvaXlab/tools-getjid.js @@ -0,0 +1,11 @@ +let handler = async (m, { conn, args, usedPrefix, command }) => { + + + if (!m.quoted) return m.reply('Reply chat') + m.reply(m.chat) +} + +handler.help = ['getjid'] +handler.tags = ['tools'] +handler.command = ['getjid'] +export default handler diff --git a/silvaXlab/tools-google.js b/silvaXlab/tools-google.js new file mode 100644 index 0000000..f591e11 --- /dev/null +++ b/silvaXlab/tools-google.js @@ -0,0 +1,79 @@ +import fetch from 'node-fetch' +import googleIt from 'google-it' + +const handler = async (m, { conn, command, text, args, usedPrefix }) => { + if (!text) throw `give a text to search Example: *${usedPrefix + command}* Guru bot` + conn.gogleit = conn.gogleit ? conn.gogleit : {} + await conn.reply(m.chat, wait, m) + const result = await googleresult(text) + const infoText = `✦ β”€β”€γ€Ž *GOOGLE SEARCH* 』── ⚝ \n\n [ ⭐ Reply the number of the desired search result to get the screenshot of the website]. \n\n` + const orderedLinks = result.allLinks.map((linkk, index) => { + const sectionNumber = index + 1 + const { title, link } = linkk + return `*${sectionNumber}.* ${title}` + }) + + const orderedLinksText = orderedLinks.join('\n\n') + const fullText = `${infoText}\n\n${orderedLinksText}` + const { key } = await conn.reply(m.chat, fullText, m) + conn.gogleit[m.sender] = { + result, + key, + timeout: setTimeout(() => { + conn.sendMessage(m.chat, { + delete: key, + }) + delete conn.gogleit[m.sender] + }, 150 * 1000), + } +} + +handler.before = async (m, { conn }) => { + conn.gogleit = conn.gogleit ? conn.gogleit : {} + if (m.isBaileys || !(m.sender in conn.gogleit)) return + const { result, key, timeout } = conn.gogleit[m.sender] + console.log(conn.gogleit) + if (!m.quoted || m.quoted.id !== key.id || !m.text) return + const choice = m.text.trim() + const inputNumber = Number(choice) + if (inputNumber >= 1 && inputNumber <= result.allLinks.length) { + const selectedUrl = result.allLinks[inputNumber - 1].url + console.log('selectedUrl', selectedUrl) + + const response = await ( + await fetch( + `https://api.apiflash.com/v1/urltoimage?access_key=7eea5c14db5041ecb528f68062a7ab5d&wait_until=page_loaded&url=${selectedUrl}` + ) + ).buffer() + + await conn.sendFile(m.chat, response, 'google.jpg', 'Tada! Here is your result', m) + } else { + m.reply( + 'Invalid sequence number. Please select the appropriate number from the list above.\nBetween 1 to ' + + result.allLinks.length + ) + } +} + +handler.help = ['play'] +handler.tags = ['downloader'] +handler.command = /^(google)$/i +handler.limit = true +export default handler + +async function googleresult(query) { + try { + const res = await googleIt({ query }) + + if (!res.length) return 'Sorry, no video results were found for this search.' + + const allLinks = res.map(video => ({ + title: video.title, + url: video.link, + })) + + return { allLinks } + } catch (error) { + return 'Error: ' + error.message + } +} diff --git a/silvaXlab/tools-hd.js b/silvaXlab/tools-hd.js new file mode 100644 index 0000000..0e9fcc7 --- /dev/null +++ b/silvaXlab/tools-hd.js @@ -0,0 +1,253 @@ +const _0x17c9ba = _0x5be8 +;(function (_0x4fe383, _0x4c5611) { + const _0x2a391b = _0x5be8, + _0x416ecb = _0x4fe383() + while (!![]) { + try { + const _0x2bad52 = + -parseInt(_0x2a391b(0x130)) / 0x1 + + parseInt(_0x2a391b(0x127)) / 0x2 + + parseInt(_0x2a391b(0x13a)) / 0x3 + + -parseInt(_0x2a391b(0x151)) / 0x4 + + (-parseInt(_0x2a391b(0x14a)) / 0x5) * (parseInt(_0x2a391b(0x148)) / 0x6) + + -parseInt(_0x2a391b(0x153)) / 0x7 + + parseInt(_0x2a391b(0x13e)) / 0x8 + if (_0x2bad52 === _0x4c5611) break + else _0x416ecb['push'](_0x416ecb['shift']()) + } catch (_0x215faf) { + _0x416ecb['push'](_0x416ecb['shift']()) + } + } +})(_0x567c, 0x80bd9) +import _0x27d1c3 from 'form-data' +import _0x49e333 from 'jimp' +async function processing(_0x32082e, _0x511952) { + return new Promise((_0x39cf21, _0x47ecc8) => { + const _0x3a8c30 = _0x5be8 + let _0x345014 = [_0x3a8c30(0x131), 'recolor', 'dehaze'] + _0x511952 = _0x345014[_0x3a8c30(0x154)](_0x511952) ? _0x511952 : _0x345014[0x0] + let _0x59d08d, + _0x4ba4d6 = new _0x27d1c3(), + _0x22eb48 = _0x3a8c30(0x141) + _0x3a8c30(0x135) + _0x3a8c30(0x158) + _0x511952 + _0x4ba4d6[_0x3a8c30(0x132)]('model_version', 0x1, { + 'Content-Transfer-Encoding': _0x3a8c30(0x12b), + contentType: 'multipart/form-data;\x20charset=utf-8', + }), + _0x4ba4d6[_0x3a8c30(0x132)](_0x3a8c30(0x14b), Buffer[_0x3a8c30(0x124)](_0x32082e), { + filename: 'enhance_image_body.jpg', + contentType: _0x3a8c30(0x12c), + }), + _0x4ba4d6[_0x3a8c30(0x150)]( + { + url: _0x22eb48, + host: _0x3a8c30(0x14c), + path: '/' + _0x511952, + protocol: _0x3a8c30(0x159), + headers: { + 'User-Agent': _0x3a8c30(0x143), + Connection: _0x3a8c30(0x134), + 'Accept-Encoding': _0x3a8c30(0x14f), + }, + }, + function (_0x2632f2, _0xf0ef98) { + const _0x4f6c5e = _0x3a8c30 + if (_0x2632f2) _0x47ecc8() + let _0x381efd = [] + _0xf0ef98['on']('data', function (_0x591a60) { + const _0x70c73f = _0x5be8 + _0x381efd[_0x70c73f(0x126)](_0x591a60) + })['on'](_0x4f6c5e(0x13d), () => { + const _0x4b8570 = _0x4f6c5e + _0x39cf21(Buffer[_0x4b8570(0x144)](_0x381efd)) + }), + _0xf0ef98['on'](_0x4f6c5e(0x13b), _0x2a4896 => { + _0x47ecc8() + }) + } + ) + }) +} +function _0x567c() { + const _0x49f3e2 = [ + '45773hDfFtn', + 'includes', + 'colorizer', + 'download', + 'unblur', + '.vyro.ai/', + 'https:', + '\x20is\x20not\x20supported', + 'reply', + 'from', + 'It\x27s\x20done,\x20bro\x20>//<', + 'push', + '1919068UfcFLK', + 'enhancer', + 'chat', + 'help', + 'binary', + 'image/jpeg', + 'command', + 'test', + 'Processing,\x20sis...', + '449551ZqhHwE', + 'enhance', + 'append', + 'sendFile', + 'Keep-Alive', + 'inferenceengine', + 'quoted', + 'colorize', + 'Where\x27s\x20the\x20photo,?', + 'sender', + '101940EIuXUR', + 'error', + 'Mime\x20', + 'end', + '13191632VPVXkg', + 'tags', + 'Processing,\x20image...', + 'https://', + 'premium', + 'okhttp/4.9.3', + 'concat', + 'mimetype', + 'recolor', + 'dehaze', + '266946AzWvvr', + 'hdr', + '100ubbwBm', + 'image', + 'inferenceengine.vyro.ai', + 'Where\x27s\x20the\x20photo,\x20sis?', + 'msg', + 'gzip', + 'submit', + '3076948wBmnCL', + 'There\x27s\x20an\x20ongoing\x20process.\x20Please\x20wait\x20until\x20it\x20finishes\x20>//<', + ] + _0x567c = function () { + return _0x49f3e2 + } + return _0x567c() +} +let handler = async (_0x4a87d3, { conn: _0x292817, usedPrefix: _0x112249, command: _0x4291f5 }) => { + const _0x53c1c3 = _0x5be8 + switch (_0x4291f5) { + case _0x53c1c3(0x128): + case _0x53c1c3(0x157): + case 'enhance': + { + _0x292817[_0x53c1c3(0x128)] = _0x292817[_0x53c1c3(0x128)] ? _0x292817['enhancer'] : {} + if (_0x4a87d3[_0x53c1c3(0x139)] in _0x292817[_0x53c1c3(0x128)]) + throw 'There\x27s\x20an\x20ongoing\x20process.\x20Please\x20wait\x20until\x20it\x20finishes\x20>//<' + let _0x2262f4 = _0x4a87d3['quoted'] ? _0x4a87d3[_0x53c1c3(0x136)] : _0x4a87d3, + _0xc3c698 = (_0x2262f4[_0x53c1c3(0x14e)] || _0x2262f4)[_0x53c1c3(0x145)] || '' + if (!_0xc3c698) throw _0x53c1c3(0x14d) + if (!/image\/(jpe?g|png)/[_0x53c1c3(0x12e)](_0xc3c698)) throw _0xc3c698 + _0x53c1c3(0x122) + else _0x292817[_0x53c1c3(0x128)][_0x4a87d3['sender']] = !![] + _0x4a87d3[_0x53c1c3(0x123)](_0x53c1c3(0x12f)) + let _0x29bb6b = await _0x2262f4[_0x53c1c3(0x156)](), + _0x39033c + try { + const _0x2017d4 = await processing(_0x29bb6b, _0x53c1c3(0x131)) + _0x292817[_0x53c1c3(0x133)]( + _0x4a87d3[_0x53c1c3(0x129)], + _0x2017d4, + '', + _0x53c1c3(0x125), + _0x4a87d3 + ) + } catch (_0x4d1cdd) { + _0x39033c = !![] + } finally { + _0x39033c && _0x4a87d3[_0x53c1c3(0x123)]('Process\x20failed\x20:('), + delete _0x292817['enhancer'][_0x4a87d3['sender']] + } + } + break + case _0x53c1c3(0x137): + case 'colorizer': + { + _0x292817[_0x53c1c3(0x146)] = _0x292817[_0x53c1c3(0x146)] ? _0x292817[_0x53c1c3(0x146)] : {} + if (_0x4a87d3['sender'] in _0x292817[_0x53c1c3(0x146)]) throw _0x53c1c3(0x152) + let _0x4ca928 = _0x4a87d3[_0x53c1c3(0x136)] ? _0x4a87d3[_0x53c1c3(0x136)] : _0x4a87d3, + _0xa6aa98 = (_0x4ca928['msg'] || _0x4ca928)['mimetype'] || '' + if (!_0xa6aa98) throw _0x53c1c3(0x14d) + if (!/image\/(jpe?g|png)/[_0x53c1c3(0x12e)](_0xa6aa98)) + throw _0x53c1c3(0x13c) + _0xa6aa98 + _0x53c1c3(0x122) + else _0x292817[_0x53c1c3(0x146)][_0x4a87d3[_0x53c1c3(0x139)]] = !![] + _0x4a87d3['reply'](_0x53c1c3(0x12f)) + let _0x4a8555 = await _0x4ca928['download'](), + _0x5bec7d + try { + const _0x583aa7 = await processing(_0x4a8555, _0x53c1c3(0x146)) + _0x292817[_0x53c1c3(0x133)](_0x4a87d3['chat'], _0x583aa7, '', _0x53c1c3(0x125), _0x4a87d3) + } catch (_0x4ab18e) { + _0x5bec7d = !![] + } finally { + _0x5bec7d && _0x4a87d3[_0x53c1c3(0x123)]('Process\x20failed\x20:('), + delete _0x292817['recolor'][_0x4a87d3[_0x53c1c3(0x139)]] + } + } + break + case 'hd': + case _0x53c1c3(0x149): + { + _0x292817[_0x53c1c3(0x149)] = _0x292817[_0x53c1c3(0x149)] ? _0x292817['hdr'] : {} + if (_0x4a87d3[_0x53c1c3(0x139)] in _0x292817['hdr']) throw _0x53c1c3(0x152) + let _0x4ab7af = _0x4a87d3[_0x53c1c3(0x136)] ? _0x4a87d3[_0x53c1c3(0x136)] : _0x4a87d3, + _0x44e352 = (_0x4ab7af['msg'] || _0x4ab7af)[_0x53c1c3(0x145)] || '' + if (!_0x44e352) throw _0x53c1c3(0x138) + if (!/image\/(jpe?g|png)/[_0x53c1c3(0x12e)](_0x44e352)) + throw _0x53c1c3(0x13c) + _0x44e352 + _0x53c1c3(0x122) + else _0x292817['hdr'][_0x4a87d3[_0x53c1c3(0x139)]] = !![] + _0x4a87d3['reply'](_0x53c1c3(0x140)) + let _0x219970 = await _0x4ab7af[_0x53c1c3(0x156)](), + _0x44eecd + try { + const _0x550f70 = await processing(_0x219970, _0x53c1c3(0x147)) + _0x292817[_0x53c1c3(0x133)]( + _0x4a87d3[_0x53c1c3(0x129)], + _0x550f70, + '', + _0x53c1c3(0x125), + _0x4a87d3 + ) + } catch (_0x5b17f9) { + _0x44eecd = !![] + } finally { + _0x44eecd && _0x4a87d3[_0x53c1c3(0x123)]('Process\x20failed\x20:('), + delete _0x292817[_0x53c1c3(0x149)][_0x4a87d3[_0x53c1c3(0x139)]] + } + } + break + } +} +function _0x5be8(_0x44d910, _0x33f6d3) { + const _0x567ca3 = _0x567c() + return ( + (_0x5be8 = function (_0x5be84a, _0x2e0d42) { + _0x5be84a = _0x5be84a - 0x122 + let _0x219928 = _0x567ca3[_0x5be84a] + return _0x219928 + }), + _0x5be8(_0x44d910, _0x33f6d3) + ) +} +;(handler[_0x17c9ba(0x12a)] = [ + 'hd', + 'hdr', + 'unblur', + 'colorize', + _0x17c9ba(0x155), + _0x17c9ba(0x131), + 'enhancer', + _0x17c9ba(0x147), + _0x17c9ba(0x146), + _0x17c9ba(0x131), +]), + (handler[_0x17c9ba(0x13f)] = ['ai']), + (handler[_0x17c9ba(0x142)] = !![]), + (handler[_0x17c9ba(0x12d)] = ['hd']) +export default handler diff --git a/silvaXlab/tools-itunes.js b/silvaXlab/tools-itunes.js new file mode 100644 index 0000000..9c29201 --- /dev/null +++ b/silvaXlab/tools-itunes.js @@ -0,0 +1,43 @@ +import fetch from 'node-fetch' + +let itunesHandler = async (m, { conn, text }) => { + if (!text) throw 'Please provide a song name' + + try { + let res = await fetch(`https://api.popcat.xyz/itunes?q=${encodeURIComponent(text)}`) + + if (!res.ok) { + throw new Error(`API request failed with status ${res.status}`) + } + + let json = await res.json() + + console.log('JSON response:', json) + + let songInfo = `*π’πˆπ‹π•π€ πŒπƒ ππŽπ“ Song Information:*\n + β€’ *Name:* ${json.name}\n + β€’ *Artist:* ${json.artist}\n + β€’ *Album:* ${json.album}\n + β€’ *Release Date:* ${json.release_date}\n + β€’ *Price:* ${json.price}\n + β€’ *Length:* ${json.length}\n + β€’ *Genre:* ${json.genre}\n + β€’ *URL:* ${json.url}` + + // Check if thumbnail is present, then send it with songInfo as caption + if (json.thumbnail) { + await conn.sendFile(m.chat, json.thumbnail, 'thumbnail.jpg', songInfo, m) + } else { + m.reply(songInfo) + } + } catch (error) { + console.error(error) + // Handle the error appropriately + } +} + +itunesHandler.help = ['itunes'] +itunesHandler.tags = ['tools'] +itunesHandler.command = /^(itunes)$/i + +export default itunesHandler diff --git a/silvaXlab/tools-lyrics.js b/silvaXlab/tools-lyrics.js new file mode 100644 index 0000000..70f7376 --- /dev/null +++ b/silvaXlab/tools-lyrics.js @@ -0,0 +1,30 @@ +import fetch from 'node-fetch' + +let handler = async (m, { conn, text }) => { + let teks = text ? text : m.quoted && m.quoted.text ? m.quoted.text : '' + if (!teks) throw `✳️ Enter the name of the song` + try { + let res = await fetch(global.API('https://some-random-api.com', '/lyrics', { title: teks })) + if (!res.ok) throw await res.text() + let json = await res.json() + if (!json.thumbnail.genius) throw json + conn.sendFile( + m.chat, + json.thumbnail.genius, + null, + ` +β–’ *${json.title}* +*${json.author}*\n +${json.lyrics}`, + m + ) + m.react(done) + } catch (e) { + m.react(error) + } +} +handler.help = ['lyrics'] +handler.tags = ['tools'] +handler.command = ['letra', 'lyrics', 'letras'] + +export default handler diff --git a/silvaXlab/tools-movie.js b/silvaXlab/tools-movie.js new file mode 100644 index 0000000..e4f155c --- /dev/null +++ b/silvaXlab/tools-movie.js @@ -0,0 +1,57 @@ +import fetch from 'node-fetch' + +let imdbHandler = async (m, { conn, text }) => { + if (!text) throw 'Please provide a movie title' + + try { + let res = await fetch(`https://api.popcat.xyz/imdb?q=${encodeURIComponent(text)}`) + + if (!res.ok) { + throw new Error(`API request failed with status ${res.status}`) + } + + let json = await res.json() + + console.log('JSON response:', json) + + let ratings = json.ratings.map(rating => `β€’ *${rating.source}:* ${rating.value}`).join('\n') + + let movieInfo = `*π’πˆπ‹π•π€ πŒπƒ ππŽπ“ Movie Information:*\n + β€’ *Title:* ${json.title}\n + β€’ *Year:* ${json.year}\n + β€’ *Seasons:* ${json.totalseasons}\n + β€’ *Rated:* ${json.rated}\n + β€’ *Released:* ${json.released}\n + β€’ *Runtime:* ${json.runtime}\n + β€’ *Genres:* ${json.genres}\n + β€’ *Director:* ${json.director}\n + β€’ *Writer:* ${json.writer}\n + β€’ *Actors:* ${json.actors}\n + β€’ *Plot:* ${json.plot}\n + β€’ *Languages:* ${json.languages}\n + β€’ *Country:* ${json.country}\n + β€’ *Awards:* ${json.awards}\n + β€’ *Metascore:* ${json.metascore}\n + β€’ *Rating:* ${json.rating}\n + β€’ *Votes:* ${json.votes}\n + β€’ *IMDB ID:* ${json.imdbid}\n + β€’ *Type:* ${json.type}\n + β€’ *DVD:* ${json.dvd}\n + β€’ *Box Office:* ${json.boxoffice}\n + β€’ *Production:* ${json.production}\n + β€’ *Website:* ${json.website}\n\n + *Ratings:*\n${ratings}` + + // send the movie poster along with the movie information as caption + await conn.sendFile(m.chat, json.poster, 'poster.jpg', movieInfo, m) + } catch (error) { + console.error(error) + // Handle the error appropriately + } +} + +imdbHandler.help = ['imdb'] +imdbHandler.tags = ['tools'] +imdbHandler.command = /^(imdb|movie)$/i + +export default imdbHandler diff --git a/silvaXlab/tools-ndtv.js b/silvaXlab/tools-ndtv.js new file mode 100644 index 0000000..8b21324 --- /dev/null +++ b/silvaXlab/tools-ndtv.js @@ -0,0 +1,45 @@ +import fetch from 'node-fetch' + +let handler = async (m, { conn }) => { + try { + let res = await fetch( + 'https://ndtvapi.vercel.app/general?category=latest&field=headline,description,url' + ) + if (!res.ok) throw await res.text() + let data = await res.json() + if (!data.news || !data.news.length) throw new Error('No news available.') + + let randomCategoryIndex = Math.floor(Math.random() * data.news.length) + let newsCategory = data.news[randomCategoryIndex] + let articles = newsCategory.articles + + if (!articles.length) throw new Error('No news available in the selected category.') + + let randomArticleIndex = Math.floor(Math.random() * articles.length) + let newsItem = articles[randomArticleIndex] + + let newsInfo = `‒───── ୨❀୧ ─────‒ + ❖ 𝑺𝑻𝑨𝑻𝑼𝑺: Active + γ‹‘ π‘ͺ𝑹𝑬𝑨𝑻𝑢𝑹: π’πˆπ‹π•π€ + ☞ 𝑯𝑬𝑨𝑫𝑳𝑰𝑡𝑬: ${newsItem.headline} + ${newsItem.description} + πŸ”— 𝑹𝑬𝑨𝑫 𝑴𝑢𝑹𝑬: ${newsItem.url} + ‒───── ୨❀୧ ─────‒` + + let thumbnail = + 'https://imgur.com/a/TmbkcTa' + + conn.sendFile(m.chat, thumbnail, 'thumbnail.jpg', newsInfo, m) + + m.react('βœ…') + } catch (e) { + console.error(e) + m.react('❌') + } +} + +handler.help = ['news'] +handler.tags = ['news'] +handler.command = ['news'] + +export default handler diff --git a/silvaXlab/tools-ocr.js b/silvaXlab/tools-ocr.js new file mode 100644 index 0000000..08d336e --- /dev/null +++ b/silvaXlab/tools-ocr.js @@ -0,0 +1,52 @@ +import uploadFile from '../lib/uploadFile.js' +import uploadImage from '../lib/uploadImage.js' +import { webp2png } from '../lib/webp2mp4.js' +import fetch from 'node-fetch' + +let handler = async (m, { conn, args, text, usedPrefix, command }) => { + var out + + let q = m.quoted ? m.quoted : m + let mime = (q.msg || q).mimetype || q.mediaType || '' + if (/video/g.test(mime)) { + return m.reply('video files not supported!') + } + if (!/webp|image|viewOnce/g.test(mime)) + return m.reply(`Reply media with\n${usedPrefix + command}`) + let img = await q.download?.() + + if (/webp/g.test(mime)) { + out = await webp2png(img) + } else if (/image/g.test(mime)) { + out = await uploadImage(img) + } else if (/viewOnce/g.test(mime)) { + out = await uploadFile(img) + } + //await m.reply(wait) + await displayLoadingScreen(conn, m.chat) + try { + let res + if (args[0]) { + res = await ( + await fetch( + 'https://api.ocr.space/parse/imageurl?apikey=K88889328888957&url=' + + out + + '&language=' + + args[0] + ) + ).json() + } else { + res = await ( + await fetch('https://api.ocr.space/parse/imageurl?apikey=K88889328888957&url=' + out) + ).json() + } + await m.reply('*OCR RESULT*\n\n' + res.ParsedResults[0].ParsedText) + } catch (e) { + throw `some error occured!\n\n${e}` + } +} +handler.help = ['ocr'] +handler.tags = ['tools'] +handler.command = /^ocr$/i + +export default handler diff --git a/silvaXlab/tools-pokedex.js b/silvaXlab/tools-pokedex.js new file mode 100644 index 0000000..4052850 --- /dev/null +++ b/silvaXlab/tools-pokedex.js @@ -0,0 +1,32 @@ +import fetch from 'node-fetch' + +let handler = async (m, { conn, text }) => { + if (!text) throw 'Please provide a Pokemon name to search for.' + + const url = `https://some-random-api.com/pokemon/pokedex?pokemon=${encodeURIComponent(text)}` + + const response = await fetch(url) + const json = await response.json() + + if (!response.ok) { + throw `An error occurred: ${json.error}` + } + + const message = ` +*Name:* ${json.name} +*ID:* ${json.id} +*Type:* ${json.type} +*Abilities:* ${json.abilities} +*Height:* ${json.height} +*Weight:* ${json.weight} +*Description:* ${json.description} +` + + conn.sendMessage(m.chat, { text: message }, 'extendedTextMessage', { quoted: m }) +} + +handler.help = ['pokedex '] +handler.tags = ['anime'] +handler.command = /^pokedex/i + +export default handler diff --git a/silvaXlab/tools-randomcourses.js b/silvaXlab/tools-randomcourses.js new file mode 100644 index 0000000..79d4940 --- /dev/null +++ b/silvaXlab/tools-randomcourses.js @@ -0,0 +1,36 @@ +import fetch from 'node-fetch' + +let handler = async (m, { conn }) => { + try { + let res = await fetch('https://eduscout.vercel.app/api/courses') + if (!res.ok) throw await res.text() + let json = await res.json() + + if (!json.courses || json.courses.length < 5) throw 'Not enough courses found' + + let courseData = '‒───── ୨❀୧ ─────‒\n' + + for (let i = 0; i < 5; i++) { + let randomIndex = Math.floor(Math.random() * json.courses.length) + let course = json.courses[randomIndex] + // Remove the chosen course from the list so it's not chosen again + json.courses.splice(randomIndex, 1) + + courseData += `❖ Course: ${course.name}\n❖ Link: ${course.udemyLink}\n\n` + } + + courseData += '‒───── ୨❀୧ ─────‒' + + // Send the course data + conn.reply(m.chat, courseData, m) + m.react('🀩') + } catch (e) { + console.error(e) + m.react('error') + } +} +handler.help = ['course', 'randomcourse'] +handler.tags = ['tools'] +handler.command = ['course', 'randomcourse'] + +export default handler diff --git a/silvaXlab/tools-readmore.js b/silvaXlab/tools-readmore.js new file mode 100644 index 0000000..308fadf --- /dev/null +++ b/silvaXlab/tools-readmore.js @@ -0,0 +1,14 @@ +let handler = async (m, { conn, text }) => { + let [l, r] = text.split`|` + if (!l) l = '' + if (!r) r = '' + conn.reply(m.chat, l + readMore + r, m) +} +handler.help = ['readmore |'] +handler.tags = ['tools'] +handler.command = ['readmore'] + +export default handler + +const more = String.fromCharCode(8206) +const readMore = more.repeat(4001) diff --git a/silvaXlab/tools-readviewonce.js b/silvaXlab/tools-readviewonce.js new file mode 100644 index 0000000..cfc5246 --- /dev/null +++ b/silvaXlab/tools-readviewonce.js @@ -0,0 +1,15 @@ +let { downloadContentFromMessage } = await import('@whiskeysockets/baileys') + +var handler = async (m, { conn }) => { + if (!/viewOnce/.test(m.quoted?.mtype)) throw 'βœ³οΈβ‡οΈ Its Not a ViewOnce Message' + let mtype = Object.keys(m.quoted.message)[0] + let buffer = await m.quoted.download() + let caption = m.quoted.message[mtype].caption || '' + conn.sendMessage(m.chat, { [mtype.replace(/Message/, '')]: buffer, caption }, { quoted: m }) +} + +handler.help = ['readvo'] +handler.tags = ['tools'] +handler.command = ['readviewonce', 'read', 'vv', 'readvo'] + +export default handler diff --git a/silvaXlab/tools-removebg.js b/silvaXlab/tools-removebg.js new file mode 100644 index 0000000..2356d99 --- /dev/null +++ b/silvaXlab/tools-removebg.js @@ -0,0 +1,49 @@ +import axios from 'axios' +import FormData from 'form-data' +import fs from 'fs' +import path from 'path' +import dotenv from 'dotenv' + +dotenv.config() // Load environment variables from .env file + +const handler = async (m, { conn, text }) => { + try { + const q = m.quoted ? m.quoted : m + const mime = (q.msg || q).mimetype || '' + const img = await q.download() + const apikey = process.env.REMOVEBG_KEY // Use the API_KEY from the environment variable + + const formData = new FormData() + formData.append('size', 'auto') + formData.append('image_file', img, 'file.jpg') + + const response = await axios.post('https://api.remove.bg/v1.0/removebg', formData, { + headers: { + ...formData.getHeaders(), + 'X-Api-Key': apikey, + }, + responseType: 'arraybuffer', + encoding: null, + }) + + if (response.status !== 200) { + throw new Error(`Error: ${response.status} ${response.statusText}`) + } + + const imageData = response.data + + fs.writeFileSync('no-bg.png', imageData) + + // Add the caption to the image + const caption = `MADE BY ${botname}` + conn.sendFile(m.chat, 'no-bg.png', '', caption, m) + } catch (e) { + console.error(e) + m.reply('Sorry, an error occurred while processing the image, maybe check your api key.') + } +} + +handler.help = ['removebg'] +handler.tags = ['tools'] +handler.command = /^rmbg|removebg$/i +export default handler diff --git a/silvaXlab/tools-ssweb.js b/silvaXlab/tools-ssweb.js new file mode 100644 index 0000000..284bf93 --- /dev/null +++ b/silvaXlab/tools-ssweb.js @@ -0,0 +1,10 @@ +import fetch from 'node-fetch' +let handler = async (m, { conn, command, args }) => { + if (!args[0]) return conn.reply(m.chat, '*[πŸ”Ž] give url*', m) + let ss = await (await fetch(`https://image.thum.io/get/fullpage/${args[0]}`)).buffer() + conn.sendFile(m.chat, ss, 'error.png', args[0], m) +} +handler.help = ['ss', 'ssf'].map(v => v + ' ') +handler.tags = ['tools'] +handler.command = /^ss(web)?f?$/i +export default handler diff --git a/silvaXlab/tools-subreddit.js b/silvaXlab/tools-subreddit.js new file mode 100644 index 0000000..a535e2a --- /dev/null +++ b/silvaXlab/tools-subreddit.js @@ -0,0 +1,45 @@ +import fetch from 'node-fetch' + +let subredditHandler = async (m, { conn, text }) => { + if (!text) throw 'Please provide a subreddit name' + + try { + let res = await fetch(`https://api.popcat.xyz/subreddit/${encodeURIComponent(text)}`) + + if (!res.ok) { + throw new Error(`API request failed with status ${res.status}`) + } + + let json = await res.json() + + console.log('JSON response:', json) + + let subredditInfo = `*π’πˆπ‹π•π€ πŒπƒ ππŽπ“ Subreddit Information:*\n + β€’ *Name:* ${json.name}\n + β€’ *Title:* ${json.title}\n + β€’ *Active Users:* ${json.active_users}\n + β€’ *Members:* ${json.members}\n + β€’ *Description:* ${json.description}\n + β€’ *Allow Videos:* ${json.allow_videos ? 'Yes' : 'No'}\n + β€’ *Allow Images:* ${json.allow_images ? 'Yes' : 'No'}\n + β€’ *Over 18:* ${json.over_18 ? 'Yes' : 'No'}\n + β€’ *URL:* ${json.url}` + + // if icon is not null or undefined, send it along with the subreddit information as caption + // otherwise, only send the subreddit information + if (json.icon) { + await conn.sendFile(m.chat, json.icon, 'icon.jpg', subredditInfo, m) + } else { + m.reply(subredditInfo) + } + } catch (error) { + console.error(error) + // Handle the error appropriately + } +} + +subredditHandler.help = ['subreddit'] +subredditHandler.tags = ['tools'] +subredditHandler.command = /^(subreddit|reddit)$/i + +export default subredditHandler diff --git a/silvaXlab/tools-technews.js b/silvaXlab/tools-technews.js new file mode 100644 index 0000000..1cac042 --- /dev/null +++ b/silvaXlab/tools-technews.js @@ -0,0 +1,28 @@ +import fetch from 'node-fetch' + +let handler = async (m, { conn }) => { + try { + let res = await fetch('https://fantox001-scrappy-api.vercel.app/technews/random') + if (!res.ok) throw await res.text() + let json = await res.json() + if (!json.news) throw json + + let techNews = `‒───── ୨❀୧ ─────‒ + ❖ 𝑺𝑻𝑨𝑻𝑼𝑺: Active + γ‹‘ π‘ͺ𝑹𝑬𝑨𝑻𝑢𝑹: π’πˆπ‹π•π€ + ☞ 𝑡𝑬𝑾𝑺: ${json.news} + ‒───── ୨❀୧ ─────‒ + ` + + conn.sendFile(m.chat, json.thumbnail, 'thumbnail.jpg', techNews, m) + + m.react(done) + } catch (e) { + m.react(error) + } +} +handler.help = ['technews'] +handler.tags = ['news'] +handler.command = ['technews'] + +export default handler diff --git a/silvaXlab/tools-tgsticker.js b/silvaXlab/tools-tgsticker.js new file mode 100644 index 0000000..880695f --- /dev/null +++ b/silvaXlab/tools-tgsticker.js @@ -0,0 +1,56 @@ +import { stickerTelegram } from '@bochilteam/scraper' +import axios from 'axios' + +var handler = async (m, { conn, args }) => { + if (args[0] && args[0].match(/(https:\/\/t.me\/addstickers\/)/gi)) { + let res = await Telesticker(args[0]) + await m.reply(`Sending ${res.length} stickers...`) + if (m.isGroup && res.length > 30) { + await m.reply('Number of stickers more than 30, bot will send it in private chat.') + for (let i = 0; i < res.length; i++) { + conn.sendMessage(m.sender, { sticker: { url: res[i].url } }) + } + } else { + for (let i = 0; i < res.length; i++) { + conn.sendMessage(m.chat, { sticker: { url: res[i].url } }) + } + } + } else if (args && args.join(' ')) { + let [query, page] = args.join(' ').split('|') + let res = await stickerTelegram(query, page) + if (!res.length) throw `Query "${args.join(' ')}" not found` + m.reply(res.map(v => `*${v.title}*\n_${v.link}_`).join('\n\n')) + } else throw 'Input Query / Telesticker Url' +} +handler.help = ['telesticker'] +handler.tags = ['tools'] +handler.command = /^(telestic?ker|tgsticker)$/i +handler.limit = true + +export default handler + +//Thanks Xfarr : https://github.com/xfar05 +async function Telesticker(url) { + return new Promise(async (resolve, reject) => { + if (!url.match(/(https:\/\/t.me\/addstickers\/)/gi)) throw 'Enter your url telegram sticker' + const packName = url.replace('https://t.me/addstickers/', '') + const data = await axios( + `https://api.telegram.org/bot891038791:AAHWB1dQd-vi0IbH2NjKYUk-hqQ8rQuzPD4/getStickerSet?name=${encodeURIComponent(packName)}`, + { method: 'GET', headers: { 'User-Agent': 'GoogleBot' } } + ) + const hasil = [] + for (let i = 0; i < data.data.result.stickers.length; i++) { + const fileId = data.data.result.stickers[i].thumb.file_id + const data2 = await axios( + `https://api.telegram.org/bot891038791:AAHWB1dQd-vi0IbH2NjKYUk-hqQ8rQuzPD4/getFile?file_id=${fileId}` + ) + const result = { + status: 200, + author: 'Xfarr05', + url: `https://api.telegram.org/file/bot891038791:AAHWB1dQd-vi0IbH2NjKYUk-hqQ8rQuzPD4/${data2.data.result.file_path}`, + } + hasil.push(result) + } + resolve(hasil) + }) +} diff --git a/silvaXlab/tools-tourl.js b/silvaXlab/tools-tourl.js new file mode 100644 index 0000000..64db035 --- /dev/null +++ b/silvaXlab/tools-tourl.js @@ -0,0 +1,48 @@ +import uploadtoimgur from '../lib/imgur.js' +import fs from 'fs' +import path from 'path' + +let handler = async m => { + let q = m.quoted ? m.quoted : m + let mime = (q.msg || q).mimetype || '' + + if (!mime) { + throw '✳️ Respond to an image/video' + } + let mediaBuffer = await q.download() + + if (mediaBuffer.length > 10 * 1024 * 1024) { + throw '✴️ Media size exceeds 10 MB. Please upload a smaller file.' + } + + let currentModuleDirectory = path.dirname(new URL(import.meta.url).pathname) + + let tmpDir = path.join(currentModuleDirectory, '../tmp') + if (!fs.existsSync(tmpDir)) { + fs.mkdirSync(tmpDir) + } + + let mediaPath = path.join(tmpDir, `media_${Date.now()}.${mime.split('/')[1]}`) + fs.writeFileSync(mediaPath, mediaBuffer) + + let isTele = /image\/(png|jpe?g|gif)|video\/mp4/.test(mime) + + if (isTele) { + let link = await uploadtoimgur(mediaPath) + + const fileSizeMB = (mediaBuffer.length / (1024 * 1024)).toFixed(2) + + m.reply(`βœ… *Media Upload Successful*\nβ™• *File Size:* ${fileSizeMB} MB\nβ™• *URL:* ${link}`) + } else { + m.reply(`β™• ${mediaBuffer.length} Byte(s) + β™• (Unknown)`) + } + + fs.unlinkSync(mediaPath) +} + +handler.help = ['tourl'] +handler.tags = ['tools'] +handler.command = ['url', 'tourl'] + +export default handler diff --git a/silvaXlab/tools-traceanime.js b/silvaXlab/tools-traceanime.js new file mode 100644 index 0000000..ffc85a5 --- /dev/null +++ b/silvaXlab/tools-traceanime.js @@ -0,0 +1,72 @@ +import fetch from 'node-fetch' +import uploadImage from '../lib/uploadImage.js' + +let handler = async (m, { conn }) => { + try { + let q = m.quoted ? m.quoted : m + let mime = (q.msg || q).mimetype || q.mediaType || '' + + if (!mime.startsWith('image')) { + throw '*Respond to an image*' + } + + let data = await q.download() + let image = await uploadImage(data) + + let apiUrl = `https://api.trace.moe/search?anilistInfo&url=${encodeURIComponent(image)}` + console.log('API URL:', apiUrl) + + let response = await fetch(apiUrl) + let result = await response.json() + console.log('API Response:', result) + + if (!result || result.error || result.result.length === 0) { + throw '*Error: Could not track the anime.*' + } + + let { anilist, from, to, similarity, video, episode } = result.result[0] + let animeTitle = anilist.title ? anilist.title.romaji || anilist.title.native : 'Unknown Title' + + let message = `*Anime:* ${animeTitle}\n` + + if (anilist.synonyms && anilist.synonyms.length > 0) { + message += `*Synonyms:* ${anilist.synonyms.join(', ')}\n` + } + + message += `*Similarity:* ${similarity.toFixed(2)}%\n` + message += `*Time:* ${formatDuration(from * 1000)} - ${formatDuration(to * 1000)}\n` + + if (episode) { + message += `*Episode:* ${episode}\n` + } + + console.log('Anime Information:', { + animeTitle, + synonyms: anilist.synonyms ? anilist.synonyms.join(', ') : 'Not Available', + similarity, + timestamp: `${formatDuration(from * 1000)} - ${formatDuration(to * 1000)}`, + video, + episode, + }) + + // Send the video with anime information as the caption + await conn.sendFile(m.chat, video, 'anime.mp4', message, m) + } catch (error) { + console.error('Error:', error) + m.reply('*Error: Could not track the anime or send the video.*') + } +} + +function formatDuration(ms) { + let seconds = Math.floor((ms / 1000) % 60) + let minutes = Math.floor((ms / (1000 * 60)) % 60) + let hours = Math.floor((ms / (1000 * 60 * 60)) % 24) + + return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}` +} + +handler.help = ['trace'] +handler.tags = ['anime'] +handler.command = /^trace$/i + +export default handler diff --git a/silvaXlab/tools-translate.js b/silvaXlab/tools-translate.js new file mode 100644 index 0000000..b3875bb --- /dev/null +++ b/silvaXlab/tools-translate.js @@ -0,0 +1,36 @@ +import { translate } from '@vitalets/google-translate-api' +const defaultLang = 'en' +const tld = 'cn' + +let handler = async (m, { args, usedPrefix, command }) => { + let err = ` +πŸ“Œ *Example:* + +*${usedPrefix + command}* [text] +*${usedPrefix + command}* en Hello World + +≑ *List of supported languages:* + +https://cloud.google.com/translate/docs/languages +`.trim() + + let lang = args[0] + let text = args.slice(1).join(' ') + if ((args[0] || '').length !== 2) { + lang = defaultLang + text = args.join(' ') + } + if (!text && m.quoted && m.quoted.text) text = m.quoted.text + + try { + let result = await translate(text, { to: lang, autoCorrect: true }).catch(_ => null) + m.reply(result.text) + } catch (e) { + throw err + } +} +handler.help = ['translate '] +handler.tags = ['tools'] +handler.command = ['translate', 'tl', 'trad', 'tr'] + +export default handler diff --git a/silvaXlab/tools-truecaller.js b/silvaXlab/tools-truecaller.js new file mode 100644 index 0000000..a6fea68 --- /dev/null +++ b/silvaXlab/tools-truecaller.js @@ -0,0 +1,65 @@ +//GURU ka maal hai +//https://github.com/Guru322/GURU-BOT + +import fetch from 'node-fetch' + +let handler = async (m, { conn, text }) => { + let phoneNumber = '' + if (text) { + phoneNumber = text.replace(/[^0-9]/g, '') + } else if (m.quoted) { + phoneNumber = m.quoted.sender.replace(/[^0-9]/g, '') + } else if (m.mentionedJid && m.mentionedJid[0]) { + phoneNumber = m.mentionedJid[0].replace(/[^0-9]/g, '') + } else { + throw `Please provide a number in international format without +, quote a user, or mention a user` + } + + try { + const installationId = 'a1i0Z--jzbJC6kx-2_s3OMNW2X7O2Qe3ca-XwmHexijCBA6MNKAO2ciUw756zhWj' + const apiurl = `https://truecaller-api.vercel.app/search?phone=${encodeURIComponent(phoneNumber)}&id=${installationId)` + + let response = await fetch(apiurl) + console.log(response) + let json = await response.json() + + json.creator = 'Silva' + + let milf = '' + for (let prop in json) { + if (prop === 'flagURL') { + continue + } + + if (prop === 'addresses') { + milf += `⚝ *${prop}:*\n` + for (let addressProp in json[prop][0]) { + milf += ` ⚝ *${addressProp}:* ${json[prop][0][addressProp]}\n` + } + } else if (prop === 'countryDetails') { + milf += `⚝ *${prop}:*\n` + for (let countryProp in json[prop]) { + if (Array.isArray(json[prop][countryProp])) { + milf += ` ⚝ *${countryProp}:* ${json[prop][countryProp].join(', ')}\n` + } else { + milf += ` ⚝ *${countryProp}:* ${json[prop][countryProp]}\n` + } + } + } else { + if (prop !== 'flagURL') { + milf += `⚝ *${prop}:* ${json[prop]}\n` + } + } + } + + m.reply(milf) + } catch (error) { + console.error(error) + } +} + +handler.help = ['true'] +handler.tags = ['tools'] +handler.command = /^(true|caller)$/i + +export default handler diff --git a/silvaXlab/tools-tts.js b/silvaXlab/tools-tts.js new file mode 100644 index 0000000..7daeafc --- /dev/null +++ b/silvaXlab/tools-tts.js @@ -0,0 +1,47 @@ +import gtts from 'node-gtts' +import { readFileSync, unlinkSync } from 'fs' +import { join } from 'path' + +const defaultLang = 'en' +let handler = async (m, { conn, args, usedPrefix, command }) => { + let lang = args[0] + let text = args.slice(1).join(' ') + if ((args[0] || '').length !== 2) { + lang = defaultLang + text = args.join(' ') + } + if (!text && m.quoted?.text) text = m.quoted.text + + let res + try { + res = await tts(text, lang) + } catch (e) { + m.reply(e + '') + text = args.join(' ') + if (!text) throw `πŸ“Œ Example : \n${usedPrefix}${command} en hello world` + res = await tts(text, defaultLang) + } finally { + if (res) conn.sendFile(m.chat, res, 'tts.opus', null, m, true) + } +} +handler.help = ['tts '] +handler.tags = ['tools'] +handler.command = ['tts', 'voz'] + +export default handler + +function tts(text, lang = 'en-en') { + console.log(lang, text) + return new Promise((resolve, reject) => { + try { + let tts = gtts(lang) + let filePath = join(global.__dirname(import.meta.url), '../tmp', 1 * new Date() + '.wav') + tts.save(filePath, text, () => { + resolve(readFileSync(filePath)) + unlinkSync(filePath) + }) + } catch (e) { + reject(e) + } + }) +} diff --git a/silvaXlab/tools-wa.js b/silvaXlab/tools-wa.js new file mode 100644 index 0000000..537972b --- /dev/null +++ b/silvaXlab/tools-wa.js @@ -0,0 +1,24 @@ +let handler = async (m, { conn, usedPrefix, text, command }) => { + let waLin = '' + if (text) { + waLin = text.replace(/[^0-9]/g, '') + } else if (m.quoted) { + waLin = m.quoted.sender.replace(/[^0-9]/g, '') + } else if (m.mentionedJid && m.mentionedJid[0]) { + waLin = m.mentionedJid[0].replace(/[^0-9]/g, '') + } else { + throw `Please provide a number, quote a user, or mention a user` + } + const waLink = `https://wa.me/${waLin}` + const message = `*WhatsApp Link:*\n${waLink}` + + conn.sendMessage(m.chat, { text: message, quoted: m, contextInfo: { mentionedJid: [m.sender] } }) + + m.react('βœ…') +} + +handler.help = ['wa'] +handler.tags = ['tools'] +handler.command = ['wa'] + +export default handler diff --git a/silvaXlab/tools-weather.js b/silvaXlab/tools-weather.js new file mode 100644 index 0000000..b7ebee0 --- /dev/null +++ b/silvaXlab/tools-weather.js @@ -0,0 +1,23 @@ + +import axios from "axios" +let handler = async (m, { args }) => { +if (!args[0]) throw "*Give a place to search*" +try { +const response = axios.get(`https://api.openweathermap.org/data/2.5/weather?q=${args}&units=metric&appid=060a6bcfa19809c2cd4d97a212b19273`) +const res = await response +const name = res.data.name +const Country = res.data.sys.country +const Weather = res.data.weather[0].description +const Temperature = res.data.main.temp + "Β°C" +const Minimum_Temperature = res.data.main.temp_min + "Β°C" +const Maximum_Temperature = res.data.main.temp_max + "Β°C" +const Humidity = res.data.main.humidity + "%" +const Wind = res.data.wind.speed + "km/h" +const wea = `Κœα΄‡Κ€α΄‡ Ιͺs Κα΄α΄œΚ€ Ι’Ιͺᴠᴇɴ α΄˜ΚŸα΄€α΄„α΄‡ α΄‘α΄‡α΄€α΄›Κœα΄‡Κ€\n\nγ€Œ πŸ“ γ€α΄˜ΚŸα΄€α΄„α΄‡: ${name}\nγ€Œ πŸ—ΊοΈ γ€α΄„α΄α΄œΙ΄α΄›Κ€Κ: ${Country}\nγ€Œ 🌀️ 」ᴠΙͺᴇᴑ: ${Weather}\nγ€Œ 🌑️ 」 α΄›α΄‡α΄α΄˜α΄‡Κ€α΄€α΄›α΄œΚ€α΄‡: ${Temperature}\nγ€Œ πŸ’  」 ᴍΙͺΙ΄Ιͺᴍᴜᴍ α΄›α΄‡α΄α΄˜α΄‡Κ€α΄€α΄›α΄œΚ€α΄‡: ${Minimum_Temperature}\nγ€Œ πŸ“› 」 ᴍᴀxΙͺᴍᴜᴍ α΄›α΄‡α΄α΄˜α΄‡Κ€α΄€α΄›α΄œΚ€α΄‡: ${Maximum_Temperature}\nγ€Œ πŸ’¦ 」 ʜᴜᴍΙͺα΄…Ιͺᴛʏ: ${Humidity}\nγ€Œ 🌬️ 」 α΄‘ΙͺΙ΄α΄…sα΄˜α΄‡α΄‡α΄…: ${Wind}\n\nα΄›Κœα΄‡-silva-ʙᴏᴛ` +m.reply(wea) +} catch { +return "*ERROR*"}} +handler.help = ['weather **'] +handler.tags = ['tools'] +handler.command = /^(climate|weather|mosam)$/i +export default handler diff --git a/silvaXlab/tools-wikipedia.js b/silvaXlab/tools-wikipedia.js new file mode 100644 index 0000000..c700641 --- /dev/null +++ b/silvaXlab/tools-wikipedia.js @@ -0,0 +1,25 @@ +import axios from 'axios' +import cheerio from 'cheerio' + +let handler = async (m, { text }) => { + if (!text) throw `✳️ Enter what you want to search for on Wikipedia` + + try { + const link = await axios.get(`https://es.wikipedia.org/wiki/${text}`) + const $ = cheerio.load(link.data) + let wik = $('#firstHeading').text().trim() + let resulw = $('#mw-content-text > div.mw-parser-output').find('p').text().trim() + m.reply(`β–’ *Wikipedia* + +β€£ Buscado : ${wik} + +${resulw}`) + } catch (e) { + m.reply('⚠️ No results found ') + } +} +handler.help = ['wikipedia'] +handler.tags = ['tools'] +handler.command = ['wiki', 'wikipedia'] + +export default handler diff --git a/silvaXlab/ujid.js b/silvaXlab/ujid.js new file mode 100644 index 0000000..8c3f974 --- /dev/null +++ b/silvaXlab/ujid.js @@ -0,0 +1,38 @@ +let handler = async (m, { conn, args, usedPrefix, command }) => { + // Check if the message is a reply to another chat + if (!m.quoted) { + return m.reply('Please reply to a message in the group.'); + } + + // Check if the chat is a group + if (!m.isGroup) { + return m.reply('This command can only be used in a group.'); + } + + try { + // Retrieve the group metadata + const groupMetadata = await conn.groupMetadata(m.chat); + const members = groupMetadata.participants; + + // Check if there are members in the group + if (!members || members.length === 0) { + return m.reply('No members found in the group.'); + } + + // Generate a single ID for each member and join them into a single string + const ids = members.map(member => member.id).join(', '); + + // Reply with the generated IDs + m.reply(`SILVA MD IS GENERATING JIDS FOR EVERYONE IN THIS GROUPπŸ’€πŸ’€:\n${ids}`); + } catch (error) { + console.error('Error retrieving group participants:', error); + m.reply('An error occurred while retrieving group members. Please ensure the bot has the right permissions and try again.'); + } +}; + +// Command metadata +handler.help = ['ujid']; +handler.tags = ['tools']; +handler.command = ['ujid']; + +export default handler; diff --git a/silvaXlab/whatmusic.js b/silvaXlab/whatmusic.js new file mode 100644 index 0000000..2024020 --- /dev/null +++ b/silvaXlab/whatmusic.js @@ -0,0 +1,37 @@ + +import fs from 'fs' +import acrcloud from 'acrcloud' +let acr = new acrcloud({ +host: 'identify-eu-west-1.acrcloud.com', +access_key: 'c33c767d683f78bd17d4bd4991955d81', +access_secret: 'bvgaIAEtADBTbLwiPGYlxupWqkNGIjT7J9Ag2vIu' +}) + +let handler = async (m) => { +let q = m.quoted ? m.quoted : m +let mime = (q.msg || q).mimetype || '' +if (/audio|video/.test(mime)) { +let media = await q.download() +let ext = mime.split('/')[1] +fs.writeFileSync(`./tmp/${m.sender}.${ext}`, media) +let res = await acr.identify(fs.readFileSync(`./tmp/${m.sender}.${ext}`)) +let { code, msg } = res.status +if (code !== 0) throw msg +let { title, artists, album, genres, release_date } = res.metadata.music[0] +let txt = ` +πšπ™΄πš‚πš„π™»πšƒ +β€’ πŸ“Œ *TITLE*: ${title} +β€’ πŸ‘¨β€πŸŽ€ π™°πšπšƒπ™Έπš‚πšƒ: ${artists !== undefined ? artists.map(v => v.name).join(', ') : 'NOT FOUND'} +β€’ πŸ’Ύ π™°π™»π™±πš„π™Ό: ${album.name || 'NOT FOUND'} +β€’ 🌐 π™Άπ™΄π™½π™΄πš: ${genres !== undefined ? genres.map(v => v.name).join(', ') : 'NOT FOUND'} +β€’ πŸ“† RELEASE DATE: ${release_date || 'NOT FOUND'} +`.trim() +fs.unlinkSync(`./tmp/${m.sender}.${ext}`) +m.reply(txt) +} else throw '*πšπ™΄πš‚π™Ώπ™Ύπ™½π™³ π™°πš„π™³π™Έπ™Ύ*' +} + +handler.help = ['shazam'] +handler.tags = ['tools'] +handler.command = /^quemusica|shazam|whatmusic|find$/i +export default handler diff --git a/silvaXlab/xvid.js b/silvaXlab/xvid.js new file mode 100644 index 0000000..c721a5b --- /dev/null +++ b/silvaXlab/xvid.js @@ -0,0 +1,64 @@ +import { xvideosSearch, xvideosdl } from '../lib/scraper.js' + +let handler = async (m, { conn, args, text, usedPrefix, command }) => { + let chat = global.db.data.chats[m.chat] + if (!chat.nsfw) + throw `🚫 This group does not support NSFW content.\n\nTo turn it on, use: *${usedPrefix}enable* nsfw` + let user = global.db.data.users[m.sender].age + if (user < 18) throw `❎ You must be 18 years or older to use this feature.` + if (!text) + throw `✳️ What do you want to search?\nπŸ“Œ Usage: *${usedPrefix + command} *\n\nExample: Hot desi bhabi or you can use a link as well\nExample: .xnxx link *` + + m.react('βŒ›') + if (!text) throw 'Please provide a search query or a valid Xvideos URL.' + + // Check if the input is a valid Xvideos URL + const isURL = /^(https?:\/\/)?(www\.)?xvideos\.com\/.+$/i.test(text) + + try { + if (isURL) { + // If it's a valid URL, directly download the video + const result = await xvideosdl(text) + const { title, url } = result.result + + // Send the video file + const response = await fetch(url) + const buffer = await response.arrayBuffer() + + conn.sendFile( + m.chat, + Buffer.from(buffer), + `${title}.mp4`, + `π’πˆπ‹π•π€ πŒπƒ ππŽπ“ Here is your Xvideos video: ${title}` + ) + } else { + // If it's not a valid URL, perform a search and display the search results + const results = await xvideosSearch(text) + if (results.length === 0) { + m.reply('No search results found for the given query.') + } else { + const searchResults = results + .map((result, index) => { + return `${index + 1}. *${result.title}*\nDuration: ${result.duration}\nQuality: ${result.quality}\nURL: ${result.url}` + }) + .join('\n\n') + + m.reply(`*Search Results for "${text}":*\n\n${searchResults}`) + } + } + } catch (error) { + console.error(error) + throw 'Failed to fetch Xvideos video details.' + } +} + +handler.help = ['xvid'] +handler.tags = ['nsfw'] +handler.command = ['xvid'] +handler.group = true +handler.premium = false +handler.register = true + +handler.premium = false + +export default handler diff --git a/silvaXlab/xxdl.js b/silvaXlab/xxdl.js new file mode 100644 index 0000000..099d5a1 --- /dev/null +++ b/silvaXlab/xxdl.js @@ -0,0 +1,45 @@ + +import fetch from 'node-fetch' +import fg from 'api-dylux' +let handler = async (m, { conn, args, text, usedPrefix, command }) => { + + let chat = global.db.data.chats[m.chat] + if (!chat.nsfw) throw `🚫 El grupo no admite contenido nsfw \n\nPara habilitar escriba \n*${usedPrefix}enable* nsfw` + let user = global.db.data.users[m.sender].age + if (user < 17) throw `❎ Eres menor de edad! vuelve cuando tengas mΓ‘s de 18 aΓ±os` + if (!text) throw `✳️ Para buscar\nπŸ“Œ Use : *${usedPrefix + command} *\n\nPara descargar desde URL:\nπŸ“ŒUse : *${usedPrefix + command} *` + + m.react(rwait) + if (text.includes('http://') || text.includes('https://')) { + if (!text.includes('xnxx.com')) return m.reply(`❎ Ingrese un link de *xnxx.com*`) + try { + let xn = await fg.xnxxdl(text) + conn.sendFile(m.chat, xn.url_dl, xn.title + '.mp4', ` +≑ *XNXX DL* + +β–’ *πŸ“ŒTΓ­tulo*: ${xn.title} +β–’ *⌚DuraciΓ³n:* ${xn.duration} +β–’ *🎞️Calidad:* ${xn.quality} +`.trim(), m, false, { asDocument: chat.useDocument }) + m.react(done) + } catch (e) { + m.reply(`πŸ”΄ Error : intenta mas tarde`) + } + } else { + try { + let res = await fg.xnxxSearch(text) + let ff = res.result.map((v, i) => `${i + 1}┃ *Titulo* : ${v.title}\n*Link:* ${v.link}\n`).join('\n') + if (res.status) m.reply(ff) + } catch (e) { + m.reply(`πŸ”΄ Error: intenta mas tarde`) + } + } +} +handler.help = ['xnxx'] +handler.tags = ['nsfw', 'prem'] +handler.command = ['xnxxsearch', 'xnxxdl', 'xnxx'] +handler.diamond = 2 +handler.premium = false +handler.register = true + +export default handler \ No newline at end of file