Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Nasrullahmalik authored Dec 25, 2023
1 parent 9513a64 commit 7c75a10
Show file tree
Hide file tree
Showing 8 changed files with 1,224 additions and 0 deletions.
71 changes: 71 additions & 0 deletions plugins/Quran-surah.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import fetch from 'node-fetch';
import { translate } from '@vitalets/google-translate-api';

let Handler = async (m, { conn }) => {
try {
// Extract the surah number or name from the command text.
let surahInput = m.text.split(' ')[1];

if (!surahInput) {
throw new Error(`Please specify the surah number or name`);
}

let surahListRes = await fetch('https://quran-endpoint.vercel.app/quran');
let surahList = await surahListRes.json();

let surahData = surahList.data.find(surah =>
surah.number === Number(surahInput) ||
surah.asma.ar.short.toLowerCase() === surahInput.toLowerCase() ||
surah.asma.en.short.toLowerCase() === surahInput.toLowerCase()
);

if (!surahData) {
throw new Error(`Couldn't find surah with number or name "${surahInput}"`);
}

let res = await fetch(`https://quran-endpoint.vercel.app/quran/${surahData.number}`);

if (!res.ok) {
let error = await res.json();
throw new Error(`API request failed with status ${res.status} and message ${error.message}`);
}

let json = await res.json();

// Translate tafsir from Bahasa Indonesia to Urdu
let translatedTafsirUrdu = await translate(json.data.tafsir.id, { to: 'ur', autoCorrect: true });

// Translate tafsir from Bahasa Indonesia to English
let translatedTafsirEnglish = await translate(json.data.tafsir.id, { to: 'en', autoCorrect: true });

let quranSurah = `
🕌 *Quran: The Holy Book*\n
📜 *Surah ${json.data.number}: ${json.data.asma.ar.long} (${json.data.asma.en.long})*\n
Type: ${json.data.type.en}\n
Number of verses: ${json.data.ayahCount}\n
🔮 *Explanation (Urdu):*\n
${translatedTafsirUrdu.text}\n
🔮 *Explanation (English):*\n
${translatedTafsirEnglish.text}`;

m.reply(quranSurah);

if (json.data.recitation.full) {
conn.sendFile(m.chat, json.data.recitation.full, 'recitation.mp3', null, m, true, { type: 'audioMessage', ptt: true });
}
} catch (error) {
console.error(error);
m.reply(`Error: ${error.message}`);
}
};

Handler.help = ['quran [surah_number|surah_name]'];
Handler.tags = ['quran', 'surah'];
Handler.command = ['quran', 'surah']

export default Handler;





28 changes: 28 additions & 0 deletions plugins/ai-bing2.js
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 Bing`;
}

try {
m.react('👁');

const API_URL = `https://aemt.me/bingai?text=${encodeURIComponent(text)}`;
const response = await fetch(API_URL);
const data = await response.json();

if (data.status && data.result) {
const respuestaAPI = data.result + "_©️Bing: ʙʏ ɴᴀꜱʀᴜʟʟᴀʜ ᴍᴀᴄʜɪ🦹‍♂️_";
conn.reply(m.chat, respuestaAPI, m);
} else {
throw '*Server is busy now. Try again Later.*';
}
} catch (error) {
throw `*Error*`;
}
};

handler.command = /^bing$/i;

export default handler;
32 changes: 32 additions & 0 deletions plugins/ai_bard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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
32 changes: 32 additions & 0 deletions plugins/aimalik_bard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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
31 changes: 31 additions & 0 deletions plugins/malik-cricket.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import axios from "axios"
let handler = async (m, { args }) => {
if (!args[0]) throw "No matchs found. Or Type correct match id"
const response = axios.get(`https://cric-theta.vercel.app/score?url=https://m.cricbuzz.com/cricket-commentary/${args}&timestamp=`+new Date());
const res = await response

let msg = ''
if (res.data.title) msg += res.data.title + `\n`
if (res.data.update) msg += `*`+res.data.update + `*\n\n`
if (res.data.current) msg += '*'+res.data.current + `*\n`
if (res.data.batsman) msg += `Batsman 🏏: *${res.data.batsman} - ${res.data.batsmanrun} ${res.data.ballsfaced}\n`
if (res.data.sr) msg +=`Strike rate: ${res.data.sr}\n`
if (res.data.batsman) msg +=`Batsman 2 🏏: *${res.data.batsmantwo}* - ${res.data.batsmantworun} ${res.data.batsmantwoballsfaced}\n`
if (res.data.batsman) msg += `Strike rate: ${res.data.batsmantwosr}\n\n`
if (res.data.batsman) msg += `Bowler ⚾: *${res.data.bowler}*\n`
if (res.data.batsman) msg +=`Over: ${res.data.bowlerover}\n`
if (res.data.batsman) msg += `Runs: ${res.data.bowlerruns}\n`
if (res.data.batsman) msg +=`Wickets: ${res.data.bowlerwickets}\n`
if (res.data.batsman) msg+=`Bowler 2: ${res.data.bowlertwo}\n\n`
if (res.data.batsman) {
msg += `${res.data.recentballs}\n\n`
msg += `Last wicket ❌ ${res.data.lastwicket}\n`
msg += `Run rate %: *${res.data.runrate}*\n`
}
m.reply('*Live score updating... 🏏🏏*')
m.reply(msg)
}
handler.help = ['score *<matchID>*']
handler.tags = ['herramientas']
handler.command = /^(cricket|score)$/i
export default handler
23 changes: 23 additions & 0 deletions plugins/malik-geonews.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import axios from "axios"
let handler = async (m, { args }) => {
const response = axios.get(`https://cric-theta.vercel.app/geo?url=https://urdu.geo.tv/`);
const res = await response

let msg = ''
if (res.data.newsb) msg += "\n📺*جیو نیوز*\n\n" + res.data.newsb
if (res.data.newsc) msg += res.data.newsc
if (res.data.newsd) msg += res.data.newsd
if (res.data.newse) msg += res.data.newse
if (res.data.newsf) msg += res.data.newsf
if (res.data.newg) msg += res.data.newsg
if (res.data.newsh) msg += res.data.newsh
if (res.data.newsi) msg += res.data.newsi
if (res.data.newsj) msg += res.data.newsj
if (res.data.newsk) msg += res.data.newsk

m.reply(msg)
}
handler.help = ['geo']
handler.tags = ['herramientas']
handler.command = /^(geo|geonews)$/i
export default handler
Loading

0 comments on commit 7c75a10

Please sign in to comment.