-
Notifications
You must be signed in to change notification settings - Fork 1
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
53ae9a8
commit 800a3e3
Showing
1 changed file
with
49 additions
and
0 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,49 @@ | ||
// pake lolapi kalo modul brainly error di panel | ||
import { Brainly } from 'brainly-scraper-v2' | ||
|
||
Brainly.initialize() | ||
const brain = new Brainly('id') | ||
|
||
let handler = async (m, { conn, text, usedPrefix, command }) => { | ||
if (!text) throw `Example: ${usedPrefix + command} Soekarno adalah` | ||
try { | ||
let anu = await brain.search(text) | ||
let txt = '*Result :*' | ||
for (let x of anu) { | ||
txt += `\n\n*QUESTION :*\n${x.question.content}\n` | ||
for (let y of x.question.attachments) { | ||
txt += `_- ${y}_\n` | ||
} | ||
txt += `*ANSWER :*\n${x.answers[0].content}\n` | ||
for (let y of x.answers[0].attachments) { | ||
txt += `_- ${y}_\n` | ||
} | ||
txt += `───────────────────` | ||
} | ||
await m.reply(txt.replace(/(<([^>]+)>)/ig, '')) | ||
} catch (e) { | ||
try { | ||
let anu = await (await fetch(`https://api.lolhuman.xyz/api/brainly?apikey=${api.lol}&query=${text}`)).json() | ||
if (anu.status != 200) return m.reply('no ingfo') | ||
let txt = '' | ||
for (let x of anu.result) { | ||
txt += `\n\n*QUESTION :*\n${x.question.content}` | ||
+ `\n*ANSWER :*\n${x.answer.content}` | ||
+ `\n───────────────────` | ||
} | ||
await m.reply(txt.replace(/(<([^>]+)>)/ig, '')) | ||
} catch (e) { | ||
console.log(e) | ||
throw 'informasi tidak tersedia' | ||
} | ||
} | ||
} | ||
|
||
handler.help = ['brainly <teks>'] | ||
handler.tags = ['information'] | ||
handler.command = /^(brainly)$/i | ||
|
||
handler.premium = true | ||
handler.limit = true | ||
|
||
export default handler |