-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6067c47
commit 76cff1e
Showing
96 changed files
with
4,178 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import fetch from 'node-fetch'; | ||
import displayLoadingScreen from '../lib/loading.js' | ||
|
||
const endpoint = 'https://v2-guru-indratensei.cloud.okteto.net/perplexity?query='; | ||
|
||
let handler = async (m, { text, conn, usedPrefix, command }) => { | ||
try { | ||
if (!text && !(m.quoted && m.quoted.text)) { | ||
throw `Please provide some text or quote a message to get a response.`; | ||
} | ||
|
||
if (!text && m.quoted && m.quoted.text) { | ||
text = m.quoted.text; | ||
} else if (text && m.quoted && m.quoted.text) { | ||
text = `${text} ${m.quoted.text}`; | ||
if (m.quoted.text.includes('.aisearch')) { | ||
text = text.replace('.aisearch', ''); // | ||
} | ||
} | ||
await displayLoadingScreen(conn, m.chat) | ||
conn.sendPresenceUpdate('composing', m.chat); | ||
let emsg = await conn.sendMessage(m.chat, {text: 'Thinking...'}) | ||
const prompt = encodeURIComponent(text); | ||
|
||
const response = await fetch(endpoint + prompt); | ||
|
||
if (!response.ok) { | ||
throw `Received an error response from the server: ${response.status} - ${response.statusText}`; | ||
} | ||
|
||
const data = await response.json(); | ||
const result = data.response.trim(); | ||
await conn.relayMessage(m.chat, { | ||
protocolMessage: { | ||
key: emsg.key, | ||
type: 14, | ||
editedMessage: { | ||
conversation: result | ||
} | ||
} | ||
}, {}) | ||
} catch (error) { | ||
console.error('Error:', error); | ||
m.reply(`An error occurred while processing your request. Please try again later.`); | ||
} | ||
}; | ||
handler.help = ['aisearch'] | ||
handler.tags = ['AI'] | ||
handler.command = ['aisearch', 'ai2']; | ||
|
||
|
||
export default handler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
import didyoumean from 'didyoumean' | ||
|
||
import similarity from 'similarity' | ||
//import { plugins } from '../lib/plugins.js' | ||
|
||
export async function before(m, { conn, match, usedPrefix, command }) { | ||
|
||
if ((usedPrefix = (match[0] || '')[0])) { | ||
let noPrefix = m.text.replace(usedPrefix, '') | ||
let args = noPrefix.trim().split` `.slice(1) | ||
let text = args.join` ` | ||
let help = Object.values(plugins).filter(v => v.help && !v.disabled).map(v => v.help).flat(1) | ||
if (help.includes(noPrefix)) return | ||
let mean = didyoumean(noPrefix, help) | ||
let sim = similarity(noPrefix, mean) | ||
let som = sim * 100 | ||
let who = m.mentionedJid && m.mentionedJid[0] ? m.mentionedJid[0] : m.fromMe ? conn.user.jid : m.sender | ||
let name = await conn.getName(who) | ||
|
||
let caption = `Hey ${name} senpai are you trying to use *${usedPrefix + mean} ?*` | ||
if (mean) this.reply(m.chat, `${caption}`, m) | ||
} | ||
} | ||
export const disabled = false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
const { | ||
proto, | ||
generateWAMessage, | ||
areJidsSameUser | ||
} = (await import('@whiskeysockets/baileys')).default | ||
|
||
export async function all(m, chatUpdate) { | ||
if (m.isBaileys) | ||
return | ||
if (!m.message) | ||
return | ||
if (!(m.message.buttonsResponseMessage || m.message.templateButtonReplyMessage || m.message.listResponseMessage)) | ||
return | ||
let id = m.message.buttonsResponseMessage?.selectedButtonId || m.message.templateButtonReplyMessage?.selectedId || m.message.listResponseMessage?.singleSelectReply?.selectedRowId | ||
let text = m.message.buttonsResponseMessage?.selectedDisplayText || m.message.templateButtonReplyMessage?.selectedDisplayText || m.message.listResponseMessage?.title | ||
let isIdMessage = false, usedPrefix | ||
for (let name in global.plugins) { | ||
let plugin = global.plugins[name] | ||
if (!plugin) | ||
continue | ||
if (plugin.disabled) | ||
continue | ||
if (!opts['restrict']) | ||
if (plugin.tags && plugin.tags.includes('admin')) | ||
continue | ||
if (typeof plugin !== 'function') | ||
continue | ||
if (!plugin.command) | ||
continue | ||
const str2Regex = str => str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&') | ||
let _prefix = plugin.customPrefix ? plugin.customPrefix : this.prefix ? this.prefix : global.prefix | ||
let match = (_prefix instanceof RegExp ? // RegExp Mode? | ||
[[_prefix.exec(id), _prefix]] : | ||
Array.isArray(_prefix) ? // Array? | ||
_prefix.map(p => { | ||
let re = p instanceof RegExp ? // RegExp in Array? | ||
p : | ||
new RegExp(str2Regex(p)) | ||
return [re.exec(id), re] | ||
}) : | ||
typeof _prefix === 'string' ? // String? | ||
[[new RegExp(str2Regex(_prefix)).exec(id), new RegExp(str2Regex(_prefix))]] : | ||
[[[], new RegExp]] | ||
).find(p => p[1]) | ||
if ((usedPrefix = (match[0] || '')[0])) { | ||
let noPrefix = id.replace(usedPrefix, '') | ||
let [command] = noPrefix.trim().split` `.filter(v => v) | ||
command = (command || '').toLowerCase() | ||
let isId = plugin.command instanceof RegExp ? // RegExp Mode? | ||
plugin.command.test(command) : | ||
Array.isArray(plugin.command) ? // Array? | ||
plugin.command.some(cmd => cmd instanceof RegExp ? // RegExp in Array? | ||
cmd.test(command) : | ||
cmd === command | ||
) : | ||
typeof plugin.command === 'string' ? // String? | ||
plugin.command === command : | ||
false | ||
if (!isId) | ||
continue | ||
isIdMessage = true | ||
} | ||
|
||
} | ||
let messages = await generateWAMessage(m.chat, { text: isIdMessage ? id : text, mentions: m.mentionedJid }, { | ||
userJid: this.user.id, | ||
quoted: m.quoted && m.quoted.fakeObj | ||
}) | ||
messages.key.fromMe = areJidsSameUser(m.sender, this.user.id) | ||
messages.key.id = m.key.id | ||
messages.pushName = m.name | ||
if (m.isGroup) | ||
messages.key.participant = messages.participant = m.sender | ||
let msg = { | ||
...chatUpdate, | ||
messages: [proto.WebMessageInfo.fromObject(messages)].map(v => (v.conn = this, v)), | ||
type: 'append' | ||
} | ||
this.ev.emit('messages.upsert', msg) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import fetch from 'node-fetch'; | ||
|
||
const handler = async (m, {conn, text, usedPrefix, command}) => { | ||
if (!text) { | ||
throw `*Example:* ${usedPrefix + command} Hello Gemini`; | ||
} | ||
|
||
try { | ||
conn.sendPresenceUpdate('composing', m.chat); | ||
|
||
const API_URL = `https://vihangayt.me/tools/gemini?q=${encodeURIComponent(text)}`; | ||
const response = await fetch(API_URL); | ||
const data = await response.json(); | ||
|
||
if (data.status && data.data) { | ||
const respuestaAPI = data.data + "/n_©️Gemini: ʙʏ ɴᴀꜱʀᴜʟʟᴀʜ ᴍᴀᴄʜɪ🦹♂️_"; | ||
conn.reply(m.chat, respuestaAPI, m); | ||
} else { | ||
throw '*Server is busy now. Try again Later.*'; | ||
} | ||
} catch (error) { | ||
throw `*Error*`; | ||
} | ||
}; | ||
|
||
handler.command = /^gemini$/i; | ||
|
||
export default handler; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,60 @@ | ||
import fetch from 'node-fetch' | ||
import uploader from '../lib/uploadImage.js' | ||
|
||
var handler = async (m, { conn, text, command, usedPrefix }) => { | ||
|
||
let q = m.quoted ? m.quoted : m | ||
let mime = (q.msg || q).mimetype || q.mediaType || '' | ||
if (!mime){ | ||
if (!text) throw `*🎟 ️Ask Question* \n\n *_Example:_* *.bard Hi* \n\n*_Example 2:_* *.ans who are you? * \n\n *I'm ready to help and reply your queries*` | ||
await m.react('🪄') | ||
let json = await (await fetch(`https://aemt.me/bard?text=${text}`)).json() | ||
conn.sendMessage(m.chat, { text: json.result + "\n\n*_©️Bard: ʙʏ ɴᴀꜱʀᴜʟʟᴀʜ ᴍᴀᴄʜɪ🦹♂️_*" }, { quoted: m }) | ||
|
||
} else | ||
if (/image/g.test(mime) && !/webp/g.test(mime)) { | ||
let buffer = await q.download() | ||
await m.react('🪄') | ||
let media = await (uploader)(buffer) | ||
if (!text) throw `*🎟️ Upload image with Question*\n\n 🪄 *_Example:_* *What is this?* \n\n *I'm ready to help and reply your queries.*` | ||
|
||
let json = await (await fetch(`https://aemt.me/bardimg?url=${media}&text=${text}`)).json() | ||
|
||
conn.sendMessage(m.chat, { text: json.result + "\n\n*_©️Bard: ʙʏ ɴᴀꜱʀᴜʟʟᴀʜ ᴍᴀᴄʜɪ🦹♂️_*" }, { quoted: m }) | ||
|
||
} else return conn.reply(m.chat, `*🎟️Upload image with Question\n I'm ready to help and reply your queries.*`, m ) | ||
|
||
} | ||
|
||
handler.command = /^(bard|ask|ans)$/i | ||
|
||
|
||
export default handler | ||
import _0x2d65cc from '../lib/uploadImage.js'; | ||
import _0x37e01c from '../lib/bard.js'; | ||
const bardAi = new _0x37e01c(); | ||
let handler = async (_0x4be7c9, { | ||
conn: _0x5ef915, | ||
args: _0x477776, | ||
usedPrefix: _0x1954a4, | ||
command: _0x4fd041 | ||
}) => { | ||
let _0x2d15fc; | ||
if (_0x477776.length >= 0x1) { | ||
_0x2d15fc = _0x477776.slice(0x0).join(" "); | ||
} else { | ||
if (_0x4be7c9.quoted && _0x4be7c9.quoted.text) { | ||
_0x2d15fc = _0x4be7c9.quoted.text; | ||
} else { | ||
return _0x4be7c9.reply("Give some text"); | ||
} | ||
} | ||
let _0x40ed32 = _0x4be7c9.quoted ? _0x4be7c9.quoted : _0x4be7c9; | ||
let _0x31ff36 = (_0x40ed32.msg || _0x40ed32).mimetype || ''; | ||
await _0x4be7c9.react('🦹🏻♂️'); | ||
if (!_0x31ff36) { | ||
try { | ||
let _0x2e87ed = await Bard(_0x2d15fc); | ||
const mea_0 = await _0x2e87ed.content; | ||
const mea = mea_0 +"\n\n_©️ʙᴀʀᴅ: ʙʏ ɴᴀꜱʀᴜʟʟᴀʜ ᴍᴀᴄʜɪ🦹♂️_"; | ||
_0x4be7c9.reply(mea); | ||
} catch (_0x5d43cb) { | ||
throw "An error occured"; | ||
} | ||
} else { | ||
let _0x16e1ad = await _0x40ed32.download(); | ||
let _0x4a18d4 = /image\/(png|jpe?g)/.test(_0x31ff36); | ||
if (_0x4a18d4) { | ||
let _0x2c3508 = await _0x2d65cc(_0x16e1ad); | ||
let _0x17024e = await BardImg(_0x2d15fc, _0x2c3508); | ||
const mea_0 = await _0x17024e.content ; | ||
const mea = mea_0 +"\n\n*_©️ʙᴀʀᴅ: ʙʏ ɴᴀꜱʀᴜʟʟᴀʜ ᴍᴀᴄʜɪ🦹♂️_"; | ||
_0x4be7c9.reply(mea); | ||
} else { | ||
await _0x4be7c9.reply("Only images are supported"); | ||
} | ||
} | ||
}; | ||
handler.help = ["bard2"]; | ||
handler.tags = ['ai']; | ||
handler.command = /^(bard2)$/i; | ||
export default handler; | ||
async function Bard(_0x43fecc) { | ||
return await bardAi.question({ | ||
'ask': _0x43fecc | ||
}); | ||
}; | ||
async function BardImg(_0x44c94d, _0x2b7bfe) { | ||
return await bardAi.questionWithImage({ | ||
'ask': _0x44c94d, | ||
'image': _0x2b7bfe | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { toAudio } from '../lib/converter.js' | ||
|
||
let handler = async (m, { conn, usedPrefix, command }) => { | ||
let q = m.quoted ? m.quoted : m | ||
/* let mime = (m.quoted ? m.quoted : m.msg).mimetype || '' | ||
if (!/video|audio/.test(mime)) throw `✳️ Reply to the video or voice note you want to convert to mp3 with the command :\n\n*${usedPrefix + command}*`*/ | ||
let media = await q.download?.() | ||
if (!media) throw '❎ Failed to download media' | ||
let audio = await toAudio(media, 'mp4') | ||
if (!audio.data) throw '❎ Error converting' | ||
conn.sendFile(m.chat, audio.data, 'audio.mp3', '', m, null, { mimetype: 'audio/mp4' }) | ||
} | ||
handler.help = ['tomp3'] | ||
handler.tags = ['fun'] | ||
handler.command = /^to(mp3|a(udio)?)$/i | ||
|
||
export default handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { toPTT } from '../lib/converter.js' | ||
|
||
let handler = async (m, { conn, usedPrefix, command }) => { | ||
let q = m.quoted ? m.quoted : m | ||
let mime = (m.quoted ? m.quoted : m.msg).mimetype || '' | ||
if (!/video|audio/.test(mime)) throw `✳️ Reply to the audio you want to convert to voice memo with :\n *${usedPrefix + command}*` | ||
let media = await q.download?.() | ||
if (!media) throw '❎ Failed to download media' | ||
let audio = await toPTT(media, 'mp4') | ||
if (!audio.data) throw '❎ Error converting' | ||
conn.sendFile(m.chat, audio.data, 'audio.mp3', '', m, true, { mimetype: 'audio/mp4' }) | ||
} | ||
handler.help = ['toav'] | ||
handler.tags = ['fun'] | ||
|
||
handler.command = ['toav', 'tovn'] | ||
|
||
export default handler |
Oops, something went wrong.