-
Notifications
You must be signed in to change notification settings - Fork 203
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
Showing
83 changed files
with
1,387,165 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import config from '../../config.cjs'; | ||
import axios from 'axios'; | ||
|
||
const cricketScore = async (m, Matrix) => { | ||
const prefix = config.PREFIX; | ||
const cmd = m.body.startsWith(prefix) ? m.body.slice(prefix.length).split(' ')[0].toLowerCase() : ''; | ||
const text = m.body.slice(prefix.length + cmd.length).trim(); | ||
|
||
const validCommands = ['score', 'crick', 'crickterscore', 'cricket']; | ||
|
||
if (validCommands.includes(cmd)) { | ||
if (!text) { | ||
await m.React("❌"); | ||
return m.reply(`*Provide a match ID for cricket score.*\nExample: ${prefix}cricketscore 12345`); | ||
} | ||
|
||
const matchId = encodeURIComponent(text); | ||
|
||
try { | ||
const apiUrl = `https://iol.apinepdev.workers.dev/${matchId}`; | ||
const response = await axios.get(apiUrl); | ||
|
||
if (!response.status === 200) { | ||
await m.React("❌"); | ||
return m.reply(`Invalid response from the cricket score API. Status code: ${response.status}`); | ||
} | ||
|
||
const result = response.data; | ||
|
||
let formattedResult = `╭══════════════•∞•══╮\n`; | ||
formattedResult += `│⿻ *BONIFHACE MD*\n`; | ||
formattedResult += `│⿻ *LIVE MATCH INFO* ✨\n`; | ||
formattedResult += `│⿻\n`; | ||
|
||
if (result.code === 200) { | ||
formattedResult += `│⿻ *${result.data.title}*\n`; | ||
formattedResult += `│⿻ *${result.data.update}*\n`; | ||
formattedResult += `│⿻ \n`; | ||
} else { | ||
await m.reply(`*Update:* Data not found for the specified match ID.`); | ||
await m.React("❌"); | ||
return; | ||
} | ||
|
||
if (result.data.liveScore && result.data.liveScore.toLowerCase() !== "data not found") { | ||
formattedResult += `│⿻ *Live Score:* ${result.data.liveScore}\n`; | ||
formattedResult += `│⿻ *Run Rate:* ${result.data.runRate}\n`; | ||
formattedResult += `│⿻\n`; | ||
formattedResult += `│⿻ *Batter 1:* ${result.data.batsmanOne}\n`; | ||
formattedResult += `│⿻ *${result.data.batsmanOneRun} (${result.data.batsmanOneBall})* SR: ${result.data.batsmanOneSR}\n`; | ||
formattedResult += `│⿻\n`; | ||
formattedResult += `│⿻ *Batter 2:* ${result.data.batsmanTwo}\n`; | ||
formattedResult += `│⿻ *${result.data.batsmanTwoRun} (${result.data.batsmanTwoBall})* SR: ${result.data.batsmanTwoSR}\n`; | ||
formattedResult += `│⿻\n`; | ||
formattedResult += `│⿻ *Bowler 1:* ${result.data.bowlerOne}\n`; | ||
formattedResult += `│⿻ *${result.data.bowlerOneOver} overs, ${result.data.bowlerOneRun}/${result.data.bowlerOneWickets}, Econ:* ${result.data.bowlerOneEconomy}\n`; | ||
formattedResult += `│⿻\n`; | ||
formattedResult += `│⿻ *Bowler 2:* ${result.data.bowlerTwo}\n`; | ||
formattedResult += `│⿻ *${result.data.bowlerTwoOver} overs, ${result.data.bowlerTwoRun}/${result.data.bowlerTwoWicket}, Econ:* ${result.data.bowlerTwoEconomy}\n`; | ||
} | ||
|
||
formattedResult += `╰══•∞•═══════════════╯ `; | ||
|
||
await m.reply(formattedResult); | ||
await m.React("✅"); | ||
} catch (error) { | ||
console.error(error); | ||
await m.React("❌"); | ||
return m.reply(`An error occurred while processing the cricket score request. ${error.message}`); | ||
} | ||
} | ||
}; | ||
|
||
export default cricketScore; |
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 { dBinary } from '../../lib/binary.cjs'; | ||
import config from '../../config.cjs'; | ||
|
||
const dbinary = async (m, gss) => { | ||
const prefix = config.PREFIX; | ||
const cmd = m.body.startsWith(prefix) ? m.body.slice(prefix.length).split(' ')[0].toLowerCase() : ''; | ||
const text = m.body.slice(prefix.length + cmd.length).trim(); | ||
|
||
const validCommands = ['dbinary']; | ||
|
||
if (validCommands.includes(cmd)) { | ||
if (!text) return m.reply('Please provide a text.'); | ||
let db = await dBinary(text) | ||
m.reply(db) | ||
} | ||
}; | ||
|
||
export default dbinary; |
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,36 @@ | ||
import config from '../../config.cjs'; | ||
|
||
const deleteMessage = async (m, gss) => { | ||
try { | ||
const botNumber = await gss.decodeJid(gss.user.id); | ||
const isCreator = [botNumber, config.OWNER_NUMBER + '@s.whatsapp.net'].includes(m.sender); | ||
const prefix = config.PREFIX; | ||
const cmd = m.body.startsWith(prefix) ? m.body.slice(prefix.length).split(' ')[0].toLowerCase() : ''; | ||
const text = m.body.slice(prefix.length + cmd.length).trim(); | ||
|
||
const validCommands = ['del', 'delete']; | ||
|
||
if (validCommands.includes(cmd)) { | ||
if (!isCreator) { | ||
return m.reply("*📛 THIS IS AN OWNER COMMAND*"); | ||
} | ||
|
||
if (!m.quoted) { | ||
return m.reply('✳️ Reply to the message you want to delete'); | ||
} | ||
|
||
const key = { | ||
remoteJid: m.from, | ||
id: m.quoted.key.id, | ||
participant: m.quoted.key.participant || m.quoted.key.remoteJid | ||
}; | ||
|
||
await gss.sendMessage(m.from, { delete: key }); | ||
} | ||
} catch (error) { | ||
console.error('Error deleting message:', error); | ||
m.reply('An error occurred while trying to delete the message.'); | ||
} | ||
}; | ||
|
||
export default deleteMessage; |
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 config from '../../config.cjs'; | ||
|
||
const demote = async (m, gss) => { | ||
try { | ||
const prefix = config.PREFIX; | ||
const cmd = m.body.startsWith(prefix) ? m.body.slice(prefix.length).split(' ')[0].toLowerCase() : ''; | ||
const text = m.body.slice(prefix.length + cmd.length).trim(); | ||
|
||
const validCommands = ['demote', 'unadmin']; | ||
|
||
if (!validCommands.includes(cmd)) return; | ||
|
||
|
||
if (!m.isGroup) return m.reply("*📛 THIS COMMAND CAN ONLY BE USED IN GROUPS*"); | ||
const groupMetadata = await gss.groupMetadata(m.from); | ||
const participants = groupMetadata.participants; | ||
const botNumber = await gss.decodeJid(gss.user.id); | ||
const botAdmin = participants.find(p => p.id === botNumber)?.admin; | ||
const senderAdmin = participants.find(p => p.id === m.sender)?.admin; | ||
|
||
if (!botAdmin) return m.reply("*📛 BOT MUST BE AN ADMIN TO USE THIS COMMAND*"); | ||
if (!senderAdmin) return m.reply("*📛 YOU MUST BE AN ADMIN TO USE THIS COMMAND*"); | ||
|
||
if (!m.mentionedJid) m.mentionedJid = []; | ||
|
||
if (m.quoted?.participant) m.mentionedJid.push(m.quoted.participant); | ||
|
||
const users = m.mentionedJid.length > 0 | ||
? m.mentionedJid | ||
: text.replace(/[^0-9]/g, '').length > 0 | ||
? [text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'] | ||
: []; | ||
|
||
if (users.length === 0) { | ||
return m.reply("*📛 PLEASE MENTION OR QUOTE A USER TO DEMOTE*"); | ||
} | ||
|
||
const validUsers = users.filter(Boolean); | ||
|
||
await gss.groupParticipantsUpdate(m.from, validUsers, 'demote') | ||
.then(() => { | ||
const demotedNames = validUsers.map(user => `@${user.split("@")[0]}`); | ||
m.reply(`*USERS ${demotedNames} DEMOTED SUCCESSFULLY IN THE GROUP ${groupMetadata.subject}*`); | ||
}) | ||
.catch(() => m.reply('Failed to demote user(s) in the group.')); | ||
} catch (error) { | ||
console.error('Error:', error); | ||
m.reply('An error occurred while processing the command.'); | ||
} | ||
}; | ||
|
||
export default demote; |
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,43 @@ | ||
import pkg from "nayan-media-downloader"; | ||
const { GDLink } = pkg; | ||
import config from '../../config.cjs'; | ||
|
||
const gdriveDownload = async (m, Matrix) => { | ||
const prefix = config.PREFIX; | ||
const cmd = m.body.startsWith(prefix) ? m.body.slice(prefix.length).split(' ')[0].toLowerCase() : ''; | ||
const text = m.body.slice(prefix.length + cmd.length).trim(); | ||
|
||
const validCommands = ['gdrive', 'gd', 'gddownload']; | ||
|
||
if (validCommands.includes(cmd)) { | ||
if (!text) return m.reply('Please provide a Google Drive URL.'); | ||
|
||
try { | ||
await m.React('🕘'); | ||
|
||
const gdriveUrl = text; | ||
const gdriveInfo = await GDLink(gdriveUrl); | ||
|
||
if (gdriveInfo && gdriveInfo.status && gdriveInfo.data) { | ||
const mediaUrl = gdriveInfo.data; | ||
const caption = `> © Powered By BONIFHACE-MD`; | ||
|
||
// Inferring the file type based on the file extension | ||
const extension = mediaUrl.split('.').pop().toLowerCase(); | ||
|
||
// Send the media using Matrix.sendMedia | ||
await Matrix.sendMedia(m.from, mediaUrl, extension, caption, m); | ||
|
||
await m.React('✅'); | ||
} else { | ||
throw new Error('Invalid response from Google Drive.'); | ||
} | ||
} catch (error) { | ||
console.error('Error downloading Google Drive file:', error.message); | ||
m.reply('Error downloading Google Drive file.'); | ||
await m.React('❌'); | ||
} | ||
} | ||
}; | ||
|
||
export default gdriveDownload; |
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 { eBinary } from '../../lib/binary.cjs'; | ||
import config from '../../config.cjs'; | ||
|
||
const ebinary = async (m, gss) => { | ||
const prefix = config.PREFIX; | ||
const cmd = m.body.startsWith(prefix) ? m.body.slice(prefix.length).split(' ')[0].toLowerCase() : ''; | ||
const text = m.body.slice(prefix.length + cmd.length).trim(); | ||
|
||
const validCommands = ['ebinary']; | ||
|
||
if (validCommands.includes(cmd)) { | ||
if (!text) return m.reply('Please provide a question.'); | ||
let db = await eBinary(text) | ||
m.reply(db) | ||
} | ||
}; | ||
|
||
export default ebinary; |
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,37 @@ | ||
import fetch from 'node-fetch'; | ||
import fs from 'fs'; | ||
import config from '../../config.cjs'; | ||
|
||
const emojimix = async (m, Matrix) => { | ||
try { | ||
const prefix = config.PREFIX; | ||
const cmd = m.body.startsWith(prefix) ? m.body.slice(prefix.length).split(' ')[0].toLowerCase() : ''; | ||
const text = m.body.slice(prefix.length + cmd.length).trim(); | ||
|
||
const validCommands = ['emojimix', 'emix']; | ||
if (!validCommands.includes(cmd)) return; | ||
|
||
let [emoji1, emoji2] = text.split('+'); | ||
if (!emoji1 || !emoji2) { | ||
return m.reply(`Example: ${prefix + cmd} 😅+🤔`); | ||
} | ||
|
||
const url = `https://tenor.googleapis.com/v2/featured?key=AIzaSyAyimkuYQYF_FXVALexPuGQctUWRURdCYQ&contentfilter=high&media_filter=png_transparent&component=proactive&collection=emoji_kitchen_v5&q=${encodeURIComponent(emoji1)}_${encodeURIComponent(emoji2)}`; | ||
const response = await fetch(url); | ||
const anu = await response.json(); | ||
|
||
if (!anu.results || anu.results.length === 0) { | ||
return m.reply('No emoji mix found for the provided emojis.'); | ||
} | ||
|
||
for (let res of anu.results) { | ||
const encmedia = await Matrix.sendImageAsSticker(m.from, res.url, m, { packname: "", author: "BONIFHACE-MD", categories: res.tags }); | ||
await fs.unlinkSync(encmedia); | ||
} | ||
} catch (error) { | ||
console.error('Error:', error); | ||
m.reply('An error occurred while processing the command.'); | ||
} | ||
}; | ||
|
||
export default emojimix; |
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,35 @@ | ||
jimport { createRequire } from 'module'; | ||
import config from '../../config.cjs'; | ||
import path from 'path'; | ||
|
||
const require = createRequire(import.meta.url); | ||
const __filename = new URL(import.meta.url).pathname; | ||
const __dirname = path.dirname(__filename); | ||
const reminiPath = path.resolve(__dirname, '../remini.cjs'); | ||
const { remini } = require(reminiPath); | ||
|
||
const tohd = async (m, gss) => { | ||
const prefix = config.PREFIX; | ||
const cmd = m.body.startsWith(prefix) ? m.body.slice(prefix.length).split(' ')[0].toLowerCase() : ''; | ||
const text = m.body.slice(prefix.length + cmd.length).trim(); | ||
const validCommands = ['hdr', 'hd', 'remini', 'enhance', 'upscale']; | ||
|
||
if (validCommands.includes(cmd)) { | ||
if (!m.quoted || m.quoted.mtype !== 'imageMessage') { | ||
return m.reply(`*Send/Reply with an Image to Enhance Your Picture Quality ${prefix + cmd}*`); | ||
} | ||
|
||
const media = await m.quoted.download(); | ||
|
||
try { | ||
let proses = await remini(media, "enhance"); // Call remini directly | ||
gss.sendMessage(m.from, { image: proses, caption: `> *Hey ${m.pushName} Here Is Your Enhanced Image By BONIFHACE-MD*` }, { quoted: m }); | ||
|
||
} catch (error) { | ||
console.error('Error processing media:', error); | ||
m.reply('Error processing media.'); | ||
} | ||
} | ||
}; | ||
|
||
export default tohd; |
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,25 @@ | ||
import config from '../../config.cjs'; | ||
|
||
const leaveGroup = async (m, gss) => { | ||
try { | ||
const botNumber = await gss.decodeJid(gss.user.id); | ||
const isCreator = [botNumber, config.OWNER_NUMBER + '@s.whatsapp.net'].includes(m.sender); | ||
const prefix = config.PREFIX; | ||
const cmd = m.body.startsWith(prefix) ? m.body.slice(prefix.length).split(' ')[0].toLowerCase() : ''; | ||
const text = m.body.slice(prefix.length + cmd.length).trim(); | ||
|
||
const validCommands = ['leave', 'exit', 'left']; | ||
|
||
if (!validCommands.includes(cmd)) return; | ||
|
||
if (!m.isGroup) return m.reply("*📛 THIS COMMAND CAN ONLY BE USED IN GROUPS*"); | ||
|
||
if (!isCreator) return m.reply("*📛 THIS IS AN OWNER COMMAND*"); | ||
|
||
await gss.groupLeave(m.from); | ||
} catch (error) { | ||
console.error('Error:', error); | ||
} | ||
}; | ||
|
||
export default leaveGroup; |
Oops, something went wrong.