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 Feb 16, 2024
1 parent 76cff1e commit 15ec754
Show file tree
Hide file tree
Showing 38 changed files with 1,482 additions and 6 deletions.
12 changes: 6 additions & 6 deletions plugins/Quran-surah.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fetch from 'node-fetch';
import { translate } from '@vitalets/google-translate-api';

let Handler = async (m, { conn }) => {
let quranSurahHandler = async (m, { conn }) => {
try {
// Extract the surah number or name from the command text.
let surahInput = m.text.split(' ')[1];
Expand Down Expand Up @@ -59,13 +59,13 @@ ${translatedTafsirEnglish.text}`;
}
};

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

export default Handler;
export default quranSurahHandler;






40 changes: 40 additions & 0 deletions plugins/Tools-animeinfo.js
Original file line number Diff line number Diff line change
@@ -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;
21 changes: 21 additions & 0 deletions plugins/owner.banlist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

let handler = async (m, { conn, usedPrefix }) => {
let chats = Object.entries(global.db.data.chats).filter(chat => chat[1].isBanned)
let users = Object.entries(global.db.data.users).filter(user => user[1].banned)

m.reply(`
≡ *USERS BANNED*
▢ Total : *${users.length}*
${users ? '\n' + users.map(([jid], i) => `
${i + 1}. ${conn.getName(jid) == undefined ? 'UNKNOWN' : conn.getName(jid)}
${jid}
`.trim()).join('\n') : ''}
`.trim())
}
handler.help = ['listban']
handler.tags = ['owner']
handler.command = ['banlist', 'listban']

export default handler
1 change: 1 addition & 0 deletions plugins/plugin-all.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions plugins/plugin-install.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import axios from 'axios';
import fs from 'fs';
import path from 'path';

let handler = async (m, { text, usedPrefix, command }) => {
if (!text) throw `Please provide a plugin URL`;

// Extract the Gist ID from the URL
const gistId = text.match(/(?:\/|gist\.github\.com\/)([a-fA-F0-9]+)/);


if (!gistId) throw `Invalid plugin URL`;

const gistName = gistId[1];
const gistURL = `https://api.github.com/gists/${gistName}`;

try {
const response = await axios.get(gistURL);
const gistData = response.data;

if (!gistData || !gistData.files) {
throw `No valid files found in the Gist`;
}

for (const file of Object.values(gistData.files)) {
// Use the Gist file name as the plugin name
const pluginName = file.filename;

// Construct the path to save the plugin
const pluginPath = path.join('plugins', `${pluginName}`);

// Write the Gist file content to the plugin file
await fs.promises.writeFile(pluginPath, file.content);
m.reply(`successfully installed the plugin to Guru Bot`);
}
} catch (error) {
throw `Error fetching or saving the plugin: ${error.message}`;
}
};

handler.help = ['install'].map((v) => v + ' <Gist URL>');
handler.tags = ['plugin'];
handler.command = /^install$/i;

handler.owner = true;

export default handler;
36 changes: 36 additions & 0 deletions plugins/plugin-remove.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//https://github.com/Fabri115/botwhaita/blob/main/plugins/OWNER_deleteplugin.js

import { tmpdir } from 'os';
import path, { join } from 'path';
import {
readdirSync,
statSync,
unlinkSync,
existsSync,
readFileSync,
watch,
} from 'fs';

const handler = async (m, { conn, usedPrefix: _p, __dirname, args, text }) => {
const ar = Object.keys(plugins);
const ar1 = ar.map((v) => v.replace('.js', ''));

if (!text) throw `📌 *_Example usage:_*\n*#deleteplugin main-menu*`;

if (!ar1.includes(args[0])) {
return m.reply(`*🗃️ This plugin doesn't exist!*` +
`\n•••••••••••••••••••••••••••••••••••••••••••••••••••••••\n\n${ar1.map((v) => ' ' + v).join(`\n`)}`);
}

const file = join(__dirname, '../plugins/' + args[0] + '.js');
unlinkSync(file);
conn.reply(m.chat, `⚠️ *_The "plugins/${args[0]}.js" plugin has been deleted._*`, m);
};

handler.help = ['deleteplugin <name>'];
handler.tags = ['owner'];
handler.command = /^(deleteplugin|dp|remove)$/i;

handler.owner = true;

export default handler;
39 changes: 39 additions & 0 deletions plugins/rg-register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//import db from '../lib/database.js'

import { createHash } from 'crypto'
let Reg = /\|?(.*)([.|] *?)([0-9]*)$/i
let handler = async function (m, { conn, text, usedPrefix, command }) {
let user = global.db.data.users[m.sender]
let name2 = conn.getName(m.sender)
if (user.registered === true) throw `✳️ You are already registered\n\nDo you want to re-register?\n\n 📌 Use this command to remove your record \n*${usedPrefix}unreg* <Serial number>`
if (!Reg.test(text)) throw `⚠️ Format incorrect\n\n ✳️ Use this command: *${usedPrefix + command} name.age*\n📌Exemple : *${usedPrefix + command}* ${name2}.16`
let [_, name, splitter, age] = text.match(Reg)
if (!name) throw '✳️ The name cannot be empty'
if (!age) throw '✳️ age cannot be empty'
if (name.length >= 30) throw '✳️The name is too long'
age = parseInt(age)
if (age > 100) throw '👴🏻 Wow grandpa wants to play bot'
if (age < 5) throw '🚼 there is a grandpa baby jsjsj '
user.name = name.trim()
user.age = age
user.regTime = + new Date
user.registered = true
let sn = createHash('md5').update(m.sender).digest('hex')
m.reply(`
┌─「 *REGISTERED* 」─
▢ *NUMBER:* ${name}
▢ *AGE* : ${age} years
▢ *SERIEL NUMBER* :
${sn}
└──────────────
*${usedPrefix}help* to see menu
`.trim())
}
handler.help = ['reg'].map(v => v + ' <name.age>')
handler.tags = ['rg']

handler.command = ['verify', 'reg', 'register', 'registrar']

export default handler

13 changes: 13 additions & 0 deletions plugins/rg-sn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { createHash } from 'crypto'

let handler = async function (m, { conn, text, usedPrefix }) {
let sn = createHash('md5').update(m.sender).digest('hex')
m.reply(`
▢ *seriel number* : ${sn}
`.trim())
}
handler.help = ['mysn']
handler.tags = ['rg']
handler.command = ['nserie', 'sn', 'mysn']
handler.register = true
export default handler
19 changes: 19 additions & 0 deletions plugins/rg-unreg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//import db from '../lib/database.js'

import { createHash } from 'crypto'
let handler = async function (m, { conn, args, usedPrefix}) {
if (!args[0]) throw `✳️ *Enter serial number*\nCheck your serial number with the command...\n\n*${usedPrefix}nserie*`
let user = global.db.data.users[m.sender]
let sn = createHash('md5').update(m.sender).digest('hex')
if (args[0] !== sn) throw '⚠️ *Incorrect serial number*'
user.registered = false
m.reply(`✅ Register eliminated`)
}
handler.help = ['unreg <Num Serie>']
handler.tags = ['rg']

handler.command = ['unreg']
handler.register = true

export default handler

31 changes: 31 additions & 0 deletions plugins/sticker-emojimix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

import fetch from 'node-fetch'
import { sticker } from '../lib/sticker.js'

const fetchJson = (url, options) => new Promise(async (resolve, reject) => {
fetch(url, options)
.then(response => response.json())
.then(json => {
resolve(json)
})
.catch((err) => {
reject(err)
})})

let handler = async (m, { conn, text, args, usedPrefix, command }) => {

if (!args[0]) throw `📌 Example : ${usedPrefix + command} 😎+🤑`
if (!text.includes('+')) throw `✳️ Separate the emoji with a *+* \n\n📌 Example : \n*${usedPrefix + command}* 😎+🤑`
let [emoji, emoji2] = text.split`+`
let anu = await fetchJson(`https://tenor.googleapis.com/v2/featured?key=AIzaSyAyimkuYQYF_FXVALexPuGQctUWRURdCYQ&contentfilter=high&media_filter=png_transparent&component=proactive&collection=emoji_kitchen_v5&q=${encodeURIComponent(emoji)}_${encodeURIComponent(emoji2)}`)
for (let res of anu.results) {
let stiker = await sticker(false, res.url, global.packname, global.author)
conn.sendFile(m.chat, stiker, null, { asSticker: true }, m)
}}

handler.help = ['emojimix <emoji+emoji>']
handler.tags = ['sticker']
handler.command = ['emojimix']
handler.diamond = true

export default handler
35 changes: 35 additions & 0 deletions plugins/sticker-getsticker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

import fg from 'api-dylux'
import fetch from 'node-fetch'
import { sticker } from '../lib/sticker.js'
let handler = async (m, { conn, args, text, usedPrefix, command }) => {
if (!args[0]) throw `✳️ enter what you want to search \n\n📌*Example:*\n${usedPrefix + command} homero`

//Result https://getstickerpack.com/
try {
/*let res = await fetch(global.API('fgmods', '/api/getsticker', { q:text }, 'apikey'))
let json = await res.json()*/
let json = await fg.StickerSearch(text)
m.reply(`
✅ Result
▢ *Title:* ${json.title}
▢ *Total stickers:* ${json.sticker_url.length}
▢ *Estimated shipping time:* _*${json.sticker_url.length * 2} s*_`)
for (let i of json.sticker_url) {
const stiker = await sticker(false, i, global.packname, global.author)
await conn.sendFile(m.chat, stiker, 'sticker.webp', '', m)
//await delay(1500)
}
} catch (e) {
m.reply(`❇️ Error: try another`)
}
}
handler.help = ['getsticker']
handler.tags = ['sticker']
handler.command = ['getsticker', 'getstick', 'stickersearch', 'sticksearch']
handler.diamond = false

export default handler

const delay = time => new Promise(res => setTimeout(res, time))
17 changes: 17 additions & 0 deletions plugins/sticker-scircle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import uploadImage from '../lib/uploadImage.js'
import { sticker } from '../lib/sticker.js'
let handler = async (m, { conn, text }) => {
try {
let q = m.quoted ? m.quoted : m
let mime = (q.msg || q).mimetype || ''
let img = await q.download()
let url = await uploadImage(img)
let scircle = global.API('dzx', '/api/canvas/circle', { url })
let stiker = await sticker(null, scircle, global.packname, global.author)
conn.sendFile(m.chat, stiker, 'sticker.webp', '', m, { asSticker: true })
} catch (e) {
m.reply('*[❗𝐈𝐍𝐅𝐎❗] respond to a image to make it circle sticker*')
}}
handler.command = /^scircle|circle$/i
export default handler
/* `https://api.dhamzxploit.my.id/api/canvas/circle?url=${url}` */
38 changes: 38 additions & 0 deletions plugins/sticker-smaker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import uploadImage from '../lib/uploadImage.js'
import { sticker } from '../lib/sticker.js'

const effects = ['jail', 'gay', 'glass', 'wasted' ,'triggered', 'lolice', 'simpcard', 'horny']

let handler = async (m, { conn, usedPrefix, text, command }) => {
let effect = text.trim().toLowerCase()
if (!effects.includes(effect)) throw `
┌─⊷ *EFFECTS*
${effects.map(effect => `▢ ${effect}`).join('\n')}
└───────────
📌 *Example:*
${usedPrefix + command} wasted
`.trim()
let q = m.quoted ? m.quoted : m
let mime = (q.msg || q).mimetype || ''
if (!mime) throw '✳️ Respond to an image'
if (!/image\/(jpe?g|png)/.test(mime)) throw `✳️ Format not supported`
let img = await q.download()
let url = await uploadImage(img)
let apiUrl = global.API('https://some-random-api.com/canvas/', encodeURIComponent(effect), {
avatar: url
})
try {
let stiker = await sticker(null, apiUrl, global.packname, global.author)
conn.sendFile(m.chat, stiker, null, { asSticker: true }, m)
} catch (e) {
m.reply('Conversion to sticker error, send as image instead')
await conn.sendFile(m.chat, apiUrl, 'smaker.png', null, m)
}}
handler.help = ['smaker']
handler.tags = ['sticker']
handler.command = ['stickmaker', 'stickermaker', 'smaker']
handler.diamond = false

export default handler
Loading

0 comments on commit 15ec754

Please sign in to comment.