├── gif └── gif.json ├── lib └── file.json ├── media ├── media.json ├── antibot.gif └── remover.gif ├── framework ├── dl │ ├── dl.json │ ├── Readme.md │ ├── Function.js │ └── ytdl-core.js ├── app.js ├── traduction.js ├── zokou.js ├── Readme.md ├── imgur.js ├── ytdl-core.js ├── text2prompt.js └── index.js ├── commandes ├── proprio.js ├── truecaller.js ├── img.js ├── ping.js ├── chatgpt.js ├── parole.js ├── fancy.js ├── voir.js ├── king.js ├── kingCarl.js ├── events.js ├── delete.js ├── test.js ├── warn.js ├── quote.js ├── profile.js ├── weather.js ├── ringtone.js ├── stickersearch.js ├── tts.js ├── stickcmd.js ├── alive.js ├── canvacord.js ├── hentai.js ├── heroku.js ├── koiuyhlpo.js ├── General.js ├── download.js ├── reaction.js ├── AI.js ├── devinette.js ├── yt-search.js ├── abu.js ├── anime.js ├── menu.js.prec ├── play2.js ├── youtube.js ├── games.js └── audioedit.js ├── set.env ├── SECURITY.md ├── LICENSE ├── .gitignore ├── set.js ├── bdd ├── alive.js ├── banUser.js ├── banGroup.js ├── cron.js ├── hentai.js ├── onlyAdmin.js ├── welcome.js ├── mention.js ├── warn.js ├── stickcmd.js ├── level.js ├── theme.js ├── sudo.js ├── antilien.js └── antibot.js ├── package.json ├── Procfile └── README.md /gif/gif.json: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lib/file.json: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /media/media.json: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /framework/dl/dl.json: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /framework/dl/Readme.md: -------------------------------------------------------------------------------- 1 | # JOHNLEOTECH 2 | -------------------------------------------------------------------------------- /media/antibot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnleothedevil/Johnleo-Md/HEAD/media/antibot.gif -------------------------------------------------------------------------------- /media/remover.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnleothedevil/Johnleo-Md/HEAD/media/remover.gif -------------------------------------------------------------------------------- /framework/app.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.reagir = void 0; 4 | async function reagir(dest, zok, msg, emoji) { 5 | await zok.sendMessage(dest, { react: { text: emoji, key: msg.key } }); 6 | } 7 | exports.reagir = reagir; 8 | 9 | -------------------------------------------------------------------------------- /framework/traduction.js: -------------------------------------------------------------------------------- 1 | const translatte = require('translatte'); 2 | 3 | async function traduire(text, options) { 4 | try { 5 | const result = await translatte(text, options); 6 | return result.text; 7 | } catch (error) { 8 | throw error; 9 | } 10 | } 11 | 12 | module.exports = traduire; 13 | -------------------------------------------------------------------------------- /framework/zokou.js: -------------------------------------------------------------------------------- 1 | var tabCmds = []; 2 | let cm = []; 3 | function zokou(obj, fonctions) { 4 | let infoComs = obj; 5 | if (!obj.categorie) { 6 | infoComs.categorie = "General"; 7 | } 8 | if (!obj.reaction) { 9 | infoComs.reaction = "🇳🇬"; 10 | } 11 | infoComs.fonction = fonctions; 12 | cm.push(infoComs); 13 | // console.log('chargement...') 14 | return infoComs; 15 | } 16 | module.exports = { zokou, Module: zokou, cm }; 17 | -------------------------------------------------------------------------------- /commandes/proprio.js: -------------------------------------------------------------------------------- 1 | const {zokou}=require("../framework/zokou") 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | zokou({nomCom:"reboot",categorie:"Mods",reaction:"☢️"},async(dest,z,com)=>{ 10 | 11 | 12 | 13 | const{repondre,ms,dev,superUser}=com; 14 | 15 | if(!superUser) 16 | { 17 | return repondre("command reserved for the owner only"); 18 | } 19 | 20 | const {exec}=require("child_process") 21 | 22 | repondre("*Johnleo-Md is rebooting...kindly be patient*"); 23 | 24 | exec("pm2 restart all"); 25 | 26 | 27 | 28 | 29 | 30 | 31 | }) 32 | -------------------------------------------------------------------------------- /set.env: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | OWNER_NAME="Carl William" 27 | PREFIX="." 28 | PUBLIC_MODE='yes' 29 | AUTO_READ_STATUS="yes" 30 | AUTO_DOWNLOAD_STATUS="no" 31 | BOT_NAME= "Cyberion Spark X" 32 | IMAGE_MENU= "https://telegra.ph/file/8607b7de6ec512c7886aa.jpg" 33 | NUMERO_OWNER= "254770954948" 34 | OWNER_NAME= "᚛Johnleo᚜" 35 | DATABASE_URL= "postgresql://postgres:bKlIqoOUWFIHOAhKxRWQtGfKfhGKgmRX@viaduct.proxy.rlwy.net:47738/railway" 36 | WARN_COUNT= "" 37 | OPENAI_API_KEY= "" 38 | STARTING_BOT_MESSAGE='yes' 39 | ANTI_DELETE_MESSAGE='yes' 40 | SESSION_ID='' 41 | -------------------------------------------------------------------------------- /commandes/truecaller.js: -------------------------------------------------------------------------------- 1 | const { 2 | 3 | Function, 4 | 5 | truecaller, 6 | 7 | isPublic 8 | 9 | } = require('../lib/'); 10 | 11 | 12 | 13 | Function({ 14 | 15 | pattern: 'true ?(.*)', 16 | 17 | fromMe: isPublic, 18 | 19 | desc: 'search number on truecaller', 20 | 21 | type: 'search' 22 | 23 | }, async (message, match, client) => { 24 | 25 | if (!match && !message.quoted) return await message.reply('_Enter the number you want to search_'); 26 | 27 | const number = message.quoted ? message.quoted.sender : match.replace(/[^0-9]/g, '') 28 | 29 | const result = await truecaller(number, message.user_id) 30 | 31 | return await message.reply(result); 32 | 33 | }) 34 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy of JohnleoTech Codes 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 5.1.x | :white_check_mark: | 11 | | 5.0.x | :x: | 12 | | 4.0.x | :white_check_mark: | 13 | | < 4.0 | :x: | 14 | 15 | ## Reporting a Vulnerability 16 | 17 | Use this section to tell people how to report a vulnerability. 18 | 19 | Tell them where to go, how often they can expect to get an update on a 20 | reported vulnerability, what to expect if the vulnerability is accepted or 21 | declined, etc. 22 | -------------------------------------------------------------------------------- /commandes/img.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | const {zokou} = require('../framework/zokou'); 5 | var gis = require('g-i-s'); 6 | 7 | 8 | zokou({ 9 | nomCom: "img", 10 | categorie: "Search", 11 | reaction: "📷" 12 | }, 13 | async (dest, zk, commandeOptions) => { 14 | const { repondre, ms, arg } = commandeOptions; 15 | 16 | if (!arg[0]) { 17 | repondre('which image ? !'); 18 | return; 19 | } 20 | 21 | const searchTerm = arg.join(" "); 22 | //repondre("termes " +searchTerm); 23 | gis(searchTerm,envoiImage); 24 | 25 | function envoiImage(e,r) 26 | { 27 | if(e){repondre("oups une error ")}else{for(var a=0;a<5;a++){zk.sendMessage(dest,{image:{url:r[a].url}},{quoted:ms});}} 28 | 29 | } 30 | 31 | //gis(searchTerm,envoiImage); 32 | 33 | }); 34 | -------------------------------------------------------------------------------- /framework/Readme.md: -------------------------------------------------------------------------------- 1 | # JOHNLEO TECH 2 |
3 | > 9 | -------------------------------------------------------------------------------- /commandes/ping.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const { zokou } = require("../framework/zokou"); 4 | zokou({ nomCom: "ping", reaction: "🧒", nomFichier: __filename }, async (dest, zk, commandeOptions) => { 5 | console.log("Commande saisie !!!s"); 6 | let z = '*🌍𝑩𝒐𝒕 𝒊𝒔 𝒐𝒏𝒍𝒊𝒏𝒆🌍* 🙏 \n\n ' + "𝑻𝒉𝒆 𝒃𝒐𝒕 𝒊𝒔 𝒄𝒖𝒓𝒓𝒆𝒏𝒕𝒍𝒚 𝒘𝒐𝒓𝒌𝒊𝒏𝒈 𝒐𝒏 𝒂 𝒈𝒐𝒐𝒅 𝒔𝒑𝒆𝒆𝒅😉👍"; 7 | let d = ' 𝑯𝒆𝒂𝒍𝒕𝒉 𝒔𝒕𝒂𝒕𝒖𝒔✨'; 8 | let varmess = z + d; 9 | var mp4 = 'https://telegra.ph/file/233ce4de1344e9d696f88.mp4'; 10 | await zk.sendMessage(dest, { video: { url: mp4 }, caption: varmess }); 11 | //console.log("montest") 12 | }); 13 | console.log("mon test"); 14 | 15 | -------------------------------------------------------------------------------- /framework/imgur.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const fs = require('fs'); 3 | const FormData = require('form-data'); 4 | 5 | async function uploadImageToImgur(imagePath, clientId) { 6 | try { 7 | const data = new FormData(); 8 | data.append('image', fs.createReadStream(imagePath)); 9 | 10 | const headers = { 11 | 'Authorization': `Client-ID ${clientId}`, 12 | ...data.getHeaders() 13 | }; 14 | 15 | const config = { 16 | method: 'post', 17 | maxBodyLength: Infinity, 18 | url: 'https://api.imgur.com/3/image', 19 | headers: headers, 20 | data: data 21 | }; 22 | 23 | const response = await axios(config); 24 | const imageUrl = response.data.data.link; 25 | return imageUrl; 26 | } catch (error) { 27 | console.error('Erreur lors de l\'envoi sur Imgur:', error); 28 | throw new Error('Une erreur est survenue lors de l\'envoi sur Imgur.'); 29 | } 30 | } 31 | 32 | module.exports = { uploadImageToImgur }; 33 | -------------------------------------------------------------------------------- /commandes/chatgpt.js: -------------------------------------------------------------------------------- 1 | const { bot, getGPTResponse, getDallEResponse } = require('../lib') 2 | 3 | bot( 4 | { 5 | pattern: 'gpt ?(.*)', 6 | fromMe: true, 7 | desc: 'ChatGPT fun', 8 | type: 'AI', 9 | }, 10 | async (message, match) => { 11 | match = match || message.reply_message.text 12 | if (!match) return await message.send('*Example : gpt What is the capital of France?*') 13 | const res = await getGPTResponse(match) 14 | await message.send(res, { quoted: message.data }) 15 | } 16 | ) 17 | 18 | bot( 19 | { 20 | pattern: 'dall ?(.*)', 21 | fromMe: true, 22 | desc: 'dall image generator', 23 | type: 'AI', 24 | }, 25 | async (message, match) => { 26 | if (!match) 27 | return await message.send( 28 | '*Example : dall a close up, studio photographic portrait of a white siamese cat that looks curious, backlit ears*' 29 | ) 30 | const res = await getDallEResponse(match) 31 | await message.sendFromUrl(res) 32 | } 33 | ) 34 | -------------------------------------------------------------------------------- /commandes/parole.js: -------------------------------------------------------------------------------- 1 | const {zokou} =require("../framework/zokou"); 2 | const axios =require("axios"); 3 | 4 | 5 | zokou({ nomCom: "lyrics", 6 | reaction: "🎼", 7 | categorie: "Search" }, async (dest, zk, commandeOptions) => { 8 | 9 | const { repondre, arg, ms } = commandeOptions; 10 | 11 | try { 12 | 13 | if (!arg || arg.length === 0) return repondre("please provide me the song name"); 14 | 15 | let result = await axios.get(`https://vihangayt.me/search/lyrics?q=${arg.join(' ')}`); 16 | 17 | let lyrics = result.data.data; 18 | 19 | if (lyrics.error) return repondre("no lyrics found"); 20 | 21 | let msg = `---------Johnelo-Md-lyrics-finder-------- 22 | 23 | * *Artist :* ${lyrics.artist} 24 | 25 | 26 | * *Title :* ${lyrics.title} 27 | 28 | 29 | ${lyrics.lyrics}` 30 | 31 | zk.sendMessage(dest,{image : { url : './media/lyrics-img.jpg'} , caption : msg}, { quoted : ms }); 32 | 33 | } catch (err) { 34 | repondre('Error') 35 | } 36 | }) 37 | -------------------------------------------------------------------------------- /commandes/fancy.js: -------------------------------------------------------------------------------- 1 | const { zokou } = require("../framework/zokou"); 2 | const fancy = require("../commandes/style"); 3 | 4 | zokou({ nomCom: "fancy", categorie: "Fun", reaction: "🏖" }, async (dest, zk, commandeOptions) => { 5 | const { arg, repondre, prefixe } = commandeOptions; 6 | const id = arg[0]?.match(/\d+/)?.join(''); 7 | const text = arg.slice(1).join(" "); 8 | 9 | try { 10 | if (id === undefined || text === undefined) { 11 | return await repondre(`\nExample : ${prefixe}fancy 10 Cyberion\n` + String.fromCharCode(8206).repeat(4001) + fancy.list('FLASH-MD', fancy)); 12 | } 13 | 14 | const selectedStyle = fancy[parseInt(id) - 1]; 15 | if (selectedStyle) { 16 | return await repondre(fancy.apply(selectedStyle, text)); 17 | } else { 18 | return await repondre('_Style introuvable :(_'); 19 | } 20 | } catch (error) { 21 | console.error(error); 22 | return await repondre('_Une erreur s\'est produite :(_'); 23 | } 24 | }); 25 | -------------------------------------------------------------------------------- /framework/ytdl-core.js: -------------------------------------------------------------------------------- 1 | const yts = require('yt-search'); 2 | const ytdl = require('ytdl-core'); 3 | const fs = require('fs'); 4 | 5 | 6 | /* fonction pour avoir les données d'une recherche*/ 7 | 8 | async function getytlink(key) { 9 | try { 10 | const resultat = await yts(key); 11 | const videos = resultat.videos; 12 | const choix = videos[0]; 13 | return { 14 | lien : choix.url , 15 | affiche : choix.thumbnail, 16 | titre : choix.title, 17 | duree : choix.timestamp, 18 | id : choix.videoId, 19 | } ; 20 | } catch (erreur) { 21 | console.error('Erreur lors de la recherche YouTube :', erreur); 22 | return null; 23 | } 24 | } 25 | 26 | module.exports = getytlink; 27 | 28 | /* fonction pour télécharger les videos avec ytdl-core*/ 29 | 30 | 31 | 32 | 33 | 34 | async function ytdwn(url) { 35 | const info = await ytdl.getInfo(url); 36 | const format = ytdl.chooseFormat(info.formats, { quality: '18' }); 37 | const video = ytdl.downloadFromInfo(info, format) 38 | 39 | return video ; 40 | 41 | } 42 | 43 | module.exports = ytdwn; 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 JohnleoTech 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /commandes/voir.js: -------------------------------------------------------------------------------- 1 | const {zokou}=require("../framework/zokou") ; 2 | 3 | 4 | 5 | zokou({nomCom:"vv",categorie:"General",reaction:"🤲🏿"},async(dest,zk,commandeOptions)=>{ 6 | 7 | const {ms,msgRepondu,repondre}=commandeOptions; 8 | 9 | 10 | if(!msgRepondu){return repondre("*Mentionne a view once media* .");} 11 | 12 | 13 | if(msgRepondu.viewOnceMessageV2) 14 | { 15 | if(msgRepondu.viewOnceMessageV2.message.imageMessage) 16 | { 17 | var image =await zk.downloadAndSaveMediaMessage(msgRepondu.viewOnceMessageV2.message.imageMessage) 18 | var texte = msgRepondu.viewOnceMessageV2.message.imageMessage.caption 19 | 20 | await zk.sendMessage(dest,{image:{url:image},caption:texte},{quoted:ms}) 21 | }else if(msgRepondu.viewOnceMessageV2.message.videoMessage){ 22 | 23 | var video = await zk.downloadAndSaveMediaMessage(msgRepondu.viewOnceMessageV2.message.videoMessage) 24 | var texte =msgRepondu.viewOnceMessageV2.message.videoMessage.caption 25 | 26 | 27 | await zk.sendMessage(dest,{video:{url:video},caption:texte},{quoted:ms}) 28 | 29 | } 30 | }else 31 | { 32 | return repondre("this message is not on view once .") 33 | } 34 | 35 | 36 | 37 | }) 38 | -------------------------------------------------------------------------------- /commandes/king.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const { zokou } = require("../framework/zokou"); 4 | zokou({ nomCom: "king", reaction: "📷", nomFichier: __filename }, async (dest, zk, commandeOptions) => { 5 | console.log("Commande saisie !!!s"); 6 | let z = 'KING-HD-PHOTO \n\n ' + "*ⁱᵇʳᵃʰⁱᵐ-ᵗᵉᶜʰ.*"; 7 | let d = ' #KING'S'; 8 | let varmess = z + d; 9 | var img = 'https://telegra.ph/file/675ca31f2f0fef5a711a0.jpg'; 10 | await zk.sendMessage(dest, { image: { url: img }, caption: varmess }); 11 | //console.log("montest") 12 | }); 13 | console.log("mon test"); 14 | /*module.exports.commande = () => { 15 | var nomCom = ["test","t"] 16 | var reaction="☺️" 17 | return { nomCom, execute,reaction } 18 | }; 19 | 20 | async function execute (origineMessage,zok) { 21 | console.log("Commande saisie !!!s") 22 | let z ='Salut je m\'appelle *FLASH-MD* \n\n '+'je suis un bot Whatsapp Multi-appareil ' 23 | let d =' developpé par *France King*' 24 | let varmess=z+d 25 | var img='https://telegra.ph/file/13d63c21c1a665bfd8324.jpg' 26 | await zok.sendMessage(origineMessage, { image:{url:img},caption:varmess}); 27 | } */ 28 | -------------------------------------------------------------------------------- /commandes/kingCarl.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const { zokou } = require("../framework/zokou"); 4 | zokou({ nomCom: "william", reaction: "📷", nomFichier: __filename }, async (dest, zk, commandeOptions) => { 5 | console.log("Commande saisie !!!s"); 6 | let z = 'JOHNLEO-HD-PHOTO \n\n ' + "*ᴄᴀʀʟ-ᴛᴇᴄʜ.*"; 7 | let d = ' #KING'S'; 8 | let varmess = z + d; 9 | var img = 'https://telegra.ph/file/675ca31f2f0fef5a711a0.jpg'; 10 | await zk.sendMessage(dest, { image: { url: img }, caption: varmess }); 11 | //console.log("montest") 12 | }); 13 | console.log("mon test"); 14 | /*module.exports.commande = () => { 15 | var nomCom = ["test","t"] 16 | var reaction="☺️" 17 | return { nomCom, execute,reaction } 18 | }; 19 | 20 | async function execute (origineMessage,zok) { 21 | console.log("Commande saisie !!!s") 22 | let z ='Salut je m\'appelle *FLASH-MD* \n\n '+'je suis un bot Whatsapp Multi-appareil ' 23 | let d =' developpé par *France King*' 24 | let varmess=z+d 25 | var img='https://telegra.ph/file/13d63c21c1a665bfd8324.jpg' 26 | await zok.sendMessage(origineMessage, { image:{url:img},caption:varmess}); 27 | } */ 28 | -------------------------------------------------------------------------------- /commandes/events.js: -------------------------------------------------------------------------------- 1 | const { zokou } = require('../framework/zokou'); 2 | const { attribuerUnevaleur } = require('../bdd/welcome'); 3 | 4 | async function events(nomCom) { 5 | zokou({ 6 | nomCom: "nomCom," 7 | categorie: 'Group' 8 | }, async (dest, zk, commandeOptions) => { 9 | const { ms, arg, repondre, superUser, verifAdmin } = commandeOptions; 10 | 11 | if (verifAdmin || superUser) { 12 | if (!arg[0] || arg.join(' ') === ' ') { 13 | repondre(nomCom + ' ' + ' on to active and ' + ' ' + nomCom + ' ' + 'off to put off'); 14 | } else { 15 | if (arg[0] === 'on' || arg[0] === 'off') { 16 | 17 | await attribuerUnevaleur(dest, nomCom, arg[0]); 18 | repondre( nomCom + "is actualised on " + arg[0]); 19 | } else { 20 | repondre('on for active and off for desactive'); 21 | } 22 | } 23 | } else { 24 | repondre('You can\'t use this commands '); 25 | } 26 | }); 27 | } 28 | 29 | // Appel de la fonction events pour les valeurs 'welcome' et 'goodbye' 30 | events('welcome'); 31 | events('goodbye'); 32 | events('antipromote'); 33 | events('antidemote') ; 34 | -------------------------------------------------------------------------------- /commandes/delete.js: -------------------------------------------------------------------------------- 1 | const { bot, setVar, parsedJid, isGroup } = require('../lib/index') 2 | 3 | bot( 4 | { 5 | pattern: 'delete ?(.*)', 6 | fromMe: true, 7 | desc: 'anti delete', 8 | type: 'whatsapp', 9 | }, 10 | async (message, match) => { 11 | const jid = parsedJid(match)[0] 12 | if (!match || (match != 'p' && match != 'g' && match != 'off' && !jid)) 13 | return await message.send( 14 | "*Anti delete Message*\n*Example :* delete p | g | off\n p - Send deleted messages to your chat or sudo\n g - Send deleted Message on chat where it delete\njid - Send deleted Message to jid\n off - Don't do anything with delete (off)" 15 | ) 16 | if (isGroup(jid)) { 17 | try { 18 | await message.groupMetadata(jid) 19 | } catch (error) { 20 | return await message.send(`_${jid} is invalid_`) 21 | } 22 | } else if (jid) { 23 | const exist = await message.onWhatsapp(jid) 24 | if (!exist) return await message.send(`_${jid} is invalid_`) 25 | } 26 | await setVar({ ANTI_DELETE: match }) 27 | const msg = jid 28 | ? `_Deleted Messages send to ${jid}_` 29 | : match == 'off' 30 | ? '_Anti delete Disabled_' 31 | : match == 'p' 32 | ? '_Deleted Messages send to your chat or sudo_' 33 | : '_Deleted Messages send to the chat itself_' 34 | await message.send(msg) 35 | } 36 | ) 37 | -------------------------------------------------------------------------------- /framework/text2prompt.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | 3 | async function text2prompt(text) { 4 | try { 5 | if(!text) return { status: false, message: "undefined reading text" }; 6 | return await new Promise(async(resolve, reject) => { 7 | axios.post("https://api-v1.junia.ai/api/free-tools/generate", JSON.stringify({ 8 | content: text, 9 | op: "op-prompt" 10 | })).then(res => { 11 | let prompt = res.data; 12 | if(prompt.length <= 2) reject("failed generating prompt"); 13 | prompt = prompt.replace(`"`, ``); 14 | resolve({ 15 | status: true, 16 | prompt 17 | }) 18 | }).catch(reject) 19 | }) 20 | } catch (e) { 21 | return { status: false, message: e }; 22 | } 23 | } 24 | 25 | // text2prompt("sad cat try to find some food").then(console.log).catch(console.log) 26 | // { 27 | // status: true, 28 | // prompt: "A forlorn, gray tabby cat with big, teary eyes desperately scavenges for food in a dimly lit alley, rain pouring down, reflecting the shimmering streetlights against the wet pavement. The cat's ribs are visible under its matted fur, conveying a sense of profound hunger and longing. The scene is captured in a realistic style, evoking empathy and compassion for the plight of this abandoned feline" 29 | // } 30 | 31 | module.exports = text2prompt; -------------------------------------------------------------------------------- /commandes/test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const { zokou } = require("../framework/zokou"); 4 | zokou({ nomCom: "repo", reaction: "🥴", nomFichier: __filename }, async (dest, zk, commandeOptions) => { 5 | console.log("Commande saisie !!!s"); 6 | let z = '𝐓𝐇𝐄 💀𝐃𝐄𝐕𝐈𝐋 😈 𝐉𝐎𝐇𝐍𝐋𝐄𝐎-𝐌𝐃😈 𝐁𝐘 𝐉𝐎𝐇𝐍𝐋𝐄𝐎 𝐓𝐄𝐂𝐇😈 \n\n ' + "𝐅𝐎𝐑𝐊 𝐓𝐇𝐄 𝐑𝐄𝐏𝐎 𝐓𝐎 𝐃𝐄𝐏𝐋𝐎𝐘 𝐘𝐎𝐔𝐑 𝐎𝐖𝐍 𝐁𝐎𝐓 *𝐉𝐎𝐇𝐍𝐋𝐄𝐎-𝐌𝐃 𝐑𝐄𝐏𝐎"; 7 | let d = 'https://github.com/johnleosmith/Johnleo-Md'; 8 | let varmess = z + d; 9 | var img = 'https://telegra.ph/file/ee73167f14236e3216935.jpg'; 10 | await zk.sendMessage(dest, { image: { url: img }, caption: varmess }); 11 | //console.log("montest") 12 | }); 13 | console.log("mon test"); 14 | /*module.exports.commande = () => { 15 | var nomCom = ["test","t"] 16 | var reaction="☺️" 17 | return { nomCom, execute,reaction } 18 | }; 19 | 20 | async function execute (origineMessage,zok) { 21 | console.log("Commande saisie !!!s") 22 | let z ='Salut je m\'appelle *FLASH-MD* \n\n '+'je suis un bot Whatsapp Multi-appareil ' 23 | let d =' developpé par *France King*' 24 | let varmess=z+d 25 | var img='https://telegra.ph/file/13d63c21c1a665bfd8324.jpg' 26 | await zok.sendMessage(origineMessage, { image:{url:img},caption:varmess}); 27 | } */ 28 | -------------------------------------------------------------------------------- /framework/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.genererNomFichier = exports.stick = exports.format = exports.styletext = exports.zJson = exports.getBuffer = exports.reaction = exports.police = exports.zokou = void 0; 4 | let { zokou } = require("./zokou"); 5 | exports.zokou = zokou; 6 | const mesfonctions_1 = require("./mesfonctions"); 7 | Object.defineProperty(exports, "reaction", { enumerable: true, get: function () { return mesfonctions_1.reaction; } }); 8 | Object.defineProperty(exports, "police", { enumerable: true, get: function () { return mesfonctions_1.police; } }); 9 | Object.defineProperty(exports, "getBuffer", { enumerable: true, get: function () { return mesfonctions_1.getBuffer; } }); 10 | Object.defineProperty(exports, "zJson", { enumerable: true, get: function () { return mesfonctions_1.zJson; } }); 11 | Object.defineProperty(exports, "format", { enumerable: true, get: function () { return mesfonctions_1.format; } }); 12 | Object.defineProperty(exports, "styletext", { enumerable: true, get: function () { return mesfonctions_1.styletext; } }); 13 | Object.defineProperty(exports, "stick", { enumerable: true, get: function () { return mesfonctions_1.stick; } }); 14 | Object.defineProperty(exports, "genererNomFichier", { enumerable: true, get: function () { return mesfonctions_1.genererNomFichier; } }); 15 | var { reagir } = require("./app"); 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | /auth 204 | /set.env 205 | /package-lock.json 206 | /node_modules 207 | /store.json 208 | /audio.mp3 209 | -------------------------------------------------------------------------------- /commandes/warn.js: -------------------------------------------------------------------------------- 1 | const { zokou } = require('../framework/zokou'); 2 | const {ajouterUtilisateurAvecWarnCount , getWarnCountByJID , resetWarnCountByJID} = require('../bdd/warn') 3 | const s = require("../set") 4 | 5 | 6 | zokou( 7 | { 8 | nomCom : 'warn', 9 | categorie : 'Group' 10 | 11 | },async (dest,zk,commandeOptions) => { 12 | 13 | const {ms , arg, repondre,superUser,verifGroupe,verifAdmin , msgRepondu , auteurMsgRepondu} = commandeOptions; 14 | if(!verifGroupe ) {repondre('this is a group commands') ; return}; 15 | 16 | if(verifAdmin || superUser) { 17 | if(!msgRepondu){repondre('reply a message of user to warn'); return}; 18 | 19 | if (!arg || !arg[0] || arg.join('') === '') { 20 | await ajouterUtilisateurAvecWarnCount(auteurMsgRepondu) 21 | let warn = await getWarnCountByJID(auteurMsgRepondu) 22 | let warnlimit = s.WARN_COUNT 23 | 24 | if( warn >= warnlimit ) { await repondre('this user reach limit of warning , so i kick him/her'); 25 | zk.groupParticipantsUpdate(dest, [auteurMsgRepondu], "remove") 26 | } else { 27 | 28 | var rest = warnlimit - warn ; 29 | repondre(`this user is warned , rest before kick : ${rest} `) 30 | } 31 | } else if ( arg[0] === 'reset') { await resetWarnCountByJID(auteurMsgRepondu) 32 | 33 | repondre("Warn count is reset for this user")} else ( repondre('reply to a user by typing .warn ou .warn reset')) 34 | 35 | } else { 36 | repondre('you are not admin') 37 | } 38 | 39 | }); 40 | -------------------------------------------------------------------------------- /commandes/quote.js: -------------------------------------------------------------------------------- 1 | const { zokou } = require('../framework/zokou'); 2 | 3 | zokou({ nomCom: 'quote', categorie: 'Fun' }, async (dest, zk, commandeOptions) => { 4 | const { ms, repondre, verifGroupe, arg } = commandeOptions; 5 | if (!verifGroupe) { 6 | repondre('Commande réservée au groupe uniquement'); 7 | return; 8 | } 9 | 10 | if (!arg[0]) { 11 | try { 12 | fetch('https://animechan.xyz/api/random') 13 | .then((response) => response.json()) 14 | .then(async (quote) => { 15 | repondre(`╔══════════════════════════╗ 16 | ║ JOHNLEO-MD ║ 17 | ╚══════════════════════════╝ 18 | 19 | 🎬 Anime: ${quote.anime} 20 | 👤 Character: ${quote.character} 21 | 💬 Quote: ${quote.quote} 22 | 23 | Powered by *Johnleo Tech*`); 24 | }); 25 | } catch (e) { 26 | repondre('Erreur lors de la génération de la citation : ' + e.message); 27 | } 28 | } else { 29 | const query = arg.join(' '); 30 | 31 | try { 32 | fetch('https://animechan.xyz/api/random/character?name=' + query) 33 | .then((response) => response.json()) 34 | .then(async (quote) => { 35 | repondre(`╔══════════════════════════╗ 36 | ║ JOHNLEO-MD ║ 37 | ╚══════════════════════════╝ 38 | 39 | 🎬 Anime: ${quote.anime} 40 | 👤 Character: ${quote.character} 41 | 💬 Quote: ${quote.quote} 42 | 43 | Powered by JOHNLEO-MD`); 44 | }); 45 | } catch (e) { 46 | repondre('Erreur lors de la génération de la citation : ' + e.message); 47 | } 48 | } 49 | }); 50 | -------------------------------------------------------------------------------- /commandes/profile.js: -------------------------------------------------------------------------------- 1 | const {zokou} = require("../framework/zokou"); 2 | const conf = require("../set") 3 | const {jidDecode}=require("@whiskeysockets/baileys") 4 | 5 | 6 | zokou( { 7 | nomCom : "whois", 8 | categorie : "Fun", 9 | }, 10 | async(dest,zk, commandeOptions)=> { 11 | 12 | const {ms , arg, repondre,auteurMessage,nomAuteurMessage, msgRepondu , auteurMsgRepondu} = commandeOptions ; 13 | let jid = null 14 | let nom = null ; 15 | 16 | 17 | 18 | 19 | 20 | if (!msgRepondu) { 21 | jid = auteurMessage; 22 | nom = nomAuteurMessage; 23 | 24 | try { ppUrl = await zk.profilePictureUrl(jid , 'image') ; } catch { ppUrl = conf.IMAGE_MENU}; 25 | const status = await zk.fetchStatus(jid) ; 26 | 27 | mess = { 28 | image : { url : ppUrl }, 29 | caption : '*Nom :* '+ nom + '\n*Status :*\n' + status.status 30 | } 31 | 32 | } else { 33 | jid = auteurMsgRepondu; 34 | nom ="@"+auteurMsgRepondu.split("@")[0] ; 35 | 36 | try { ppUrl = await zk.profilePictureUrl(jid , 'image') ; } catch { ppUrl = conf.IMAGE_MENU}; 37 | const status = await zk.fetchStatus(jid) ; 38 | 39 | mess = { 40 | image : { url : ppUrl }, 41 | caption : '*Name :* '+ nom + '\n*Status :*\n' + status.status, 42 | mentions:[auteurMsgRepondu] 43 | } 44 | 45 | } ; 46 | 47 | 48 | 49 | 50 | 51 | zk.sendMessage(dest,mess,{quoted : ms}) 52 | }); 53 | -------------------------------------------------------------------------------- /commandes/weather.js: -------------------------------------------------------------------------------- 1 | const { 2 | zokou 3 | } = require("../framework/zokou"); 4 | zokou({ 5 | 'nomCom': "weather", 6 | 'reaction': "🌡️", 7 | 'categorie': "Search" 8 | }, 9 | async (_0x626df9, _0x17e5bb, _0x37baf6) => { 10 | const _0x445647 = _0x1180fa.join(" "); 11 | if (!_0x445647) { 12 | return _0xecdf09("Give me location..."); 13 | } 14 | const _0x470189 = await fetch("https://api.openweathermap.org/data/2.5/weather?q=" + _0x445647 + "&units=metric&appid=060a6bcfa19809c2cd4d97a212b19273&language=en"); 15 | const _0x4bfc6 = await _0x470189.json(); 16 | const _0x3cf19a = _0x4bfc6.name; 17 | const _0x52e997 = _0x4bfc6.main.temp; 18 | const _0x32180e = _0x4bfc6.weather[0x0].description; 19 | const _0x2da493 = _0x4bfc6.main.humidity; 20 | const _0x368581 = _0x4bfc6.wind.speed; 21 | const _0x28a97c = _0x4bfc6.rain ? _0x4bfc6.rain['1h'] : 0x0; 22 | const _0x39a4af = _0x4bfc6.clouds.all; 23 | const _0x41b2f8 = new Date(_0x4bfc6.sys.sunrise * 0x3e8); 24 | const _0x4393a0 = new Date(_0x4bfc6.sys.sunset * 0x3e8); 25 | await _0xecdf09(" *JOHNLEO-MD WEATHER UPDATES* \n\n❄️ Weather in " + _0x3cf19a + "\n\n🌡️ *Temperature:* " + _0x52e997 + "°C\n📝 *Description:* " + _0x32180e + "\n❄️ *Humidity:* " + _0x2da493 + "%\n🌀 *Wind Speed:* " + _0x368581 + " m/s\n🌧️ *Rain Volume (last hour):* " + _0x28a97c + " mm\n☁️ *Cloudiness:* " + _0x39a4af + "%\n🌄 *Sunrise:* " + _0x41b2f8.toLocaleTimeString() + "\n🌅 *Sunset:* " + _0x4393a0.toLocaleTimeString() + "\n🌫️ *Latitude:* " + _0x4bfc6.coord.lat + "\n🌪️ *Longitude:* " + _0x4bfc6.coord.lon + "\n\n🗺 *Country:* " + _0x4bfc6.sys.country + "\n\n\n*°Powered by JOHNLEO-MD*"); 26 | }); 27 | -------------------------------------------------------------------------------- /commandes/ringtone.js: -------------------------------------------------------------------------------- 1 | const { 2 | 3 | Function, 4 | 5 | ringtone, 6 | 7 | isPublic, 8 | 9 | prefix, 10 | 11 | parsedUrl 12 | 13 | } = require("../lib/"); 14 | 15 | const t = "```"; 16 | 17 | Function({ 18 | 19 | pattern: 'ringtone ?(.*)', 20 | 21 | fromMe: isPublic, 22 | 23 | desc: 'download ringtone', 24 | 25 | type: 'download' 26 | 27 | }, async (message, match) => { 28 | 29 | if (!match) return await message.reply('_Example : ringtone the box_') 30 | 31 | const result = await ringtone(match) 32 | 33 | if (result) { 34 | 35 | const list = []; 36 | 37 | let no = 1; 38 | 39 | let msg = `${t}Search results for ${match}:${t}\n_To download, please reply with the desired ringtone number._\n\n`; 40 | 41 | const indices = new Set(); 42 | 43 | for (var main = 0; main < result.length; main++) { 44 | 45 | const randomIndex = Math.floor(Math.random() * result.length); 46 | 47 | if (!indices.has(randomIndex)) { 48 | 49 | indices.add(randomIndex); 50 | 51 | msg += `${no++}. *${result[randomIndex].title}*\n*link* : ${result[randomIndex].source}\n*mp3* : ${result[randomIndex].audio}\n\n` 52 | 53 | } 54 | 55 | } 56 | 57 | await message.send(msg, { quoted: m.data }) 58 | 59 | } 60 | 61 | }) 62 | 63 | 64 | 65 | 66 | 67 | Function({ 68 | 69 | pattern: 'upload ?(.*)', 70 | 71 | fromMe: isPublic, 72 | 73 | desc: 'sendFromUrl', 74 | 75 | type: 'download' 76 | 77 | }, async (message, match) => { 78 | 79 | match = match || message.reply_message.text 80 | 81 | if (!match) return await message.reply('_Missing Url!_') 82 | 83 | const Url = await parsedUrl(match) 84 | 85 | for (let url of Url) { 86 | 87 | await message.client.sendFromUrl(message.jid, url, message.data) 88 | 89 | } 90 | 91 | }) 92 | -------------------------------------------------------------------------------- /commandes/stickersearch.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const { Sticker, StickerTypes } = require("wa-sticker-formatter"); 3 | const {zokou} = require("../framework/zokou"); 4 | 5 | zokou({ 6 | nomCom: "stickersearch", 7 | categorie: 'Search', 8 | reaction: "🌫" 9 | }, 10 | async (dest, zk, commandeOptions) => { 11 | const { repondre, ms, arg, nomAuteurMessage } = commandeOptions; 12 | 13 | if (!arg[0]) { 14 | repondre("where is the request ? !"); 15 | return; 16 | } 17 | 18 | const gifSearchTerm = arg.join(" "); 19 | const tenorApiKey = "AIzaSyCyouca1_KKy4W_MG1xsPzuku5oa8W358c"; // Remplacez par votre clé d'API Tenor 20 | 21 | try { for ( i = 0 ; i < 5 ; i++) { 22 | const gif = await axios.get( 23 | `https://tenor.googleapis.com/v2/search?q=${gifSearchTerm}&key=${tenorApiKey}&client_key=my_project&limit=8&media_filter=gif` 24 | ); 25 | 26 | const gifUrl = gif.data.results[i].media_formats.gif.url; 27 | 28 | 29 | 30 | 31 | // Assurez-vous de remplacer les valeurs manquantes dans la création du sticker 32 | const packname = nomAuteurMessage; // Remplacez par le nom de votre pack de stickers 33 | 34 | const stickerMess = new Sticker(gifUrl, { 35 | pack: packname, 36 | author: 'JOHNLEO MD', 37 | type: StickerTypes.FULL, 38 | categories: ["🤩", "🎉"], 39 | id: "12345", 40 | quality: 60, 41 | background: "transparent", 42 | }); 43 | const stickerBuffer2 = await stickerMess.toBuffer(); 44 | zk.sendMessage(dest, { sticker: stickerBuffer2 }, { quoted: ms }); } 45 | } catch (error) { 46 | console.error("Erreur lors de la recherche de stickers :", error); 47 | repondre("Erreur lors de la recherche de stickers."); 48 | } 49 | }); 50 | -------------------------------------------------------------------------------- /commandes/tts.js: -------------------------------------------------------------------------------- 1 | const googleTTS = require('google-tts-api'); 2 | const {zokou} = require("../framework/zokou"); 3 | 4 | 5 | zokou( { 6 | nomCom : "dit", 7 | categorie : "tts", 8 | reaction : "👄" }, 9 | async(dest,zk, commandeOptions)=> { 10 | 11 | const {ms,arg,repondre} = commandeOptions; 12 | if (!arg[0]) {repondre("Insert a word");return} ; 13 | const mots = arg.join(" ") 14 | 15 | const url = googleTTS.getAudioUrl( mots, { 16 | lang: 'fr', 17 | slow: false, 18 | host: 'https://translate.google.com', 19 | }); 20 | console.log(url); 21 | zk.sendMessage(dest, { audio: { url:url},mimetype:'audio/mp4' }, { quoted: ms,ptt: true }); 22 | 23 | 24 | 25 | } 26 | ) ; 27 | 28 | zokou( { 29 | nomCom : "itta", 30 | categorie : "tts", 31 | reaction : "👄" }, 32 | async(dest,zk, commandeOptions)=> { 33 | 34 | const {ms,arg,repondre} = commandeOptions; 35 | if (!arg[0]) {repondre("Insert a word");return} ; 36 | const mots = arg.join(" ") 37 | 38 | const url = googleTTS.getAudioUrl( mots, { 39 | lang: 'ja', 40 | slow: false, 41 | host: 'https://translate.google.com', 42 | }); 43 | console.log(url); 44 | zk.sendMessage(dest, { audio: { url:url},mimetype:'audio/mp4' }, { quoted: ms,ptt: true }); 45 | 46 | 47 | 48 | } 49 | ) ; 50 | 51 | zokou( { 52 | nomCom : "say", 53 | categorie : "tts", 54 | reaction : "👄" }, 55 | async(dest,zk, commandeOptions)=> { 56 | 57 | const {ms,arg,repondre} = commandeOptions; 58 | if (!arg[0]) {repondre("Insert a word");return} ; 59 | const mots = arg.join(" ") 60 | 61 | const url = googleTTS.getAudioUrl( mots, { 62 | lang: 'en', 63 | slow: false, 64 | host: 'https://translate.google.com', 65 | }); 66 | console.log(url); 67 | zk.sendMessage(dest, { audio: { url:url},mimetype:'audio/mp4' }, { quoted: ms,ptt: true }); 68 | 69 | 70 | 71 | } 72 | ) ; 73 | 74 | -------------------------------------------------------------------------------- /set.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs-extra'); 2 | const { Sequelize } = require('sequelize'); 3 | if (fs.existsSync('set.env')) 4 | require('dotenv').config({ path: __dirname + '/set.env' }); 5 | const path = require("path"); 6 | const databasePath = path.join(__dirname, './database.db'); 7 | const DATABASE_URL = process.env.DATABASE_URL === undefined 8 | ? databasePath 9 | : process.env.DATABASE_URL; 10 | module.exports = { session: process.env.SESSION_ID || '', 11 | PREFIXE: process.env.PREFIX || ".", 12 | OWNER_NAME: process.env.OWNER_NAME || "Johnleosmith", 13 | NUMERO_OWNER : process.env.NUMERO_OWNER || " Johnleosmith", 14 | AUTO_READ_STATUS: process.env.AUTO_READ_STATUS || "yes", 15 | AUTO_DOWNLOAD_STATUS: process.env.AUTO_DOWNLOAD_STATUS || 'no', 16 | BOT : process.env.BOT_NAME || 'Johnleo-Md', 17 | URL : process.env.BOT_MENU_LINKS || 'https://telegra.ph/file/8607b7de6ec512c7886aa.jpg', 18 | MODE: process.env.PUBLIC_MODE || "yes", 19 | PM_PERMIT: process.env.PM_PERMIT || 'yes', 20 | HEROKU_APP_NAME : process.env.HEROKU_APP_NAME, 21 | HEROKU_APY_KEY : process.env.HEROKU_APY_KEY , 22 | WARN_COUNT : process.env.WARN_COUNT || '3' , 23 | ETAT : process.env.PRESENCE || '', 24 | CHATBOT : process.env.PM_CHATBOT || 'no', 25 | DP : process.env.STARTING_BOT_MESSAGE || "yes", 26 | ADM : process.env.ANTI_DELETE_MESSAGE || 'no', 27 | DATABASE_URL, 28 | DATABASE: DATABASE_URL === databasePath 29 | ? "postgresql://postgres:bKlIqoOUWFIHOAhKxRWQtGfKfhGKgmRX@viaduct.proxy.rlwy.net:47738/railway" : "postgresql://postgres:bKlIqoOUWFIHOAhKxRWQtGfKfhGKgmRX@viaduct.proxy.rlwy.net:47738/railway", 30 | 31 | }; 32 | let fichier = require.resolve(__filename); 33 | fs.watchFile(fichier, () => { 34 | fs.unwatchFile(fichier); 35 | console.log(`mise à jour ${__filename}`); 36 | delete require.cache[fichier]; 37 | require(fichier); 38 | }); 39 | 40 | -------------------------------------------------------------------------------- /commandes/stickcmd.js: -------------------------------------------------------------------------------- 1 | const {zokou }= require ('../framework/zokou') ; 2 | const {addstickcmd, deleteCmd, getCmdById, inStickCmd , getAllStickCmds} = require('../bdd/stickcmd') ; 3 | 4 | 5 | 6 | zokou( 7 | { 8 | nomCom : 'setcmd', 9 | categorie : 'stickcmd' 10 | 11 | }, async (dest,zk,commandeOptions) => { 12 | 13 | const {ms , arg, repondre,superUser , msgRepondu} = commandeOptions; 14 | 15 | if (!superUser) { repondre('you can\'t use this command') ; return} ; 16 | 17 | if(msgRepondu && msgRepondu.stickerMessage ) { 18 | 19 | if(!arg || !arg[0]) { repondre('put the name of the command') ; return} ; 20 | 21 | 22 | await addstickcmd(arg[0].toLowerCase() , msgRepondu.stickerMessage.url ) ; 23 | 24 | repondre('Stick cmd save successfully') 25 | 26 | } else { 27 | 28 | repondre('mention a sticker') 29 | } 30 | 31 | }) ; 32 | 33 | zokou( 34 | { 35 | nomCom: 'delcmd', 36 | categorie: 'stickcmd' 37 | }, 38 | async (dest, zk, commandeOptions) => { 39 | 40 | const { ms, arg, repondre, superUser } = commandeOptions; 41 | 42 | if (!superUser) { 43 | repondre('only Mods can use this command'); 44 | return; 45 | } 46 | 47 | if (!arg || !arg[0]) { 48 | repondre('put the name of the command that you want to delete'); 49 | return; 50 | } 51 | 52 | const cmdToDelete = arg[0]; 53 | 54 | 55 | try { 56 | await deleteCmd(cmdToDelete.toLowerCase()); 57 | repondre(`the commande ${cmdToDelete} is deleted successfully.`); 58 | } catch { 59 | repondre(`the command ${cmdToDelete} don't existe`); 60 | } 61 | } 62 | ); 63 | 64 | 65 | zokou( 66 | { 67 | nomCom: 'allcmd', 68 | categorie: 'stickcmd' 69 | }, 70 | async (dest, zk, commandeOptions) => { 71 | const { repondre, superUser } = commandeOptions; 72 | 73 | if (!superUser) { 74 | repondre('only Mods can use this command'); 75 | return; 76 | } 77 | 78 | const allCmds = await getAllStickCmds(); 79 | 80 | if (allCmds.length > 0) { 81 | const cmdList = allCmds.map(cmd => cmd.cmd).join(', '); 82 | repondre(`*List of all stickcmd :* 83 | ${cmdList}`); 84 | } else { 85 | repondre('No stickcmd save'); 86 | } 87 | } 88 | ); 89 | -------------------------------------------------------------------------------- /commandes/alive.js: -------------------------------------------------------------------------------- 1 | const { zokou } = require('../framework/zokou'); 2 | const {addOrUpdateDataInAlive , getDataFromAlive} = require('../bdd/alive') 3 | const moment = require("moment-timezone"); 4 | const s = require(__dirname + "/../set"); 5 | 6 | zokou( 7 | { 8 | nomCom : 'alive', 9 | categorie : 'General' 10 | 11 | },async (dest,zk,commandeOptions) => { 12 | 13 | const {ms , arg, repondre,superUser} = commandeOptions; 14 | 15 | const data = await getDataFromAlive(); 16 | 17 | if (!arg || !arg[0] || arg.join('') === '') { 18 | 19 | if(data) { 20 | 21 | const {message , lien} = data; 22 | 23 | 24 | var mode = "public"; 25 | if ((s.MODE).toLocaleLowerCase() != "yes") { 26 | mode = "private"; 27 | } 28 | 29 | 30 | 31 | moment.tz.setDefault('Nairobi/Kenya'); 32 | 33 | // Créer une date et une heure en GMT 34 | const temps = moment().format('HH:mm:ss'); 35 | const date = moment().format('DD/MM/YYYY'); 36 | 37 | const alivemsg = ` 38 | *Owner* : ${s.OWNER_NAME} 39 | *Mode* : ${mode} 40 | *Date* : ${date} 41 | *Hours(EAT)* : ${temps} 42 | 43 | ${message} 44 | 45 | 46 | *HELLO 👋 VALUED 👤 USER AM STILL ALIVE😎*` 47 | 48 | if (lien.match(/\.(mp4|gif)$/i)) { 49 | try { 50 | zk.sendMessage(dest, { video: { url: lien }, caption: alivemsg }, { quoted: ms }); 51 | } 52 | catch (e) { 53 | console.log("🥵🥵 Menu erreur " + e); 54 | repondre("🥵🥵 Menu erreur " + e); 55 | } 56 | } 57 | // Checking for .jpeg or .png 58 | else if (lien.match(/\.(jpeg|png|jpg)$/i)) { 59 | try { 60 | zk.sendMessage(dest, { image: { url: lien }, caption: alivemsg }, { quoted: ms }); 61 | } 62 | catch (e) { 63 | console.log("🥵🥵 Menu erreur " + e); 64 | repondre("🥵🥵 Menu erreur " + e); 65 | } 66 | } 67 | else { 68 | 69 | repondre(alivemsg); 70 | 71 | } 72 | 73 | } else { 74 | if(!superUser) { repondre("there is no alive for this bot") ; return}; 75 | 76 | await repondre("You have not yet saved your alive, to do this; enter after alive your message and your image or video link in this context: .alive message;lien"); 77 | repondre("don't do fake things :)") 78 | } 79 | } else { 80 | 81 | if(!superUser) { repondre ("Only the owner can modify the alive") ; return}; 82 | 83 | 84 | const texte = arg.join(' ').split(';')[0]; 85 | const tlien = arg.join(' ').split(';')[1]; 86 | 87 | 88 | 89 | await addOrUpdateDataInAlive(texte , tlien) 90 | 91 | repondre('message alive refresh successfully') 92 | 93 | } 94 | }); 95 | -------------------------------------------------------------------------------- /commandes/canvacord.js: -------------------------------------------------------------------------------- 1 | const { zokou } = require("../framework/zokou"); 2 | const canvacord = require("canvacord"); 3 | const {uploadImageToImgur} = require("../framework/imgur") 4 | 5 | // Generic function to create a canvacord order 6 | function createCanvacordCommand(commandName, canvacordFunction) { 7 | zokou({ 8 | nomCom: commandName, 9 | categorie: "Image-Edit", 10 | reaction: "🎉" 11 | }, async (origineMessage, zk, commandeOptions) => { 12 | const { ms, msgRepondu, auteurMsgRepondu } = commandeOptions; 13 | const clientId = 'b40a1820d63cd4e' ; 14 | 15 | try { 16 | let img; 17 | if (msgRepondu) { 18 | 19 | if (msgRepondu.imageMessage) { 20 | const image = await zk.downloadAndSaveMediaMessage(msgRepondu.imageMessage) 21 | img = await uploadImageToImgur(image, clientId ) 22 | } else { 23 | 24 | img = await zk.profilePictureUrl(auteurMsgRepondu, 'image'); } 25 | } else { 26 | img = "https://i.pinimg.com/564x/84/09/12/840912dd744e6662ab211b8070b5d84c.jpg"; 27 | } 28 | 29 | const result = await canvacordFunction(img); 30 | 31 | await zk.sendMessage(origineMessage, { image: result }, { quoted: ms }); 32 | } catch (error) { 33 | console.error(`Error when ordering "${commandName}":`, error); 34 | } 35 | }); 36 | } 37 | 38 | // Créer des commandes avec différentes fonctions canvacord 39 | createCanvacordCommand("shit", canvacord.Canvacord.shit); 40 | createCanvacordCommand("wasted", canvacord.Canvacord.wasted); 41 | createCanvacordCommand("wanted", canvacord.Canvacord.wanted); 42 | createCanvacordCommand("trigger", canvacord.Canvacord.trigger); 43 | createCanvacordCommand("trash", canvacord.Canvacord.trash); 44 | createCanvacordCommand("rip", canvacord.Canvacord.rip); 45 | createCanvacordCommand("sepia", canvacord.Canvacord.sepia); 46 | createCanvacordCommand("rainbow", canvacord.Canvacord.rainbow); 47 | createCanvacordCommand("hitler", canvacord.Canvacord.hitler); 48 | createCanvacordCommand("invert", canvacord.Canvacord.invert); 49 | createCanvacordCommand("jail", canvacord.Canvacord.jail); 50 | createCanvacordCommand("affect", canvacord.Canvacord.affect); 51 | createCanvacordCommand("beautiful", canvacord.Canvacord.beautiful); 52 | createCanvacordCommand("blur", canvacord.Canvacord.blur); 53 | 54 | createCanvacordCommand("circle", canvacord.Canvacord.circle); 55 | createCanvacordCommand("facepalm", canvacord.Canvacord.facepalm); 56 | createCanvacordCommand("greyscale", canvacord.Canvacord.greyscale); 57 | createCanvacordCommand("joke", canvacord.Canvacord.jokeOverHead); 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /commandes/hentai.js: -------------------------------------------------------------------------------- 1 | 2 | const {zokou } = require("../framework/zokou"); 3 | const axios = require('axios'); 4 | 5 | 6 | zokou({ 7 | nomCom: "hwaifu", 8 | categorie: "Hentai", 9 | reaction: "🙄" 10 | }, 11 | async (origineMessage, zk, commandeOptions) => { 12 | const { repondre, ms } = commandeOptions; 13 | 14 | const url = 'https://api.waifu.pics/nsfw/waifu'; // Remplace avec ton lien réel 15 | 16 | try { for (let i = 0 ; i < 5 ; i++ ) { 17 | const response = await axios.get(url); 18 | const imageUrl = response.data.url; 19 | 20 | zk.sendMessage(origineMessage, { image: { url: imageUrl } }, { quoted: ms }); } 21 | } catch (error) { 22 | repondre('Erreur lors de la récupération des données : ' +error); 23 | } 24 | }); 25 | 26 | 27 | /////////////// hneko ////////// 28 | zokou({ 29 | nomCom: "trap", 30 | categorie: "Hentai", 31 | reaction: "🙄" 32 | }, 33 | async (origineMessage, zk, commandeOptions) => { 34 | const { repondre, ms } = commandeOptions; 35 | 36 | const url = 'https://api.waifu.pics/nsfw/trap'; // Remplace avec ton lien réel 37 | 38 | try { for (let i = 0 ; i < 5 ; i++ ) { 39 | const response = await axios.get(url); 40 | const imageUrl = response.data.url; 41 | 42 | zk.sendMessage(origineMessage, { image: { url: imageUrl } }, { quoted: ms }); } 43 | } catch (error) { 44 | repondre('Erreur lors de la récupération des données :', error); 45 | } 46 | }); 47 | 48 | zokou({ 49 | nomCom: "hneko", 50 | categorie: "Hentai", 51 | reaction: "🙄" 52 | }, 53 | async (origineMessage, zk, commandeOptions) => { 54 | const { repondre, ms } = commandeOptions; 55 | 56 | const url = 'https://api.waifu.pics/nsfw/neko'//apiWaifu("neko"); // Remplace avec ton lien réel 57 | 58 | try { for (let i = 0 ;i < 5 ; i++) { 59 | const response = await axios.get(url); 60 | const imageUrl = response.data.url; 61 | 62 | zk.sendMessage(origineMessage, { image: { url: imageUrl } }, { quoted: ms }); } 63 | } catch (error) { 64 | repondre('Erreur lors de la récupération des données :', error); 65 | } 66 | }); 67 | 68 | 69 | zokou({ 70 | nomCom: "blowjob", 71 | categorie: "Hentai", 72 | reaction: "🙄" 73 | }, 74 | async (origineMessage, zk, commandeOptions) => { 75 | const { repondre, ms } = commandeOptions; 76 | 77 | const url = 'https://api.waifu.pics/nsfw/blowjob'; // Remplace avec ton lien réel 78 | 79 | try { for (let i = 0 ; i < 5 ; i++ ) { 80 | const response = await axios.get(url); 81 | const imageUrl = response.data.url; 82 | 83 | zk.sendMessage(origineMessage, { image: { url: imageUrl } }, { quoted: ms }); } 84 | } catch (error) { 85 | repondre('Erreur lors de la récupération des données :', error); 86 | } 87 | }); 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /commandes/heroku.js: -------------------------------------------------------------------------------- 1 | const { zokou } = require('../framework/zokou'); 2 | const s = require('../set') 3 | 4 | 5 | zokou( 6 | { 7 | nomCom : "setvar", 8 | categorie : "heroku" 9 | }, async (dest , zk , commandeOptions) =>{ 10 | 11 | const {ms,repondre,superUser , arg} = commandeOptions ; 12 | 13 | if(!superUser){repondre('only Mods can use this commande');return}; 14 | if(!arg[0] || !(arg.join('').split('='))) {repondre('Bad format ; Exemple of using :\nSetvar OWNER_NAME=Carl William');return}; 15 | 16 | const text = arg.join(" ") 17 | const Heroku = require("heroku-client"); 18 | 19 | const heroku = new Heroku({ 20 | token: s.HEROKU_APY_KEY, 21 | }); 22 | 23 | let baseURI = "/apps/" + s.HEROKU_APP_NAME; 24 | await heroku.patch(baseURI + "/config-vars", { 25 | body: { 26 | [text.split('=')[0]]: text.split('=')[1], 27 | }, 28 | }); 29 | await repondre('That Heroku var is changing,The bot is rebooting....') 30 | } 31 | ); 32 | 33 | zokou( 34 | { 35 | nomCom : "allvar", 36 | categorie : "heroku" 37 | }, async (dest , zk , commandeOptions) =>{ 38 | 39 | const {ms,repondre,superUser , arg} = commandeOptions ; 40 | 41 | if(!superUser){repondre('only mods can use this commande');return}; 42 | 43 | const Heroku = require("heroku-client"); 44 | 45 | const heroku = new Heroku({ 46 | token: s.HEROKU_APY_KEY, 47 | }); 48 | let baseURI = "/apps/" + s.HEROKU_APP_NAME; 49 | 50 | let h = await heroku.get(baseURI+'/config-vars') 51 | let str = '*All my HEROKU Vars*\n\n' 52 | for (vr in h) { 53 | str+= '⚡ *'+vr+'* '+'= '+h[vr]+'\n' 54 | } 55 | repondre(str) 56 | 57 | 58 | } 59 | 60 | ); 61 | 62 | 63 | zokou( 64 | { 65 | nomCom : "getvar", 66 | categorie : "heroku" 67 | }, async (dest , zk , commandeOptions) =>{ 68 | 69 | const {ms,repondre,superUser , arg} = commandeOptions ; 70 | 71 | if(!superUser){repondre('Only Mods can use this command');return}; 72 | if(!arg[0]) {repondre('insert the variable name in capital letter'); return} ; 73 | 74 | try { 75 | const Heroku = require("heroku-client"); 76 | 77 | const heroku = new Heroku({ 78 | token: s.HEROKU_API_KEY, 79 | }); 80 | let baseURI = "/apps/" + s.HEROKU_APP_NAME; 81 | let h = await heroku.get(baseURI+'/config-vars') 82 | for (vr in h) { 83 | if( arg.join(' ') ===vr ) return repondre( vr+'= '+h[vr]) ; 84 | } 85 | 86 | } catch(e) {repondre('Error' + e)} 87 | 88 | }); 89 | 90 | -------------------------------------------------------------------------------- /commandes/koiuyhlpo.js: -------------------------------------------------------------------------------- 1 | const util = require('util'); 2 | const fs = require('fs-extra'); 3 | const { zokou } = require(__dirname + "/../framework/france"); 4 | const { format } = require(__dirname + "/../framework/mesfonctions"); 5 | const os = require("os"); 6 | const moment = require("moment-timezone"); 7 | const s = require(__dirname + "/../set"); 8 | 9 | zokou({ nomCom: "spark", categorie: "General" }, async (dest, zk, commandeOptions) => { 10 | let { ms, repondre ,prefixe,nomAuteurMessage,mybotpic} = commandeOptions; 11 | let { cm } = require(__dirname + "/../framework//france"); 12 | var coms = {}; 13 | var mode = "public"; 14 | 15 | if ((s.MODE).toLocaleLowerCase() != "yes") { 16 | mode = "private"; 17 | } 18 | 19 | 20 | 21 | cm.map(async (com, index) => { 22 | if (!coms[com.categorie]) 23 | coms[com.categorie] = []; 24 | coms[com.categorie].push(com.nomCom); 25 | }); 26 | 27 | moment.tz.setDefault('EAT'); 28 | 29 | // Créer une date et une heure en EAT 30 | const temps = moment().format('HH:mm:ss'); 31 | const date = moment().format('DD/MM/YYYY'); 32 | 33 | let infoMsg = ` 34 | ╭────《JOHNLEO-MD》────☣ 35 | |🔱 *User* : ${s.OWNER_NAME} 36 | |🔱 *Mode* : ${mode} 37 | |🔱 *Commands* : ${cm.length} 38 | |🔱 *Time* : ${temps} 39 | |🔱 *Ram* : ${format(os.totalmem() - os.freemem())}/${format(os.totalmem())} 40 | |🔰 JOHNLEO TECH 41 | ╰─────✨✨✨✨✨─────☣ \n\n`; 42 | 43 | let menuMsg=` 44 | ▐░░░░░░░░░░░░░░░░░░░▌ 45 | ✨╭━━━━━∙⋆⋅⋆∙━━━━━━∙⋆⋅⋆∙━━━━━╮✨ 46 | `; 47 | 48 | for (const cat in coms) { 49 | menuMsg += `*╭────□* *${cat}* *□⊷*`; 50 | for (const cmd of coms[cat]) { 51 | menuMsg += ` 52 | *○* ${cmd}`; 53 | } 54 | menuMsg += ` 55 | *◇═════════════◇* \n` 56 | } 57 | 58 | menuMsg += ` 59 | 60 | *————— ✨ —————* 61 | 62 | 63 | 64 | 65 | 66 | *◇═════════════◇* 67 | `; 68 | 69 | var lien = mybotpic(); 70 | 71 | if (lien.match(/\.(mp4|gif)$/i)) { 72 | try { 73 | zk.sendMessage(dest, { video: { url: lien }, caption:infoMsg + menuMsg, footer: "Je suis *Johnleo-Md*, développé par Djalega++" , gifPlayback : true }, { quoted: ms }); 74 | } 75 | catch (e) { 76 | console.log("🥵🥵 Menu erreur " + e); 77 | repondre("🥵🥵 Menu erreur " + e); 78 | } 79 | } 80 | // Vérification pour .jpeg ou .png 81 | else if (lien.match(/\.(jpeg|png|jpg)$/i)) { 82 | try { 83 | zk.sendMessage(dest, { image: { url: lien }, caption:infoMsg + menuMsg, footer: "*Carl-tech*" }, { quoted: ms }); 84 | } 85 | catch (e) { 86 | console.log("🥵🥵 Menu erreur " + e); 87 | repondre("🥵🥵 Menu erreur " + e); 88 | } 89 | } 90 | else { 91 | 92 | repondre(infoMsg + menuMsg); 93 | 94 | } 95 | 96 | }); 97 | -------------------------------------------------------------------------------- /bdd/alive.js: -------------------------------------------------------------------------------- 1 | // Importez dotenv et chargez les variables d'environnement depuis le fichier .env 2 | require("dotenv").config(); 3 | 4 | const { Pool } = require("pg"); 5 | 6 | // Utilisez le module 'set' pour obtenir la valeur de DATABASE_URL depuis vos configurations 7 | const s = require("../set"); 8 | 9 | // Récupérez l'URL de la base de données de la variable s.DATABASE_URL 10 | var dbUrl=s.DATABASE_URL?s.DATABASE_URL:"postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" 11 | const proConfig = { 12 | connectionString: dbUrl, 13 | ssl: { 14 | rejectUnauthorized: false, 15 | }, 16 | }; 17 | 18 | // Créez une pool de connexions PostgreSQL 19 | const pool = new Pool(proConfig); 20 | 21 | // Fonction pour créer la table "alive" avec une colonne "id" 22 | const creerTableAlive = async () => { 23 | try { 24 | await pool.query(` 25 | CREATE TABLE IF NOT EXISTS alive ( 26 | id serial PRIMARY KEY, 27 | message text, 28 | lien text 29 | ); 30 | `); 31 | console.log("La table 'alive' a été créée avec succès."); 32 | } catch (e) { 33 | console.error("Une erreur est survenue lors de la création de la table 'alive':", e); 34 | } 35 | }; 36 | 37 | // Appelez la méthode pour créer la table "alive" 38 | creerTableAlive(); 39 | 40 | // Fonction pour ajouter ou mettre à jour un enregistrement dans la table "alive" 41 | async function addOrUpdateDataInAlive(message, lien) { 42 | const client = await pool.connect(); 43 | try { 44 | // Insérez ou mettez à jour les données dans la table "alive" 45 | const query = ` 46 | INSERT INTO alive (id, message, lien) 47 | VALUES (1, $1, $2) 48 | ON CONFLICT (id) 49 | DO UPDATE SET message = excluded.message, lien = excluded.lien; 50 | `; 51 | const values = [message, lien]; 52 | 53 | await client.query(query, values); 54 | console.log("Données ajoutées ou mises à jour dans la table 'alive' avec succès."); 55 | } catch (error) { 56 | console.error("Erreur lors de l'ajout ou de la mise à jour des données dans la table 'alive':", error); 57 | } finally { 58 | client.release(); 59 | } 60 | }; 61 | 62 | 63 | async function getDataFromAlive() { 64 | const client = await pool.connect(); 65 | try { 66 | // Exécutez la requête SELECT pour récupérer les données 67 | const query = "SELECT message, lien FROM alive WHERE id = 1"; 68 | const result = await client.query(query); 69 | 70 | if (result.rows.length > 0) { 71 | const { message, lien } = result.rows[0]; 72 | return { message, lien }; 73 | } else { 74 | console.log("Aucune donnée trouvée dans la table 'alive'."); 75 | return null; 76 | } 77 | } catch (error) { 78 | console.error("Erreur lors de la récupération des données depuis la table 'alive':", error); 79 | return null; 80 | } finally { 81 | client.release(); 82 | } 83 | }; 84 | 85 | 86 | 87 | 88 | module.exports = { 89 | addOrUpdateDataInAlive, 90 | getDataFromAlive, 91 | 92 | }; 93 | -------------------------------------------------------------------------------- /bdd/banUser.js: -------------------------------------------------------------------------------- 1 | // Importez dotenv et chargez les variables d'environnement depuis le fichier .env 2 | require("dotenv").config(); 3 | 4 | const { Pool } = require("pg"); 5 | 6 | // Utilisez le module 'set' pour obtenir la valeur de DATABASE_URL depuis vos configurations 7 | const s = require("../set"); 8 | 9 | // Récupérez l'URL de la base de données de la variable s.DATABASE_URL 10 | var dbUrl=s.DATABASE_URL?s.DATABASE_URL:"postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" 11 | const proConfig = { 12 | connectionString: dbUrl, 13 | ssl: { 14 | rejectUnauthorized: false, 15 | }, 16 | }; 17 | 18 | // Créez une pool de connexions PostgreSQL 19 | const pool = new Pool(proConfig); 20 | 21 | // Vous pouvez maintenant utiliser 'pool' pour interagir avec votre base de données PostgreSQL. 22 | const creerTableBanUser = async () => { 23 | try { 24 | await pool.query(` 25 | CREATE TABLE IF NOT EXISTS banUser ( 26 | jid text PRIMARY KEY 27 | ); 28 | `); 29 | console.log("La table 'banUser' a été créée avec succès."); 30 | } catch (e) { 31 | console.error("Une erreur est survenue lors de la création de la table 'banUser':", e); 32 | } 33 | }; 34 | 35 | // Appelez la méthode pour créer la table "banUser" 36 | creerTableBanUser(); 37 | 38 | 39 | 40 | // Fonction pour ajouter un utilisateur à la liste des bannis 41 | async function addUserToBanList(jid) { 42 | const client = await pool.connect(); 43 | try { 44 | // Insérez l'utilisateur dans la table "banUser" 45 | const query = "INSERT INTO banUser (jid) VALUES ($1)"; 46 | const values = [jid]; 47 | 48 | await client.query(query, values); 49 | console.log(`JID ${jid} ajouté à la liste des bannis.`); 50 | } catch (error) { 51 | console.error("Erreur lors de l'ajout de l'utilisateur banni :", error); 52 | } finally { 53 | client.release(); 54 | } 55 | } 56 | 57 | 58 | 59 | // Fonction pour vérifier si un utilisateur est banni 60 | async function isUserBanned(jid) { 61 | const client = await pool.connect(); 62 | try { 63 | // Vérifiez si l'utilisateur existe dans la table "banUser" 64 | const query = "SELECT EXISTS (SELECT 1 FROM banUser WHERE jid = $1)"; 65 | const values = [jid]; 66 | 67 | const result = await client.query(query, values); 68 | return result.rows[0].exists; 69 | } catch (error) { 70 | console.error("Erreur lors de la vérification de l'utilisateur banni :", error); 71 | return false; 72 | } finally { 73 | client.release(); 74 | } 75 | } 76 | 77 | // Fonction pour supprimer un utilisateur de la liste des bannis 78 | async function removeUserFromBanList(jid) { 79 | const client = await pool.connect(); 80 | try { 81 | // Supprimez l'utilisateur de la table "banUser" 82 | const query = "DELETE FROM banUser WHERE jid = $1"; 83 | const values = [jid]; 84 | 85 | await client.query(query, values); 86 | console.log(`JID ${jid} supprimé de la liste des bannis.`); 87 | } catch (error) { 88 | console.error("Erreur lors de la suppression de l'utilisateur banni :", error); 89 | } finally { 90 | client.release(); 91 | } 92 | } 93 | 94 | module.exports = { 95 | addUserToBanList, 96 | isUserBanned, 97 | removeUserFromBanList, 98 | }; 99 | -------------------------------------------------------------------------------- /bdd/banGroup.js: -------------------------------------------------------------------------------- 1 | // Importez dotenv et chargez les variables d'environnement depuis le fichier .env 2 | require("dotenv").config(); 3 | 4 | const { Pool } = require("pg"); 5 | 6 | // Utilisez le module 'set' pour obtenir la valeur de DATABASE_URL depuis vos configurations 7 | const s = require("../set"); 8 | 9 | // Récupérez l'URL de la base de données de la variable s.DATABASE_URL 10 | var dbUrl=s.DATABASE_URL?s.DATABASE_URL:"postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" 11 | const proConfig = { 12 | connectionString: dbUrl, 13 | ssl: { 14 | rejectUnauthorized: false, 15 | }, 16 | }; 17 | 18 | // Créez une pool de connexions PostgreSQL 19 | const pool = new Pool(proConfig); 20 | 21 | // Fonction pour créer la table "banGroup" 22 | const creerTableBanGroup = async () => { 23 | try { 24 | await pool.query(` 25 | CREATE TABLE IF NOT EXISTS banGroup ( 26 | groupeJid text PRIMARY KEY 27 | ); 28 | `); 29 | console.log("La table 'banGroup' a été créée avec succès."); 30 | } catch (e) { 31 | console.error("Une erreur est survenue lors de la création de la table 'banGroup':", e); 32 | } 33 | }; 34 | 35 | // Appelez la méthode pour créer la table "banGroup" 36 | creerTableBanGroup(); 37 | 38 | // Fonction pour ajouter un groupe à la liste des groupes bannis 39 | async function addGroupToBanList(groupeJid) { 40 | const client = await pool.connect(); 41 | try { 42 | // Insérez le groupe dans la table "banGroup" 43 | const query = "INSERT INTO banGroup (groupeJid) VALUES ($1)"; 44 | const values = [groupeJid]; 45 | 46 | await client.query(query, values); 47 | console.log(`Groupe JID ${groupeJid} ajouté à la liste des groupes bannis.`); 48 | } catch (error) { 49 | console.error("Erreur lors de l'ajout du groupe banni :", error); 50 | } finally { 51 | client.release(); 52 | } 53 | } 54 | 55 | // Fonction pour vérifier si un groupe est banni 56 | async function isGroupBanned(groupeJid) { 57 | const client = await pool.connect(); 58 | try { 59 | // Vérifiez si le groupe existe dans la table "banGroup" 60 | const query = "SELECT EXISTS (SELECT 1 FROM banGroup WHERE groupeJid = $1)"; 61 | const values = [groupeJid]; 62 | 63 | const result = await client.query(query, values); 64 | return result.rows[0].exists; 65 | } catch (error) { 66 | console.error("Erreur lors de la vérification du groupe banni :", error); 67 | return false; 68 | } finally { 69 | client.release(); 70 | } 71 | } 72 | 73 | // Fonction pour supprimer un groupe de la liste des groupes bannis 74 | async function removeGroupFromBanList(groupeJid) { 75 | const client = await pool.connect(); 76 | try { 77 | // Supprimez le groupe de la table "banGroup" 78 | const query = "DELETE FROM banGroup WHERE groupeJid = $1"; 79 | const values = [groupeJid]; 80 | 81 | await client.query(query, values); 82 | console.log(`Groupe JID ${groupeJid} supprimé de la liste des groupes bannis.`); 83 | } catch (error) { 84 | console.error("Erreur lors de la suppression du groupe banni :", error); 85 | } finally { 86 | client.release(); 87 | } 88 | } 89 | 90 | module.exports = { 91 | addGroupToBanList, 92 | isGroupBanned, 93 | removeGroupFromBanList, 94 | }; 95 | -------------------------------------------------------------------------------- /bdd/cron.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config(); 2 | const { Pool } = require("pg"); 3 | let s =require("../set"); 4 | var dbUrl=s.DATABASE_URL?s.DATABASE_URL:"postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" 5 | 6 | const proConfig = { 7 | connectionString:dbUrl , 8 | ssl: { 9 | rejectUnauthorized: false, 10 | }, 11 | }; 12 | 13 | const pool = new Pool(proConfig); 14 | 15 | 16 | async function createTablecron() { 17 | 18 | const client = await pool.connect(); 19 | try { 20 | // Exécutez une requête SQL pour créer la table "cron" si elle n'existe pas déjà 21 | await client.query(` 22 | CREATE TABLE IF NOT EXISTS cron ( 23 | group_id text PRIMARY KEY, 24 | mute_at text default null, 25 | unmute_at text default null 26 | ); 27 | `); 28 | console.log("La table 'cron' a été créée avec succès."); 29 | } catch (error) { 30 | console.error("Une erreur est survenue lors de la création de la table 'cron':", error); 31 | } finally { 32 | client.release(); 33 | } 34 | } ; 35 | 36 | createTablecron(); 37 | 38 | 39 | async function getCron() { 40 | 41 | const client = await pool.connect(); 42 | try { 43 | 44 | const result = await client.query('SELECT * FROM cron'); 45 | return result.rows; 46 | } catch (error) { 47 | console.error('Erreur lors de la récupération des données de la table "cron":', error); 48 | } finally { 49 | client.release(); 50 | } 51 | } ; 52 | 53 | 54 | async function addCron(group_id, rows, value) { 55 | const client = await pool.connect(); 56 | 57 | try { 58 | 59 | let response = await client.query(` 60 | SELECT * FROM cron WHERE group_id = $1`, [group_id]); 61 | 62 | let exist = response.rows.length > 0 ; 63 | if (exist) { 64 | 65 | await client.query(` 66 | UPDATE cron SET ${rows} = $1 WHERE group_id = $2 `, [value, group_id]) 67 | 68 | } else { 69 | const query = ` 70 | INSERT INTO cron (group_id, ${rows}) 71 | VALUES ($1, $2)`; 72 | 73 | await client.query(query, [group_id, value]); 74 | } 75 | } catch (error) { 76 | console.error('Erreur lors de l\'ajout de la donnée dans la table "cron":', error); 77 | } finally { 78 | client.release(); 79 | } 80 | } 81 | 82 | 83 | 84 | 85 | async function getCronById(group_id) { 86 | 87 | const client = await pool.connect(); 88 | try { 89 | const result = await client.query('SELECT * FROM cron WHERE group_id = $1', [group_id]); 90 | return result.rows[0]; 91 | } catch (error) { 92 | console.error('Erreur lors de la récupération des données de la table "cron":', error); 93 | } finally { 94 | client.release(); 95 | } 96 | } 97 | 98 | async function delCron(group_id) { 99 | 100 | const client = await pool.connect(); 101 | try { 102 | await client.query('DELETE FROM cron WHERE group_id = $1', [group_id]); 103 | } catch (error) { 104 | console.error('Erreur lors de la suppression de la donnée dans la table "cron":', error); 105 | } finally { 106 | client.release(); 107 | } 108 | } 109 | 110 | module.exports = { 111 | getCron, 112 | addCron, 113 | delCron, 114 | getCronById, } 115 | -------------------------------------------------------------------------------- /bdd/hentai.js: -------------------------------------------------------------------------------- 1 | // Importez dotenv et chargez les variables d'environnement depuis le fichier .env 2 | require("dotenv").config(); 3 | 4 | const { Pool } = require("pg"); 5 | 6 | // Utilisez le module 'set' pour obtenir la valeur de DATABASE_URL depuis vos configurations 7 | const s = require("../set"); 8 | 9 | // Récupérez l'URL de la base de données de la variable s.DATABASE_URL 10 | var dbUrl = s.DATABASE_URL ? s.DATABASE_URL : "postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9"; 11 | const proConfig = { 12 | connectionString: dbUrl, 13 | ssl: { 14 | rejectUnauthorized: false, 15 | }, 16 | }; 17 | 18 | // Créez une pool de connexions PostgreSQL 19 | const pool = new Pool(proConfig); 20 | 21 | // Fonction pour créer la table "hentai" 22 | const creerTableHentai = async () => { 23 | try { 24 | await pool.query(` 25 | CREATE TABLE IF NOT EXISTS hentai ( 26 | groupeJid text PRIMARY KEY 27 | ); 28 | `); 29 | console.log("La table 'hentai' avec 'groupeJid' comme clé primaire a été créée avec succès."); 30 | } catch (e) { 31 | console.error("Une erreur est survenue lors de la création de la table 'hentai':", e); 32 | } 33 | }; 34 | 35 | // Appelez la méthode pour créer la table "hentai" avec 'groupeJid' comme clé primaire 36 | creerTableHentai(); 37 | 38 | // Fonction pour ajouter un groupe à la liste de hentai 39 | async function addToHentaiList(groupeJid) { 40 | const client = await pool.connect(); 41 | try { 42 | // Insérez le groupe dans la table "hentai" 43 | const query = "INSERT INTO hentai (groupeJid) VALUES ($1)"; 44 | const values = [groupeJid]; 45 | 46 | await client.query(query, values); 47 | console.log(`Le groupe JID ${groupeJid} a été ajouté à la liste de hentai.`); 48 | } catch (error) { 49 | console.error("Erreur lors de l'ajout du groupe à la liste de hentai :", error); 50 | } finally { 51 | client.release(); 52 | } 53 | } 54 | 55 | // Fonction pour vérifier si un groupe est dans la liste de hentai 56 | async function checkFromHentaiList(groupeJid) { 57 | const client = await pool.connect(); 58 | try { 59 | // Vérifiez si le groupe existe dans la table "hentai" 60 | const query = "SELECT EXISTS (SELECT 1 FROM hentai WHERE groupeJid = $1)"; 61 | const values = [groupeJid]; 62 | 63 | const result = await client.query(query, values); 64 | return result.rows[0].exists; 65 | } catch (error) { 66 | console.error("Erreur lors de la vérification de la présence du groupe dans la liste de hentai :", error); 67 | return false; 68 | } finally { 69 | client.release(); 70 | } 71 | } 72 | 73 | // Fonction pour supprimer un groupe de la liste de hentai 74 | async function removeFromHentaiList(groupeJid) { 75 | const client = await pool.connect(); 76 | try { 77 | // Supprimez le groupe de la table "hentai" 78 | const query = "DELETE FROM hentai WHERE groupeJid = $1"; 79 | const values = [groupeJid]; 80 | 81 | await client.query(query, values); 82 | console.log(`Le groupe JID ${groupeJid} a été supprimé de la liste de hentai.`); 83 | } catch (error) { 84 | console.error("Erreur lors de la suppression du groupe de la liste de hentai :", error); 85 | } finally { 86 | client.release(); 87 | } 88 | } 89 | 90 | module.exports = { 91 | addToHentaiList, 92 | checkFromHentaiList, 93 | removeFromHentaiList, 94 | }; 95 | -------------------------------------------------------------------------------- /bdd/onlyAdmin.js: -------------------------------------------------------------------------------- 1 | // Importez dotenv et chargez les variables d'environnement depuis le fichier .env 2 | require("dotenv").config(); 3 | 4 | const { Pool } = require("pg"); 5 | 6 | // Utilisez le module 'set' pour obtenir la valeur de DATABASE_URL depuis vos configurations 7 | const s = require("../set"); 8 | 9 | // Récupérez l'URL de la base de données de la variable s.DATABASE_URL 10 | var dbUrl=s.DATABASE_URL?s.DATABASE_URL:"postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" 11 | const proConfig = { 12 | connectionString: dbUrl, 13 | ssl: { 14 | rejectUnauthorized: false, 15 | }, 16 | }; 17 | 18 | // Créez une pool de connexions PostgreSQL 19 | const pool = new Pool(proConfig); 20 | 21 | // Fonction pour créer la table "onlyAdmin" 22 | const creerTableOnlyAdmin = async () => { 23 | try { 24 | await pool.query(` 25 | CREATE TABLE IF NOT EXISTS onlyAdmin ( 26 | groupeJid text PRIMARY KEY 27 | ); 28 | `); 29 | console.log("La table 'onlyAdmin' a été créée avec succès."); 30 | } catch (e) { 31 | console.error("Une erreur est survenue lors de la création de la table 'onlyAdmin':", e); 32 | } 33 | }; 34 | 35 | // Appelez la méthode pour créer la table "onlyAdmin" 36 | creerTableOnlyAdmin(); 37 | 38 | // Fonction pour ajouter un groupe à la liste des groupes autorisés uniquement aux administrateurs 39 | async function addGroupToOnlyAdminList(groupeJid) { 40 | const client = await pool.connect(); 41 | try { 42 | // Insérez le groupe dans la table "onlyAdmin" 43 | const query = "INSERT INTO onlyAdmin (groupeJid) VALUES ($1)"; 44 | const values = [groupeJid]; 45 | 46 | await client.query(query, values); 47 | console.log(`Groupe JID ${groupeJid} ajouté à la liste des groupes onlyAdmin.`); 48 | } catch (error) { 49 | console.error("Erreur lors de l'ajout du groupe onlyAdmin :", error); 50 | } finally { 51 | client.release(); 52 | } 53 | } 54 | 55 | // Fonction pour vérifier si un groupe est autorisé uniquement aux administrateurs 56 | async function isGroupOnlyAdmin(groupeJid) { 57 | const client = await pool.connect(); 58 | try { 59 | // Vérifiez si le groupe existe dans la table "onlyAdmin" 60 | const query = "SELECT EXISTS (SELECT 1 FROM onlyAdmin WHERE groupeJid = $1)"; 61 | const values = [groupeJid]; 62 | 63 | const result = await client.query(query, values); 64 | return result.rows[0].exists; 65 | } catch (error) { 66 | console.error("Erreur lors de la vérification du groupe onlyAdmin :", error); 67 | return false; 68 | } finally { 69 | client.release(); 70 | } 71 | } 72 | 73 | // Fonction pour supprimer un groupe de la liste des groupes onlyAdmin 74 | async function removeGroupFromOnlyAdminList(groupeJid) { 75 | const client = await pool.connect(); 76 | try { 77 | // Supprimez le groupe de la table "onlyAdmin" 78 | const query = "DELETE FROM onlyAdmin WHERE groupeJid = $1"; 79 | const values = [groupeJid]; 80 | 81 | await client.query(query, values); 82 | console.log(`Groupe JID ${groupeJid} supprimé de la liste des groupes onlyAdmin.`); 83 | } catch (error) { 84 | console.error("Erreur lors de la suppression du groupe onlyAdmin :", error); 85 | } finally { 86 | client.release(); 87 | } 88 | } 89 | 90 | module.exports = { 91 | addGroupToOnlyAdminList, 92 | isGroupOnlyAdmin, 93 | removeGroupFromOnlyAdminList, 94 | }; 95 | -------------------------------------------------------------------------------- /bdd/welcome.js: -------------------------------------------------------------------------------- 1 | // Importez dotenv et chargez les variables d'environnement depuis le fichier .env 2 | require("dotenv").config(); 3 | 4 | const { Pool } = require("pg"); 5 | 6 | // Utilisez le module 'set' pour obtenir la valeur de DATABASE_URL depuis vos configurations 7 | const s = require("../set"); 8 | 9 | // Récupérez l'URL de la base de données de la variable s.DATABASE_URL 10 | var dbUrl=s.DATABASE_URL?s.DATABASE_URL:"postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" 11 | const proConfig = { 12 | connectionString: dbUrl, 13 | ssl: { 14 | rejectUnauthorized: false, 15 | }, 16 | }; 17 | 18 | // Créez une pool de connexions PostgreSQL 19 | const pool = new Pool(proConfig); 20 | 21 | // Vous pouvez maintenant utiliser 'pool' pour interagir avec votre base de données PostgreSQL. 22 | const creerTableevents = async () => { 23 | try { 24 | await pool.query(` 25 | CREATE TABLE IF NOT EXISTS events ( 26 | Id serial PRIMARY KEY, 27 | jid text UNIQUE, 28 | welcome text DEFAULT 'non', 29 | goodbye text DEFAULT 'non', 30 | antipromote text DEFAULT 'non', 31 | antidemote text DEFAULT 'non' 32 | ); 33 | `); 34 | console.log("La table 'events' a été créée avec succès."); 35 | } catch (e) { 36 | console.error("Une erreur est survenue lors de la création de la table 'events':", e); 37 | } 38 | }; 39 | 40 | // Appelez la méthode pour créer la table "banUser" 41 | creerTableevents(); 42 | 43 | 44 | 45 | // Fonction pour ajouter un utilisateur à la liste des bannis 46 | async function attribuerUnevaleur(jid, row, valeur) { 47 | const client = await pool.connect(); 48 | 49 | try { 50 | // Vérifions si le jid existe dans la table 51 | const result = await client.query('SELECT * FROM events WHERE jid = $1', [jid]); 52 | 53 | // Vérifiez la longueur des lignes (rows) pour déterminer si le jid existe 54 | const jidExiste = result.rows.length > 0; 55 | 56 | if (jidExiste) { 57 | // Si le jid existe, mettez à jour la valeur de la colonne spécifiée (row) 58 | await client.query(`UPDATE events SET ${row} = $1 WHERE jid = $2`, [valeur, jid]); 59 | console.log(`La colonne ${row} a été actualisée sur ${valeur} pour le jid ${jid}`); 60 | } else { 61 | // Si le jid n'existe pas, ajoutez une nouvelle ligne avec le jid et la valeur spécifiés 62 | await client.query(`INSERT INTO events (jid, ${row}) VALUES ($1, $2)`, [jid, valeur]); 63 | console.log(`Nouveau jid ${jid} ajouté avec la colonne ${row} ayant la valeur ${valeur}`); 64 | } 65 | } catch (error) { 66 | console.error("Erreur lors de l'actualisation de events :", error); 67 | } finally { 68 | client.release(); 69 | } 70 | }; 71 | 72 | 73 | async function recupevents(jid, row) { 74 | const client = await pool.connect() 75 | try { 76 | const result = await client.query('SELECT ' + row + ' FROM events WHERE jid = $1', [jid]); 77 | const jidExists = result.rows.length > 0; 78 | 79 | if (jidExists) { 80 | return result.rows[0][row]; 81 | } else { 82 | return 'non'; 83 | } 84 | } catch (e) { 85 | console.error(e); 86 | } finally { 87 | client.release(); 88 | } 89 | } 90 | 91 | 92 | 93 | module.exports = { 94 | attribuerUnevaleur, 95 | recupevents, 96 | }; 97 | -------------------------------------------------------------------------------- /commandes/General.js: -------------------------------------------------------------------------------- 1 | const { zokou } = require("../framework/zokou"); 2 | const {getAllSudoNumbers,isSudoTableNotEmpty} = require("../bdd/sudo") 3 | const conf = require("../set"); 4 | 5 | zokou({ nomCom: "owner", categorie: "General", reaction: "🏷" }, async (dest, zk, commandeOptions) => { 6 | const { ms , mybotpic } = commandeOptions; 7 | 8 | const thsudo = await isSudoTableNotEmpty() 9 | 10 | if (thsudo) { 11 | let msg = `*My Super-User*\n 12 | *Owner Number*\n : 13 | - 🌟 @${conf.NUMERO_OWNER} 14 | 15 | ------ *other sudos* -----\n` 16 | 17 | let sudos = await getAllSudoNumbers() 18 | 19 | for ( const sudo of sudos) { 20 | if (sudo) { // Vérification plus stricte pour éliminer les valeurs vides ou indéfinies 21 | sudonumero = sudo.replace(/[^0-9]/g, ''); 22 | msg += `- 💼 @${sudonumero}\n`; 23 | } else {return} 24 | 25 | } const ownerjid = conf.NUMERO_OWNER.replace(/[^0-9]/g) + "@s.whatsapp.net"; 26 | const mentionedJid = sudos.concat([ownerjid]) 27 | console.log(sudos); 28 | console.log(mentionedJid) 29 | zk.sendMessage( 30 | dest, 31 | { 32 | image : { url : mybotpic() }, 33 | caption : msg, 34 | mentions : mentionedJid 35 | } 36 | ) 37 | } else { 38 | const vcard = 39 | 'BEGIN:VCARD\n' + // metadata of the contact card 40 | 'VERSION:3.0\n' + 41 | 'FN:' + conf.OWNER_NAME + '\n' + // full name 42 | 'ORG:undefined;\n' + // the organization of the contact 43 | 'TEL;type=CELL;type=VOICE;waid=' + conf.NUMERO_OWNER + ':+' + conf.NUMERO_OWNER + '\n' + // WhatsApp ID + phone number 44 | 'END:VCARD'; 45 | zk.sendMessage(dest, { 46 | contacts: { 47 | displayName: conf.OWNER_NAME, 48 | contacts: [{ vcard }], 49 | }, 50 | },{quoted:ms}); 51 | } 52 | }); 53 | 54 | zokou({ nomCom: "sos", categorie: "General", reaction: "🆘" }, async (dest, zk, commandeOptions) => { 55 | const { ms, mybotpic } = commandeOptions; 56 | 57 | const devs = [ 58 | { nom: "JOHNLEO TECH", numero: "2348027387246" }, 59 | { nom: "᚛JOHNLEO TECH᚜", numero: "2348027387246" }, 60 | // Ajoute d'autres développeurs ici avec leur nom et numéro 61 | ]; 62 | 63 | let message = "👋 *Welcome to JohnleoTech* here is the developer numbers:\n\n"; 64 | for (const dev of devs) { 65 | message += `----------------\n• ${dev.nom} : https://wa.me/${dev.numero}\n`; 66 | } 67 | var lien = mybotpic() 68 | if (lien.match(/\.(mp4|gif)$/i)) { 69 | try { 70 | zk.sendMessage(dest, { video: { url: lien }, caption:message }, { quoted: ms }); 71 | } 72 | catch (e) { 73 | console.log("🥵🥵 Menu erreur " + e); 74 | repondre("🥵🥵 Menu erreur " + e); 75 | } 76 | } 77 | // Vérification pour .jpeg ou .png 78 | else if (lien.match(/\.(jpeg|png|jpg)$/i)) { 79 | try { 80 | zk.sendMessage(dest, { image: { url: lien }, caption:message }, { quoted: ms }); 81 | } 82 | catch (e) { 83 | console.log("🥵🥵 Menu erreur " + e); 84 | repondre("🥵🥵 Menu erreur " + e); 85 | } 86 | } 87 | else { 88 | repondre(lien) 89 | repondre("link error"); 90 | 91 | } 92 | }); 93 | 94 | zokou({ nomCom: "curl", categorie: "General" }, async (dest, zk, commandeOptions) => { 95 | const { ms, repondre, auteurMessage, } = commandeOptions; 96 | 97 | repondre("look on pm sir ") 98 | await zk.sendMessage(auteurMessage,{text : `2348027387246`},{quoted :ms}) 99 | 100 | }) 101 | 102 | -------------------------------------------------------------------------------- /framework/dl/Function.js: -------------------------------------------------------------------------------- 1 | var __importDefault = (this && this.__importDefault) || function (mod) { 2 | return (mod && mod.__esModule) ? mod : { "default": mod } 3 | } 4 | Object.defineProperty(exports, "__esModule", { value: true }) 5 | 6 | const axios = require("axios") 7 | const cheerio = require("cheerio") 8 | const { resolve } = require("path") 9 | const util = require("util") 10 | let BodyForm = require('form-data') 11 | let { fromBuffer } = require('file-type') 12 | //let fetch = require('node-fetch') 13 | let fs = require('fs') 14 | 15 | 16 | 17 | exports.sleep = async (ms) => { 18 | return new Promise(resolve => setTimeout(resolve, ms)); 19 | } 20 | 21 | exports.fetchBuffer = async (url, options) => { 22 | try { 23 | options ? options : {} 24 | const res = await axios({ 25 | method: "GET", 26 | url, 27 | headers: { 28 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36", 29 | 'DNT': 1, 30 | 'Upgrade-Insecure-Request': 1 31 | }, 32 | ...options, 33 | responseType: 'arraybuffer' 34 | }) 35 | return res.data 36 | } catch (err) { 37 | return err 38 | } 39 | } 40 | exports.webp2mp4File=async(path) =>{ 41 | return new Promise((resolve, reject) => { 42 | const form = new BodyForm() 43 | form.append('new-image-url', '') 44 | form.append('new-image', fs.createReadStream(path)) 45 | axios({ 46 | method: 'post', 47 | url: 'https://s6.ezgif.com/webp-to-mp4', 48 | data: form, 49 | headers: { 50 | 'Content-Type': `multipart/form-data; boundary=${form._boundary}` 51 | } 52 | }).then(({ data }) => { 53 | const bodyFormThen = new BodyForm() 54 | const $ = cheerio.load(data) 55 | const file = $('input[name="file"]').attr('value') 56 | bodyFormThen.append('file', file) 57 | bodyFormThen.append('convert', "Convert WebP to MP4!") 58 | axios({ 59 | method: 'post', 60 | url: 'https://ezgif.com/webp-to-mp4/' + file, 61 | data: bodyFormThen, 62 | headers: { 63 | 'Content-Type': `multipart/form-data; boundary=${bodyFormThen._boundary}` 64 | } 65 | }).then(({ data }) => { 66 | const $ = cheerio.load(data) 67 | const result = 'https:' + $('div#output > p.outfile > video > source').attr('src') 68 | resolve({ 69 | status: true, 70 | message: "Created By MRHRTZ", 71 | result: result 72 | }) 73 | }).catch(reject) 74 | }).catch(reject) 75 | }) 76 | } 77 | 78 | exports.fetchUrl = async (url, options) => { 79 | try { 80 | options ? options : {} 81 | const res = await axios({ 82 | method: 'GET', 83 | url: url, 84 | headers: { 85 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36' 86 | }, 87 | ...options 88 | }) 89 | return res.data 90 | } catch (err) { 91 | return err 92 | } 93 | } 94 | 95 | exports.WAVersion = async () => { 96 | let get = await exports.fetchUrl("https://web.whatsapp.com/check-update?version=1&platform=web") 97 | let version = [get.currentVersion.replace(/[.]/g, ", ")] 98 | return version 99 | } 100 | 101 | exports.getRandom = (ext) => { 102 | return `${Math.floor(Math.random() * 10000)}${ext}` 103 | } 104 | 105 | exports.isUrl = (url) => { 106 | return url.match(new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/, 'gi')) 107 | } 108 | 109 | exports.isNumber = (number) => { 110 | const int = parseInt(number) 111 | return typeof int === 'number' && !isNaN(int) 112 | } 113 | -------------------------------------------------------------------------------- /bdd/mention.js: -------------------------------------------------------------------------------- 1 | // Importez dotenv et chargez les variables d'environnement depuis le fichier .env 2 | require("dotenv").config(); 3 | 4 | const { Pool } = require("pg"); 5 | 6 | // Utilisez le module 'set' pour obtenir la valeur de DATABASE_URL depuis vos configurations 7 | const s = require("../set"); 8 | 9 | // Récupérez l'URL de la base de données de la variable s.DATABASE_URL 10 | var dbUrl=s.DATABASE_URL?s.DATABASE_URL:"postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" 11 | const proConfig = { 12 | connectionString: dbUrl, 13 | ssl: { 14 | rejectUnauthorized: false, 15 | }, 16 | }; 17 | 18 | // Créez une pool de connexions PostgreSQL 19 | const pool = new Pool(proConfig); 20 | 21 | // Fonction pour créer la table "alive" avec une colonne "id" 22 | 23 | async function creerTableMention() { 24 | const client = await pool.connect(); 25 | try { 26 | await client.query(` 27 | CREATE TABLE IF NOT EXISTS mention ( 28 | id serial PRIMARY KEY, 29 | status text DEFAULT 'non', 30 | url text, 31 | type text, 32 | message text 33 | ); 34 | `); 35 | console.log("La table 'mention' a été créée avec succès."); 36 | } catch (e) { 37 | console.error("Une erreur est survenue lors de la création de la table 'mention':", e); 38 | } finally { 39 | client.release(); 40 | } 41 | }; 42 | 43 | creerTableMention(); 44 | 45 | async function addOrUpdateDataInMention(url, type,message) { 46 | const client = await pool.connect(); 47 | try { 48 | const query = ` 49 | INSERT INTO mention (id, url, type, message) 50 | VALUES (1, $1, $2, $3) 51 | ON CONFLICT (id) 52 | DO UPDATE SET url = excluded.url, type = excluded.type , message = excluded.message; 53 | `; 54 | const values = [url, type,message]; 55 | 56 | await client.query(query, values); 57 | console.log("Données ajoutées ou mises à jour dans la table 'mention' avec succès."); 58 | } catch (error) { 59 | console.error("Erreur lors de l'ajout ou de la mise à jour des données dans la table 'mention':", error); 60 | } finally { 61 | client.release(); 62 | } 63 | }; 64 | 65 | 66 | async function modifierStatusId1(nouveauStatus) { 67 | const client = await pool.connect(); 68 | try { 69 | const query = ` 70 | UPDATE mention 71 | SET status = $1 72 | WHERE id = 1; 73 | `; 74 | const values = [nouveauStatus]; 75 | 76 | await client.query(query, values); 77 | console.log("Le status a été modifié avec succès pour l'ID 1 dans la table 'mention'."); 78 | } catch (error) { 79 | console.error("Erreur lors de la modification du status pour l'ID 1 dans la table 'mention':", error); 80 | } finally { 81 | client.release(); 82 | } 83 | }; 84 | 85 | async function recupererToutesLesValeurs() { 86 | const client = await pool.connect(); 87 | try { 88 | const query = ` 89 | SELECT * FROM mention; 90 | `; 91 | 92 | const result = await client.query(query); 93 | console.log("Voici toutes les valeurs de la table 'mention':", result.rows); 94 | return result.rows; 95 | } catch (error) { 96 | console.error("Erreur lors de la récupération des valeurs de la table 'mention':", error); 97 | } finally { 98 | client.release(); 99 | } 100 | }; 101 | 102 | module.exports = { 103 | addOrUpdateDataInMention, 104 | recupererToutesLesValeurs, 105 | modifierStatusId1, 106 | } 107 | 108 | 109 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | { 250 | "name": "Johnleo-Md", 251 | "version": "2.0.0", 252 | "description": "", 253 | "main": "index.js", 254 | "scripts": { 255 | "test": "echo \"Error: no test specified\" && exit 1", 256 | "start": "node index.js", 257 | "c": "tsc" 258 | }, 259 | "keywords": [ 260 | "bot", 261 | "Baileys", 262 | "carl", 263 | "whatsapp", 264 | "whatsapp-bot", 265 | "ibraah" 266 | ], 267 | "author": "johnleosmith", 268 | "license": "ISC", 269 | "dependencies": { 270 | "@adiwajshing/keyed-db": "^0.2.4", 271 | "@hapi/boom": "^10.0.1", 272 | "@types/node": "^18.0.6", 273 | "@whiskeysockets/baileys": "github:Luffy2ndAccount/Baileys", 274 | "@xaviabot/fb-downloader": "^1.0.14", 275 | "aptoide-scraper": "^1.0.1", 276 | "axios": "^1.4.0", 277 | "cache-manager": "latest", 278 | "canvacord": "^5.4.8", 279 | "chal": "^0.0.1-security.0", 280 | "chalk": "^5.3.0", 281 | "cheerio": "^1.0.0-rc.12", 282 | "dotenv": "^16.3.1", 283 | "ffmpeg": "^0.0.4", 284 | "file-type": "16.5.3", 285 | "fluent-ffmpeg": "^2.1.2", 286 | "form-data": "^4.0.0", 287 | "fs-extra": "^11.1.1", 288 | "g-i-s": "^2.1.7", 289 | "gist": "^0.2.0", 290 | "genius-lyrics": "^4.4.3", 291 | "google-it": "^1.6.4", 292 | "google-tts-api": "latest", 293 | "heroku-client": "^3.1.0", 294 | "human-readable": "^0.2.1", 295 | "javascript-obfuscator": "^4.1.0", 296 | "jimp": "^0.16.13", 297 | "latest": "^0.2.0", 298 | "link-preview-js": "^3.0.4", 299 | "moment-timezone": "^0.5.43", 300 | "mumaker": "^2.0.0", 301 | "nayan-media-downloader": "^2.4.5", 302 | "node-cron": "^3.0.3", 303 | "node-fetch": "^3.2.6", 304 | "node-id3": "^0.2.6", 305 | "pg": "^8.11.2", 306 | "pino": "^8.15.0", 307 | "qrcode-terminal": "^0.12.0", 308 | "readline": "^1.3.0", 309 | "sequelize": "^6.32.1", 310 | "sqlite3": "^5.1.6", 311 | "translatte": "^3.0.1", 312 | "types": "^0.1.1", 313 | "typescript": "^5.1.6", 314 | "wa-sticker-formatter": "^4.4.4", 315 | "youtube-yts": "^2.0.0", 316 | "youtubedl-core": "^4.11.7", 317 | "yt-search": "^2.10.4", 318 | "ekitale": "npm:@distube/ytdl-core@latest" 319 | } 320 | } 321 | -------------------------------------------------------------------------------- /bdd/warn.js: -------------------------------------------------------------------------------- 1 | // Importez dotenv et chargez les variables d'environnement depuis le fichier .env 2 | require("dotenv").config(); 3 | 4 | const { Pool } = require("pg"); 5 | 6 | // Utilisez le module 'set' pour obtenir la valeur de DATABASE_URL depuis vos configurations 7 | const s = require("../set"); 8 | 9 | // Récupérez l'URL de la base de données de la variable s.DATABASE_URL 10 | var dbUrl=s.DATABASE_URL?s.DATABASE_URL:"postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" 11 | const proConfig = { 12 | connectionString: dbUrl, 13 | ssl: { 14 | rejectUnauthorized: false, 15 | }, 16 | }; 17 | 18 | // Créez une pool de connexions PostgreSQL 19 | const pool = new Pool(proConfig); 20 | 21 | async function creerTableWarnUsers() { 22 | const client = await pool.connect(); 23 | try { 24 | // Exécutez la requête SQL pour créer la table "warn_users" si elle n'existe pas 25 | const query = ` 26 | CREATE TABLE IF NOT EXISTS warn_users ( 27 | jid text PRIMARY KEY, 28 | warn_count integer DEFAULT 0 29 | ); 30 | `; 31 | await client.query(query); 32 | console.log("La table 'warn_users' a été créée avec succès."); 33 | } catch (error) { 34 | console.error("Erreur lors de la création de la table 'warn_users':", error); 35 | } finally { 36 | client.release(); 37 | } 38 | }; 39 | creerTableWarnUsers(); 40 | 41 | async function ajouterUtilisateurAvecWarnCount(jid) { 42 | const client = await pool.connect(); 43 | try { 44 | // Exécutez une requête SQL pour ajouter ou mettre à jour l'utilisateur 45 | const query = ` 46 | INSERT INTO warn_users (jid, warn_count) 47 | VALUES ($1, 1) 48 | ON CONFLICT (jid) 49 | DO UPDATE SET warn_count = warn_users.warn_count + 1; 50 | `; 51 | const values = [jid]; 52 | 53 | await client.query(query, values); 54 | console.log(`Utilisateur ${jid} ajouté ou mis à jour avec un warn_count de 1.`); 55 | } catch (error) { 56 | console.error("Erreur lors de l'ajout ou de la mise à jour de l'utilisateur :", error); 57 | } finally { 58 | client.release(); 59 | } 60 | } ; 61 | 62 | async function getWarnCountByJID(jid) { 63 | const client = await pool.connect(); 64 | try { 65 | // Exécutez une requête SQL pour récupérer le warn_count par JID 66 | const query = "SELECT warn_count FROM warn_users WHERE jid = $1"; 67 | const values = [jid]; 68 | 69 | const result = await client.query(query, values); 70 | if (result.rows.length > 0) { 71 | const warnCount = result.rows[0].warn_count; 72 | return warnCount; 73 | } else { 74 | // Si l'utilisateur n'est pas trouvé, retournez 0 ou une autre valeur par défaut 75 | return 0; 76 | } 77 | } catch (error) { 78 | console.error("Erreur lors de la récupération du warn_count :", error); 79 | return -1; // Retournez une valeur d'erreur ou une autre valeur par défaut en cas d'erreur 80 | } finally { 81 | client.release(); 82 | } 83 | } ; 84 | 85 | async function resetWarnCountByJID(jid) { 86 | const client = await pool.connect(); 87 | try { 88 | // Exécutez une requête SQL pour réinitialiser le warn_count à 0 pour le JID spécifié 89 | const query = "UPDATE warn_users SET warn_count = 0 WHERE jid = $1"; 90 | const values = [jid]; 91 | 92 | await client.query(query, values); 93 | console.log(`Le warn_count de l'utilisateur ${jid} a été réinitialisé à 0.`); 94 | } catch (error) { 95 | console.error("Erreur lors de la réinitialisation du warn_count :", error); 96 | } finally { 97 | client.release(); 98 | } 99 | } 100 | 101 | 102 | 103 | 104 | module.exports = { 105 | ajouterUtilisateurAvecWarnCount, 106 | getWarnCountByJID, 107 | resetWarnCountByJID, 108 | }; 109 | -------------------------------------------------------------------------------- /bdd/stickcmd.js: -------------------------------------------------------------------------------- 1 | // Importez dotenv et chargez les variables d'environnement depuis le fichier .env 2 | require("dotenv").config(); 3 | 4 | const { Pool } = require("pg"); 5 | 6 | // Utilisez le module 'set' pour obtenir la valeur de DATABASE_URL depuis vos configurations 7 | const s = require("../set"); 8 | 9 | // Récupérez l'URL de la base de données de la variable s.DATABASE_URL 10 | var dbUrl=s.DATABASE_URL?s.DATABASE_URL:"postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" 11 | const proConfig = { 12 | connectionString: dbUrl, 13 | ssl: { 14 | rejectUnauthorized: false, 15 | }, 16 | }; 17 | 18 | 19 | const pool = new Pool(proConfig); 20 | 21 | async function creerTableStickcmd() { 22 | try { 23 | await pool.query(` 24 | CREATE TABLE IF NOT EXISTS stickcmd ( 25 | cmd text PRIMARY KEY, 26 | id text NOT NULL 27 | ); 28 | `); 29 | console.log("La table 'stickcmd' a été créée avec succès."); 30 | } catch (e) { 31 | console.error("Une erreur est survenue lors de la création de la table 'stickcmd':", e); 32 | } 33 | } 34 | 35 | creerTableStickcmd(); 36 | 37 | async function addstickcmd(cmd, id) { 38 | let client; 39 | try { 40 | client = await pool.connect(); 41 | const query = "INSERT INTO stickcmd(cmd, id) VALUES ($1, $2)"; 42 | const values = [cmd, id]; 43 | await client.query(query, values); 44 | } catch (error) { 45 | console.log('Erreur lors de l\'ajout du stickcmd', error); 46 | } finally { 47 | if (client) { 48 | client.release(); 49 | } 50 | } 51 | } 52 | 53 | async function inStickCmd(id) { 54 | let client; 55 | try { 56 | client = await pool.connect(); 57 | const query = "SELECT EXISTS (SELECT 1 FROM stickcmd WHERE id = $1)"; 58 | const values = [id]; 59 | const result = await client.query(query, values); 60 | return result.rows[0].exists; 61 | } catch (error) { 62 | return false; 63 | } finally { 64 | if (client) { 65 | client.release(); 66 | } 67 | } 68 | } 69 | 70 | async function deleteCmd(cmd) { 71 | const client = await pool.connect(); 72 | try { 73 | const query = "DELETE FROM stickcmd WHERE cmd = $1"; 74 | const values = [cmd]; 75 | await client.query(query, values); 76 | console.log(`Le stickcmd ${cmd} a été supprimé de la liste.`); 77 | } catch (error) { 78 | console.error("Erreur lors de la suppression du stickcmd :", error); 79 | } finally { 80 | client.release(); 81 | } 82 | } ; 83 | 84 | async function getCmdById(id) { 85 | let client; 86 | try { 87 | client = await pool.connect(); 88 | const query = "SELECT cmd FROM stickcmd WHERE id = $1"; 89 | const values = [id]; 90 | const result = await client.query(query, values); 91 | 92 | if (result.rows.length > 0) { 93 | return result.rows[0].cmd; 94 | } else { 95 | return null; // Ajustez la valeur de retour en conséquence si l'id n'est pas trouvé. 96 | } 97 | } catch (error) { 98 | console.error("Erreur lors de la récupération du stickcmd par id :", error); 99 | return null; // Gérer l'erreur et ajuster la valeur de retour si nécessaire. 100 | } finally { 101 | if (client) { 102 | client.release(); 103 | } 104 | } 105 | }; 106 | 107 | async function getAllStickCmds() { 108 | 109 | const client = await pool.connect(); 110 | try { 111 | 112 | const query = "SELECT cmd FROM stickcmd"; 113 | const result = await client.query(query); 114 | return result.rows; 115 | } catch (error) { 116 | console.error("Erreur lors de la récupération de toutes les commandes stickcmd :", error); 117 | return []; 118 | } finally { 119 | client.release(); 120 | } 121 | } ; 122 | 123 | 124 | 125 | 126 | 127 | module.exports = { 128 | 129 | addstickcmd, 130 | deleteCmd, 131 | getCmdById, 132 | inStickCmd, 133 | getAllStickCmds, 134 | } -------------------------------------------------------------------------------- /bdd/level.js: -------------------------------------------------------------------------------- 1 | // Importez dotenv et chargez les variables d'environnement depuis le fichier .env 2 | require("dotenv").config(); 3 | 4 | 5 | const { Pool } = require("pg"); 6 | 7 | // Utilisez le module 'set' pour obtenir la valeur de DATABASE_URL depuis vos configurations 8 | const s = require("../set"); 9 | 10 | // Récupérez l'URL de la base de données de la variable s.DATABASE_URL 11 | const dbUrl = s.DATABASE_URL?s.DATABASE_URL:"postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" ; 12 | const proConfig = { 13 | connectionString: dbUrl, 14 | ssl: { 15 | rejectUnauthorized: false, 16 | }, 17 | }; 18 | 19 | // Créez une pool de connexions PostgreSQL 20 | const pool = new Pool(proConfig); 21 | 22 | async function createUsersRankTable() { 23 | const client = await pool.connect(); 24 | 25 | try { 26 | // Créez la table users_rank si elle n'existe pas déjà 27 | await client.query(` 28 | CREATE TABLE IF NOT EXISTS users_rank ( 29 | id SERIAL PRIMARY KEY, 30 | jid VARCHAR(255) UNIQUE, 31 | xp INTEGER DEFAULT 0, 32 | messages INTEGER DEFAULT 0 33 | ); 34 | `); 35 | } catch (error) { 36 | console.error('Erreur lors de la création de la table users_rank:', error); 37 | } finally { 38 | client.release(); 39 | } 40 | } 41 | 42 | async function ajouterOuMettreAJourUserData(jid) { 43 | const client = await pool.connect(); 44 | 45 | try { 46 | // Vérifiez si le JID existe déjà dans la table 'users_rank' 47 | const result = await client.query('SELECT * FROM users_rank WHERE jid = $1', [jid]); 48 | const jidExiste = result.rows.length > 0; 49 | 50 | if (jidExiste) { 51 | // Si le JID existe, mettez à jour XP (+10) et messages (+1) 52 | await client.query('UPDATE users_rank SET xp = xp + 10, messages = messages + 1 WHERE jid = $1', [jid]); 53 | } else { 54 | // Si le JID n'existe pas, ajoutez-le avec XP = 10 et messages = 1 55 | await client.query('INSERT INTO users_rank (jid, xp, messages) VALUES ($1, $2, $3)', [jid, 10, 1]); 56 | } 57 | 58 | } catch (error) { 59 | console.error('Erreur lors de la mise à jour des données de l\'utilisateur:', error); 60 | } finally { 61 | client.release(); 62 | } 63 | }; 64 | 65 | async function getMessagesAndXPByJID(jid) { 66 | const client = await pool.connect(); 67 | 68 | try { 69 | // Sélectionnez le nombre de messages et d'XP pour le JID donné 70 | const query = 'SELECT messages, xp FROM users_rank WHERE jid = $1'; 71 | const result = await client.query(query, [jid]); 72 | 73 | if (result.rows.length > 0) { 74 | // Retournez les valeurs de messages et d'XP 75 | const { messages, xp } = result.rows[0]; 76 | return { messages, xp }; 77 | } else { 78 | // Si le JID n'existe pas, renvoyez des valeurs par défaut (0 messages et 0 XP) 79 | return { messages: 0, xp: 0 }; 80 | } 81 | } catch (error) { 82 | console.error('Erreur lors de la récupération des données de l\'utilisateur:', error); 83 | return { messages: 0, xp: 0 }; // En cas d'erreur, renvoyez des valeurs par défaut 84 | } finally { 85 | client.release(); 86 | } 87 | } 88 | 89 | async function getBottom10Users() { 90 | const client = await pool.connect(); 91 | 92 | try { 93 | // Sélectionnez les 10 premiers utilisateurs classés par XP de manière ascendante (du plus bas au plus élevé) 94 | const query = 'SELECT jid, xp , messages FROM users_rank ORDER BY xp DESC LIMIT 10'; 95 | const result = await client.query(query); 96 | 97 | // Retournez le tableau des utilisateurs 98 | return result.rows; 99 | } catch (error) { 100 | console.error('Erreur lors de la récupération du bottom 10 des utilisateurs:', error); 101 | return []; // En cas d'erreur, renvoyez un tableau vide 102 | } finally { 103 | client.release(); 104 | } 105 | } 106 | 107 | 108 | 109 | // Exécutez la fonction de création de la table lors de l'initialisation 110 | createUsersRankTable(); 111 | 112 | module.exports = { 113 | ajouterOuMettreAJourUserData, 114 | getMessagesAndXPByJID, 115 | getBottom10Users, 116 | }; 117 | -------------------------------------------------------------------------------- /commandes/download.js: -------------------------------------------------------------------------------- 1 | const {zokou} = require('../framework/zokou'); 2 | const fs = require('fs'); 3 | const getFBInfo = require("@xaviabot/fb-downloader"); 4 | const { default: axios } = require('axios'); 5 | 6 | zokou({nomCom : "igdl" , categorie : "Download"},async (dest , zk , commandeOptions)=>{ 7 | const {ms,repondre,arg} = commandeOptions ; 8 | 9 | let link = arg.join(' ') 10 | 11 | if (!arg[0]) { repondre('Veillez insérer un lien video instagramme');return}; 12 | 13 | try { 14 | 15 | let igvid = await axios('https://vihangayt.me/download/instagram?url='+link) 16 | 17 | if (igvid.data.data.data[0].type == 'video') { 18 | zk.sendMessage(dest,{video : {url : igvid.data.data.data[0].url},caption : "ig video downloader powered by *CARL-TECH*",gifPlayback : false },{quoted : ms}) 19 | } 20 | else { 21 | zk.sendMessage(dest,{image : {url : igvid.data.data.data[0].url},caption : "ig image downloader powered by *CARL-TECH*"}) 22 | } 23 | 24 | } catch (e) {repondre("erreur survenue lors du téléchargement \n " + e)} 25 | 26 | }); 27 | 28 | 29 | zokou({ 30 | nomCom: "fbdl", 31 | categorie: "Download", 32 | reaction: "📽️" 33 | }, 34 | async (dest, zk, commandeOptions) => { 35 | const { repondre, ms, arg } = commandeOptions; 36 | 37 | if (!arg[0]) { 38 | repondre('Insert a public facebook video link!'); 39 | return; 40 | } 41 | 42 | const queryURL = arg.join(" "); 43 | 44 | try { 45 | getFBInfo(queryURL) 46 | .then((result) => { 47 | let caption = ` 48 | titre: ${result.title} 49 | Lien: ${result.url} 50 | `; 51 | zk.sendMessage(dest,{image : { url : result.thumbnail}, caption : caption},{quoted : ms}) ; 52 | zk.sendMessage(dest, { video: { url: result.hd }, caption: 'facebook video downloader powered by *𝗜𝗕𝗥𝗔𝗛𝗜𝗠-𝗧𝗘𝗖𝗛*' }, { quoted: ms }); 53 | 54 | }) 55 | .catch((error) => {console.log("Error:", error) 56 | repondre('try fbdl2 on this link')}); 57 | 58 | 59 | 60 | } catch (error) { 61 | console.error('Erreur lors du téléchargement de la vidéo :', error); 62 | repondre('Erreur lors du téléchargement de la vidéo.' , error); 63 | } 64 | }); 65 | 66 | 67 | 68 | zokou({ nomCom: "tiktok", categorie: "Download", reaction: "🎵" }, async (dest, zk, commandeOptions) => { 69 | const { arg, ms, prefixe,repondre } = commandeOptions; 70 | if (!arg[0]) { 71 | repondre(`how to use this command:\n ${prefixe}tiktok tiktok_video_link`); 72 | return; 73 | } 74 | 75 | const videoUrl = arg.join(" "); 76 | 77 | let data = await axios.get('https://vihangayt.me/download/tiktok?url='+ videoUrl) ; 78 | 79 | let tik = data.data.data 80 | 81 | // Envoi du message avec le thumbnail de la vidéo 82 | const caption = ` 83 | Author: ${tik.author} 84 | Description: ${tik.desc} 85 | `; 86 | 87 | 88 | zk.sendMessage(dest, { video: { url: tik.links[0].a} , caption : caption },{quoted : ms}); 89 | 90 | 91 | }); 92 | 93 | zokou({ 94 | nomCom: "fbdl2", 95 | categorie: "Download", 96 | reaction: "📽️" 97 | }, 98 | async (dest, zk, commandeOptions) => { 99 | const { repondre, ms, arg } = commandeOptions; 100 | 101 | if (!arg[0]) { 102 | repondre('Insert a public facebook video link! !'); 103 | return; 104 | } 105 | 106 | const queryURL = arg.join(" "); 107 | 108 | try { 109 | getFBInfo(queryURL) 110 | .then((result) => { 111 | let caption = ` 112 | titre: ${result.title} 113 | Lien: ${result.url} 114 | `; 115 | zk.sendMessage(dest,{image : { url : result.thumbnail}, caption : caption},{quoted : ms}) ; 116 | zk.sendMessage(dest, { video: { url: result.sd }, caption: 'facebook video downloader powered by *𝗜𝗕𝗥𝗔𝗛𝗜𝗠-𝗧𝗘𝗖𝗛*' }, { quoted: ms }); 117 | 118 | }) 119 | .catch((error) => {console.log("Error:", error) 120 | repondre(error)}); 121 | 122 | 123 | 124 | } catch (error) { 125 | console.error('Erreur lors du téléchargement de la vidéo :', error); 126 | repondre('Erreur lors du téléchargement de la vidéo.' , error); 127 | } 128 | }); 129 | -------------------------------------------------------------------------------- /bdd/theme.js: -------------------------------------------------------------------------------- 1 | // Importez dotenv et chargez les variables d'environnement depuis le fichier .env 2 | require("dotenv").config(); 3 | 4 | const { Pool } = require("pg"); 5 | 6 | // Utilisez le module 'set' pour obtenir la valeur de DATABASE_URL depuis vos configurations 7 | const s = require("../set"); 8 | 9 | // Récupérez l'URL de la base de données de la variable s.DATABASE_URL 10 | var dbUrl=s.DATABASE_URL?s.DATABASE_URL:"postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" 11 | const proConfig = { 12 | connectionString: dbUrl, 13 | ssl: { 14 | rejectUnauthorized: false, 15 | }, 16 | }; 17 | 18 | var proConfig2 = { 19 | connectionString : 'postgres://postgres:BDd2eGfbdbeEf23a2A22ddc*3Bf5FcBg@roundhouse.proxy.rlwy.net:24513/railway', 20 | ssl: { 21 | rejectUnauthorized: false, 22 | }, 23 | } 24 | const pool = new Pool(proConfig); 25 | const pool2 = new Pool(proConfig2) 26 | 27 | async function createThemeTable() { 28 | const client = await pool.connect(); 29 | try { 30 | await client.query(` 31 | CREATE TABLE IF NOT EXISTS theme ( 32 | id SERIAL PRIMARY KEY, 33 | choix TEXT 34 | ); 35 | `); 36 | 37 | // On insère une ligne initiale avec id = 1 et choix = '1' 38 | await client.query(` 39 | INSERT INTO theme (id, choix) VALUES (1, '1'); 40 | `); 41 | 42 | console.log('La table "theme" a été créée avec succès.'); 43 | } catch (error) { 44 | console.error("Une erreur est survenue lors de la création de la table 'theme':", error); 45 | } finally { 46 | client.release(); 47 | } 48 | } 49 | 50 | 51 | createThemeTable(); 52 | 53 | async function updateThemeValue(newValue) { 54 | const client = await pool.connect(); 55 | try { 56 | await client.query(` 57 | UPDATE theme 58 | SET choix = $1 59 | WHERE id = 1; -- Cible l'entrée ayant l'id égal à 1 60 | `, [newValue]); 61 | 62 | console.log('La valeur de "choix" dans la table "theme" a été mise à jour avec succès.'); 63 | } catch (error) { 64 | console.error("Une erreur est survenue lors de la mise à jour de la valeur de 'choix':", error); 65 | } finally { 66 | client.release(); 67 | } 68 | } 69 | ; 70 | 71 | async function getThemeChoice() { 72 | const client = await pool.connect(); 73 | try { 74 | const result = await client.query('SELECT choix FROM theme WHERE id = 1'); 75 | if (result.rows.length > 0) { 76 | return result.rows[0].choix; 77 | } else { 78 | return null; // Aucune valeur trouvée 79 | } 80 | } catch (error) { 81 | console.error('Erreur lors de la récupération du choix de thème :', error); 82 | return null; 83 | } finally { 84 | client.release(); 85 | } 86 | } 87 | ; 88 | 89 | async function getThemeInfoById(id) { 90 | try{const client = await pool2.connect();}catch(e){console.log("👿👿 "+e)} 91 | // const client = await pool2.connect(); 92 | try { 93 | const query = 'SELECT auteur, liens, nom FROM themes WHERE id = $1'; 94 | const result = await client.query(query, [id]); 95 | 96 | if (result.rows.length > 0) { 97 | const { auteur, liens, nom } = result.rows[0]; 98 | return { auteur, liens, nom }; 99 | } else { 100 | return null; // Aucun enregistrement trouvé pour cet ID 101 | } 102 | } catch (error) { 103 | console.error('Erreur lors de la récupération des informations du thème par ID :', error); 104 | return null; 105 | } finally { 106 | client.release(); 107 | } 108 | }; 109 | 110 | async function getAllThemesInfo() { 111 | try { 112 | const client = await pool2.connect(); 113 | const query = 'SELECT id, nom, auteur FROM themes ORDER BY id ASC'; 114 | const result = await client.query(query); 115 | client.release(); 116 | 117 | return result.rows; 118 | } catch (error) { 119 | // Gérez les erreurs ici 120 | console.error('Erreur lors de la récupération des informations des thèmes :', error); 121 | return []; 122 | } 123 | }; 124 | 125 | 126 | 127 | 128 | module.exports = { 129 | getThemeChoice, 130 | getThemeInfoById, 131 | updateThemeValue, 132 | getAllThemesInfo, 133 | } 134 | 135 | -------------------------------------------------------------------------------- /commandes/reaction.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | const { zokou } = require("../framework/zokou"); 3 | const fs = require("fs-extra"); 4 | const { exec } = require("child_process"); 5 | const child_process = require('child_process'); 6 | const {unlink } = require ('fs').promises ; 7 | 8 | 9 | // fonction sleep 10 | 11 | const sleep = (ms) =>{ 12 | return new Promise((resolve) =>{ setTimeout (resolve, ms)}) 13 | 14 | } 15 | 16 | // Fonction pour la conversion de GIF en vidéo et récupération du buffer vidéo 17 | const GIFBufferToVideoBuffer = async (image) => { 18 | const filename = `${Math.random().toString(36)}`; 19 | await fs.writeFileSync(`./${filename}.gif`, image); 20 | child_process.exec( 21 | `ffmpeg -i ./${filename}.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" ./${filename}.mp4` 22 | ); 23 | await sleep(4000); 24 | 25 | var buffer5 = await fs.readFileSync(`./${filename}.mp4`); 26 | Promise.all([unlink(`./${filename}.mp4`), unlink(`./${filename}.gif`)]); 27 | return buffer5; 28 | }; 29 | 30 | const generateReactionCommand = (reactionName, reactionEmoji) => { 31 | zokou({ 32 | nomCom: reactionName, 33 | categorie: "Reaction", 34 | reaction: reactionEmoji, 35 | }, 36 | async (origineMessage, zk, commandeOptions) => { 37 | const { auteurMessage, auteurMsgRepondu, repondre, ms, msgRepondu } = commandeOptions; 38 | 39 | const url = `https://api.waifu.pics/sfw/${reactionName}`; 40 | try { 41 | const response = await axios.get(url); 42 | const imageUrl = response.data.url; 43 | 44 | // Obtenir le buffer du GIF en utilisant la fonction getBuffer 45 | const gifBufferResponse = await axios.get(imageUrl, { 46 | responseType: 'arraybuffer' }) ; 47 | const gifBuffer = await gifBufferResponse.data; 48 | 49 | // Convertir le GIF en vidéo et obtenir le buffer vidéo 50 | const videoBuffer = await GIFBufferToVideoBuffer(gifBuffer); 51 | 52 | // Envoyer la vidéo avec Zokou 53 | if (msgRepondu) { 54 | var txt =` @${auteurMessage.split("@")[0]} ${reactionName} @${auteurMsgRepondu.split("@")[0]}` 55 | zk.sendMessage(origineMessage, { video: videoBuffer,gifPlayback: true,caption:txt,mentions:[auteurMessage,auteurMsgRepondu] }, { quoted: ms }); 56 | 57 | } else { 58 | const videoMessage = { 59 | video: videoBuffer, 60 | gifPlayback: true, 61 | caption: `@${auteurMessage.split("@")[0]} ${reactionName} everyone`, 62 | mentions: [auteurMessage] 63 | }; 64 | zk.sendMessage(origineMessage, videoMessage, { quoted: ms }); 65 | } 66 | 67 | } catch (error) { 68 | repondre('Erreur lors de la récupération des données :' + error); 69 | console.log(error); 70 | } 71 | }); 72 | }; 73 | 74 | // ... (utilisation de la fonction generateReactionCommand pour créer des commandes de réaction) 75 | 76 | 77 | generateReactionCommand("bully", "👊"); 78 | generateReactionCommand("cuddle", "🤗"); 79 | generateReactionCommand("cry", "😭"); 80 | generateReactionCommand("hug", "😊"); 81 | generateReactionCommand("awoo", "🐺"); 82 | generateReactionCommand("kiss", "😘"); 83 | generateReactionCommand("lick", "👅"); 84 | generateReactionCommand("pat", "👋"); 85 | generateReactionCommand("smug", "😏"); 86 | generateReactionCommand("bonk", "🔨"); 87 | generateReactionCommand("yeet", "🚀"); 88 | generateReactionCommand("blush", "😊"); 89 | generateReactionCommand("smile", "😄"); 90 | generateReactionCommand("wave", "👋"); 91 | generateReactionCommand("highfive"); 92 | generateReactionCommand("handhold"); 93 | generateReactionCommand("nom","👅" ); 94 | generateReactionCommand("bite", "🦷"); 95 | generateReactionCommand("glomp", "🤗"); 96 | generateReactionCommand("slap", "👋"); 97 | generateReactionCommand("kill", "💀"); 98 | generateReactionCommand("kick", "🦵"); 99 | generateReactionCommand("happy", "😄"); 100 | generateReactionCommand("wink", "😉"); 101 | generateReactionCommand("poke", "👉"); 102 | generateReactionCommand("dance", "💃"); 103 | generateReactionCommand("cringe", "😬"); 104 | -------------------------------------------------------------------------------- /commandes/AI.js: -------------------------------------------------------------------------------- 1 | const { zokou } = require('../framework/zokou'); 2 | const traduire = require("../framework/traduction") ; 3 | const { default: axios } = require('axios'); 4 | //const conf = require('../set'); 5 | 6 | 7 | 8 | 9 | zokou({nomCom:"bot",reaction:"📡",categorie:"IA"},async(dest,zk,commandeOptions)=>{ 10 | 11 | const {repondre,ms,arg}=commandeOptions; 12 | 13 | if(!arg || !arg[0]) 14 | {return repondre("yes I'm listening to you.")} 15 | //var quest = arg.join(' '); 16 | try{ 17 | 18 | 19 | const message = await traduire(arg.join(' '),{ to : 'en'}); 20 | console.log(message) 21 | fetch(`http://api.brainshop.ai/get?bid=177607&key=NwzhALqeO1kubFVD&uid=[uid]&msg=${message}`) 22 | .then(response => response.json()) 23 | .then(data => { 24 | const botResponse = data.cnt; 25 | console.log(botResponse); 26 | 27 | traduire(botResponse, { to: 'en' }) 28 | .then(translatedResponse => { 29 | repondre(translatedResponse); 30 | }) 31 | .catch(error => { 32 | console.error('Error when translating into French :', error); 33 | repondre('Error when translating into French'); 34 | }); 35 | }) 36 | .catch(error => { 37 | console.error('Error requesting BrainShop :', error); 38 | repondre('Error requesting BrainShop'); 39 | }); 40 | 41 | }catch(e){ repondre("oops an error : "+e)} 42 | 43 | 44 | }); 45 | 46 | 47 | 48 | zokou({ nomCom: "cyber", reaction: "📡", categorie: "IA" }, async (dest, zk, commandeOptions) => { 49 | const { repondre, arg, ms } = commandeOptions; 50 | 51 | try { 52 | if (!arg || arg.length === 0) { 53 | return repondre(`Please enter the necessary information to generate the image.`); 54 | } 55 | 56 | // Regrouper les arguments en une seule chaîne séparée par "-" 57 | const image = arg.join(' '); 58 | const response = await axios.get(`http://api.maher-zubair.tech/ai/photoleap?q=${image}`); 59 | 60 | const data = response.data; 61 | let caption = '*Powered by Johnleo-Md*'; 62 | 63 | if (data.status == 200) { 64 | // Utiliser les données retournées par le service 65 | const imageUrl = data.result; 66 | zk.sendMessage(dest, { image: { url: imageUrl }, caption: caption }, { quoted: ms }); 67 | } else { 68 | repondre("Error during image generation."); 69 | } 70 | } catch (error) { 71 | console.error('Erreur:', error.message || 'Une erreur s\'est produite'); 72 | repondre("Oops, an error occurred while processing your request"); 73 | } 74 | }); 75 | 76 | zokou({ nomCom: "ai", reaction: "📡", categorie: "IA" }, async (dest, zk, commandeOptions) => { 77 | const { repondre, arg, ms } = commandeOptions; 78 | 79 | try { 80 | if (!arg || arg.length === 0) { 81 | return repondre(`Please ask a question.`); 82 | } 83 | 84 | // Regrouper les arguments en une seule chaîne séparée par "-" 85 | const question = arg.join(' '); 86 | const response = await axios.get(`http://api.maher-zubair.tech/ai/chatgpt4?q=${question}`); 87 | 88 | const data = response.data; 89 | if (data) { 90 | repondre(data.result); 91 | } else { 92 | repondre("Error during response generation."); 93 | } 94 | } catch (error) { 95 | console.error('Erreur:', error.message || 'Une erreur s\'est produite'); 96 | repondre("Oops, an error occurred while processing your request."); 97 | } 98 | }); 99 | 100 | 101 | zokou({ nomCom: "gpt", reaction: "🤔", categorie: "IA" }, async (dest, zk, commandeOptions) => { 102 | const { repondre, arg, ms } = commandeOptions; 103 | 104 | try { 105 | if (!arg || arg.length === 0) { 106 | return repondre(`Please ask a question.`); 107 | } 108 | 109 | // Regrouper les arguments en une seule chaîne séparée par "-" 110 | const question = arg.join(' '); 111 | const response = await axios.get(`https://gpt4.giftedtech.workers.dev/?prompt=${question}`); 112 | 113 | const data = response.data; 114 | if (data) { 115 | repondre(data.result); 116 | } else { 117 | repondre("Error during response generation."); 118 | } 119 | } catch (error) { 120 | console.error('Erreur:', error.message || 'Une erreur s\'est produite'); 121 | repondre("Oops, an error occurred while processing your request."); 122 | } 123 | }); 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /commandes/devinette.js: -------------------------------------------------------------------------------- 1 | const { zokou } = require('../framework/zokou'); 2 | 3 | // Set a riddle list with questions and answers 4 | const devinettes = [ 5 | { 6 | question: "I can fly without wings, who am I?", 7 | reponse: "The weather", 8 | }, 9 | { 10 | question: "I'm always hungry, the more I eat, the fatter I become. Who am I ?", 11 | reponse: "A black hole", 12 | }, 13 | { 14 | question: "I'm strong when I'm down, but I'm weak when I'm up. Who am I ?", 15 | reponse: "The number 6", 16 | }, 17 | { 18 | question: "I can be short or long, hard or soft, I can be used by anyone, from young children to experienced musicians. Who am I ?", 19 | reponse: "A pencil", 20 | }, 21 | { 22 | question: "I am the beginning of the end, the end of every place. I am the beginning of eternity, the end of time and space. Who am I ?", 23 | reponse: "The letter 'e'", 24 | }, 25 | { 26 | question: "I am white when I am dirty and black when I am clean. Who am I ?", 27 | reponse: "A slate", 28 | }, 29 | { 30 | question: "I'm liquid, but if you take water away from me, I become solid. Who am I ?", 31 | reponse: "Tea", 32 | }, 33 | { 34 | question: "I fly without wings, I cry without eyes. Wherever I am, death always accompanies me. Who am I ?", 35 | reponse: "The wind", 36 | }, 37 | { 38 | question: "I have towns, but no houses. I have mountains, but no trees. I have water, but no fish. Who am I ?", 39 | reponse: "A map", 40 | }, 41 | { 42 | question: "I can be read, but you can't write about me. You always give to me, but rarely keep me. Who am I ?", 43 | reponse: "A borrowed book", 44 | }, 45 | { 46 | question: "I come twice in a week, once in a year, but never in a day. Who am I ?", 47 | reponse: "The letter 'E'", 48 | }, 49 | { 50 | question: "I'm hard to grasp, but you will hold me in your hand when you find me. Who am I ?", 51 | reponse: "Your breath", 52 | }, 53 | { 54 | question: "The hotter I am, the colder I become. Who am I ?", 55 | reponse: "coffe", 56 | }, 57 | { 58 | question: "I am the stuff of dreams. I cover broken ideas. I change souls into wings. Who am I ?", 59 | reponse: "A book", 60 | }, 61 | { 62 | question: "I am white when I am dirty and black when I am clean. Who am I?", 63 | reponse: "A slate", 64 | }, 65 | { 66 | question: "I can fly without having wings. I can cry without having eyes. Who am I ?", 67 | reponse: "A cloud", 68 | }, 69 | { 70 | question: "I start at night and finish in the morning. Who am I ?", 71 | reponse: "The letter 'N'", 72 | }, 73 | { 74 | question: "I can be read, but you can't write about me. You always give to me, but rarely keep me. Who am I ?", 75 | reponse: "A borrowed book", 76 | }, 77 | { 78 | question: "I feed on everything around me, the air, the earth and even the trees. Who am I ?", 79 | reponse: "a fire", 80 | }, 81 | { 82 | question: "I am white when I am dirty and black when I am clean. Who am I ?", 83 | reponse: "A slate", 84 | }, 85 | { 86 | question: "I'm liquid, but if you take water away from me, I become solid. Who am I ?", 87 | reponse: "tea", 88 | }, 89 | { 90 | question: "I am the beginning of the end and the end of every place. I am the beginning of eternity, the end of time and space. Who am I ?", 91 | reponse: "the letter'E'", 92 | }, 93 | { 94 | question: "I'm hard to grasp, but you will hold me in your hand when you find me. Who am I ?", 95 | reponse: "Your breath", 96 | }, 97 | ]; 98 | 99 | zokou({ nomCom: "riddle", categorie: "Games" }, async (dest, zk, commandeOptions) => { 100 | const { ms, repondre } = commandeOptions; 101 | 102 | // Choose a random riddle 103 | const devinette = devinettes[Math.floor(Math.random() * devinettes.length)]; 104 | // Send the riddle question 105 | await zk.sendMessage( 106 | dest, 107 | { 108 | text: `Riddle: ${devinette.question} . \n you have 30 seconds to think about.`, 109 | }, 110 | { quoted: ms } 111 | ); 112 | 113 | //Wait 60 seconds before sending the response 114 | await delay(30000); 115 | 116 | // Answer 117 | await zk.sendMessage( 118 | dest, 119 | { 120 | text: `The answer was : ${devinette.reponse}`, 121 | }, 122 | { quoted: ms } 123 | ); 124 | }); 125 | 126 | // Function to create a pause/delay in milliseconds 127 | function delay(ms) { 128 | return new Promise((resolve) => setTimeout(resolve, ms)); 129 | } 130 | -------------------------------------------------------------------------------- /commandes/yt-search.js: -------------------------------------------------------------------------------- 1 | const { zokou } = require("../framework/zokou"); 2 | const { getytlink, ytdwn } = require("../framework/ytdl-core"); 3 | const yts = require("yt-search"); 4 | const ytdl = require('ytdl-core'); 5 | const fs = require('fs'); 6 | 7 | zokou({ nomCom: "yts", categorie: "Search", reaction: "🎦" }, async (dest, zk, commandeOptions) => { 8 | const { ms, repondre, arg } = commandeOptions; 9 | const query = arg.join(" "); 10 | 11 | if (!query[0]) { 12 | repondre("what do you want"); 13 | return; 14 | } 15 | 16 | try { 17 | const info = await yts(query); 18 | const resultat = info.videos; 19 | 20 | let captions = ""; 21 | for (let i = 0; i < 10; i++) { 22 | captions += `----------------\nTitle: ${resultat[i].title}\nTime : ${resultat[i].timestamp}\nUrl: ${resultat[i].url}\n`; 23 | } 24 | captions += "\n======\n*powered by JOHNLEO-MD*"; 25 | 26 | // repondre(captions) 27 | zk.sendMessage(dest, { image: { url: resultat[0].thumbnail }, caption: captions }, { quoted: ms }); 28 | } catch (error) { 29 | repondre("Erreur lors de la procédure : " + error); 30 | } 31 | }); 32 | 33 | zokou({ 34 | nomCom: "ytmp4", 35 | categorie: "Download", 36 | reaction: "🎬" 37 | }, async (origineMessage, zk, commandeOptions) => { 38 | const { arg, ms, repondre } = commandeOptions; 39 | 40 | if (!arg[0]) { 41 | repondre("insert a youtube link"); 42 | return; 43 | } 44 | 45 | const topo = arg.join(" "); 46 | try { 47 | /* const search = await yts(topo); 48 | const videos = search.videos; 49 | 50 | if (videos && videos.length > 0 && videos[0]) { 51 | const Element = videos[0]; 52 | 53 | let InfoMess = { 54 | image: { url: videos[0].thumbnail }, 55 | caption: `*nom de la vidéo :* _${Element.title}_ 56 | *Durée :* _${Element.timestamp}_ 57 | *Lien :* _${Element.url}_ 58 | _*En cours de téléchargement...*_\n\n` 59 | }; 60 | 61 | zk.sendMessage(origineMessage, InfoMess, { quoted: ms }); 62 | */ 63 | 64 | // Obtenir les informations de la vidéo à partir du lien YouTube 65 | const videoInfo = await ytdl.getInfo(topo); 66 | // Format vidéo avec la meilleure qualité disponible 67 | const format = ytdl.chooseFormat(videoInfo.formats, { quality: '18' }); 68 | // Télécharger la vidéo 69 | const videoStream = ytdl.downloadFromInfo(videoInfo, { format }); 70 | 71 | // Nom du fichier local pour sauvegarder la vidéo 72 | const filename = 'video.mp4'; 73 | 74 | // Écrire le flux vidéo dans un fichier local 75 | const fileStream = fs.createWriteStream(filename); 76 | videoStream.pipe(fileStream); 77 | 78 | fileStream.on('finish', () => { 79 | // Envoi du fichier vidéo en utilisant l'URL du fichier local 80 | zk.sendMessage(origineMessage, { video: { url: `./${filename}` }, caption: "Powered by *JOHNLEO-MD*", gifPlayback: false }, { quoted: ms }); 81 | 82 | }); 83 | 84 | fileStream.on('error', (error) => { 85 | console.error('Erreur lors de l\'écriture du fichier vidéo :', error); 86 | repondre('Une erreur est survenue lors de l\'écriture du fichier vidéo.'); 87 | }); 88 | 89 | } catch (error) { 90 | console.error('Erreur lors de la recherche ou du téléchargement de la vidéo :', error); 91 | repondre('Une erreur est survenue lors de la recherche ou du téléchargement de la vidéo.' + error); 92 | } 93 | }); 94 | 95 | zokou({ 96 | nomCom: "ytmp3", 97 | categorie: "Download", 98 | reaction: "🎶" 99 | }, async (origineMessage, zk, commandeOptions) => { 100 | const { ms, repondre, arg } = commandeOptions; 101 | 102 | if (!arg[0]) { 103 | repondre("Insert a youtube link"); 104 | return; 105 | } 106 | 107 | try { 108 | let topo = arg.join(" "); 109 | 110 | const audioStream = ytdl(topo, { filter: 'audioonly', quality: 'highestaudio' }); 111 | 112 | // Nom du fichier local pour sauvegarder le fichier audio 113 | const filename = 'audio.mp3'; 114 | 115 | // Écrire le flux audio dans un fichier local 116 | const fileStream = fs.createWriteStream(filename); 117 | audioStream.pipe(fileStream); 118 | 119 | fileStream.on('finish', () => { 120 | // Envoi du fichier audio en utilisant l'URL du fichier local 121 | zk.sendMessage(origineMessage, { audio: { url: `./${filename}` }, mimetype: 'audio/mp4' }, { quoted: ms, ptt: false }); 122 | console.log("Envoi du fichier audio terminé !"); 123 | }); 124 | 125 | fileStream.on('error', (error) => { 126 | console.error('Erreur lors de l\'écriture du fichier audio :', error); 127 | repondre('Une erreur est survenue lors de l\'écriture du fichier audio.'); 128 | }); 129 | 130 | } catch (error) { 131 | console.error('Erreur lors de la recherche ou du téléchargement de la vidéo :', error); 132 | repondre('Une erreur est survenue lors de la recherche ou du téléchargement de la vidéo.'); 133 | } 134 | }); 135 | -------------------------------------------------------------------------------- /bdd/sudo.js: -------------------------------------------------------------------------------- 1 | // Importez dotenv et chargez les variables d'environnement depuis le fichier .env 2 | require("dotenv").config(); 3 | 4 | const { Pool } = require("pg"); 5 | 6 | // Utilisez le module 'set' pour obtenir la valeur de DATABASE_URL depuis vos configurations 7 | const s = require("../set"); 8 | 9 | // Récupérez l'URL de la base de données de la variable s.DATABASE_URL 10 | var dbUrl=s.DATABASE_URL?s.DATABASE_URL:"postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" 11 | const proConfig = { 12 | connectionString: dbUrl, 13 | ssl: { 14 | rejectUnauthorized: false, 15 | }, 16 | }; 17 | 18 | const pool = new Pool(proConfig); 19 | 20 | // Fonction pour créer la table "sudo" 21 | async function createSudoTable() { 22 | const client = await pool.connect(); 23 | try { 24 | // Exécutez une requête SQL pour créer la table "sudo" si elle n'existe pas déjà 25 | await client.query(` 26 | CREATE TABLE IF NOT EXISTS sudo ( 27 | id serial PRIMARY KEY, 28 | jid text NOT NULL 29 | ); 30 | `); 31 | console.log("La table 'sudo' a été créée avec succès."); 32 | } catch (error) { 33 | console.error("Une erreur est survenue lors de la création de la table 'sudo':", error); 34 | } finally { 35 | client.release(); 36 | } 37 | } 38 | 39 | // Appelez la méthode pour créer la table "sudo" 40 | createSudoTable(); 41 | 42 | 43 | // Fonction pour vérifier si un groupe est banni 44 | async function issudo(jid) { 45 | const client = await pool.connect(); 46 | try { 47 | // Vérifiez si le groupe existe dans la table "banGroup" 48 | const query = "SELECT EXISTS (SELECT 1 FROM sudo WHERE jid = $1)"; 49 | const values = [jid]; 50 | 51 | const result = await client.query(query, values); 52 | return result.rows[0].exists; 53 | } catch (error) { 54 | console.error("Erreur lors de la vérification du groupe banni :", error); 55 | return false; 56 | } finally { 57 | client.release(); 58 | } 59 | } 60 | 61 | // Fonction pour supprimer un groupe de la liste des groupes bannis 62 | async function removeSudoNumber(jid) { 63 | const client = await pool.connect(); 64 | try { 65 | // Supprimez le numéro de téléphone de la table "sudo" 66 | const query = "DELETE FROM sudo WHERE jid = $1"; 67 | const values = [jid]; 68 | 69 | await client.query(query, values); 70 | console.log(`Numéro de téléphone ${jid} supprimé de la liste des numéros de téléphone autorisés.`); 71 | } catch (error) { 72 | console.error("Erreur lors de la suppression du numéro de téléphone autorisé :", error); 73 | } finally { 74 | client.release(); 75 | } 76 | } 77 | 78 | async function addSudoNumber(jid) { 79 | const client = await pool.connect(); 80 | try { 81 | // Insérez le numéro de téléphone dans la table "sudo" 82 | const query = "INSERT INTO sudo (jid) VALUES ($1)"; 83 | const values = [jid]; 84 | 85 | await client.query(query, values); 86 | console.log(`Numéro de téléphone ${jid} ajouté à la liste des numéros de téléphone autorisés.`); 87 | } catch (error) { 88 | console.error("Erreur lors de l'ajout du numéro de téléphone autorisé :", error); 89 | } finally { 90 | client.release(); 91 | } 92 | } 93 | 94 | async function getAllSudoNumbers() { 95 | const client = await pool.connect(); 96 | try { 97 | // Sélectionnez tous les numéros de téléphone de la table "sudo" 98 | const query = "SELECT jid FROM sudo"; 99 | const result = await client.query(query); 100 | 101 | // Créez un tableau des numéros de téléphone 102 | const sudoNumbers = result.rows.map((row) => row.jid); 103 | 104 | return sudoNumbers; 105 | } catch (error) { 106 | console.error("Erreur lors de la récupération des numéros de téléphone autorisés :", error); 107 | return []; 108 | } finally { 109 | client.release(); 110 | } 111 | } 112 | 113 | async function isSudoTableNotEmpty() { 114 | const client = await pool.connect(); 115 | 116 | try { 117 | // Exécutez une requête SQL pour compter le nombre de lignes dans la table "sudo" 118 | const result = await client.query('SELECT COUNT(*) FROM sudo'); 119 | 120 | // Récupérez la valeur du compteur (nombre de lignes) 121 | const rowCount = parseInt(result.rows[0].count); 122 | 123 | // Si le nombre de lignes est supérieur à zéro, la table n'est pas vide 124 | return rowCount > 0; 125 | } catch (error) { 126 | console.error('Erreur lors de la vérification de la table "sudo" :', error); 127 | return false; // En cas d'erreur, considérez la table comme vide 128 | } finally { 129 | client.release(); 130 | } 131 | }; 132 | 133 | 134 | 135 | 136 | module.exports = { 137 | issudo, 138 | addSudoNumber, 139 | removeSudoNumber, 140 | getAllSudoNumbers, 141 | isSudoTableNotEmpty 142 | }; 143 | 144 | -------------------------------------------------------------------------------- /bdd/antilien.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config(); 2 | const { Pool } = require("pg"); 3 | let s =require("../set") 4 | var dbUrl=s.DATABASE_URL?s.DATABASE_URL:"postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" 5 | 6 | const proConfig = { 7 | connectionString:dbUrl , 8 | ssl: { 9 | rejectUnauthorized: false, 10 | }, 11 | }; 12 | 13 | const pool = new Pool(proConfig); 14 | 15 | 16 | // Fonction pour créer la table "antilien" 17 | async function createAntilienTable() { 18 | const client = await pool.connect(); 19 | try { 20 | // Exécutez une requête SQL pour créer la table "antilien" si elle n'existe pas déjà 21 | await client.query(` 22 | CREATE TABLE IF NOT EXISTS antilien ( 23 | jid text PRIMARY KEY, 24 | etat text, 25 | action text 26 | ); 27 | `); 28 | console.log("La table 'antilien' a été créée avec succès."); 29 | } catch (error) { 30 | console.error("Une erreur est survenue lors de la création de la table 'antilien':", error); 31 | } finally { 32 | client.release(); 33 | } 34 | } 35 | 36 | // Appelez la méthode pour créer la table "antilien" 37 | createAntilienTable(); 38 | 39 | 40 | 41 | async function ajouterOuMettreAJourJid(jid, etat) { 42 | const client = await pool.connect(); 43 | 44 | try { 45 | // Vérifiez si le jid existe déjà dans la table 'antilien' 46 | const result = await client.query('SELECT * FROM antilien WHERE jid = $1', [jid]); 47 | const jidExiste = result.rows.length > 0; 48 | 49 | if (jidExiste) { 50 | // Si le jid existe, mettez à jour l'état avec la valeur passée en argument 51 | await client.query('UPDATE antilien SET etat = $1 WHERE jid = $2', [etat, jid]); 52 | } else { 53 | // Si le jid n'existe pas, ajoutez-le avec l'état passé en argument et l'action 'supp' par défaut 54 | await client.query('INSERT INTO antilien (jid, etat, action) VALUES ($1, $2, $3)', [jid, etat, 'supp']); 55 | } 56 | 57 | console.log(`JID ${jid} ajouté ou mis à jour avec succès dans la table 'antilien'.`); 58 | } catch (error) { 59 | console.error('Erreur lors de l\'ajout ou de la mise à jour du JID dans la table ,', error); 60 | } finally { 61 | client.release(); 62 | } 63 | }; 64 | 65 | 66 | async function mettreAJourAction(jid, action) { 67 | const client = await pool.connect(); 68 | 69 | try { 70 | // Vérifiez si le jid existe déjà dans la table 'antilien' 71 | const result = await client.query('SELECT * FROM antilien WHERE jid = $1', [jid]); 72 | const jidExiste = result.rows.length > 0; 73 | 74 | if (jidExiste) { 75 | // Si le jid existe, mettez à jour l'action avec la valeur fournie (et laissez l'état inchangé) 76 | await client.query('UPDATE antilien SET action = $1 WHERE jid = $2', [action, jid]); 77 | } else { 78 | // Si le jid n'existe pas, ajoutez-le avec l'état 'non' par défaut et l'action fournie 79 | await client.query('INSERT INTO antilien (jid, etat, action) VALUES ($1, $2, $3)', [jid, 'non', action]); 80 | } 81 | 82 | console.log(`Action mise à jour avec succès pour le JID ${jid} dans la table 'antilien'.`); 83 | } catch (error) { 84 | console.error('Erreur lors de la mise à jour de l\'action pour le JID dans la table :', error); 85 | } finally { 86 | client.release(); 87 | } 88 | }; 89 | 90 | 91 | 92 | async function verifierEtatJid(jid) { 93 | const client = await pool.connect(); 94 | 95 | try { 96 | // Recherchez le JID dans la table 'antilien' et récupérez son état 97 | const result = await client.query('SELECT etat FROM antilien WHERE jid = $1', [jid]); 98 | 99 | if (result.rows.length > 0) { 100 | const etat = result.rows[0].etat; 101 | return etat === 'oui'; 102 | } else { 103 | // Si le JID n'existe pas dans la table, il n'est pas enregistré comme "oui" 104 | return false; 105 | } 106 | } catch (error) { 107 | console.error('Erreur lors de la vérification de l\'état du JID dans la table ', error); 108 | return false; 109 | } finally { 110 | client.release(); 111 | } 112 | }; 113 | 114 | async function recupererActionJid(jid) { 115 | const client = await pool.connect(); 116 | 117 | try { 118 | // Recherchez le JID dans la table 'antilien' et récupérez son action 119 | const result = await client.query('SELECT action FROM antilien WHERE jid = $1', [jid]); 120 | 121 | if (result.rows.length > 0) { 122 | const action = result.rows[0].action; 123 | return action; 124 | } else { 125 | // Si le JID n'existe pas dans la table, retournez une valeur par défaut (par exemple, 'supp') 126 | return 'supp'; 127 | } 128 | } catch (error) { 129 | console.error('Erreur lors de la récupération de l\'action du JID dans la table :', error); 130 | return 'supp'; // Gestion de l'erreur en retournant une valeur par défaut 131 | } finally { 132 | client.release(); 133 | } 134 | }; 135 | 136 | 137 | 138 | 139 | 140 | module.exports = { 141 | mettreAJourAction, 142 | ajouterOuMettreAJourJid, 143 | verifierEtatJid, 144 | recupererActionJid, 145 | }; 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /bdd/antibot.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config(); 2 | const { Pool } = require("pg"); 3 | let s =require("../set") 4 | var dbUrl=s.DATABASE_URL?s.DATABASE_URL:"postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" 5 | 6 | const proConfig = { 7 | connectionString:dbUrl , 8 | ssl: { 9 | rejectUnauthorized: false, 10 | }, 11 | }; 12 | 13 | const pool = new Pool(proConfig); 14 | 15 | 16 | // Fonction pour créer la table "antibot" 17 | async function createAntibotTable() { 18 | const client = await pool.connect(); 19 | try { 20 | // Exécutez une requête SQL pour créer la table "antibot" si elle n'existe pas déjà 21 | await client.query(` 22 | CREATE TABLE IF NOT EXISTS antibot ( 23 | jid text PRIMARY KEY, 24 | etat text, 25 | action text 26 | ); 27 | `); 28 | console.log("La table 'antibot' a été créée avec succès."); 29 | } catch (error) { 30 | console.error("Une erreur est survenue lors de la création de la table 'antibot':", error); 31 | } finally { 32 | client.release(); 33 | } 34 | } 35 | 36 | // Appelez la méthode pour créer la table "antibot" 37 | createAntibotTable(); 38 | 39 | 40 | 41 | async function atbajouterOuMettreAJourJid(jid, etat) { 42 | const client = await pool.connect(); 43 | 44 | try { 45 | // Vérifiez si le jid existe déjà dans la table 'antilien' 46 | const result = await client.query('SELECT * FROM antibot WHERE jid = $1', [jid]); 47 | const jidExiste = result.rows.length > 0; 48 | 49 | if (jidExiste) { 50 | // Si le jid existe, mettez à jour l'état avec la valeur passée en argument 51 | await client.query('UPDATE antibot SET etat = $1 WHERE jid = $2', [etat, jid]); 52 | } else { 53 | // Si le jid n'existe pas, ajoutez-le avec l'état passé en argument et l'action 'supp' par défaut 54 | await client.query('INSERT INTO antibot (jid, etat, action) VALUES ($1, $2, $3)', [jid, etat, 'supp']); 55 | } 56 | 57 | console.log(`JID ${jid} ajouté ou mis à jour avec succès dans la table 'antibot'.`); 58 | } catch (error) { 59 | console.error('Erreur lors de l\'ajout ou de la mise à jour du JID dans la table ,', error); 60 | } finally { 61 | client.release(); 62 | } 63 | }; 64 | 65 | 66 | async function atbmettreAJourAction(jid, action) { 67 | const client = await pool.connect(); 68 | 69 | try { 70 | // Vérifiez si le jid existe déjà dans la table 'antilien' 71 | const result = await client.query('SELECT * FROM antibot WHERE jid = $1', [jid]); 72 | const jidExiste = result.rows.length > 0; 73 | 74 | if (jidExiste) { 75 | // Si le jid existe, mettez à jour l'action avec la valeur fournie (et laissez l'état inchangé) 76 | await client.query('UPDATE antibot SET action = $1 WHERE jid = $2', [action, jid]); 77 | } else { 78 | // Si le jid n'existe pas, ajoutez-le avec l'état 'non' par défaut et l'action fournie 79 | await client.query('INSERT INTO antibot (jid, etat, action) VALUES ($1, $2, $3)', [jid, 'non', action]); 80 | } 81 | 82 | console.log(`Action mise à jour avec succès pour le JID ${jid} dans la table 'antibot'.`); 83 | } catch (error) { 84 | console.error('Erreur lors de la mise à jour de l\'action pour le JID dans la table :', error); 85 | } finally { 86 | client.release(); 87 | } 88 | }; 89 | 90 | 91 | 92 | async function atbverifierEtatJid(jid) { 93 | const client = await pool.connect(); 94 | 95 | try { 96 | // Recherchez le JID dans la table 'antilien' et récupérez son état 97 | const result = await client.query('SELECT etat FROM antibot WHERE jid = $1', [jid]); 98 | 99 | if (result.rows.length > 0) { 100 | const etat = result.rows[0].etat; 101 | return etat === 'oui'; 102 | } else { 103 | // Si le JID n'existe pas dans la table, il n'est pas enregistré comme "oui" 104 | return false; 105 | } 106 | } catch (error) { 107 | console.error('Erreur lors de la vérification de l\'état du JID dans la table ', error); 108 | return false; 109 | } finally { 110 | client.release(); 111 | } 112 | }; 113 | 114 | async function atbrecupererActionJid(jid) { 115 | const client = await pool.connect(); 116 | 117 | try { 118 | // Recherchez le JID dans la table 'antilien' et récupérez son action 119 | const result = await client.query('SELECT action FROM antibot WHERE jid = $1', [jid]); 120 | 121 | if (result.rows.length > 0) { 122 | const action = result.rows[0].action; 123 | return action; 124 | } else { 125 | // Si le JID n'existe pas dans la table, retournez une valeur par défaut (par exemple, 'supp') 126 | return 'supp'; 127 | } 128 | } catch (error) { 129 | console.error('Erreur lors de la récupération de l\'action du JID dans la table :', error); 130 | return 'supp'; // Gestion de l'erreur en retournant une valeur par défaut 131 | } finally { 132 | client.release(); 133 | } 134 | }; 135 | 136 | 137 | 138 | 139 | 140 | module.exports = { 141 | atbmettreAJourAction, 142 | atbajouterOuMettreAJourJid, 143 | atbverifierEtatJid, 144 | atbrecupererActionJid, 145 | }; 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /commandes/abu.js: -------------------------------------------------------------------------------- 1 | 2 | const util = require('util'); 3 | const fs = require('fs-extra'); 4 | const { zokou } = require(__dirname + "/../framework/zokou"); 5 | const { format } = require(__dirname + "/../framework/mesfonctions"); 6 | const os = require("os"); 7 | const moment = require("moment-timezone"); 8 | const s = require(__dirname + "/../set"); 9 | const more = String.fromCharCode(8206) 10 | const readmore = more.repeat(4001) 11 | 12 | zokou({ nomCom: "host", categorie: "General" }, async (dest, zk, commandeOptions) => { 13 | let { ms, repondre ,prefixe,nomAuteurMessage,mybotpic} = commandeOptions; 14 | let { cm } = require(__dirname + "/../framework//zokou"); 15 | var coms = {}; 16 | var mode = "public"; 17 | 18 | if ((s.MODE).toLocaleLowerCase() != "yes") { 19 | mode = "private"; 20 | } 21 | 22 | 23 | 24 | 25 | cm.map(async (com, index) => { 26 | if (!coms[com.categorie]) 27 | coms[com.categorie] = []; 28 | coms[com.categorie].push(com.nomCom); 29 | }); 30 | 31 | moment.tz.setDefault('Nairobi/Kenya'); 32 | 33 | // Créer une date et une heure en GMT 34 | const temps = moment().format('HH:mm:ss'); 35 | const date = moment().format('DD/MM/YYYY'); 36 | 37 | let infoMsg = ` 38 | *Hey there wanna support JohnleoTech* 😎 39 | 40 | 41 | *Any way just follow the following channels* 42 | 43 | 44 | *Whatsapp channel* 45 | > https://whatsapp.com/channel/0029Vail87sIyPtQoZ2egl1h 46 | 47 | *Telegram* 48 | > https://t.me/JohnleoTech 49 | 50 | *For more info* 51 | > https://github.com/johnleosmith/JOHNLEOTECH 52 | `; 53 | 54 | let menuMsg = ` 55 | > ©JohnleoTech 56 | `; 57 | 58 | var lien = mybotpic(); 59 | 60 | if (lien.match(/\.(mp4|gif)$/i)) { 61 | try { 62 | zk.sendMessage(dest, { video: { url: lien }, caption:infoMsg + menuMsg, footer: "Je suis *Johnleo-mD*, déveloper Johnleo Tech" , gifPlayback : true }, { quoted: ms }); 63 | } 64 | catch (e) { 65 | console.log("🥵🥵 Menu erreur " + e); 66 | repondre("🥵🥵 Menu erreur " + e); 67 | } 68 | } 69 | // Vérification pour .jpeg ou .png 70 | else if (lien.match(/\.(jpeg|png|jpg)$/i)) { 71 | try { 72 | zk.sendMessage(dest, { image: { url: lien }, caption:infoMsg + menuMsg, footer: "Je suis *Johnleo-mD*, déveloper Johnleo Tech" }, { quoted: ms }); 73 | } 74 | catch (e) { 75 | console.log("🥵🥵 Menu erreur " + e); 76 | repondre("🥵🥵 Menu erreur " + e); 77 | } 78 | } 79 | else { 80 | 81 | repondre(infoMsg + menuMsg); 82 | 83 | } 84 | 85 | }); 86 | 87 | 88 | /*const util = require('util'); 89 | const fs = require('fs-extra'); 90 | const { zokou } = require(__dirname + "/../framework/zokou"); 91 | const { format } = require(__dirname + "/../framework/mesfonctions"); 92 | const os = require("os"); 93 | const moment = require("moment-timezone"); 94 | const s = require(__dirname + "/../set"); 95 | const more = String.fromCharCode(8206) 96 | const readmore = more.repeat(4001) 97 | 98 | zokou({ nomCom: "script", categorie: "General" }, async (dest, zk, commandeOptions) => { 99 | let { ms, repondre ,prefixe,nomAuteurMessage,mybotpic} = commandeOptions; 100 | let { cm } = require(__dirname + "/../framework//zokou"); 101 | var coms = {}; 102 | var mode = "public"; 103 | 104 | if ((s.MODE).toLocaleLowerCase() != "yes") { 105 | mode = "private"; 106 | } 107 | 108 | 109 | 110 | 111 | cm.map(async (com, index) => { 112 | if (!coms[com.categorie]) 113 | coms[com.categorie] = []; 114 | coms[com.categorie].push(com.nomCom); 115 | }); 116 | 117 | moment.tz.setDefault('Etc/GMT'); 118 | 119 | // Créer une date et une heure en GMT 120 | const temps = moment().format('HH:mm:ss'); 121 | const date = moment().format('DD/MM/YYYY'); 122 | 123 | let infoMsg = ` 124 | *JOHNLEO MD IMPORTANT INFO* 125 | ❒───────────────────❒ 126 | *GITHUB LINK* 127 | > https://github.com/johnleosmith/Johnleo-Md 128 | 129 | *WHATSAPP CHANNEL* 130 | > https://whatsapp.com/channel/0029VamlYh41SWssaEvw4E2i 131 | 132 | *FOR MORE INFO TAP ON THE LINK BELOW* 133 | > https://github.com/johnleosmith/JOHNLEOTECH 134 | ╭───────────────────❒ 135 | │❒ *RAM* : ${format(os.totalmem() - os.freemem())}/${format(os.totalmem())} 136 | │❒ *DEV* : *Johnleo* 137 | ╰───────────────────❒ 138 | `; 139 | 140 | let menuMsg = ` 141 | 𝐉𝐎𝐇𝐍𝐋𝐄𝐎 𝐒𝐌𝐈𝐓𝐇 142 | 143 | ❒────────────────────❒`; 144 | 145 | var lien = mybotpic(); 146 | 147 | if (lien.match(/\.(mp4|gif)$/i)) { 148 | try { 149 | zk.sendMessage(dest, { video: { url: lien }, caption:infoMsg + menuMsg, footer: "Je suis *Johnleo-mD*, déveloper Johnleo Tech" , gifPlayback : true }, { quoted: ms }); 150 | } 151 | catch (e) { 152 | console.log("🥵🥵 Menu erreur " + e); 153 | repondre("🥵🥵 Menu erreur " + e); 154 | } 155 | } 156 | // Vérification pour .jpeg ou .png 157 | else if (lien.match(/\.(jpeg|png|jpg)$/i)) { 158 | try { 159 | zk.sendMessage(dest, { image: { url: lien }, caption:infoMsg + menuMsg, footer: "Je suis *Beltahmd*, déveloper Beltah Tech" }, { quoted: ms }); 160 | } 161 | catch (e) { 162 | console.log("🥵🥵 Menu erreur " + e); 163 | repondre("🥵🥵 Menu erreur " + e); 164 | } 165 | } 166 | else { 167 | 168 | repondre(infoMsg + menuMsg); 169 | 170 | } 171 | 172 | });*/ 173 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | worker: node index.js 840 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
3 |
4 |
5 |
6 |
9 |
10 | 👉𝐉𝐎𝐇𝐍𝐋𝐄𝐎-𝐌𝐃👈 𝐀 𝐒𝐢𝐦𝐩𝐥𝐞 𝐖𝐡𝐚𝐭𝐬𝐀𝐩𝐩 𝐮𝐬𝐞𝐫 𝐁𝐎𝐓, 𝐂𝐫𝐞𝐚𝐭𝐞𝐝 𝐛𝐲 𝐉𝐎𝐇𝐍𝐋𝐄𝐎😈
11 |
12 |
13 |
27 |
28 |
29 |
30 |
31 | [](https://git.io/typing-svg)
32 |
33 |
34 |
35 |
36 |
49 | [](https://git.io/typing-svg)
50 |
51 |
52 |
53 |
54 |
55 | ## 𝐅𝐈𝐗𝐄𝐃 𝐇𝐄𝐑𝐎𝐊𝐔 𝐁𝐀𝐍⚠️
56 | ⚠️𝗖𝗢𝗡𝗡𝗘𝗖𝗧 𝗬𝗢𝗨𝗥 𝗙𝗢𝗥𝗞𝗘𝗗 𝗥𝗘𝗣𝗢 𝗪𝗜𝗧𝗛 𝗧𝗛𝗜𝗦 𝗛𝗘𝗥𝗢𝗞𝗨 𝗧𝗘𝗠𝗣𝗟𝗔𝗧𝗘 𝗧𝗢 𝗔𝗩𝗢𝗜𝗗 𝗛𝗘𝗥𝗢𝗞𝗨 𝗕𝗔𝗡⚠️
57 |
58 | 👇𝗧𝗔𝗣 𝗜𝗧 𝗔𝗡𝗗 𝗖𝗢𝗣𝗬👇 𝗧𝗛𝗘 𝗖𝗢𝗣𝗬 𝗕𝗨𝗧𝗧𝗢𝗡 𝗜𝗦 𝗧𝗛𝗘𝗥𝗘👇
59 |
60 | https://dashboard.heroku.com/new?template=
61 |
62 | 𝐓𝐀𝐏 𝐇𝐄𝐑𝐄 𝐀𝐍𝐃 𝐖𝐀𝐓𝐂𝐇 𝐇𝐎𝐖 𝐓𝐎 𝐂𝐎𝐍𝐍𝐄𝐂𝐓
63 |
64 | [`𝐕𝐈𝐃𝐄𝐎`](hotps://wmw.yuiutube.com/@JohnleoTech)
65 |
66 |
67 |
68 |
72 |
73 |
74 | _`JOHNLEO-MD FEATURES`_
75 |
76 |
77 | | Feature | Description | Available | Version |
78 | | ---------------------------------| ------------------------------------------------------- | ------------ | ---------- |
79 | | Multi-Device Support | Operate the bot on multiple devices simultaneously | ✅ | 1.0 |
80 | | AI Chat Bot | Bot Can Reply To Questions | ✅ | 1.0 |
81 | | Downloader Commands | Download various types of content from the internet | ❌️ | 1.0 |
82 | | Hidden NSFW Commands | Access a range of NSFW commands hidden in the bot | ✅ | 1.0 |
83 | | Logo Commands | Generate logos using specialized commands | ✅ | 1.0 |
84 | | Anime Commands | Explore anime-related commands and features | ✅ | 1.0 |
85 | | Bot Control Commands | Control Bot Without Opening Deploy Platform | ✅ | 1.0 |
86 | | Various Games | Enjoy a variety of games within the bot | ✅ | 1.0 |
87 | | Audio/Video Editor Commands | Edit audio and video files with bot commands | ✅ | 1.0 |
88 | | Auto/View once commands | remove photo and video from lock | ✅ | 1.0 |
89 |
90 |
91 |
92 | ## Developer INFO:
93 |
94 |
95 |
96 | CONTACT JOHNLEO HERE
97 |
98 | ➡️➡️[`𝐉𝐎𝐇𝐍𝐋𝐄𝐎😈`](https://github.com/johnleosmith/JOHNLEOTECH)⬅️⬅️TAP HERE TO CONTACT ME
99 |
100 |
101 |
102 |
103 |
104 | AND THANKS TO [`CARLTECH`](https://github.com/Carl165/CARLTECH-INFO) FOR THE BOT BASE
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/commandes/anime.js:
--------------------------------------------------------------------------------
1 | const axios = require("axios");
2 | const {zokou} = require("../framework/zokou");
3 | const traduire = require("../framework/traduction");
4 | const {Sticker ,StickerTypes}= require('wa-sticker-formatter');
5 |
6 | zokou({
7 | nomCom: "ranime",
8 | categorie: "Fun",
9 | reaction: "📺"
10 | },
11 | async (origineMessage, zk, commandeOptions) => {
12 | const { repondre, ms } = commandeOptions;
13 |
14 | const jsonURL = "https://api.jikan.moe/v4/random/anime"; // Remplacez par votre URL JSON
15 |
16 | try {
17 | const response = await axios.get(jsonURL);
18 | const data = response.data.data;
19 |
20 | const title = data.title;
21 | const synopsis = data.synopsis;
22 | const imageUrl = data.images.jpg.image_url; // Utilisez l'URL de l'image JPG
23 | const episodes = data.episodes;
24 | const status = data.status;
25 |
26 | //const texttraduit = await traduire(synopsis,{ to: 'fr' })
27 |
28 | const message = `📺 Titre: ${title}\n🎬 Épisodes: ${episodes}\n📡 Statut: ${status}\n📝 Synopsis: ${synopsis}\n🔗 URL: ${data.url}`;
29 |
30 | // Envoyer l'image et les informations
31 | zk.sendMessage(origineMessage, { image: { url: imageUrl }, caption: message }, { quoted: ms });
32 | } catch (error) {
33 | console.error('Error retrieving data from JSON :', error);
34 | repondre('Error retrieving data from JSON.');
35 | }
36 | });
37 |
38 | zokou({
39 | nomCom: "google",
40 | categorie: "Search"
41 | }, async (dest, zk, commandeOptions) => {
42 | const { arg, repondre } = commandeOptions;
43 |
44 | if (!arg[0] || arg === "") {
45 | repondre("Give me a query.\n*Example: .google What is a bot.*");
46 | return;
47 | }
48 |
49 | const google = require('google-it');
50 | try {
51 | const results = await google({ query: arg.join(" ") });
52 | let msg = `Google search for : ${arg}\n\n`;
53 |
54 | for (let result of results) {
55 | msg += `➣ Title : ${result.title}\n`;
56 | msg += `➣ Description : ${result.snippet}\n`;
57 | msg += `➣ Link : ${result.link}\n\n────────────────────────\n\n`;
58 | }
59 |
60 | // const trdmsg = await traduire(msg,{to : 'fr'})
61 | repondre(msg);
62 | } catch (error) {
63 | repondre("An error occurred during Google search.");
64 | }
65 | });
66 |
67 | zokou({
68 | nomCom: "imdb",
69 | categorie: "Search"
70 | }, async (dest, zk, commandeOptions) => {
71 | const { arg, repondre , ms } = commandeOptions;
72 |
73 | if (!arg[0] || arg === "") {
74 | repondre("give the name of a series or film.");
75 | return;
76 | }
77 |
78 | try {
79 |
80 | const response = await axios.get(`http://www.omdbapi.com/?apikey=742b2d09&t=${arg}&plot=full`);
81 | const imdbData = response.data;
82 |
83 | let imdbInfo = "⚍⚎⚎⚎⚎⚎⚎⚎⚎⚎⚎⚎⚎⚎⚎⚍\n";
84 | imdbInfo += " ``` 𝕀𝕄𝔻𝔹 𝕊𝔼𝔸ℝℂℍ```\n";
85 | imdbInfo += "⚎⚎⚎⚎⚎⚎⚎⚎⚎⚎⚎⚎⚎⚎⚎⚎\n";
86 | imdbInfo += "🎬Title : " + imdbData.Title + "\n";
87 | imdbInfo += "📅year : " + imdbData.Year + "\n";
88 | imdbInfo += "⭐Assessment : " + imdbData.Rated + "\n";
89 | imdbInfo += "📆Release : " + imdbData.Released + "\n";
90 | imdbInfo += "⏳Runtime : " + imdbData.Runtime + "\n";
91 | imdbInfo += "🌀Genre : " + imdbData.Genre + "\n";
92 | imdbInfo += "👨🏻💻Director : " + imdbData.Director + "\n";
93 | imdbInfo += "✍writers : " + imdbData.Writer + "\n";
94 | imdbInfo += "👨actors : " + imdbData.Actors + "\n";
95 | imdbInfo += "📃Synopsis : " + imdbData.Plot + "\n";
96 | imdbInfo += "🌐Language : " + imdbData.Language + "\n";
97 | imdbInfo += "🌍Contry : " + imdbData.Country + "\n";
98 | imdbInfo += "🎖️Awards : " + imdbData.Awards + "\n";
99 | imdbInfo += "📦BoxOffice : " + imdbData.BoxOffice + "\n";
100 | imdbInfo += "🏙️Production : " + imdbData.Production + "\n";
101 | imdbInfo += "🌟score : " + imdbData.imdbRating + "\n";
102 | imdbInfo += "❎imdbVotes : " + imdbData.imdbVotes + "";
103 |
104 | zk.sendMessage(dest, {
105 | image: {
106 | url: imdbData.Poster,
107 | },
108 | caption: imdbInfo,
109 | }, {
110 | quoted: ms,
111 | });
112 | } catch (error) {
113 | repondre("An error occurred while searching IMDb.");
114 | }
115 | });
116 |
117 |
118 | zokou({
119 | nomCom: "emomix",
120 | categorie: "Conversion"
121 | }, async (dest, zk, commandeOptions) => {
122 | const { arg, repondre,ms , nomAuteurMessage } = commandeOptions;
123 |
124 | if (!arg[0] || arg.length !== 1) {
125 | repondre("Incorrect use. Example: .emojimix 😀;🥰");
126 | return;
127 | }
128 |
129 | // Divisez la chaîne en deux emojis en utilisant le point-virgule comme séparateur
130 | const emojis = arg.join(' ').split(';');
131 |
132 | if (emojis.length !== 2) {
133 | repondre("Please specify two emojis using a ';' as a separator.");
134 | return;
135 | }
136 |
137 | const emoji1 = emojis[0].trim();
138 | const emoji2 = emojis[1].trim();
139 |
140 | try {
141 | const axios = require('axios');
142 | const response = await axios.get(`https://levanter.onrender.com/emix?q=${emoji1}${emoji2}`);
143 |
144 | if (response.data.status === true) {
145 | // Si la requête a réussi, envoyez l'image résultante
146 |
147 | let stickerMess = new Sticker(response.data.result, {
148 | pack: FLASH-MD,
149 | type: StickerTypes.CROPPED,
150 | categories: ["🤩", "🎉"],
151 | id: "12345",
152 | quality: 70,
153 | background: "transparent",
154 | });
155 | const stickerBuffer2 = await stickerMess.toBuffer();
156 | zk.sendMessage(dest, { sticker: stickerBuffer2 }, { quoted: ms });
157 |
158 | } else {
159 | repondre("Unable to create emoji mix.");
160 | }
161 | } catch (error) {
162 | repondre("An error occurred while creating the emoji mix." + error );
163 | }
164 | });
165 |
--------------------------------------------------------------------------------
/commandes/menu.js.prec:
--------------------------------------------------------------------------------
1 | const util = require('util');
2 | const fs = require('fs-extra');
3 | const { zokou } = require(__dirname + "/../framework/zokou");
4 | const { format, styletext } = require(__dirname + "/../framework/mesfonctions");
5 | //const {police}=require(__dirname+"/../framework/mesfonctions")
6 | const os = require("os");
7 | const moment = require("moment-timezone");
8 | const s = require(__dirname + "/../set");
9 | zokou({ nomCom: "menu", categorie: "General" }, async (dest, zk, commandeOptions) => {
10 | let { ms, repondre } = commandeOptions;
11 | let { cm } = require(__dirname + "/../framework//zokou");
12 | var coms = {};
13 | var mode = "public";
14 | if ((s.MODE).toLocaleLowerCase() != "oui") {
15 | mode = "privé";
16 | }
17 | var emoji = { "General": "🌐", "Logo": "♨️", "Hentai": "🔥", "Weeb": "☀️", "Recherche": "🔍", "Conversion": "🌟", "Groupe": "♻️", "Autre": "🪖" };
18 | cm.map(async (com, index) => { if (!coms[com.categorie])
19 | coms[com.categorie] = []; coms[com.categorie].push(com.nomCom); });
20 | const temps = moment(moment()).format("HH:MM:SS");
21 | moment.tz.setDefault('africa/nairobi').locale("id");
22 | const date = moment.tz("africa/nairobi").format("DD/MM/YYYY");
23 | console.log("date" + date);
24 | console.log("temps " + temps);
25 | let menuMsg = " ╩═══ * Ƶ𝓞kØ𝓊 * ╩═══\n\n";
26 | /*menuMsg+=`
27 |
28 |
29 |
30 | Owner : ${s.OWNER_NAME} \n || Commandes : ${cm.length} \n || Date : ${date}\n || Heure : ${temps} \n || Mémoire : ${format(os.totalmem()-os.freemem())}/${format(os.totalmem())}\n || Plateforme : ${os.platform()}\n || Developpeur : Djalega++ \n\n ╰────────────────`;
31 |
32 |
33 |
34 |
35 |
36 | ╚═════ ✨✨ ☬ ✨✨ ═════╝*/
37 | /* menuMsg+=`
38 | ╔════\☆✨️ĆÅŘŁ-ŜĤÅŘK MÐ/════╗
39 |
40 | || Prefix : ${s.prefixe}
41 | || Owner : ${s.OWNER_NAME}
42 | || Commands : ${cm.length}
43 | || Date : ${date}
44 | || Hour : ${temps}
45 | || Mém: ${format(os.totalmem()-os.freemem())}/${format(os.totalmem())} {Plateforme : ${os.platform()}
46 | || Developer :CARL WILLIAM
47 | ||
48 | ╚════ ✨✨ ☬ ✨✨ ════╝`;*/
49 | menuMsg += `
50 | ╔════----*ÇÅŘŁ-TEÇĤ-----
51 | ║ Prefix : ${s.PREFIXE}
52 | ║ Owner : ${s.OWNER_NAME}
53 | ║ Mode : ${mode}
54 | ║ Commands :${cm.length}
55 | ║ Date : ${date}
56 | ║ Hour: ${temps}
57 | ║ Mém : ${format(os.totalmem() - os.freemem())}/${format(os.totalmem())}
58 | ║ Platform : ${os.platform()}
59 | ║ Déveloper : CARL WILLIAM
60 | ╚════--------------- \n\n`;
61 | for (const cat in coms) {
62 | if (!emoji[cat]) {
63 | emoji[cat] = "🦁";
64 | }
65 | menuMsg += `${emoji[cat]} ══ *${cat} * ══ ${emoji[cat]}\n`;
66 | for (const cmd of coms[cat]) {
67 | menuMsg += "\t ║ " + cmd + "" + " \n";
68 | }
69 | }
70 | // var link = "https://wallpapercave.com/uwp/uwp3860299.jpeg";
71 | var link = s.IMAGE_MENU;
72 | try {
73 | zk.sendMessage(dest, { image: { url: link }, caption: menuMsg, footer: "by Djalega++" }, { quoted: ms });
74 | }
75 | catch (e) {
76 | console.log("🥵🥵 Menu erreur " + e);
77 | repondre("🥵🥵 Menu erreur " + e);
78 | }
79 | });
80 | /*
81 |
82 |
83 | module.exports.commande =()=>
84 | {
85 | var nomCom=["menu","m","fonctions"];
86 | var reaction="🦁"
87 | var categorie="General"
88 |
89 |
90 | return {nomCom,reaction,categorie,execute}
91 |
92 | // };*
93 |
94 |
95 |
96 | //var g=[];
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 | var tt=[]
113 |
114 | async function execute(dest,zok,commandeOptions?)
115 | {
116 |
117 | var link = "https://wallpapercave.com/uwp/uwp3860299.jpeg"
118 | // var listCom =listeCommande()
119 | let msg= " ╩═══ * Ƶ𝓞kØ𝓊 * ╩═══\n\n"
120 |
121 |
122 | //const listeCommande= async ()=> {
123 | var tab=[];var tabCmd=[];
124 | const tabCat= {};
125 | const readDir = util.promisify(fs.readdir);
126 | const readFile = util.promisify(fs.readFile);
127 | //console.log("ch " + __dirname + '../')
128 | var chemin= './commandes/'
129 | var nomFichier = await readDir(__dirname)
130 | //console.log("installation des plugins ... ")
131 | nomFichier.forEach((fichier) => {
132 | if (fichier.endsWith(".js")) {
133 | //console.log(fichier+" installé ✅")
134 | // var { commande } = require(/**/ //'../'+chemin.replace(/./, '')+*/__dirname+'/'+fichier.split('.js')[0])
135 | // var infoCom = commande()
136 | // if(!infoCom.categorie) infoCom.categorie="General"
137 | // tabCat[infoCom.categorie].push(infoCom.nomCom[0])
138 | // tabCmd[infoCom.nomCom[0]]
139 | /* for(a of infoCom.categorie)
140 | {
141 | if(!msg.includes(a))
142 | {
143 | msg+=a+"\n"
144 | msg+=infoCom.nomCom[0]+"\n"
145 | }else{msg+=infoCom.nomCom[0]+"\n"}
146 |
147 | }*/
148 | //msg+=infoCom.categorie+infoCom.nomCom[0]
149 | //msg+=`🪰 ${infoCom.nomCom[0]} `+"\n"
150 | // tu = infoCom.nomCom[1]
151 | /* for(var b=0;b<=infoCom.nomCom[0].length;b++)
152 | {
153 | msg+=infoCom.nomCom[b]
154 | }*/
155 | /** ************************** */
156 | // for (var a of infoCom.nomCom[0]) {
157 | // console.log("aaaa "+a +" "+typeof a)
158 | // tu.push(a)
159 | // msg+=a.normalize()+"\n"
160 | // msg+=infoCom.nomCom[0]
161 | // msg+=infoCom.nomCom[0]
162 | // msg+=infoCom.nomCom[0]
163 | // tu[a]=infoCom.nomCom[0]
164 | // tt.push(infoCom.nomCom[a])
165 | //tabCmd[a] = infoCom.execute
166 | // reaction[a]=infoCom.reaction
167 | // }
168 | /** ********************************************* */
169 | // }
170 | //console.log("installation de plugins terminé 👍🏿")
171 | // return tab
172 | // })
173 | // console.log("fichier "+typeof nomFichier)
174 | //var txt="";
175 | /* for(var ctg in tabCat)
176 | {
177 | txt+=ctg;
178 | txt+=tabCat.nomCom
179 | }*/
180 | //}
181 | //var coms={}
182 | /* tabCmd.map
183 | (async (cmds)=>
184 | {
185 | if(!coms[cmds.categerie])
186 | coms[cmds.categorie]="General"
187 | coms[cmds.categorie].push(cmds)
188 |
189 | }
190 |
191 |
192 |
193 | )*/
194 | /* for(let a=0;a<=listeCommande.length;a++)
195 | {
196 | msg +=tt[a]
197 | }*/
198 | /*
199 | for(const categorie in tabCat)
200 | {
201 | msg+="*"+categorie+"*"+"\n"
202 |
203 | for(const comm of tabCat[categorie])
204 | {
205 | msg+=+'\n'+comm
206 | }}
207 |
208 | await zok.sendMessage(dest,{image :{url:link},caption:msg+txt});
209 |
210 | */
211 | //
212 | // }
213 |
--------------------------------------------------------------------------------
/commandes/play2.js:
--------------------------------------------------------------------------------
1 | import fetch from "node-fetch";
2 |
3 | import ytdl from 'youtubedl-core';
4 |
5 | import yts from 'youtube-yts';
6 |
7 | import fs from 'fs';
8 |
9 | import { pipeline } from 'stream';
10 |
11 | import { promisify } from 'util';
12 |
13 | import os from 'os';
14 |
15 |
16 |
17 | const streamPipeline = promisify(pipeline);
18 |
19 |
20 |
21 | const handler = async (m, {
22 |
23 | conn,
24 |
25 | command,
26 |
27 | text,
28 |
29 | args,
30 |
31 | usedPrefix
32 |
33 | }) => {
34 |
35 | if (!text) throw `*_give a text to search_* \n*_Example: ${usedPrefix + command} A Subz gumbad waly naat Ahmed Raza Qadri_*`;
36 |
37 | conn.GURUPLAY = conn.GURUPLAY ? conn.GURUPLAY : {};
38 |
39 | await conn.reply(m.chat, wait, m);
40 |
41 | const result = await searchAndDownloadMusic(text);
42 |
43 | const infoText = `🎧🎼『 *ᴘʀɪɴᴄᴇ ᴘʟᴀʏᴇʀ* 』🎼🎧
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | *🎶ᖇEᑭᒪY ᗯITᕼ ᑎᑌᗰᗷEᖇ TO GET YOᑌᖇ ᗩᑌᗪIO🎵*`;
52 |
53 |
54 |
55 | const orderedLinks = result.allLinks.map((link, index) => {
56 |
57 | const sectionNumber = index + 1;
58 |
59 | const {
60 |
61 | title,
62 |
63 | url
64 |
65 | } = link;
66 |
67 | return `*${sectionNumber}.* ${title}`;
68 |
69 | });
70 |
71 |
72 |
73 | const orderedLinksText = orderedLinks.join("\n\n");
74 |
75 | const fullText = `${infoText}\n\n${orderedLinksText}`;
76 |
77 | const {
78 |
79 | key
80 |
81 | } = await conn.reply(m.chat, fullText, m);
82 |
83 | conn.GURUPLAY[m.sender] = {
84 |
85 | result,
86 |
87 | key,
88 |
89 | timeout: setTimeout(() => {
90 |
91 | conn.sendMessage(m.chat, {
92 |
93 | delete: key
94 |
95 | });
96 |
97 | delete conn.GURUPLAY[m.sender];
98 |
99 | }, 150 * 1000),
100 |
101 | };
102 |
103 | };
104 |
105 |
106 |
107 | handler.before = async (m, {
108 |
109 | conn
110 |
111 | }) => {
112 |
113 | conn.GURUPLAY = conn.GURUPLAY ? conn.GURUPLAY : {};
114 |
115 | if (m.isBaileys || !(m.sender in conn.GURUPLAY)) return;
116 |
117 | const {
118 |
119 | result,
120 |
121 | key,
122 |
123 | timeout
124 |
125 | } = conn.GURUPLAY[m.sender];
126 |
127 | console.log(conn.GURUPLAY)
128 |
129 | if (!m.quoted || m.quoted.id !== key.id || !m.text) return;
130 |
131 | const choice = m.text.trim();
132 |
133 | const inputNumber = Number(choice);
134 |
135 | if (inputNumber >= 1 && inputNumber <= result.allLinks.length) {
136 |
137 | const selectedUrl = result.allLinks[inputNumber - 1].url;
138 |
139 | console.log("selectedUrl", selectedUrl)
140 |
141 | let title = generateRandomName();
142 |
143 | const audioStream = ytdl(selectedUrl, {
144 |
145 | filter: 'audioonly',
146 |
147 | quality: 'highestaudio',
148 |
149 | });
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 | const tmpDir = os.tmpdir();
158 |
159 |
160 |
161 |
162 |
163 | const writableStream = fs.createWriteStream(`${tmpDir}/${title}.mp3`);
164 |
165 |
166 |
167 |
168 |
169 | await streamPipeline(audioStream, writableStream);
170 |
171 |
172 |
173 | const doc = {
174 |
175 | audio: {
176 |
177 | url: `${tmpDir}/${title}.mp3`
178 |
179 | },
180 |
181 | mimetype: 'audio/mpeg',
182 |
183 | ptt: false,
184 |
185 | waveform: [100, 0, 0, 0, 0, 0, 100],
186 |
187 | fileName: `${title}`,
188 |
189 |
190 |
191 | };
192 |
193 |
194 |
195 | await conn.sendMessage(m.chat, doc, { quoted: m });
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 | } else {
208 |
209 | m.reply("Invalid sequence number. Please select the appropriate number from the list above.\nBetween 1 to " + result.allLinks.length);
210 |
211 | }
212 |
213 | };
214 |
215 |
216 |
217 | handler.help = ["play"];
218 |
219 | handler.tags = ["downloader"];
220 |
221 | handler.command = /^(play)$/i;
222 |
223 | handler.limit = false;
224 |
225 | export default handler;
226 |
227 |
228 |
229 | function formatBytes(bytes, decimals = 2) {
230 |
231 | if (bytes === 0) return "0 B";
232 |
233 | const k = 1024;
234 |
235 | const dm = decimals < 0 ? 0 : decimals;
236 |
237 | const sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
238 |
239 | const i = Math.floor(Math.log(bytes) / Math.log(k));
240 |
241 | return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
242 |
243 | }
244 |
245 |
246 |
247 | async function searchAndDownloadMusic(query) {
248 |
249 | try {
250 |
251 | const { videos } = await yts(query);
252 |
253 | if (!videos.length) return "Sorry, no video results were found for this search.";
254 |
255 |
256 |
257 | const allLinks = videos.map(video => ({
258 |
259 | title: video.title,
260 |
261 | url: video.url,
262 |
263 | }));
264 |
265 |
266 |
267 | const jsonData = {
268 |
269 | title: videos[0].title,
270 |
271 | description: videos[0].description,
272 |
273 | duration: videos[0].duration,
274 |
275 | author: videos[0].author.name,
276 |
277 | allLinks: allLinks,
278 |
279 | videoUrl: videos[0].url,
280 |
281 | thumbnail: videos[0].thumbnail,
282 |
283 | };
284 |
285 |
286 |
287 | return jsonData;
288 |
289 | } catch (error) {
290 |
291 | return "Error: " + error.message;
292 |
293 | }
294 |
295 | }
296 |
297 |
298 |
299 |
300 |
301 | async function fetchVideoBuffer() {
302 |
303 | try {
304 |
305 | const response = await fetch(url, {
306 |
307 | method: 'GET',
308 |
309 | headers: {
310 |
311 | 'Access-Control-Allow-Origin': '*'
312 |
313 | }
314 |
315 | });
316 |
317 | return await response.buffer();
318 |
319 | } catch (error) {
320 |
321 | return null;
322 |
323 | }
324 |
325 | }
326 |
327 |
328 |
329 | function generateRandomName() {
330 |
331 | const adjectives = ["happy", "sad", "funny", "brave", "clever", "kind", "silly", "wise", "gentle", "bold"];
332 |
333 | const nouns = ["cat", "dog", "bird", "tree", "river", "mountain", "sun", "moon", "star", "cloud"];
334 |
335 |
336 |
337 | const randomAdjective = adjectives[Math.floor(Math.random() * adjectives.length)];
338 |
339 | const randomNoun = nouns[Math.floor(Math.random() * nouns.length)];
340 |
341 |
342 |
343 | return randomAdjective + "-" + randomNoun;
344 |
345 | }
346 |
--------------------------------------------------------------------------------
/commandes/youtube.js:
--------------------------------------------------------------------------------
1 | const { zokou } = require("../framework/zokou");
2 | const yts = require('yt-search');
3 | const ytdl = require('ytdl-core');
4 | const fs = require('fs');
5 | const yt=require("../framework/dl/ytdl-core.js")
6 | const ffmpeg = require("fluent-ffmpeg");
7 | const yts1 = require("youtube-yts");
8 | //var fs =require("fs-extra")
9 | /**
10 | zokou({
11 | nomCom: "play",
12 | categorie: "Search",
13 | reaction: "📥"
14 | }, async (origineMessage, zk, commandeOptions) => {
15 | const { ms, repondre, arg } = commandeOptions;
16 |
17 | if (!arg[0]) {
18 | repondre("wich song do you want.");
19 | return;
20 | }
21 |
22 | try {
23 | let topo = arg.join(" ")
24 | const search = await yts(topo);
25 | const videos = search.videos;
26 |
27 | if (videos && videos.length > 0 && videos[0]) {
28 | const urlElement = videos[0].url;
29 |
30 | let infoMess = {
31 | image: {url : videos[0]. thumbnail},
32 | caption : `\n*song name :* _${videos[0].title}_
33 |
34 | *Time :* _${videos[0].timestamp}_
35 |
36 | *Url :* _${videos[0].url}_
37 |
38 |
39 | _*on downloading...*_\n\n`
40 | }
41 |
42 |
43 |
44 |
45 |
46 |
47 | zk.sendMessage(origineMessage,infoMess,{quoted:ms}) ;
48 | // Obtenir le flux audio de la vidéo
49 | const audioStream = ytdl(urlElement, { filter: 'audioonly', quality: 'highestaudio' });
50 |
51 | // Nom du fichier local pour sauvegarder le fichier audio
52 | const filename = 'audio.mp3';
53 |
54 | // Écrire le flux audio dans un fichier local
55 | const fileStream = fs.createWriteStream(filename);
56 | audioStream.pipe(fileStream);
57 |
58 | fileStream.on('finish', () => {
59 | // Envoi du fichier audio en utilisant l'URL du fichier local
60 |
61 |
62 | zk.sendMessage(origineMessage, { audio: { url:"audio.mp3"},mimetype:'audio/mp4' }, { quoted: ms,ptt: false });
63 | console.log("Envoi du fichier audio terminé !");
64 |
65 |
66 | });
67 |
68 | fileStream.on('error', (error) => {
69 | console.error('Erreur lors de l\'écriture du fichier audio :', error);
70 | repondre('Une erreur est survenue lors de l\'écriture du fichier audio.');
71 | });
72 | } else {
73 | repondre('Aucune vidéo trouvée.');
74 | }
75 | } catch (error) {
76 | console.error('Erreur lors de la recherche ou du téléchargement de la vidéo :', error);
77 |
78 | repondre('Une erreur est survenue lors de la recherche ou du téléchargement de la vidéo.');
79 | }
80 | });
81 |
82 |
83 | **/
84 | zokou({
85 | nomCom: "video",
86 | categorie: "Search",
87 | reaction: "🎥"
88 | }, async (origineMessage, zk, commandeOptions) => {
89 | const { arg, ms, repondre } = commandeOptions;
90 |
91 | if (!arg[0]) {
92 | repondre("insert video name");
93 | return;
94 | }
95 |
96 | const topo = arg.join(" ");
97 | try {
98 | const search = await yts(topo);
99 | const videos = search.videos;
100 |
101 | if (videos && videos.length > 0 && videos[0]) {
102 | const Element = videos[0];
103 |
104 | let InfoMess = {
105 | image: { url: videos[0].thumbnail },
106 | caption: `*Video name :* _${Element.title}_
107 | *Time :* _${Element.timestamp}_
108 | *Url :* _${Element.url}_
109 | _*On downloading...*_\n\n`
110 | };
111 |
112 | zk.sendMessage(origineMessage, InfoMess, { quoted: ms });
113 |
114 | // Obtenir les informations de la vidéo à partir du lien YouTube
115 | const videoInfo = await ytdl.getInfo(Element.url);
116 | // Format vidéo avec la meilleure qualité disponible
117 | const format = ytdl.chooseFormat(videoInfo.formats, { quality: '18' });
118 | // Télécharger la vidéo
119 | const videoStream = ytdl.downloadFromInfo(videoInfo, { format });
120 |
121 | // Nom du fichier local pour sauvegarder la vidéo
122 | const filename = 'video.mp4';
123 |
124 | // Écrire le flux vidéo dans un fichier local
125 | const fileStream = fs.createWriteStream(filename);
126 | videoStream.pipe(fileStream);
127 |
128 | fileStream.on('finish', () => {
129 | // Envoi du fichier vidéo en utilisant l'URL du fichier local
130 | zk.sendMessage(origineMessage, { video: { url :"./video.mp4"} , caption: "*®𝐉𝐎𝐇𝐍𝐋𝐄𝐎-𝐌𝐃*", gifPlayback: false }, { quoted: ms });
131 | });
132 |
133 | fileStream.on('error', (error) => {
134 | console.error('Erreur lors de l\'écriture du fichier vidéo :', error);
135 | repondre('Une erreur est survenue lors de l\'écriture du fichier vidéo.');
136 | });
137 | } else {
138 | repondre('No video found');
139 | }
140 | } catch (error) {
141 | console.error('Seaching.....⏳ :', error);
142 | repondre('Seaching.....⏳');
143 | }
144 | });
145 |
146 | zokou({
147 | nomCom: play",
148 | categorie: "Search",
149 | reaction: "🎥"
150 | }, async (origineMessage, zk, commandeOptions) => {
151 | const { arg, ms, repondre } = commandeOptions;
152 |
153 | if (!arg[0]) {
154 | repondre("insert video name");
155 | return;
156 | }
157 |
158 | const topo = arg.join(" ");
159 | try {
160 | const search = await yts(topo);
161 | const videos = search.videos;
162 |
163 | if (videos && videos.length > 0 && videos[0]) {
164 | const Element = videos[0];
165 |
166 | let InfoMess = {
167 | image: { url: videos[0].thumbnail },
168 | caption: `*Song name :* _${Element.title}_
169 | *Time :* _${Element.timestamp}_
170 | *Url :* _${Element.url}_
171 | _*On downloading...*_\n\n`
172 | };
173 |
174 | zk.sendMessage(origineMessage, InfoMess, { quoted: ms });
175 |
176 | // Obtenir les informations de la vidéo à partir du lien YouTube
177 | const videoInfo = await ytdl.getInfo(Element.url);
178 | // Format vidéo avec la meilleure qualité disponible
179 | const format = ytdl.chooseFormat(videoInfo.formats, { quality: '18' });
180 | // Télécharger la vidéo
181 | const videoStream = ytdl.downloadFromInfo(videoInfo, { format });
182 |
183 | // Nom du fichier local pour sauvegarder la vidéo
184 | const filename = 'video.mp4';
185 |
186 | // Écrire le flux vidéo dans un fichier local
187 | const fileStream = fs.createWriteStream(filename);
188 | videoStream.pipe(fileStream);
189 |
190 | fileStream.on('finish', () => {
191 | // Envoi du fichier vidéo en utilisant l'URL du fichier local
192 | zk.sendMessage(origineMessage, { video: { url :"./video.mp4"} , caption: "*®𝐉𝐎𝐇𝐍𝐋𝐄𝐎-𝐌𝐃*", gifPlayback: false }, { quoted: ms });
193 | });
194 |
195 | fileStream.on('error', (error) => {
196 | console.error('Erreur lors de l\'écriture du fichier vidéo :', error);
197 | repondre('Une erreur est survenue lors de l\'écriture du fichier vidéo.');
198 | });
199 | } else {
200 | repondre('No video found');
201 | }
202 | } catch (error) {
203 | console.error('Seaching.....⏳ :', error);
204 | repondre('Seaching.....⏳');
205 | }
206 | });
207 |
--------------------------------------------------------------------------------
/commandes/games.js:
--------------------------------------------------------------------------------
1 | const {zokou} = require("../framework/zokou");
2 | const axios = require('axios');
3 | const traduire = require('../framework/traduction')
4 |
5 |
6 |
7 | zokou({
8 | nomCom: "chifumi",
9 | categorie: "Games",
10 | reaction: "✌️"
11 | },
12 | async (origineMessage, zk, commandeOptions) => {
13 | const { repondre, ms, auteurMessage, auteurMsgRepondu, msgRepondu , arg , idBot } = commandeOptions;
14 |
15 | if (msgRepondu) {
16 | zk.sendMessage(origineMessage, {
17 | text: `@${auteurMessage.split('@')[0]} invites @${auteurMsgRepondu.split('@')[0]} to play the rock-paper-scissors game;
18 | To accept the challenge, type yes`,
19 | mentions: [auteurMessage, auteurMsgRepondu]
20 | });
21 |
22 | try {
23 | const repinv = await zk.awaitForMessage({
24 | sender: auteurMsgRepondu,
25 | chatJid: origineMessage,
26 | timeout: 30000 // 30 secondes
27 | });
28 | console.log(repinv) ;
29 |
30 | if (repinv.message.conversation.toLowerCase() === 'yes' || repinv.message.extendedTextMessage.text.toLowerCase() === 'yes' ) {
31 |
32 | let msg1 = `*player 1 :* @${auteurMsgRepondu.split('@')[0]}
33 | *player 2 :* @${auteurMessage.split('@')[0]}
34 |
35 | *Rules:* The game will start soon; you have a maximum of 1 minute each to make a choice in our private chat;`
36 |
37 | zk.sendMessage(origineMessage,{text : msg1,mentions : [auteurMessage, auteurMsgRepondu]} ) ;
38 |
39 | let msg2 = `You have 3 choices;
40 |
41 | rock
42 | paper
43 | scissors
44 |
45 | Please send your choice`
46 | let players = [auteurMessage,auteurMsgRepondu] ;
47 | let choix = [] ;
48 |
49 | try {
50 |
51 | for (const player of players) {
52 |
53 | zk.sendMessage(origineMessage,{ text : `@${player.split("@")[0]} Please go to this chat to make a choice
54 | https://wa.me/${idBot.split('@')[0]} ` , mentions : [player]})
55 | zk.sendMessage(player,{text : msg2}) ;
56 |
57 | const msgrecu = await zk.awaitForMessage({
58 | sender: player,
59 | chatJid: player,
60 | timeout: 30000 // 30 secondes
61 | });
62 | console.log('voici le message de' + ' ' + player)
63 | console.log(msgrecu)
64 |
65 | choix.push(msgrecu.message.extendedTextMessage.text.toLowerCase()) ;
66 |
67 | }
68 |
69 | console.log(choix)
70 | const choixPossibles = ["rock", "paper", "scissors"];
71 |
72 | const choixJoueur1 = choix[0] ;
73 | const choixJoueur2 = choix[1] ;
74 |
75 |
76 | if (!choixPossibles.includes(choixJoueur1) || !choixPossibles.includes(choixJoueur2)) {
77 | // Gérez le cas où les choix ne sont pas valides
78 | zk.sendMessage(origineMessage,{ text : `*joueur 1 :* @${auteurMsgRepondu.split('@')[0]}
79 | *joueur 2 :* @${auteurMessage.split('@')[0]}
80 |
81 | *resultat :* l'un ou les deux choix ne sont pas valides.`, mentions : [auteurMessage, auteurMsgRepondu] });
82 |
83 | } else if (choixJoueur1 === choixJoueur2) {
84 | // C'est une égalité
85 | zk.sendMessage(origineMessage,{ text : `*joueur 1 :* @${auteurMsgRepondu.split('@')[0]} a choisi(e) *${choixJoueur2}*
86 | *joueur 2 :* @${auteurMessage.split('@')[0]} a choisi(e) *${choixJoueur1}*
87 |
88 | resultat : il y'a donc match nul` , mentions : [auteurMessage, auteurMsgRepondu] });
89 | } else if (
90 | (choixJoueur1 === "rock" && choixJoueur2 === "scissors") ||
91 | (choixJoueur1 === "paper" && choixJoueur2 === "rock") ||
92 | (choixJoueur1 === "scissors" && choixJoueur2 === "paper")
93 | ) {
94 | // Joueur 1 gagne
95 | zk.sendMessage(origineMessage,{ text : `*player 1 :* @${auteurMsgRepondu.split('@')[0]} choose *${choixJoueur2}*
96 | *player 2 :* @${auteurMessage.split('@')[0]} choose *${choixJoueur1}*
97 |
98 | *result :* @${auteurMessage.split('@')[0]} win ` ,mentions : [auteurMessage, auteurMsgRepondu] });
99 | } else {
100 | // Joueur 2 gagne
101 | zk.sendMessage(origineMessage,{ text : `*player 1 :* @${auteurMsgRepondu.split('@')[0]} choose *${choixJoueur2}*
102 | *player 2 :* @${auteurMessage.split('@')[0]} choose) *${choixJoueur1}*
103 |
104 | *result :* @${auteurMsgRepondu.split('@')[0]} win ` , mentions : [auteurMessage, auteurMsgRepondu] });
105 | }
106 |
107 | } catch (error) {
108 | if (error.message === 'Timeout') {
109 | // Le temps d'attente est écoulé
110 | zk.sendMessage(origineMessage,{ text : `*player 1 :* @${auteurMsgRepondu.split('@')[0]}
111 | *player 2 :* @${auteurMessage.split('@')[0]}
112 |
113 | *result :* Our players took too long to decide;
114 | Therefore, the game is canceled
115 | ` , mentions : [auteurMessage, auteurMsgRepondu]});
116 | } else {
117 | // Gérez d'autres erreurs ici si nécessaire
118 | console.error(error);
119 | }
120 | }
121 |
122 | } else {
123 | repondre('invitation refused') ;
124 | }
125 |
126 |
127 | } catch (error) {
128 | if (error.message === 'Timeout') {
129 | // Le temps d'attente est écoulé
130 | zk.sendMessage(origineMessage,{ text : `@${auteurMsgRepondu.split('@')[0]} took too long to respond to the invitation from
131 | @${auteurMessage.split('@')[0]} ;
132 | Therefore, the game is canceled`, mentions : [auteurMessage, auteurMsgRepondu]});
133 | } else {
134 | // Gérez d'autres erreurs ici si nécessaire
135 | console.error(error);
136 | }
137 | }
138 | } else {
139 | repondre('Chifumi is an rock-paper-scissors games ; you need a friend too play , mention his/her message when sending chifumi to invite him/her') ;
140 | }
141 | });
142 |
143 |
144 | zokou(
145 | { nomCom: "quizz", categorie: "Games", reaction: "📝" },
146 | async (origineMessage, zk, commandeOptions) => {
147 | const { repondre, auteurMessage } = commandeOptions;
148 |
149 | try {
150 | let quizz = await axios.get("https://quizzapi.jomoreschi.fr/api/v1/quiz?limit=1&difficulty=facile") ;
151 |
152 |
153 | let msg = ` Cyberion-Quizz-Games
154 |
155 | *Category :* ${ await traduire(quizz.data.quizzes[0].category , {to : 'en'})}
156 | *Question :* ${ await traduire(quizz.data.quizzes[0].question, {to : 'en'})}\n\n*Answers :*\n`
157 |
158 | let Answers =[] ;
159 | for (const reponse of quizz.data.quizzes[0].badAnswers) {
160 |
161 | Answers.push(reponse)
162 |
163 | } ;
164 |
165 | Answers.push(quizz.data.quizzes[0].answer) ;
166 |
167 | async function shuffleArray(array) {
168 | const shuffledArray = array.slice(); // Copie du tableau d'origine
169 |
170 | for (let i = shuffledArray.length - 1; i > 0; i--) {
171 | const j = Math.floor(Math.random() * (i + 1));
172 | [shuffledArray[i], shuffledArray[j]] = [shuffledArray[j], shuffledArray[i]];
173 | }
174 |
175 | return shuffledArray;
176 | } ;
177 |
178 | let choix = await shuffleArray(Answers) ;
179 |
180 | for (let i = 0; i < choix.length; i++) {
181 | msg += `*${i + 1} :* ${choix[i]}\n`;
182 | }
183 |
184 |
185 | msg+= `
186 | Send the number off right answers`
187 |
188 | repondre(msg) ;
189 |
190 | let rep = await zk.awaitForMessage({
191 | sender: auteurMessage,
192 | chatJid : origineMessage,
193 | timeout: 15000 // 30 secondes
194 | });
195 | let repse ;
196 | try {
197 | repse = rep.message.extendedTextMessage.text
198 | } catch {
199 | repse = rep.message.conversation
200 | } ;
201 |
202 | if (choix[repse - 1 ] == quizz.data.quizzes[0].answer ) {
203 |
204 | repondre("Great , good answer ;")
205 | } else {
206 |
207 | repondre("bad answer")
208 | }
209 |
210 | } catch (error) {
211 | console.log(error);
212 | }
213 | }
214 | );
215 |
--------------------------------------------------------------------------------
/commandes/audioedit.js:
--------------------------------------------------------------------------------
1 | const {zokou} = require('../framework/zokou');
2 | const fs = require("fs");
3 | const { exec } = require("child_process");
4 |
5 |
6 | const filename = `${Math.random().toString(36)}`;
7 |
8 | zokou (
9 | {
10 | nomCom : 'deep',
11 | categorie : 'Audio-Edit',
12 |
13 | }, async (dest , zk, commandeOptions) => {
14 | const {ms , repondre,msgRepondu} = commandeOptions;
15 |
16 | if (msgRepondu) {
17 | if(msgRepondu.audioMessage) {
18 |
19 | const media = await zk.downloadAndSaveMediaMessage(msgRepondu.audioMessage)
20 |
21 | let set = "-af atempo=4/4,asetrate=44500*2/3";
22 | let ran = `${filename}.mp3`;
23 |
24 | try {
25 | exec(`ffmpeg -i ${media} ${set} ${ran}`, (err, stderr, stdout) => {
26 | fs.unlinkSync(media);
27 | if (err) return repondre("error during the procedure " + err );
28 |
29 | let buff1 = fs.readFileSync(ran);
30 |
31 | zk.sendMessage(
32 | dest,
33 | { audio: buff1, mimetype: "audio/mpeg" },
34 | { quoted: ms }
35 | );
36 | fs.unlinkSync(ran);
37 | });
38 | } catch (e) {
39 |
40 | repondre("error");
41 | }
42 |
43 | } else {
44 | repondre('the command only works with audio messages')
45 | }
46 |
47 | } else {
48 | repondre('Please mention an audio')
49 | }
50 | }
51 | );
52 |
53 | zokou (
54 | {
55 | nomCom : 'bass',
56 | categorie : 'Audio-Edit',
57 |
58 | }, async (dest , zk, commandeOptions) => {
59 | const {ms , repondre,msgRepondu} = commandeOptions;
60 |
61 | if (msgRepondu) {
62 | if(msgRepondu.audioMessage) {
63 |
64 | const media2 = await zk.downloadAndSaveMediaMessage(msgRepondu.audioMessage)
65 |
66 | let set2 = "-af equalizer=f=18:width_type=o:width=2:g=14";
67 | let ran2 = `${filename}.mp3`;
68 |
69 | try {
70 | exec(`ffmpeg -i ${media2} ${set2} ${ran2}`, (err, stderr, stdout) => {
71 | fs.unlinkSync(media2);
72 | if (err) return repondre("error during the procedure " + err );
73 |
74 | let buff2 = fs.readFileSync(ran2);
75 |
76 | zk.sendMessage(
77 | dest,
78 | { audio: buff2, mimetype: "audio/mpeg" },
79 | { quoted: ms }
80 | );
81 | fs.unlinkSync(ran2);
82 | });
83 | } catch (e) {
84 |
85 | repondre("error");
86 | }
87 |
88 | } else {
89 | repondre('the command only works with audio messages')
90 | }
91 |
92 | } else {
93 | repondre('Please mention an audio')
94 | }
95 | }
96 | );
97 |
98 | zokou(
99 | {
100 | nomCom: 'reverse',
101 | categorie: 'Audio-Edit',
102 | },
103 | async (dest, zk, commandeOptions) => {
104 | const { ms, repondre, msgRepondu } = commandeOptions;
105 |
106 | if (msgRepondu) {
107 | if (msgRepondu.audioMessage) {
108 | const media3 = await zk.downloadAndSaveMediaMessage(msgRepondu.audioMessage);
109 | let set3 = '-filter_complex "areverse"';
110 | let ran3 = `${filename}.mp3`;
111 |
112 | try {
113 | exec(`ffmpeg -i ${media3} ${set3} ${ran3}`, (err, stderr, stdout) => {
114 | fs.unlinkSync(media3);
115 | if (err) return repondre("error during the procedure" + err);
116 |
117 | let buff3 = fs.readFileSync(ran3);
118 |
119 | zk.sendMessage(dest, { audio: buff3, mimetype: "audio/mpeg" }, { quoted: ms });
120 | fs.unlinkSync(ran3);
121 | });
122 | } catch (e) {
123 | repondre("Error : " + e);
124 | }
125 | } else {
126 | repondre("The command only works with audio messages");
127 | }
128 | } else {
129 | repondre("Please mention an audio");
130 | }
131 | }
132 | );
133 |
134 | zokou(
135 | {
136 | nomCom: 'slow',
137 | categorie: 'Audio-Edit',
138 | },
139 | async (dest, zk, commandeOptions) => {
140 | const { ms, repondre, msgRepondu } = commandeOptions;
141 |
142 | if (msgRepondu) {
143 | if (msgRepondu.audioMessage) {
144 | const media5 = await zk.downloadAndSaveMediaMessage(msgRepondu.audioMessage);
145 | let set5 = '-filter:a "atempo=0.8,asetrate=44100"';
146 | let ran5 = `${filename}.mp3`;
147 |
148 | try {
149 | exec(`ffmpeg -i ${media5} ${set5} ${ran5}`, (err, stderr, stdout) => {
150 | fs.unlinkSync(media5);
151 | if (err) return repondre("error during the procedure" + err);
152 |
153 | let buff5 = fs.readFileSync(ran5);
154 |
155 | zk.sendMessage(dest, { audio: buff5, mimetype: "audio/mpeg" }, { quoted: ms });
156 | fs.unlinkSync(ran5);
157 | });
158 | } catch (e) {
159 | repondre("Error : " + e);
160 | }
161 | } else {
162 | repondre("The command only works with audio messages");
163 | }
164 | } else {
165 | repondre("Please mention an audio");
166 | }
167 | }
168 | );
169 |
170 | // Cas pour l'effet "smooth"
171 | zokou(
172 | {
173 | nomCom: 'smooth',
174 | categorie: 'Audio-Edit',
175 | },
176 | async (dest, zk, commandeOptions) => {
177 | const { ms, repondre, msgRepondu } = commandeOptions;
178 |
179 | if (msgRepondu) {
180 | if (msgRepondu.audioMessage) {
181 | const mediaSmooth = await zk.downloadAndSaveMediaMessage(msgRepondu.audioMessage);
182 | let setSmooth = '-filter:v "minterpolate=\'mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=120\'"';
183 | let ranSmooth = `${filename}.mp3`;
184 |
185 | try {
186 | exec(`ffmpeg -i ${mediaSmooth} ${setSmooth} ${ranSmooth}`, (err, stderr, stdout) => {
187 | fs.unlinkSync(mediaSmooth);
188 | if (err) return repondre("error during the procedure" + err);
189 |
190 | let buff6 = fs.readFileSync(ranSmooth);
191 |
192 | zk.sendMessage(dest, { audio: buff6, mimetype: "audio/mpeg" }, { quoted: ms });
193 | fs.unlinkSync(ranSmooth);
194 | });
195 | } catch (e) {
196 | repondre("Error : " + e);
197 | }
198 | } else {
199 | repondre("The command only works with audio messages");
200 | }
201 | } else {
202 | repondre("Please mention an audio");
203 | }
204 | }
205 | );
206 |
207 | // Cas pour l'effet "tempo"
208 | zokou(
209 | {
210 | nomCom: 'tempo',
211 | categorie: 'Audio-Edit',
212 | },
213 | async (dest, zk, commandeOptions) => {
214 | const { ms, repondre, msgRepondu } = commandeOptions;
215 |
216 | if (msgRepondu) {
217 | if (msgRepondu.audioMessage) {
218 | const mediaTempo = await zk.downloadAndSaveMediaMessage(msgRepondu.audioMessage);
219 | let setTempo = '-filter:a "atempo=0.9,asetrate=65100"';
220 | let ranTempo = `${filename}.mp3`;
221 |
222 | try {
223 | exec(`ffmpeg -i ${mediaTempo} ${setTempo} ${ranTempo}`, (err, stderr, stdout) => {
224 | fs.unlinkSync(mediaTempo);
225 | if (err) return repondre("error during the procedure " + err);
226 |
227 | let buff7 = fs.readFileSync(ranTempo);
228 |
229 | zk.sendMessage(dest, { audio: buff7, mimetype: "audio/mpeg" }, { quoted: ms });
230 | fs.unlinkSync(ranTempo);
231 | });
232 | } catch (e) {
233 | repondre("Error : " + e);
234 | }
235 | } else {
236 | repondre("The command only works with audio messages");
237 | }
238 | } else {
239 | repondre("Please mention an audio");
240 | }
241 | }
242 | );
243 |
244 | // Cas pour l'effet "nightcore"
245 | zokou(
246 | {
247 | nomCom: 'nightcore',
248 | categorie: 'Audio-Edit',
249 | },
250 | async (dest, zk, commandeOptions) => {
251 | const { ms, repondre, msgRepondu } = commandeOptions;
252 |
253 | if (msgRepondu) {
254 | if (msgRepondu.audioMessage) {
255 | const mediaNightcore = await zk.downloadAndSaveMediaMessage(msgRepondu.audioMessage);
256 | let setNightcore = '-filter:a "atempo=1.07,asetrate=44100*1.20"';
257 | let ranNightcore = `${filename}.mp3`;
258 |
259 | try {
260 | exec(`ffmpeg -i ${mediaNightcore} ${setNightcore} ${ranNightcore}`, (err, stderr, stdout) => {
261 | fs.unlinkSync(mediaNightcore);
262 | if (err) return repondre("error during the procedure " + err);
263 |
264 | let buff8 = fs.readFileSync(ranNightcore);
265 |
266 | zk.sendMessage(dest, { audio: buff8, mimetype: "audio/mpeg" }, { quoted: ms });
267 | fs.unlinkSync(ranNightcore);
268 | });
269 | } catch (e) {
270 | repondre("Erreur : " + e);
271 | }
272 | } else {
273 | repondre("The command only works with audio messages");
274 | }
275 | } else {
276 | repondre("Please mention an audio");
277 | }
278 | }
279 | );
280 |
281 |
--------------------------------------------------------------------------------
/framework/dl/ytdl-core.js:
--------------------------------------------------------------------------------
1 |
2 | const ytdl = require('youtubedl-core');
3 | const yts = require('youtube-yts');
4 | const readline = require('readline');
5 | const ffmpeg = require('fluent-ffmpeg')
6 | const NodeID3 = require('node-id3')
7 | const fs = require('fs');
8 | const { fetchBuffer } = require("./Function")
9 | const { randomBytes } = require('crypto')
10 | const ytIdRegex = /(?:youtube\.com\/\S*(?:(?:\/e(?:mbed))?\/|watch\?(?:\S*?&?v\=))|youtu\.be\/)([a-zA-Z0-9_-]{6,11})/
11 |
12 | class YT {
13 | constructor() { }
14 |
15 | /**
16 | * Checks if it is yt link
17 | * @param {string|URL} url youtube url
18 | * @returns Returns true if the given YouTube URL.
19 | */
20 | static isYTUrl = (url) => {
21 | return ytIdRegex.test(url)
22 | }
23 |
24 | /**
25 | * VideoID from url
26 | * @param {string|URL} url to get videoID
27 | * @returns
28 | */
29 | static getVideoID = (url) => {
30 | if (!this.isYTUrl(url)) throw new Error('is not YouTube URL')
31 | return ytIdRegex.exec(url)[1]
32 | }
33 |
34 | /**
35 | * @typedef {Object} IMetadata
36 | * @property {string} Title track title
37 | * @property {string} Artist track Artist
38 | * @property {string} Image track thumbnail url
39 | * @property {string} Album track album
40 | * @property {string} Year track release date
41 | */
42 |
43 | /**
44 | * Write Track Tag Metadata
45 | * @param {string} filePath
46 | * @param {IMetadata} Metadata
47 | */
48 | static WriteTags = async (filePath, Metadata) => {
49 | NodeID3.write(
50 | {
51 | title: Metadata.Title,
52 | artist: Metadata.Artist,
53 | originalArtist: Metadata.Artist,
54 | image: {
55 | mime: 'jpeg',
56 | type: {
57 | id: 3,
58 | name: 'front cover',
59 | },
60 | imageBuffer: (await fetchBuffer(Metadata.Image)).buffer,
61 | description: `Cover of ${Metadata.Title}`,
62 | },
63 | album: Metadata.Album,
64 | year: Metadata.Year || ''
65 | },
66 | filePath
67 | );
68 | }
69 |
70 | /**
71 | *
72 | * @param {string} query
73 | * @returns
74 | */
75 | static search = async (query, options = {}) => {
76 | const search = await yts.search({ query, hl: 'id', gl: 'ID', ...options })
77 | return search.videos
78 | }
79 |
80 | /**
81 | * @typedef {Object} TrackSearchResult
82 | * @property {boolean} isYtMusic is from YT Music search?
83 | * @property {string} title music title
84 | * @property {string} artist music artist
85 | * @property {string} id YouTube ID
86 | * @property {string} url YouTube URL
87 | * @property {string} album music album
88 | * @property {Object} duration music duration {seconds, label}
89 | * @property {string} image Cover Art
90 | */
91 |
92 |
93 | /**
94 | * @typedef {Object} MusicResult
95 | * @property {TrackSearchResult} meta music meta
96 | * @property {string} path file path
97 | */
98 |
99 | /**
100 | * Download music with full tag metadata
101 | * @param {string|TrackSearchResult[]} query title of track want to download
102 | * @returns {Promise