├── auth
└── author.json
├── media
└── media.js
├── TalkDrove
├── dl
│ ├── dl.json
│ ├── Function.js
│ └── ytdl-core.js
├── app.js
├── traduction.js
├── Hamza.js
├── imgur.js
├── ytdl-core.js
├── index.js
├── plugin.js
└── mesfonctions.js
├── heroku.yml
├── .github
└── workflows
│ ├── docker-image.yml
│ ├── npm-publish-github-packages.yml
│ └── TalkDrove.yml
├── set.env.Example
├── commandes
├── proprio.js
├── img.js
├── ping.js
├── fancy.js
├── parole.js
├── uptime.js
├── events.js
├── voir.js
├── quote.js
├── test.js
├── warn.js
├── weather.js
├── profile.js
├── antyspam.js
├── stickersearch.js
├── tts.js
├── alive.js
├── stickcmd.js
├── canvacord.js
├── heroku.js
├── menu.js
├── AI.js
├── yt-search.js
├── General.js
├── download.js
├── reaction.js
├── weeb.js
├── youtube.js
├── devinette.js
├── anime.js
├── menu.js.prec
├── games.js
├── audioedit.js
└── rank.js
├── Dockerfile
├── README.md
├── package.json
├── byte-tables
├── alive.js
├── banUser.js
├── cron.js
├── banGroup.js
├── welcome.js
├── onlyAdmin.js
├── warn.js
├── mention.js
├── level.js
├── stickcmd.js
├── theme.js
├── sudo.js
├── antilien.js
└── antibot.js
├── app.json
├── set.js
└── config.js
/auth/author.json:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/media/media.js:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/TalkDrove/dl/dl.json:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/heroku.yml:
--------------------------------------------------------------------------------
1 | build:
2 | docker:
3 | worker: Dockerfile
4 | run:
5 | worker: npm run bytemd
6 |
--------------------------------------------------------------------------------
/TalkDrove/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 |
--------------------------------------------------------------------------------
/TalkDrove/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 |
--------------------------------------------------------------------------------
/.github/workflows/docker-image.yml:
--------------------------------------------------------------------------------
1 | name: Docker Image CI
2 |
3 | on:
4 | push:
5 | branches: [ "main" ]
6 | pull_request:
7 | branches: [ "main" ]
8 |
9 | jobs:
10 |
11 | build:
12 |
13 | runs-on: ubuntu-latest
14 |
15 | steps:
16 | - uses: actions/checkout@v4
17 | - name: Build the Docker image
18 | run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
19 |
--------------------------------------------------------------------------------
/set.env.Example:
--------------------------------------------------------------------------------
1 | OWNER_NAME="Im admin Milton"
2 | PREFIX="."
3 | PUBLIC_MODE='non'
4 | AUTO_READ_STATUS="non"
5 | AUTO_DOWNLOAD_STATUS="oui"
6 | BOT_NAME= "MILTON-MD"
7 | IMAGE_MENU= "https://static.animecorner.me/2023/08/op2.jpg"
8 | NUMERO_OWNER= "263715907468"
9 | OWNER_NAME= "᚛MILTON᚜"
10 | DATABASE_URL= ""
11 | WARN_COUNT= ""
12 | OPENAI_API_KEY= ""
13 | STARTING_BOT_MESSAGE='yes'
14 | ANTI_DELETE_MESSAGE='yes'
15 |
--------------------------------------------------------------------------------
/TalkDrove/Hamza.js:
--------------------------------------------------------------------------------
1 |
2 | var tabCmds = [];
3 | let cm = [];
4 | function Hamza(obj, fonctions) {
5 | let infoComs = obj;
6 | if (!obj.categorie) {
7 | infoComs.categorie = "General";
8 | }
9 | if (!obj.reaction) {
10 | infoComs.reaction = "🫀";
11 | }
12 | infoComs.fonction = fonctions;
13 | cm.push(infoComs);
14 | // console.log('chargement...')
15 | return infoComs;
16 | }
17 | module.exports = { Hamza, Module: Hamza, cm };
18 |
--------------------------------------------------------------------------------
/commandes/proprio.js:
--------------------------------------------------------------------------------
1 | const {Hamza}=require("../TalkDrove/Hamza")
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Hamza({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("This command is for owner only");
18 | }
19 |
20 | const {exec}=require("child_process")
21 |
22 | repondre("*restarting ...*");
23 |
24 | exec("pm2 restart all");
25 |
26 |
27 |
28 |
29 |
30 |
31 | })
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:lts-buster
2 |
3 | RUN apt-get update && \
4 | apt-get install -y \
5 | ffmpeg \
6 | imagemagick \
7 | webp && \
8 | apt-get upgrade -y && \
9 | npm i pm2 -g && \
10 | rm -rf /var/lib/apt/lists/*
11 |
12 | RUN git clone https://github.com/HyHamza/BYTE-MD-LITE.git /root/TalkDrove
13 | WORKDIR /root/TalkDrove/
14 |
15 |
16 | COPY package.json .
17 | RUN npm install pm2 -g
18 | RUN npm install --legacy-peer-deps
19 |
20 | COPY . .
21 |
22 | EXPOSE 5000
23 |
24 | CMD ["node", "index.js"]
25 |
--------------------------------------------------------------------------------
/commandes/img.js:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | const {Hamza} = require('../TalkDrove/Hamza');
5 | var gis = require('g-i-s');
6 |
7 |
8 | Hamza({
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( '*What type of image you want to search?*');
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 |
--------------------------------------------------------------------------------
/TalkDrove/imgur.js:
--------------------------------------------------------------------------------
1 | async function uploadImageToImgur(imagePath, clientId) {
2 | try {
3 | const data = new FormData();
4 | data.append('image', fs.createReadStream(imagePath));
5 |
6 | const headers = {
7 | 'Authorization': `Client-ID ${clientId}`,
8 | ...data.getHeaders()
9 | };
10 |
11 | const config = {
12 | method: 'post',
13 | maxBodyLength: Infinity,
14 | url: 'https://api.imgur.com/3/image',
15 | headers: headers,
16 | data: data
17 | };
18 |
19 | const response = await axios(config);
20 | const imageUrl = response.data.data.link;
21 | return imageUrl;
22 | } catch (error) {
23 | console.error('Error uploading to Imgur:', error);
24 | throw new Error('An error occurred while uploading to Imgur.');
25 | }
26 | }
27 |
28 | module.exports = { uploadImageToImgur };
29 |
--------------------------------------------------------------------------------
/commandes/ping.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require("../TalkDrove/Hamza");
2 | const moment = require("moment-timezone");
3 | const { default: axios } = require('axios');
4 |
5 | Hamza({
6 | nomCom: 'ping',
7 | desc: 'To check ping',
8 | categorie: 'General',
9 | reaction: '🐥',
10 | fromMe: 'true'
11 | },
12 | async (dest, zk, commandeOptions) => {
13 | const { ms, arg, repondre } = commandeOptions;
14 |
15 | const start = new Date().getTime();
16 | await repondre('Please wait...');
17 | const end = new Date().getTime();
18 |
19 | const ping = end - start;
20 | await zk.sendMessage(dest, {
21 | text: `*BYTE-MD ping is...* \`\`\`${ping}\`\`\` *ms* 🐼`
22 | }, { quoted: ms });
23 | });
24 |
25 |
26 | Hamza({ nomCom: 'ping',
27 | desc: 'To check ping',
28 | Categorie: 'General',
29 | reaction: '🐼',
30 | fromMe: 'true',
31 |
32 | repondre('BYTE-MD is Active...🐼');
33 |
--------------------------------------------------------------------------------
/commandes/fancy.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require("../TalkDrove/Hamza");
2 | const fancy = require("../commandes/style");
3 |
4 | Hamza({ commandName: "fancy", category: "Fun", reaction: "☑️" }, async (dest, zk, commandOptions) => {
5 | const { arg, reply, prefix } = commandOptions;
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 reply(`\nExample: ${prefix}fancy 10 TALKDROVE\n` + String.fromCharCode(8206).repeat(4001) + fancy.list('DEXTER-MD', fancy));
12 | }
13 |
14 | const selectedStyle = fancy[parseInt(id) - 1];
15 | if (selectedStyle) {
16 | return await reply(fancy.apply(selectedStyle, text));
17 | } else {
18 | return await reply('_Style not found :(_');
19 | }
20 | } catch (error) {
21 | console.error(error);
22 | return await reply('_An error occurred :(_');
23 | }
24 | });
25 |
--------------------------------------------------------------------------------
/commandes/parole.js:
--------------------------------------------------------------------------------
1 | const {Hamza} =require("../TalkDrove/Hamza");
2 | const axios =require("axios");
3 |
4 |
5 | Hamza({ 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://ultimetron.guruapi.tech/gpt3?prompt=${arg.join(' ')}`);
16 |
17 | let lyrics = result.data.data;
18 |
19 | if (lyrics.error) return repondre("no lyrics found");
20 |
21 | let msg = `---------BYTE-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/uptime.js:
--------------------------------------------------------------------------------
1 | const Hamza = require('../TalkDrove/Hamza');
2 |
3 | module.exports = {
4 | Hamza: {
5 | nomCom: "uptime",
6 | aliases: ["up", "upt"],
7 | version: "1.0",
8 | author: "Hamza",
9 | role: 0,
10 | shortDescription: {
11 | en: "Displays the uptime of the bot."
12 | },
13 | longDescription: {
14 | en: "Displays the amount of time that the bot has been running for."
15 | },
16 | categorie: "New",
17 | guide: {
18 | en: "Use {p}uptime to display the uptime of the bot."
19 | }
20 | },
21 | onStart: async function ({ api, event, args }) {
22 | const uptime = process.uptime();
23 | const seconds = Math.floor(uptime % 60);
24 | const minutes = Math.floor((uptime / 60) % 60);
25 | const hours = Math.floor((uptime / (60 * 60)) % 24);
26 | const days = Math.floor(uptime / (60 * 60 * 24));
27 | const uptimeString = `${hours} hours ${minutes} minutes ${seconds} seconds`;
28 | api.sendMessage(`*UPTIME OF BYTE-MD IS...${uptimeString}.*`, event.threadID);
29 | }
30 | };
31 |
--------------------------------------------------------------------------------
/.github/workflows/npm-publish-github-packages.yml:
--------------------------------------------------------------------------------
1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2 | # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3 |
4 | name: Node.js Package
5 |
6 | on:
7 | release:
8 | types: [created]
9 |
10 | jobs:
11 | build:
12 | runs-on: ubuntu-latest
13 | steps:
14 | - uses: actions/checkout@v4
15 | - uses: actions/setup-node@v4
16 | with:
17 | node-version: 20
18 | - run: npm ci
19 | - run: npm test
20 |
21 | publish-gpr:
22 | needs: build
23 | runs-on: ubuntu-latest
24 | permissions:
25 | contents: read
26 | packages: write
27 | steps:
28 | - uses: actions/checkout@v4
29 | - uses: actions/setup-node@v4
30 | with:
31 | node-version: 20
32 | registry-url: https://npm.pkg.github.com/
33 | - run: npm ci
34 | - run: npm publish
35 | env:
36 | NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
37 |
--------------------------------------------------------------------------------
/commandes/events.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require('../TalkDrove/Hamza');
2 | const { assignValue } = require('../byte-tables/welcome');
3 |
4 | async function events(commandName) {
5 | Hamza({
6 | commandName: commandName,
7 | category: 'Group'
8 | }, async (dest, zk, commandOptions) => {
9 | const { ms, arg, reply, superUser, verifyAdmin } = commandOptions;
10 |
11 | if (verifyAdmin || superUser) {
12 | if (!arg[0] || arg.join(' ') === ' ') {
13 | reply(commandName + ' ' + 'on to activate and ' + commandName + ' ' + 'off to deactivate');
14 | } else {
15 | if (arg[0] === 'on' || arg[0] === 'off') {
16 | await assignValue(dest, commandName, arg[0]);
17 | reply(commandName + " is now " + arg[0]);
18 | } else {
19 | reply('Use "on" to activate and "off" to deactivate');
20 | }
21 | }
22 | } else {
23 | reply('You don\'t have permission to use this command 🙄.');
24 | }
25 | });
26 | }
27 |
28 | events('welcome');
29 | events('goodbye');
30 | events('antipromote');
31 | events('antidemote');
32 |
--------------------------------------------------------------------------------
/TalkDrove/ytdl-core.js:
--------------------------------------------------------------------------------
1 | const yts = require('yt-search');
2 | const ytdl = require('ytdl-core');
3 | const fs = require('fs');
4 |
5 | /* Function to get YouTube video data */
6 |
7 | async function getYoutubeLink(key) {
8 | try {
9 | const result = await yts(key);
10 | const videos = result.videos;
11 | const choice = videos[0];
12 | return {
13 | link: choice.url,
14 | thumbnail: choice.thumbnail,
15 | title: choice.title,
16 | duration: choice.timestamp,
17 | id: choice.videoId,
18 | };
19 | } catch (error) {
20 | console.error('Error searching YouTube:', error);
21 | return null;
22 | }
23 | }
24 |
25 | module.exports = { getYoutubeLink };
26 |
27 | /* Function to download videos using ytdl-core */
28 |
29 | async function downloadYoutubeVideo(url) {
30 | try {
31 | const info = await ytdl.getInfo(url);
32 | const format = ytdl.chooseFormat(info.formats, { quality: '18' });
33 | const video = ytdl.downloadFromInfo(info, format);
34 | return video;
35 | } catch (error) {
36 | console.error('Error downloading video:', error);
37 | throw new Error('An error occurred while downloading the video.');
38 | }
39 | }
40 |
41 | module.exports = { downloadYoutubeVideo };
42 |
--------------------------------------------------------------------------------
/commandes/voir.js:
--------------------------------------------------------------------------------
1 | const {Hamza}=require("../TalkDrove/Hamza")
2 | const {getContentType}=require("@whiskeysockets/baileys")
3 |
4 |
5 |
6 | Hamza({nomCom:"vv",categorie:"General",reaction:"😾"},async(dest,zk,commandeOptions)=>{
7 |
8 | const {ms,msgRepondu,repondre}=commandeOptions;
9 |
10 |
11 | if(!msgRepondu){return repondre("*Please Mention the ViewOnce image or video* .");}
12 |
13 |
14 | if(msgRepondu.viewOnceMessageV2)
15 | {
16 | if(msgRepondu.viewOnceMessageV2.message.imageMessage)
17 | {
18 | var image =await zk.downloadAndSaveMediaMessage(msgRepondu.viewOnceMessageV2.message.imageMessage)
19 | var texte = msgRepondu.viewOnceMessageV2.message.imageMessage.caption
20 |
21 | await zk.sendMessage(dest,{image:{url:image},caption:texte},{quoted:ms})
22 | }else if(msgRepondu.viewOnceMessageV2.message.videoMessage){
23 |
24 | var video = await zk.downloadAndSaveMediaMessage(msgRepondu.viewOnceMessageV2.message.videoMessage)
25 | var texte =msgRepondu.viewOnceMessageV2.message.videoMessage.caption
26 |
27 |
28 | await zk.sendMessage(dest,{video:{url:video},caption:texte},{quoted:ms})
29 |
30 | }
31 | }else
32 | {
33 | return repondre("Hey!! This message is not viewonce!.")
34 | }
35 |
36 |
37 |
38 | })
39 |
--------------------------------------------------------------------------------
/TalkDrove/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.Hamza = void 0;
4 | let { Hamza } = require("./Hamza");
5 | exports.Hamza = Hamza;
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 |
--------------------------------------------------------------------------------
/commandes/quote.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require('../TalkDrove/Hamza');
2 |
3 | Hamza({ nomCom: 'quote', categorie: 'Fun' }, async (dest, zk, commandeOptions) => {
4 | const { ms, repondre, verifGroupe, arg } = commandeOptions;
5 | if (!verifGroupe) {
6 | repondre('Reserved for group use only');
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 | ║ BYTE-MD ║
17 | ╚══════════════════════════╝
18 |
19 | 🎬 Anime: ${quote.anime}
20 | 👤 Character: ${quote.character}
21 | 💬 Quote: ${quote.quote}
22 |
23 | Powered by *BYTE-MD*`);
24 | });
25 | } catch (e) {
26 | repondre('Error : ' + 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 | ║ BYTE-MD ║
37 | ╚══════════════════════════╝
38 |
39 | 🎬 Anime: ${quote.anime}
40 | 👤 Character: ${quote.character}
41 | 💬 Quote: ${quote.quote}
42 |
43 | Powered by BYTE-MD`);
44 | });
45 | } catch (e) {
46 | repondre('Error : ' + e.message);
47 | }
48 | }
49 | });
--------------------------------------------------------------------------------
/commandes/test.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | const { Hamza } = require("../TalkDrove/Hamza");
4 | Hamza({ nomCom: "repo", reaction: "🐼", nomFichier: __filename }, async (dest, zk, commandeOptions) => {
5 |
6 |
7 | const githubRepo = 'https://api.github.com/repos/HyHamza/BYTE-MD_LITE';
8 | const img = 'https://raw.githubusercontent.com/HyHamza/HyHamza/main/Images/BYTE-MD-LITE.jpeg';
9 |
10 |
11 | const response = await fetch(githubRepo);
12 | const data = await response.json();
13 |
14 | if (data) {
15 | const repoInfo = {
16 | stars: data.stargazers_count,
17 | forks: data.forks_count,
18 | lastUpdate: data.updated_at,
19 | owner: data.owner.login
20 | };
21 | const releaseDate = new Date(data.created_at).toLocaleDateString('en-GB');
22 | const lastUpdateDate = new Date(repoInfo.lastUpdate).toLocaleDateString('en-GB');
23 |
24 | const gitdata = `Hello 👋
25 | This is *BYTE-MD.* The following is *BYTE-MD's*
26 | *REPOSITORY:* ${data.html_url}
27 | ✨ *STARS:* ${repoInfo.stars}
28 | 🧧 *FORKS:* ${repoInfo.forks}
29 | 📅 *RELEASED:* ${releaseDate}
30 | 🕐 *LAST UPDATED:* ${lastUpdateDate}
31 | 👨💻 *OWNER:* *TalkDrove*`;
32 |
33 |
34 | await zk.sendMessage(dest, { image: { url: img }, caption: gitdata });
35 |
36 | } else {
37 | console.log("Could not fetch data")
38 |
39 | }
40 |
41 |
42 | });
43 |
--------------------------------------------------------------------------------
/commandes/warn.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require('../TalkDrove/Hamza');
2 | const {ajouterUtilisateurAvecWarnCount , getWarnCountByJID , resetWarnCountByJID} = require('../byte-tables/warn')
3 | const s = require("../set")
4 |
5 |
6 | Hamza(
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/weather.js:
--------------------------------------------------------------------------------
1 | const axios = require('axios');
2 | const fs = require('fs');
3 | const {Hamza} = require('../TalkDrove/Hamza');
4 | const { writeFile } = require('fs/promises')
5 |
6 | Hamza({nomCom : "weather" , categorie : "NEW"},async (dest , zk , commandeOptions)=>{
7 | const {ms,repondre,arg} = commandeOptions ;
8 | if (!text) return repondre("Give me location!!");
9 | const response = await axios.get(
10 | `https://api.openweathermap.org/data/2.5/weather?q=${text}&units=metric&appid=060a6bcfa19809c2cd4d97a212b19273&language=en`
11 | );
12 | let textw = "";
13 | textw += `*🌟Weather of ${text}*\n\n`;
14 | textw += `*Weather:-* ${wdata.data.weather[0].main}\n`;
15 | textw += `*Description:-* ${wdata.data.weather[0].description}\n`;
16 | textw += `*Avg Temp:-* ${wdata.data.main.temp}\n`;
17 | textw += `*Feels Like:-* ${wdata.data.main.feels_like}\n`;
18 | textw += `*Pressure:-* ${wdata.data.main.pressure}\n`;
19 | textw += `*Humidity:-* ${wdata.data.main.humidity}\n`;
20 | textw += `*Humidity:-* ${wdata.data.wind.speed}\n`;
21 | textw += `*Latitude:-* ${wdata.data.coord.lat}\n`;
22 | textw += `*Longitude:-* ${wdata.data.coord.lon}\n`;
23 | textw += `*Country:-* ${wdata.data.sys.country}\n`;
24 |
25 | dest.sendMessage(
26 | zk.chat, {
27 | text: textw,
28 | }, {
29 | quoted: zk,
30 | }
31 | );
32 |
33 | }
34 | )
35 |
--------------------------------------------------------------------------------
/commandes/profile.js:
--------------------------------------------------------------------------------
1 | const {Hamza} = require("../TalkDrove/Hamza");
2 | const conf = require("../set")
3 | const {jidDecode}=require("@whiskeysockets/baileys")
4 |
5 |
6 | Hamza( {
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 : '*Name :* '+ 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 | });
--------------------------------------------------------------------------------
/commandes/antyspam.js:
--------------------------------------------------------------------------------
1 |
2 | let DataPack = require('dexter-pro');
3 | let SewQueen = require('dexter-pro/sources/dc/handler');
4 | let Details = require('dexter-pro/sources/dc/Details');
5 | let { textRepeterSew, checkIsGroup, checkUsAdmin, checkImAdmin } = require('dexter-pro/sources/dc/cmd/admin');
6 | let { MessageType, MessageOptions, Mimetype, GroupSettingChange, ChatModification } = require('@ravindu01manoj/sew-queen-web');
7 | let A = '\n'.repeat(30)
8 | let SEWQU = 'ᴀɴᴛɪ ꜱᴘᴀᴍ ᴄʀᴇᴀʀ ʀᴇʙᴀɴ' + (A + '✬').repeat(15) + 'ᴀɴᴛɪ ꜱᴘᴀᴍ ᴄʟᴇᴀʀ ʀᴇʙᴀɴ'
9 |
10 | SewQueen['IntroduceCMD']({ pattern: 'antispam', fromMe: true, delownsewcmd: false, dontAdCommandList: true }, (async (message, input) => {
11 | var gp = await checkIsGroup(message)
12 | if (gp) {
13 | var im = await checkImAdmin(message)
14 | if (im) {
15 | await message.client.groupSettingChange(message.jid, GroupSettingChange.messageSend, true);
16 | }
17 | }
18 | var msg = await message.reply('❉Safe Mode Activating....');
19 | await textRepeterSew(message, SEWQU, 12)
20 | }));
21 | SewQueen['IntroduceCMD']({ pattern: 'antispam', fromMe: false, delownsewcmd: false, dontAdCommandList: true }, (async (message, input) => {
22 | var gp = await checkIsGroup(message)
23 | if (!gp) return;
24 | var us = await checkUsAdmin(message)
25 | if (!us) return;
26 | var im = await checkImAdmin(message)
27 | if (!im) return
28 | await message.client.groupSettingChange(message.jid, GroupSettingChange.messageSend, true);
29 | var msg = await message.reply('❉Safe Mode Activating....');
30 | await textRepeterSew(message, SEWQU, 12)
31 | }));
32 |
--------------------------------------------------------------------------------
/commandes/stickersearch.js:
--------------------------------------------------------------------------------
1 | const axios = require("axios");
2 | const { Sticker, StickerTypes } = require("wa-sticker-formatter");
3 | const {Hamza} = require("../framework/Hamza");
4 |
5 | Hamza({
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: 'BYTE-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("Error searching for stickers :", error);
47 | repondre("Error searching for stickers.");
48 | }
49 | });
50 |
--------------------------------------------------------------------------------
/commandes/tts.js:
--------------------------------------------------------------------------------
1 | const googleTTS = require('google-tts-api');
2 | const {Hamza} = require("../TalkDrove/Hamza");
3 |
4 |
5 | Hamza( {
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 | Hamza( {
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 | Hamza( {
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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | ##
BYTE-MD-LITE WHATSAPP BOT
3 |
4 | ## Looking for the BYTE-MD? then Click Here
5 |
6 |
7 |
8 |
9 |
10 | ### Setup
11 |
12 | **📌DEPLOY ON HEROKU**
13 | - ***Click [`FORK`](https://github.com/HyHamza/BYTE-MD-LITE/fork) and `Star ⭐ Repository` for Courage.***
14 | - You will get a session ID in WhatsApp, copy the ID only.
15 | - **If you don't have an account on [Heroku](https://signup.heroku.com/), [create an account now](https://signup.heroku.com/).**p
16 |
17 | 🌟 Hamza's Portfolio 🌟
18 |
19 | Click Here
20 |
21 | **`BYTE-MD-LITE`**
22 |
23 | ## PAIRING CODE SCAN
24 |
25 |
26 |
27 | ## QR CODE SCAN
28 |
29 |
30 | ## DEPLOY IN HEROKU
31 |
32 | [](https://dashboard.heroku.com/new?template=https://github.com/HyHamza/BYTE-MD-LITE/)
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | ## Contributions
42 |
43 | Contributions to BYTE-MD-LITE are welcome! If you have ideas for new features, improvements, or bug fixes, feel free to open an issue or submit a pull request.
44 |
45 | ## License
46 |
47 | The BYTE-MD-LITE is released.
48 |
49 | Enjoy the diverse features of the BYTE-MD-LITE to enhance your conversations and make your WhatsApp experience more interesting!
50 |
51 | ## Developer:
52 | - [**WhatsApp**](https://wa.me/923072380380)
53 |
54 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 | "name": "byte-md",
4 | "version": "2.0.0",
5 | "description": "",
6 | "main": "media/byte.js",
7 | "scripts": {
8 | "test": "echo \"Error: no test specified\" && exit 1",
9 | "start": "node index.js",
10 | "bytemd": "pm2 start index.js --attach --max-memory-restart 490M",
11 | "c": "tsc"
12 | },
13 | "keywords": [
14 | "bot",
15 | "Baileys",
16 | "TalkDrove",
17 | "whatsapp",
18 | "whatsapp-bot",
19 | "Hamza"
20 | ],
21 | "author": "Hamza",
22 | "license": "ISC",
23 | "dependencies": {
24 | "@adiwajshing/keyed-db": "^0.2.4",
25 | "@hapi/boom": "^10.0.1",
26 | "@types/node": "^18.0.6",
27 | "@whiskeysockets/baileys": "github:HyHamza/Baileys",
28 | "@xaviabot/fb-downloader": "^1.0.14",
29 | "aptoide-scraper": "^1.0.1",
30 | "axios": "^1.4.0",
31 | "cache-manager": "latest",
32 | "canvacord": "^5.4.8",
33 | "chal": "^0.0.1-security.0",
34 | "chalk": "^5.3.0",
35 | "cheerio": "^1.0.0-rc.12",
36 | "dotenv": "^16.3.1",
37 | "ffmpeg": "^0.0.4",
38 | "file-type": "16.5.3",
39 | "fluent-ffmpeg": "^2.1.2",
40 | "form-data": "^4.0.0",
41 | "fs-extra": "^11.1.1",
42 | "g-i-s": "^2.1.7",
43 | "gist": "^0.2.0",
44 | "genius-lyrics": "^4.4.3",
45 | "google-it": "^1.6.4",
46 | "google-tts-api": "latest",
47 | "heroku-client": "^3.1.0",
48 | "human-readable": "^0.2.1",
49 | "javascript-obfuscator": "^4.1.0",
50 | "jimp": "^0.16.13",
51 | "latest": "^0.2.0",
52 | "link-preview-js": "^3.0.4",
53 | "moment-timezone": "^0.5.43",
54 | "mumaker": "^2.0.0",
55 | "node-cron": "^3.0.3",
56 | "node-fetch": "^3.2.6",
57 | "node-id3": "^0.2.6",
58 | "pg": "^8.11.2",
59 | "pino": "^8.15.0",
60 | "qrcode-terminal": "^0.12.0",
61 | "readline": "^1.3.0",
62 | "sequelize": "^6.32.1",
63 | "sqlite3": "^5.1.6",
64 | "translatte": "^3.0.1",
65 | "types": "^0.1.1",
66 | "typescript": "^5.1.6",
67 | "wa-sticker-formatter": "^4.4.4",
68 | "youtube-yts": "^2.0.0",
69 | "youtubedl-core": "^4.11.7",
70 | "yt-search": "^2.10.4",
71 | "ytdl-core": "^4.10.0"
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/commandes/alive.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require('../TalkDrove/Hamza');
2 | const {addOrUpdateDataInAlive , getDataFromAlive} = require('../byte-tables/alive')
3 | const moment = require("moment-timezone");
4 | const s = require(__dirname + "/../set");
5 |
6 | Hamza(
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('EAT');
32 |
33 | // Créer une date et une heure en EAT
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 | *Time* : ${temps}
42 |
43 | ${message}
44 |
45 |
46 | *BYTE-MD BY TALKDROVE*`
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 Error " + e);
54 | repondre("🥵🥵 Menu Error" + 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 Error" + e);
64 | repondre("🥵🥵 Menu Error" + 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("⚔ T A L K D R O V E Alive message ⚔");
77 | repondre(" *BYTE-MD is alive bro!!!*")
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/stickcmd.js:
--------------------------------------------------------------------------------
1 | const {Hamza }= require ('../TalkDrove/Hamza') ;
2 | const {addstickcmd, deleteCmd, getCmdById, inStickCmd , getAllStickCmds} = require('../byte-tables/stickcmd') ;
3 |
4 |
5 |
6 | Hamza(
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 | Hamza(
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 | Hamza(
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 | );
--------------------------------------------------------------------------------
/commandes/canvacord.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require("../TalkDrove/Hamza");
2 | const canvacord = require("canvacord");
3 | const {uploadImageToImgur} = require("../TalkDrove/imgur")
4 |
5 | // Generic function to create a canvacord order
6 | function createCanvacordCommand(commandName, canvacordFunction) {
7 | Hamza({
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 |
--------------------------------------------------------------------------------
/.github/workflows/TalkDrove.yml:
--------------------------------------------------------------------------------
1 | name: TalkDrove
2 |
3 | on:
4 | schedule:
5 | # Runs every 6 hours
6 | - cron: '0 */6 * * *'
7 | workflow_dispatch: # Allows manual triggering
8 | push:
9 | branches: [ main ]
10 | pull_request:
11 | branches: [ main ]
12 |
13 | jobs:
14 | check-stop-condition:
15 | runs-on: ubuntu-latest
16 | concurrency:
17 | group: date-time-limited-workflow
18 | cancel-in-progress: true
19 | outputs:
20 | stop_workflow: ${{ steps.check_stop_datetime.outputs.stop_workflow }}
21 |
22 | steps:
23 | - name: Checkout repository
24 | uses: actions/checkout@v3
25 |
26 | - name: Set up Node.js 20
27 | uses: actions/setup-node@v3
28 | with:
29 | node-version: '20'
30 |
31 | - name: Check stop date and time
32 | id: check_stop_datetime
33 | run: |
34 | stop_date="2024-07-08"
35 | stop_time="12:00:00" # Adjust this time to reflect 06:00 PM in Asia/Karachi timezone
36 |
37 | # Set timezone to Asia/Karachi and get current date and time
38 | current_datetime=$(TZ='Asia/Karachi' date +'%Y-%m-%d %H:%M:%S')
39 | stop_datetime="$stop_date $stop_time"
40 |
41 | echo "Current date and time: $current_datetime"
42 | echo "Stop date and time: $stop_datetime"
43 |
44 | if [[ "$current_datetime" > "$stop_datetime" ]]; then
45 | echo "Current date and time $current_datetime has reached or passed the stop date and time $stop_datetime. Exiting."
46 | echo "::set-output name=stop_workflow::true"
47 | else
48 | echo "Current date and time $current_datetime has not reached the stop date and time $stop_datetime. Continuing."
49 | fi
50 |
51 | build-and-start:
52 | runs-on: ubuntu-latest
53 | concurrency:
54 | group: date-time-limited-workflow
55 | cancel-in-progress: true
56 | needs: [check-stop-condition]
57 |
58 | steps:
59 | - name: Checkout repository
60 | uses: actions/checkout@v3
61 |
62 | - name: Set up Node.js 20
63 | uses: actions/setup-node@v3
64 | with:
65 | node-version: '20'
66 |
67 | - name: Install dependencies
68 | working-directory: ./ # Specify the directory where package.json is located
69 | run: yarn install --network-concurrency 1
70 | if: ${{ needs.check-stop-condition.outputs.stop_workflow != 'true' }}
71 |
72 | - name: Start application
73 | working-directory: ./ # Specify the directory where npm start command should execute
74 | run: npm start
75 | if: ${{ needs.check-stop-condition.outputs.stop_workflow != 'true' }}
76 |
--------------------------------------------------------------------------------
/commandes/heroku.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require('../TalkDrove/Hamza');
2 | const s = require('../set')
3 |
4 | Hamza(
5 | {
6 | nomCom : "setvar",
7 | categorie : "heroku"
8 | }, async (dest , zk , commandeOptions) =>{
9 |
10 | const {ms,repondre,superUser , arg} = commandeOptions ;
11 |
12 | if(!superUser){repondre('only Mods can use this commande');return};
13 | if(!arg[0] || !(arg.join('').split('='))) {repondre('Bad format ; Exemple of using :\nSetvar OWNER_NAME=DEXTER KING');return};
14 |
15 | const text = arg.join(" ")
16 | const Heroku = require("heroku-client");
17 |
18 | const heroku = new Heroku({
19 | token: s.HEROKU_APY_KEY,
20 | });
21 |
22 | let baseURI = "/apps/" + s.HEROKU_APP_NAME;
23 | await heroku.patch(baseURI + "/config-vars", {
24 | body: {
25 | [text.split('=')[0]]: text.split('=')[1],
26 | },
27 | });
28 | await repondre('That Heroku var is changing, Thats why the bot is rebooting....')
29 | }
30 | );
31 |
32 | Hamza(
33 | {
34 | nomCom : "allvar",
35 | categorie : "heroku"
36 | }, async (dest , zk , commandeOptions) =>{
37 |
38 | const {ms,repondre,superUser , arg} = commandeOptions ;
39 |
40 | if(!superUser){repondre('only mods can use this commande');return};
41 |
42 | const Heroku = require("heroku-client");
43 |
44 | const heroku = new Heroku({
45 | token: s.HEROKU_APY_KEY,
46 | });
47 | let baseURI = "/apps/" + s.HEROKU_APP_NAME;
48 |
49 | let h = await heroku.get(baseURI+'/config-vars')
50 | let str = '*All my HEROKU Vars*\n\n'
51 | for (vr in h) {
52 | str+= '⚡ *'+vr+'* '+'= '+h[vr]+'\n'
53 | }
54 | repondre(str)
55 |
56 |
57 | }
58 |
59 | );
60 |
61 |
62 | Hamza(
63 | {
64 | nomCom : "getvar",
65 | categorie : "heroku"
66 | }, async (dest , zk , commandeOptions) =>{
67 |
68 | const {ms,repondre,superUser , arg} = commandeOptions ;
69 |
70 | if(!superUser){repondre('Only Mods can use this command');return};
71 | if(!arg[0]) {repondre('insert the variable name in capital letter'); return} ;
72 |
73 | try {
74 | const Heroku = require("heroku-client");
75 |
76 | const heroku = new Heroku({
77 | token: s.HEROKU_API_KEY,
78 | });
79 | let baseURI = "/apps/" + s.HEROKU_APP_NAME;
80 | let h = await heroku.get(baseURI+'/config-vars')
81 | for (vr in h) {
82 | if( arg.join(' ') ===vr ) return repondre( vr+'= '+h[vr]) ;
83 | }
84 |
85 | } catch(e) {repondre('Error' + e)}
86 |
87 | });
88 |
--------------------------------------------------------------------------------
/byte-tables/alive.js:
--------------------------------------------------------------------------------
1 | // Import dotenv and load environment variables from .env file
2 | require("dotenv").config();
3 |
4 | const { Pool } = require("pg");
5 |
6 | // Use the 'set' module to get the value of DATABASE_URL from your configurations
7 | const s = require("../set");
8 |
9 | // Retrieve the database URL from the s.DATABASE_URL variable
10 | var dbUrl = s.DATABASE_URL ? s.DATABASE_URL : "postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9";
11 |
12 | const proConfig = {
13 | connectionString: dbUrl,
14 | ssl: {
15 | rejectUnauthorized: false,
16 | },
17 | };
18 |
19 | // Create a PostgreSQL connection pool
20 | const pool = new Pool(proConfig);
21 |
22 | // Function to create the "alive" table with an "id" column
23 | const createAliveTable = async () => {
24 | try {
25 | await pool.query(`
26 | CREATE TABLE IF NOT EXISTS alive (
27 | id serial PRIMARY KEY,
28 | message text,
29 | link text
30 | );
31 | `);
32 | console.log("The 'alive' table was created successfully.");
33 | } catch (e) {
34 | console.error("An error occurred while creating the 'alive' table:", e);
35 | }
36 | };
37 |
38 | // Call the method to create the "alive" table
39 | createAliveTable();
40 |
41 | // Function to add or update a record in the "alive" table
42 | async function addOrUpdateDataInAlive(message, link) {
43 | const client = await pool.connect();
44 | try {
45 | // Insert or update data in the "alive" table
46 | const query = `
47 | INSERT INTO alive (id, message, link)
48 | VALUES (1, $1, $2)
49 | ON CONFLICT (id)
50 | DO UPDATE SET message = excluded.message, link = excluded.link;
51 | `;
52 | const values = [message, link];
53 |
54 | await client.query(query, values);
55 | console.log("Data added or updated in the 'alive' table successfully.");
56 | } catch (error) {
57 | console.error("Error adding or updating data in the 'alive' table:", error);
58 | } finally {
59 | client.release();
60 | }
61 | };
62 |
63 | // Function to retrieve data from the "alive" table
64 | async function getDataFromAlive() {
65 | const client = await pool.connect();
66 | try {
67 | // Execute SELECT query to retrieve data
68 | const query = "SELECT message, link FROM alive WHERE id = 1";
69 | const result = await client.query(query);
70 |
71 | if (result.rows.length > 0) {
72 | const { message, link } = result.rows[0];
73 | return { message, link };
74 | } else {
75 | console.log("No data found in the 'alive' table.");
76 | return null;
77 | }
78 | } catch (error) {
79 | console.error("Error retrieving data from the 'alive' table:", error);
80 | return null;
81 | } finally {
82 | client.release();
83 | }
84 | };
85 |
86 | module.exports = {
87 | addOrUpdateDataInAlive,
88 | getDataFromAlive,
89 | };
90 |
--------------------------------------------------------------------------------
/commandes/menu.js:
--------------------------------------------------------------------------------
1 |
2 | const util = require('util');
3 | const fs = require('fs-extra');
4 | const { Hamza } = require(__dirname + "/../TalkDrove/Hamza");
5 | const { format } = require(__dirname + "/../TalkDrove/mesfonctions");
6 | const os = require("os");
7 | const moment = require("moment-timezone");
8 | const s = require(__dirname + "/../set");
9 |
10 | Hamza({ nomCom: "menu", categorie: "General" }, async (dest, zk, commandeOptions) => {
11 | let { ms, repondre ,prefixe,nomAuteurMessage,mybotpic} = commandeOptions;
12 | let { cm } = require(__dirname + "/../TalkDrove//Hamza");
13 | var coms = {};
14 | var mode = "public";
15 |
16 | if ((s.MODE).toLocaleLowerCase() != "yes") {
17 | mode = "private";
18 | }
19 |
20 |
21 |
22 | cm.map(async (com, index) => {
23 | if (!coms[com.categorie])
24 | coms[com.categorie] = [];
25 | coms[com.categorie].push(com.nomCom);
26 | });
27 |
28 | moment.tz.setDefault('Asia/Karachi');
29 |
30 | // Create a date and time in EAT
31 | const temps = moment().format('HH:mm:ss');
32 | const date = moment().format('DD/MM/YYYY');
33 | let infoMsg = `
34 | ╭────〖MILTON-MD-V3〗────╮
35 | │﹄ *Préfix* : ${s.PREFIXE}
36 | │﹄ *User* : ${s.OWNER_NAME}
37 | │﹄ *Mode* : ${mode}
38 | │﹄ *Commands* : ${cm.length}
39 | │﹄ *Date* : ${date}
40 | │﹄ *Time* : ${temps}
41 | │﹄ *Ram* : ${format(os.totalmem() - os.freemem())}/${format(os.totalmem())}
42 | │﹄ *Platform* : ${os.platform()}
43 | │﹄ *Developer* : MILTON
44 | │﹄ *Version* : v.v3
45 | ╰─────{*MILTON*}─────o: \n\n`;
46 |
47 | let menuMsg=`
48 |
49 | *Milton-MD Commands :*
50 | ◇ ◇
51 | `;
52 |
53 | for (const cat in coms) {
54 | menuMsg += `*-‿‿o* *${cat}* *o‿‿*`;
55 | for (const cmd of coms[cat]) {
56 | menuMsg += `
57 | *|*${s.PREFIXE} ${cmd}`;
58 | }
59 | menuMsg += `
60 | *╰═════Milton Robot════════⊷* \n`
61 | }
62 |
63 | menuMsg += `
64 |
65 | *———————————————————— Channel link: ———————————————————————————*
66 |
67 | _https://whatsapp.com/channel/0029VaNRcHSJP2199iMQ4W0l_
68 | *-‿-︵-‿-︵-‿-︵-‿--‿-︵-‿-︵-‿-︵-‿--‿-︵-‿-︵-‿-︵-‿-*
69 | `;
70 |
71 | var lien = mybotpic();
72 |
73 | if (lien.match(/\.(mp4|gif)$/i)) {
74 | try {
75 | zk.sendMessage(dest, { video: { url: lien }, caption:infoMsg + menuMsg, footer: "*Powered by TalkDrove*" , gifPlayback : true }, { quoted: ms });
76 | }
77 | catch (e) {
78 | console.log("Awhhhhh Menu Error " + e);
79 | repondre("Awhhhhh Menu Error " + e);
80 | }
81 | }
82 | // Vérification pour .jpeg ou .png
83 | else if (lien.match(/\.(jpeg|png|jpg)$/i)) {
84 | try {
85 | zk.sendMessage(dest, { image: { url: lien }, caption:infoMsg + menuMsg, footer: "*BYTE-MD*" }, { quoted: ms });
86 | }
87 | catch (e) {
88 | console.log("Awhhhhh Menu Error " + e);
89 | repondre("Awhhhhh Menu Error " + e);
90 | }
91 | }
92 | else {
93 |
94 | repondre(infoMsg + menuMsg);
95 |
96 | }
97 |
98 | });
99 |
--------------------------------------------------------------------------------
/byte-tables/banUser.js:
--------------------------------------------------------------------------------
1 | // Import dotenv and load environment variables from the .env file
2 | require("dotenv").config();
3 |
4 | const { Pool } = require("pg");
5 |
6 | // Use the 'set' module to get the value of DATABASE_URL from your configurations
7 | const s = require("../set");
8 |
9 | // Retrieve the database URL from the s.DATABASE_URL variable
10 | var dbUrl = s.DATABASE_URL ? s.DATABASE_URL : "postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9";
11 |
12 | const proConfig = {
13 | connectionString: dbUrl,
14 | ssl: {
15 | rejectUnauthorized: false,
16 | },
17 | };
18 |
19 | // Create a PostgreSQL connection pool
20 | const pool = new Pool(proConfig);
21 |
22 | // You can now use 'pool' to interact with your PostgreSQL database.
23 |
24 | // Function to create the "banUser" table with a "jid" column
25 | const createBanUserTable = async () => {
26 | try {
27 | await pool.query(`
28 | CREATE TABLE IF NOT EXISTS banUser (
29 | jid text PRIMARY KEY
30 | );
31 | `);
32 | console.log("The 'banUser' table was created successfully.");
33 | } catch (e) {
34 | console.error("An error occurred while creating the 'banUser' table:", e);
35 | }
36 | };
37 |
38 | // Call the method to create the "banUser" table
39 | createBanUserTable();
40 |
41 | // Function to add a user to the ban list
42 | async function addUserToBanList(jid) {
43 | const client = await pool.connect();
44 | try {
45 | // Insert the user into the "banUser" table
46 | const query = "INSERT INTO banUser (jid) VALUES ($1)";
47 | const values = [jid];
48 |
49 | await client.query(query, values);
50 | console.log(`JID ${jid} added to the ban list.`);
51 | } catch (error) {
52 | console.error("Error adding banned user:", error);
53 | } finally {
54 | client.release();
55 | }
56 | }
57 |
58 | // Function to check if a user is banned
59 | async function isUserBanned(jid) {
60 | const client = await pool.connect();
61 | try {
62 | // Check if the user exists in the "banUser" table
63 | const query = "SELECT EXISTS (SELECT 1 FROM banUser WHERE jid = $1)";
64 | const values = [jid];
65 |
66 | const result = await client.query(query, values);
67 | return result.rows[0].exists;
68 | } catch (error) {
69 | console.error("Error checking banned user:", error);
70 | return false;
71 | } finally {
72 | client.release();
73 | }
74 | }
75 |
76 | // Function to remove a user from the ban list
77 | async function removeUserFromBanList(jid) {
78 | const client = await pool.connect();
79 | try {
80 | // Remove the user from the "banUser" table
81 | const query = "DELETE FROM banUser WHERE jid = $1";
82 | const values = [jid];
83 |
84 | await client.query(query, values);
85 | console.log(`JID ${jid} removed from the ban list.`);
86 | } catch (error) {
87 | console.error("Error removing banned user:", error);
88 | } finally {
89 | client.release();
90 | }
91 | }
92 |
93 | module.exports = {
94 | addUserToBanList,
95 | isUserBanned,
96 | removeUserFromBanList,
97 | };
98 |
--------------------------------------------------------------------------------
/byte-tables/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 | async function createTableCron() {
16 | const client = await pool.connect();
17 | try {
18 | // Execute an SQL query to create the "cron" table if it doesn't already exist
19 | await client.query(`
20 | CREATE TABLE IF NOT EXISTS cron (
21 | group_id text PRIMARY KEY,
22 | mute_at text DEFAULT NULL,
23 | unmute_at text DEFAULT NULL
24 | );
25 | `);
26 | console.log("The 'cron' table was created successfully.");
27 | } catch (error) {
28 | console.error("An error occurred while creating the 'cron' table:", error);
29 | } finally {
30 | client.release();
31 | }
32 | }
33 |
34 | createTableCron();
35 |
36 | async function getCron() {
37 | const client = await pool.connect();
38 | try {
39 | const result = await client.query('SELECT * FROM cron');
40 | return result.rows;
41 | } catch (error) {
42 | console.error('Error retrieving data from the "cron" table:', error);
43 | } finally {
44 | client.release();
45 | }
46 | }
47 |
48 | async function addCron(group_id, rows, value) {
49 | const client = await pool.connect();
50 |
51 | try {
52 | let response = await client.query(`
53 | SELECT * FROM cron WHERE group_id = $1`, [group_id]);
54 |
55 | let exists = response.rows.length > 0;
56 | if (exists) {
57 | await client.query(`
58 | UPDATE cron SET ${rows} = $1 WHERE group_id = $2 `, [value, group_id]);
59 | } else {
60 | const query = `
61 | INSERT INTO cron (group_id, ${rows})
62 | VALUES ($1, $2)`;
63 |
64 | await client.query(query, [group_id, value]);
65 | }
66 | } catch (error) {
67 | console.error('Error adding data to the "cron" table:', error);
68 | } finally {
69 | client.release();
70 | }
71 | }
72 |
73 | async function getCronById(group_id) {
74 | const client = await pool.connect();
75 | try {
76 | const result = await client.query('SELECT * FROM cron WHERE group_id = $1', [group_id]);
77 | return result.rows[0];
78 | } catch (error) {
79 | console.error('Error retrieving data from the "cron" table:', error);
80 | } finally {
81 | client.release();
82 | }
83 | }
84 |
85 | async function delCron(group_id) {
86 | const client = await pool.connect();
87 | try {
88 | await client.query('DELETE FROM cron WHERE group_id = $1', [group_id]);
89 | } catch (error) {
90 | console.error('Error deleting data from the "cron" table:', error);
91 | } finally {
92 | client.release();
93 | }
94 | }
95 |
96 | module.exports = {
97 | getCron,
98 | addCron,
99 | delCron,
100 | getCronById,
101 | };
102 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name":"BYTE-MD-LITE",
3 | "description":"A lite version of BYTE-MD for TalkDrove Followers",
4 | "keywords":["bot","node","baileys","whatsapp"],
5 | "logo":"https://raw.githubusercontent.com/HyHamza/HyHamza/main/Images/BYTE-MD-LITE.jpeg",
6 | "repository":"https://github.com/HyHamza/BYTE-MD-LITE/",
7 | "succes_url":"/",
8 | "stack":"container",
9 | "env":{
10 | "PREFIX": {
11 | "description":"Choose your prefix of bot",
12 | "value":".",
13 | "required":true
14 | },
15 | "AUTO_READ_STATUS": {
16 | "description":"Your contact status will be read automatically(type yes to active or no to deactive; don't write in capital letter)",
17 | "value":"yes",
18 | "required":false
19 | },
20 | "AUTO_DOWNLOAD_STATUS": {
21 | "description":"Your contact status will be download automatically and send to you(type yes to active or no to deactive; don't write in capital letter)",
22 | "value":"no",
23 | "required":false
24 | },
25 | "BOT_NAME": {
26 | "description":"Put A name for your bot or leave default name.",
27 | "value":"BYTE-MD",
28 | "required":false
29 | },
30 | "PUBLIC_MODE": {
31 | "description":"type yes to put your bot on public mode or no to put it on private mode. In private mode, Only you'll be able to use the bot but in public mode anyone can use Byte-md",
32 | "value":"yes",
33 | "required":false
34 | },
35 | "HEROKU_API_KEY": {
36 | "description":"insert your heroku api-key (this is optionnal) But if you want to change the variables from Whatsapp then put the api key (https://dashboard.heroku.com/account) scroll down and you'll see a API key",
37 | "required":false
38 | },
39 | "HEROKU_APP_NAME": {
40 | "description":"insert your heroku APP NAME (this is optionnal) But if you want to change the variables from Whatsapp then put the app name",
41 | "required":false
42 | },
43 | "SESSION_ID": {
44 | "description":"Put your session ID, make sure it starts with Byte;;;",
45 | "value":"",
46 | "required":true
47 | },
48 | "OWNER_NAME": {
49 | "description":"Put owner name of the BOT or ignore Because this is Optional",
50 | "required":false,
51 | "value":"TalkDrove"
52 | },
53 | "OWNER_NUMBER": {
54 | "description":"Put owner number of the BOT, OWNER Can control the BOT even in Private Mode",
55 | "required":false,
56 | "value":"923072380380"
57 | },
58 | "WARN_COUNT": {
59 | "description":"this is the limit of warn for warning command, it means that if anyone cross its limit they'll be kicked out or bot will be perform action according to the specified conditions",
60 | "required":false,
61 | "value":"3"
62 | },
63 | "STARTING_BOT_MESSAGE": {
64 | "description":"if you don't want starting-bot-message put no else put yes",
65 | "required":true,
66 | "value":"yes"
67 | }
68 | },
69 | "formation": {
70 | "worker": {
71 | "quantity": 1,
72 | "size": "basic"
73 | }
74 | },
75 | "addons": [
76 | {
77 | "plan":"heroku-postgresql"
78 | }
79 | ]
80 | }
81 |
--------------------------------------------------------------------------------
/byte-tables/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 |
--------------------------------------------------------------------------------
/byte-tables/welcome.js:
--------------------------------------------------------------------------------
1 | // Import dotenv and load environment variables from the .env file
2 | require("dotenv").config();
3 |
4 | const { Pool } = require("pg");
5 |
6 | // Use the 'set' module to get the value of DATABASE_URL from your configurations
7 | const s = require("../set");
8 |
9 | // Retrieve the database URL from the s.DATABASE_URL variable
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 | // Create a PostgreSQL connection pool
19 | const pool = new Pool(proConfig);
20 |
21 | // Function to create the "events" table if it doesn't exist
22 | const createEventsTable = 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("The 'events' table was created successfully.");
35 | } catch (e) {
36 | console.error("Error creating the 'events' table:", e);
37 | }
38 | };
39 |
40 | // Call the function to create the "events" table
41 | createEventsTable();
42 |
43 | // Function to add or update a value for a specific row (column) in the "events" table
44 | async function setValue(jid, row, value) {
45 | const client = await pool.connect();
46 |
47 | try {
48 | // Check if the jid exists in the table
49 | const result = await client.query('SELECT * FROM events WHERE jid = $1', [jid]);
50 |
51 | // Check the length of rows to determine if the jid exists
52 | const jidExists = result.rows.length > 0;
53 |
54 | if (jidExists) {
55 | // If the jid exists, update the value of the specified column (row)
56 | await client.query(`UPDATE events SET ${row} = $1 WHERE jid = $2`, [value, jid]);
57 | console.log(`Column ${row} updated to ${value} for jid ${jid}`);
58 | } else {
59 | // If the jid doesn't exist, insert a new row with the specified jid and value
60 | await client.query(`INSERT INTO events (jid, ${row}) VALUES ($1, $2)`, [jid, value]);
61 | console.log(`New jid ${jid} added with column ${row} set to ${value}`);
62 | }
63 | } catch (error) {
64 | console.error("Error updating events:", error);
65 | } finally {
66 | client.release();
67 | }
68 | }
69 |
70 | // Function to retrieve the value of a specific row (column) for a given jid from the "events" table
71 | async function getEventsValue(jid, row) {
72 | const client = await pool.connect();
73 | try {
74 | const result = await client.query(`SELECT ${row} FROM events WHERE jid = $1`, [jid]);
75 | const jidExists = result.rows.length > 0;
76 |
77 | if (jidExists) {
78 | return result.rows[0][row];
79 | } else {
80 | return 'non';
81 | }
82 | } catch (error) {
83 | console.error("Error retrieving events value:", error);
84 | return 'non';
85 | } finally {
86 | client.release();
87 | }
88 | }
89 |
90 | module.exports = {
91 | setValue,
92 | getEventsValue,
93 | };
94 |
--------------------------------------------------------------------------------
/byte-tables/onlyAdmin.js:
--------------------------------------------------------------------------------
1 | // Import dotenv and load environment variables from the .env file
2 | require("dotenv").config();
3 |
4 | const { Pool } = require("pg");
5 |
6 | // Use the 'set' module to get the value of DATABASE_URL from your configurations
7 | const s = require("../set");
8 |
9 | // Retrieve the database URL from the s.DATABASE_URL variable
10 | const 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 | // Create a pool of PostgreSQL connections
19 | const pool = new Pool(proConfig);
20 |
21 | // Function to create the "onlyAdmin" table with a primary key on 'groupeJid'
22 | const createOnlyAdminTable = async () => {
23 | try {
24 | await pool.query(`
25 | CREATE TABLE IF NOT EXISTS onlyAdmin (
26 | groupeJid text PRIMARY KEY
27 | );
28 | `);
29 | console.log("The 'onlyAdmin' table was created successfully.");
30 | } catch (e) {
31 | console.error("An error occurred while creating the 'onlyAdmin' table:", e);
32 | }
33 | };
34 |
35 | // Call the function to create the "onlyAdmin" table
36 | createOnlyAdminTable();
37 |
38 | // Function to add a group to the list of groups only allowed for admins
39 | async function addGroupToOnlyAdminList(groupeJid) {
40 | const client = await pool.connect();
41 | try {
42 | // Insert the group into the "onlyAdmin" table
43 | const query = "INSERT INTO onlyAdmin (groupeJid) VALUES ($1)";
44 | const values = [groupeJid];
45 |
46 | await client.query(query, values);
47 | console.log(`Group JID ${groupeJid} added to the onlyAdmin groups list.`);
48 | } catch (error) {
49 | console.error("Error adding group to onlyAdmin list:", error);
50 | } finally {
51 | client.release();
52 | }
53 | }
54 |
55 | // Function to check if a group is in the onlyAdmin list
56 | async function isGroupOnlyAdmin(groupeJid) {
57 | const client = await pool.connect();
58 | try {
59 | // Check if the group exists in the "onlyAdmin" table
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("Error checking group in onlyAdmin list:", error);
67 | return false;
68 | } finally {
69 | client.release();
70 | }
71 | }
72 |
73 | // Function to remove a group from the onlyAdmin list
74 | async function removeGroupFromOnlyAdminList(groupeJid) {
75 | const client = await pool.connect();
76 | try {
77 | // Remove the group from the "onlyAdmin" table
78 | const query = "DELETE FROM onlyAdmin WHERE groupeJid = $1";
79 | const values = [groupeJid];
80 |
81 | await client.query(query, values);
82 | console.log(`Group JID ${groupeJid} removed from the onlyAdmin groups list.`);
83 | } catch (error) {
84 | console.error("Error removing group from onlyAdmin list:", error);
85 | } finally {
86 | client.release();
87 | }
88 | }
89 |
90 | module.exports = {
91 | addGroupToOnlyAdminList,
92 | isGroupOnlyAdmin,
93 | removeGroupFromOnlyAdminList,
94 | };
95 |
--------------------------------------------------------------------------------
/commandes/AI.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require('../TalkDrove/Hamza');
2 | const traduire = require("../TalkDrove/traduction");
3 | const { default: axios } = require('axios');
4 | //const conf = require('../set');
5 |
6 |
7 |
8 |
9 | Hamza({ nomCom: "bot", reaction: "👻", categorie: "AI" }, async (dest, zk, commandeOptions) => {
10 |
11 | const { repondre, ms, arg } = commandeOptions;
12 |
13 | if (!arg || !arg[0]) { return repondre("Hii, How are you?") }
14 | //var quest = arg.join(' ');
15 | try {
16 |
17 |
18 | const message = await traduire(arg.join(' '), { to: 'en' });
19 | console.log(message)
20 | fetch(`http://api.brainshop.ai/get?bid=177607&key=NwzhALqeO1kubFVD&uid=[uid]&msg=${message}`)
21 | .then(response => response.json())
22 | .then(data => {
23 | const botResponse = data.cnt;
24 | console.log(botResponse);
25 |
26 | traduire(botResponse, { to: 'en' })
27 | .then(translatedResponse => {
28 | repondre(translatedResponse);
29 | })
30 | .catch(error => {
31 | console.error('Error when translating into French :', error);
32 | repondre('Error when translating into French');
33 | });
34 | })
35 | .catch(error => {
36 | console.error('Error requesting BrainShop :', error);
37 | repondre('Error requesting BrainShop');
38 | });
39 |
40 | } catch (e) { repondre("oops an error : " + e) }
41 |
42 |
43 | });
44 |
45 |
46 |
47 | Hamza({ nomCom: "dalle", reaction: "🤡", categorie: "AI" }, async (dest, zk, commandeOptions) => {
48 | const { repondre, arg, ms } = commandeOptions;
49 |
50 | try {
51 | if (!arg || arg.length === 0) {
52 | return repondre(`Please enter the necessary information to generate the image.`);
53 | }
54 |
55 | // Regrouper les arguments en une seule chaîne séparée par "-"
56 | const image = arg.join(' ');
57 | const response = await axios.get(`https://vihangayt.me/tools/photoleap?q=${image}`);
58 |
59 | const data = response.data;
60 | let caption = '*powered by TALKDROVE*';
61 |
62 | if (data.status && data.owner && data.data) {
63 | // Utiliser les données retournées par le service
64 | const imageUrl = data.data;
65 | zk.sendMessage(dest, { image: { url: imageUrl }, caption: caption }, { quoted: ms });
66 | } else {
67 | repondre("Error during image generation.");
68 | }
69 | } catch (error) {
70 | console.error('Erreur:', error.message || 'Une erreur s\'est produite');
71 | repondre("Oops, an error occurred while processing your request");
72 | }
73 | });
74 |
75 | Hamza({ nomCom: "gpt", reaction: "🎃", categorie: "AI" }, async (dest, zk, commandeOptions) => {
76 | const { repondre, arg, ms } = commandeOptions;
77 |
78 | try {
79 | if (!arg || arg.length === 0) {
80 | return repondre(`Please ask a question.`);
81 | }
82 |
83 | // Regrouper les arguments en une seule chaîne séparée par "-"
84 | const question = arg.join(' ');
85 | const response = `https://ultimetron.guruapi.tech/gpt3?prompt=${question}`;
86 |
87 | const data = response.data;
88 | if (data) {
89 | repondre(data.data);
90 | } else {
91 | repondre("Error during response generation.");
92 | }
93 | } catch (error) {
94 | console.error('Erreur:', error.message || 'Une erreur s\'est produite');
95 | repondre("Oops, an error occurred while processing your request.");
96 | }
97 | });
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/byte-tables/warn.js:
--------------------------------------------------------------------------------
1 | // Import dotenv and load environment variables from the .env file
2 | require("dotenv").config();
3 |
4 | const { Pool } = require("pg");
5 |
6 | // Use the 'set' module to get the value of DATABASE_URL from your configurations
7 | const s = require("../set");
8 |
9 | // Retrieve the database URL from the s.DATABASE_URL variable
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 | // Create a PostgreSQL connection pool
19 | const pool = new Pool(proConfig);
20 |
21 | // Function to create the "warn_users" table if it doesn't exist
22 | async function createWarnUsersTable() {
23 | const client = await pool.connect();
24 | try {
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("The 'warn_users' table was created successfully.");
33 | } catch (error) {
34 | console.error("Error creating the 'warn_users' table:", error);
35 | } finally {
36 | client.release();
37 | }
38 | }
39 |
40 | // Call the function to create the "warn_users" table
41 | createWarnUsersTable();
42 |
43 | // Function to add or update a user with a warn_count
44 | async function addUserWithWarnCount(jid) {
45 | const client = await pool.connect();
46 | try {
47 | const query = `
48 | INSERT INTO warn_users (jid, warn_count)
49 | VALUES ($1, 1)
50 | ON CONFLICT (jid)
51 | DO UPDATE SET warn_count = warn_users.warn_count + 1;
52 | `;
53 | const values = [jid];
54 |
55 | await client.query(query, values);
56 | console.log(`User ${jid} added or updated with a warn_count of 1.`);
57 | } catch (error) {
58 | console.error("Error adding or updating the user:", error);
59 | } finally {
60 | client.release();
61 | }
62 | }
63 |
64 | // Function to get the warn_count by JID (user ID)
65 | async function getWarnCountByJID(jid) {
66 | const client = await pool.connect();
67 | try {
68 | const query = "SELECT warn_count FROM warn_users WHERE jid = $1";
69 | const values = [jid];
70 |
71 | const result = await client.query(query, values);
72 | if (result.rows.length > 0) {
73 | const warnCount = result.rows[0].warn_count;
74 | return warnCount;
75 | } else {
76 | // If user is not found, return 0 or another default value
77 | return 0;
78 | }
79 | } catch (error) {
80 | console.error("Error retrieving warn_count:", error);
81 | return -1; // Return an error value or another default value in case of error
82 | } finally {
83 | client.release();
84 | }
85 | }
86 |
87 | // Function to reset the warn_count to 0 for a specific JID (user ID)
88 | async function resetWarnCountByJID(jid) {
89 | const client = await pool.connect();
90 | try {
91 | const query = "UPDATE warn_users SET warn_count = 0 WHERE jid = $1";
92 | const values = [jid];
93 |
94 | await client.query(query, values);
95 | console.log(`The warn_count for user ${jid} has been reset to 0.`);
96 | } catch (error) {
97 | console.error("Error resetting warn_count:", error);
98 | } finally {
99 | client.release();
100 | }
101 | }
102 |
103 | module.exports = {
104 | addUserWithWarnCount,
105 | getWarnCountByJID,
106 | resetWarnCountByJID,
107 | };
108 |
--------------------------------------------------------------------------------
/byte-tables/mention.js:
--------------------------------------------------------------------------------
1 | // Import dotenv and load environment variables from the .env file
2 | require("dotenv").config();
3 |
4 | const { Pool } = require("pg");
5 |
6 | // Use the 'set' module to get the value of DATABASE_URL from your configurations
7 | const s = require("../set");
8 |
9 | // Retrieve the database URL from the s.DATABASE_URL variable
10 | const 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 | // Create a pool of PostgreSQL connections
19 | const pool = new Pool(proConfig);
20 |
21 | // Function to create the "mention" table with columns "id", "status", "url", "type", "message"
22 | async function createMentionTable() {
23 | const client = await pool.connect();
24 | try {
25 | await client.query(`
26 | CREATE TABLE IF NOT EXISTS mention (
27 | id serial PRIMARY KEY,
28 | status text DEFAULT 'non',
29 | url text,
30 | type text,
31 | message text
32 | );
33 | `);
34 | console.log("The 'mention' table was created successfully.");
35 | } catch (e) {
36 | console.error("An error occurred while creating the 'mention' table:", e);
37 | } finally {
38 | client.release();
39 | }
40 | }
41 |
42 | // Call the function to create the "mention" table during initialization
43 | createMentionTable();
44 |
45 | // Function to add or update data in the "mention" table
46 | async function addOrUpdateDataInMention(url, type, message) {
47 | const client = await pool.connect();
48 | try {
49 | const query = `
50 | INSERT INTO mention (id, url, type, message)
51 | VALUES (1, $1, $2, $3)
52 | ON CONFLICT (id)
53 | DO UPDATE SET url = excluded.url, type = excluded.type, message = excluded.message;
54 | `;
55 | const values = [url, type, message];
56 |
57 | await client.query(query, values);
58 | console.log("Data added or updated in the 'mention' table successfully.");
59 | } catch (error) {
60 | console.error("Error adding or updating data in the 'mention' table:", error);
61 | } finally {
62 | client.release();
63 | }
64 | }
65 |
66 | // Function to modify the status for ID 1 in the "mention" table
67 | async function modifyStatusId1(newStatus) {
68 | const client = await pool.connect();
69 | try {
70 | const query = `
71 | UPDATE mention
72 | SET status = $1
73 | WHERE id = 1;
74 | `;
75 | const values = [newStatus];
76 |
77 | await client.query(query, values);
78 | console.log("Status modified successfully for ID 1 in the 'mention' table.");
79 | } catch (error) {
80 | console.error("Error modifying status for ID 1 in the 'mention' table:", error);
81 | } finally {
82 | client.release();
83 | }
84 | }
85 |
86 | // Function to retrieve all values from the "mention" table
87 | async function getAllValues() {
88 | const client = await pool.connect();
89 | try {
90 | const query = `
91 | SELECT * FROM mention;
92 | `;
93 |
94 | const result = await client.query(query);
95 | console.log("Here are all the values from the 'mention' table:", result.rows);
96 | return result.rows;
97 | } catch (error) {
98 | console.error("Error retrieving values from the 'mention' table:", error);
99 | } finally {
100 | client.release();
101 | }
102 | }
103 |
104 | module.exports = {
105 | addOrUpdateDataInMention,
106 | getAllValues,
107 | modifyStatusId1,
108 | };
109 |
--------------------------------------------------------------------------------
/commandes/yt-search.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require("../TalkDrove/Hamza");
2 | const { getytlink, ytdwn } = require("../TalkDrove/ytdl-core");
3 | const yts = require("yt-search");
4 | const ytdl = require('ytdl-core');
5 | const fs = require('fs');
6 |
7 | Hamza({ 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("Please specify what you want to search for.");
13 | return;
14 | }
15 |
16 | try {
17 | const info = await yts(query);
18 | const results = info.videos;
19 |
20 | let captions = "";
21 | for (let i = 0; i < 10; i++) {
22 | captions += `----------------\nTitle: ${results[i].title}\nTime : ${results[i].timestamp}\nUrl: ${results[i].url}\n`;
23 | }
24 | captions += "\n======\n*Powered by BYTE-MD*";
25 |
26 | zk.sendMessage(dest, { image: { url: results[0].thumbnail }, caption: captions }, { quoted: ms });
27 | } catch (error) {
28 | repondre("Error during the process: " + error);
29 | }
30 | });
31 |
32 | Hamza({
33 | nomCom: "ytmp4",
34 | categorie: "Download",
35 | reaction: "🎥"
36 | }, async (origineMessage, zk, commandeOptions) => {
37 | const { arg, ms, repondre } = commandeOptions;
38 |
39 | if (!arg[0]) {
40 | repondre("Please insert a YouTube link.");
41 | return;
42 | }
43 |
44 | const url = arg.join(" ");
45 | try {
46 | const videoInfo = await ytdl.getInfo(url);
47 | const format = ytdl.chooseFormat(videoInfo.formats, { quality: '18' });
48 | const videoStream = ytdl.downloadFromInfo(videoInfo, { format });
49 | const filename = 'video.mp4';
50 |
51 | const fileStream = fs.createWriteStream(filename);
52 | videoStream.pipe(fileStream);
53 |
54 | fileStream.on('finish', () => {
55 | zk.sendMessage(origineMessage, { video: { url: `./${filename}` }, caption: "Powered by *BYTE-MD*", gifPlayback: false }, { quoted: ms });
56 | });
57 |
58 | fileStream.on('error', (error) => {
59 | console.error('Error writing video file:', error);
60 | repondre('An error occurred while writing the video file.');
61 | });
62 |
63 | } catch (error) {
64 | console.error('Error searching or downloading video:', error);
65 | repondre('An error occurred during the search or download of the video.' + error);
66 | }
67 | });
68 |
69 | Hamza({
70 | nomCom: "ytmp3",
71 | categorie: "Download",
72 | reaction: "💿"
73 | }, async (origineMessage, zk, commandeOptions) => {
74 | const { ms, repondre, arg } = commandeOptions;
75 |
76 | if (!arg[0]) {
77 | repondre("Please insert a YouTube link.");
78 | return;
79 | }
80 |
81 | try {
82 | const url = arg.join(" ");
83 | const audioStream = ytdl(url, { filter: 'audioonly', quality: 'highestaudio' });
84 | const filename = 'audio.mp3';
85 |
86 | const fileStream = fs.createWriteStream(filename);
87 | audioStream.pipe(fileStream);
88 |
89 | fileStream.on('finish', () => {
90 | zk.sendMessage(origineMessage, { audio: { url: `./${filename}` }, mimetype: 'audio/mp4' }, { quoted: ms, ptt: false });
91 | console.log("Audio file sent successfully!");
92 | });
93 |
94 | fileStream.on('error', (error) => {
95 | console.error('Error writing audio file:', error);
96 | repondre('An error occurred while writing the audio file.');
97 | });
98 |
99 | } catch (error) {
100 | console.error('Error searching or downloading video:', error);
101 | repondre('An error occurred during the search or download of the video.');
102 | }
103 | });
104 |
--------------------------------------------------------------------------------
/commandes/General.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require("../TalkDrovek/Hamza");
2 | const {getAllSudoNumbers,isSudoTableNotEmpty} = require("../byte-tables/sudo")
3 | const conf = require("../set");
4 |
5 | Hamza({ 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 | Hamza({ nomCom: "dev", categorie: "General", reaction: "💞" }, async (dest, zk, commandeOptions) => {
55 | const { ms, mybotpic } = commandeOptions;
56 |
57 | const devs = [
58 | { nom: "Dev Number ", numero: "923072380380" },
59 | { nom: "Dev yt", numero: "https://youtube.com/@TalkDrove" },
60 | { nom: "Whatsapp Channel", numero: "https://whatsapp.com/channel/0029VaNRcHSJP2199iMQ4W0l" },
61 | // Ajoute d'autres développeurs ici avec leur nom et numéro
62 | ];
63 |
64 | let message = "👋 Welcome to *BYTE-MD-LITE* here is the developer contact number 👇\n\n";
65 | for (const dev of devs) {
66 | message += `----------------\n• ${dev.nom} : https://wa.me/${dev.numero}\n`;
67 | }
68 | var lien = mybotpic()
69 | if (lien.match(/\.(mp4|gif)$/i)) {
70 | try {
71 | zk.sendMessage(dest, { video: { url: lien }, caption:message }, { quoted: ms });
72 | }
73 | catch (e) {
74 | console.log("🥵🥵 Menu erreur " + e);
75 | repondre("🥵🥵 Menu erreur " + e);
76 | }
77 | }
78 | // Vérification pour .jpeg ou .png
79 | else if (lien.match(/\.(jpeg|png|jpg)$/i)) {
80 | try {
81 | zk.sendMessage(dest, { image: { url: lien }, caption:message }, { quoted: ms });
82 | }
83 | catch (e) {
84 | console.log("🥵🥵 Menu erreur " + e);
85 | repondre("🥵🥵 Menu erreur " + e);
86 | }
87 | }
88 | else {
89 | repondre(lien)
90 | repondre("link error");
91 |
92 | }
93 | });
94 |
95 | Hamza({ nomCom: "help", categorie: "General" }, async (dest, zk, commandeOptions) => {
96 | const { ms, repondre, auteurMessage, } = commandeOptions;
97 |
98 | repondre("Come on, bruh here's Hamza's contact number:")
99 | await zk.sendMessage(auteurMessage,{text : `https://wa.me/923072380380`},{quoted :ms})
100 |
101 | })
--------------------------------------------------------------------------------
/TalkDrove/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 Hamza",
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 |
--------------------------------------------------------------------------------
/byte-tables/level.js:
--------------------------------------------------------------------------------
1 | // Import dotenv and load environment variables from the .env file
2 | require("dotenv").config();
3 |
4 | const { Pool } = require("pg");
5 |
6 | // Use the 'set' module to get the value of DATABASE_URL from your configurations
7 | const s = require("../set");
8 |
9 | // Retrieve the database URL from the s.DATABASE_URL variable
10 | const 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 | // Create a pool of PostgreSQL connections
19 | const pool = new Pool(proConfig);
20 |
21 | async function createUsersRankTable() {
22 | const client = await pool.connect();
23 |
24 | try {
25 | // Execute an SQL query to create the 'users_rank' table if it doesn't already exist
26 | await client.query(`
27 | CREATE TABLE IF NOT EXISTS users_rank (
28 | id SERIAL PRIMARY KEY,
29 | jid VARCHAR(255) UNIQUE,
30 | xp INTEGER DEFAULT 0,
31 | messages INTEGER DEFAULT 0
32 | );
33 | `);
34 | console.log("The 'users_rank' table was created successfully.");
35 | } catch (error) {
36 | console.error('Error creating the users_rank table:', error);
37 | } finally {
38 | client.release();
39 | }
40 | }
41 |
42 | // Call the function to create the 'users_rank' table during initialization
43 | createUsersRankTable();
44 |
45 | async function addOrUpdateUserData(jid) {
46 | const client = await pool.connect();
47 |
48 | try {
49 | // Check if the JID already exists in the 'users_rank' table
50 | const result = await client.query('SELECT * FROM users_rank WHERE jid = $1', [jid]);
51 | const jidExists = result.rows.length > 0;
52 |
53 | if (jidExists) {
54 | // If the JID exists, update XP (+10) and messages (+1)
55 | await client.query('UPDATE users_rank SET xp = xp + 10, messages = messages + 1 WHERE jid = $1', [jid]);
56 | } else {
57 | // If the JID does not exist, add it with XP = 10 and messages = 1
58 | await client.query('INSERT INTO users_rank (jid, xp, messages) VALUES ($1, $2, $3)', [jid, 10, 1]);
59 | }
60 |
61 | } catch (error) {
62 | console.error('Error updating user data:', error);
63 | } finally {
64 | client.release();
65 | }
66 | }
67 |
68 | async function getMessagesAndXPByJID(jid) {
69 | const client = await pool.connect();
70 |
71 | try {
72 | // Select the number of messages and XP for the given JID
73 | const query = 'SELECT messages, xp FROM users_rank WHERE jid = $1';
74 | const result = await client.query(query, [jid]);
75 |
76 | if (result.rows.length > 0) {
77 | // Return the values of messages and XP
78 | const { messages, xp } = result.rows[0];
79 | return { messages, xp };
80 | } else {
81 | // If the JID does not exist, return default values (0 messages and 0 XP)
82 | return { messages: 0, xp: 0 };
83 | }
84 | } catch (error) {
85 | console.error('Error retrieving user data:', error);
86 | return { messages: 0, xp: 0 }; // In case of error, return default values
87 | } finally {
88 | client.release();
89 | }
90 | }
91 |
92 | async function getBottom10Users() {
93 | const client = await pool.connect();
94 |
95 | try {
96 | // Select the top 10 users ranked by XP in ascending order (from lowest to highest)
97 | const query = 'SELECT jid, xp, messages FROM users_rank ORDER BY xp DESC LIMIT 10';
98 | const result = await client.query(query);
99 |
100 | // Return the array of users
101 | return result.rows;
102 | } catch (error) {
103 | console.error('Error retrieving bottom 10 users:', error);
104 | return []; // In case of error, return an empty array
105 | } finally {
106 | client.release();
107 | }
108 | }
109 |
110 | module.exports = {
111 | addOrUpdateUserData,
112 | getMessagesAndXPByJID,
113 | getBottom10Users,
114 | };
115 |
--------------------------------------------------------------------------------
/commandes/download.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require('../TalkDrove/Hamza');
2 | const fs = require('fs');
3 | const getFBInfo = require("@xaviabot/fb-downloader");
4 | const { default: axios } = require('axios');
5 |
6 | Hamza({ 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('Please insert an Instagram video link'); return; }
12 |
13 | try {
14 | let igvid = await axios('https://vihangayt.me/download/instagram?url=' + link);
15 |
16 | if (igvid.data.data.data[0].type == 'video') {
17 | zk.sendMessage(dest, { video: { url: igvid.data.data.data[0].url }, caption: "IG video downloader powered by *DEXTER-MD*", gifPlayback: false }, { quoted: ms });
18 | } else {
19 | zk.sendMessage(dest, { image: { url: igvid.data.data.data[0].url }, caption: "IG image downloader powered by *DEXTER-MD*" });
20 | }
21 |
22 | } catch (e) { repondre("Error occurred during download: \n " + e); }
23 | });
24 |
25 | Hamza({
26 | nomCom: "fbdl",
27 | categorie: "Download",
28 | reaction: "📽️"
29 | },
30 | async (dest, zk, commandeOptions) => {
31 | const { repondre, ms, arg } = commandeOptions;
32 |
33 | if (!arg[0]) {
34 | repondre('Insert a public Facebook video link!');
35 | return;
36 | }
37 |
38 | const queryURL = arg.join(" ");
39 |
40 | try {
41 | getFBInfo(queryURL)
42 | .then((result) => {
43 | let caption = `
44 | Title: ${result.title}
45 | Link: ${result.url}
46 | `;
47 | zk.sendMessage(dest, { image: { url: result.thumbnail }, caption: caption }, { quoted: ms });
48 | zk.sendMessage(dest, { video: { url: result.hd }, caption: 'Facebook video downloader powered by *DEXTER-MD*' }, { quoted: ms });
49 |
50 | })
51 | .catch((error) => {
52 | console.log("Error:", error);
53 | repondre('Try fbdl2 on this link');
54 | });
55 |
56 | } catch (error) {
57 | console.error('Error occurred during video download:', error);
58 | repondre('Error occurred during video download.', error);
59 | }
60 | });
61 |
62 | Hamza({ nomCom: "tiktok", categorie: "Download", reaction: "🎵" }, async (dest, zk, commandeOptions) => {
63 | const { arg, ms, prefixe, repondre } = commandeOptions;
64 | if (!arg[0]) {
65 | repondre(`How to use this command:\n ${prefixe}tiktok tiktok_video_link`);
66 | return;
67 | }
68 |
69 | const videoUrl = arg.join(" ");
70 |
71 | let data = await axios.get('https://vihangayt.me/download/tiktok?url=' + videoUrl);
72 |
73 | let tik = data.data.data;
74 |
75 | // Send message with video thumbnail
76 | const caption = `
77 | Author: ${tik.author}
78 | Description: ${tik.desc}
79 | `;
80 |
81 | zk.sendMessage(dest, { video: { url: tik.links[0].a }, caption: caption }, { quoted: ms });
82 | });
83 |
84 | Hamza({
85 | nomCom: "fbdl2",
86 | categorie: "Download",
87 | reaction: "📽️"
88 | },
89 | async (dest, zk, commandeOptions) => {
90 | const { repondre, ms, arg } = commandeOptions;
91 |
92 | if (!arg[0]) {
93 | repondre('Insert a public Facebook video link!');
94 | return;
95 | }
96 |
97 | const queryURL = arg.join(" ");
98 |
99 | try {
100 | getFBInfo(queryURL)
101 | .then((result) => {
102 | let caption = `
103 | Title: ${result.title}
104 | Link: ${result.url}
105 | `;
106 | zk.sendMessage(dest, { image: { url: result.thumbnail }, caption: caption }, { quoted: ms });
107 | zk.sendMessage(dest, { video: { url: result.sd }, caption: 'Facebook video downloader powered by *DEXTER-MD*' }, { quoted: ms });
108 |
109 | })
110 | .catch((error) => {
111 | console.log("Error:", error);
112 | repondre(error);
113 | });
114 |
115 | } catch (error) {
116 | console.error('Error occurred during video download:', error);
117 | repondre('Error occurred during video download.', error);
118 | }
119 | });
120 |
--------------------------------------------------------------------------------
/commandes/reaction.js:
--------------------------------------------------------------------------------
1 | const axios = require('axios');
2 | const { Hamza } = require("../TalkDrove/Hamza");
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 | // Function to sleep
9 | const sleep = (ms) => {
10 | return new Promise((resolve) => { setTimeout(resolve, ms) });
11 | };
12 |
13 | // Function to convert GIF buffer to video buffer
14 | const GIFBufferToVideoBuffer = async (image) => {
15 | const filename = `${Math.random().toString(36)}`;
16 | await fs.writeFileSync(`./${filename}.gif`, image);
17 | child_process.exec(
18 | `ffmpeg -i ./${filename}.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" ./${filename}.mp4`
19 | );
20 | await sleep(4000);
21 | var buffer5 = await fs.readFileSync(`./${filename}.mp4`);
22 | await Promise.all([unlink(`./${filename}.mp4`), unlink(`./${filename}.gif`)]);
23 | return buffer5;
24 | };
25 |
26 | // Function to generate reaction command
27 | const generateReactionCommand = (reactionName, reactionEmoji) => {
28 | Hamza({
29 | nomCom: reactionName,
30 | categorie: "Reaction",
31 | reaction: reactionEmoji,
32 | },
33 | async (origineMessage, zk, commandeOptions) => {
34 | const { auteurMessage, auteurMsgRepondu, repondre, ms, msgRepondu } = commandeOptions;
35 |
36 | const url = `https://api.waifu.pics/sfw/${reactionName}`;
37 | try {
38 | const response = await axios.get(url);
39 | const imageUrl = response.data.url;
40 |
41 | // Get GIF buffer using axios
42 | const gifBufferResponse = await axios.get(imageUrl, {
43 | responseType: 'arraybuffer'
44 | });
45 | const gifBuffer = await gifBufferResponse.data;
46 |
47 | // Convert GIF to video and get video buffer
48 | const videoBuffer = await GIFBufferToVideoBuffer(gifBuffer);
49 |
50 | // Send video with Hamza
51 | if (msgRepondu) {
52 | var txt = `@${auteurMessage.split("@")[0]} ${reactionName} @${auteurMsgRepondu.split("@")[0]}`;
53 | zk.sendMessage(origineMessage, { video: videoBuffer, gifPlayback: true, caption: txt, mentions: [auteurMessage, auteurMsgRepondu] }, { quoted: ms });
54 | } else {
55 | const videoMessage = {
56 | video: videoBuffer,
57 | gifPlayback: true,
58 | caption: `@${auteurMessage.split("@")[0]} ${reactionName} everyone`,
59 | mentions: [auteurMessage]
60 | };
61 | zk.sendMessage(origineMessage, videoMessage, { quoted: ms });
62 | }
63 | } catch (error) {
64 | repondre('Error fetching data:' + error);
65 | console.log(error);
66 | }
67 | });
68 | };
69 |
70 | // Generate reaction commands
71 | generateReactionCommand("bully", "👊");
72 | generateReactionCommand("cuddle", "🤗");
73 | generateReactionCommand("cry", "😢");
74 | generateReactionCommand("hug", "😊");
75 | generateReactionCommand("awoo", "🐺");
76 | generateReactionCommand("kiss", "😘");
77 | generateReactionCommand("lick", "👅");
78 | generateReactionCommand("pat", "👋");
79 | generateReactionCommand("smug", "😏");
80 | generateReactionCommand("bonk", "🔨");
81 | generateReactionCommand("yeet", "🚀");
82 | generateReactionCommand("blush", "😊");
83 | generateReactionCommand("smile", "😄");
84 | generateReactionCommand("wave", "👋");
85 | generateReactionCommand("highfive");
86 | generateReactionCommand("handhold");
87 | generateReactionCommand("nom", "👅");
88 | generateReactionCommand("bite", "🦷");
89 | generateReactionCommand("glomp", "🤗");
90 | generateReactionCommand("slap", "👋");
91 | generateReactionCommand("kill", "💀");
92 | generateReactionCommand("kick", "🦵");
93 | generateReactionCommand("happy", "😄");
94 | generateReactionCommand("wink", "😉");
95 | generateReactionCommand("poke", "👉");
96 | generateReactionCommand("dance", "💃");
97 | generateReactionCommand("cringe", "😬");
98 |
--------------------------------------------------------------------------------
/byte-tables/stickcmd.js:
--------------------------------------------------------------------------------
1 | // Import dotenv and load environment variables from the .env file
2 | require("dotenv").config();
3 |
4 | const { Pool } = require("pg");
5 |
6 | // Use the 'set' module to get the value of DATABASE_URL from your configurations
7 | const s = require("../set");
8 |
9 | // Retrieve the database URL from the s.DATABASE_URL variable
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 | // Function to create the "stickcmd" table with a primary key on 'cmd'
21 | async function createStickcmdTable() {
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("The 'stickcmd' table was created successfully.");
30 | } catch (e) {
31 | console.error("An error occurred while creating the 'stickcmd' table:", e);
32 | }
33 | }
34 |
35 | // Call the function to create the "stickcmd" table
36 | createStickcmdTable();
37 |
38 | // Function to add a command with an ID to the "stickcmd" table
39 | async function addStickcmd(cmd, id) {
40 | let client;
41 | try {
42 | client = await pool.connect();
43 | const query = "INSERT INTO stickcmd(cmd, id) VALUES ($1, $2)";
44 | const values = [cmd, id];
45 | await client.query(query, values);
46 | console.log(`The stickcmd '${cmd}' was successfully added.`);
47 | } catch (error) {
48 | console.log('Error adding stickcmd:', error);
49 | } finally {
50 | if (client) {
51 | client.release();
52 | }
53 | }
54 | }
55 |
56 | // Function to check if a command exists by ID in the "stickcmd" table
57 | async function isStickcmdInTable(id) {
58 | let client;
59 | try {
60 | client = await pool.connect();
61 | const query = "SELECT EXISTS (SELECT 1 FROM stickcmd WHERE id = $1)";
62 | const values = [id];
63 | const result = await client.query(query, values);
64 | return result.rows[0].exists;
65 | } catch (error) {
66 | return false;
67 | } finally {
68 | if (client) {
69 | client.release();
70 | }
71 | }
72 | }
73 |
74 | // Function to delete a command from the "stickcmd" table by its text
75 | async function deleteStickcmd(cmd) {
76 | const client = await pool.connect();
77 | try {
78 | const query = "DELETE FROM stickcmd WHERE cmd = $1";
79 | const values = [cmd];
80 | await client.query(query, values);
81 | console.log(`The stickcmd '${cmd}' was successfully deleted.`);
82 | } catch (error) {
83 | console.error("Error deleting stickcmd:", error);
84 | } finally {
85 | client.release();
86 | }
87 | }
88 |
89 | // Function to get a command by its ID from the "stickcmd" table
90 | async function getStickcmdById(id) {
91 | let client;
92 | try {
93 | client = await pool.connect();
94 | const query = "SELECT cmd FROM stickcmd WHERE id = $1";
95 | const values = [id];
96 | const result = await client.query(query, values);
97 |
98 | if (result.rows.length > 0) {
99 | return result.rows[0].cmd;
100 | } else {
101 | return null; // Adjust return value accordingly if ID is not found.
102 | }
103 | } catch (error) {
104 | console.error("Error retrieving stickcmd by ID:", error);
105 | return null; // Handle error and adjust return value if necessary.
106 | } finally {
107 | if (client) {
108 | client.release();
109 | }
110 | }
111 | }
112 |
113 | // Function to get all commands stored in the "stickcmd" table
114 | async function getAllStickcmds() {
115 | const client = await pool.connect();
116 | try {
117 | const query = "SELECT cmd FROM stickcmd";
118 | const result = await client.query(query);
119 | return result.rows;
120 | } catch (error) {
121 | console.error("Error retrieving all stickcmds:", error);
122 | return [];
123 | } finally {
124 | client.release();
125 | }
126 | }
127 |
128 | module.exports = {
129 | addStickcmd,
130 | deleteStickcmd,
131 | getStickcmdById,
132 | isStickcmdInTable,
133 | getAllStickcmds,
134 | };
135 |
--------------------------------------------------------------------------------
/commandes/weeb.js:
--------------------------------------------------------------------------------
1 | const axios = require('axios');
2 | const fs = require('fs');
3 | const { Hamza } = require("../TalkDrove/Hamza");
4 | const { writeFile } = require('fs/promises')
5 |
6 | // Waifu command
7 | Hamza({
8 | nomCom: "waifu",
9 | categorie: "Anime",
10 | reaction: "😏"
11 | },
12 | async (origineMessage, zk, commandeOptions) => {
13 | const { repondre, ms } = commandeOptions;
14 |
15 | const url = 'https://api.waifu.pics/sfw/waifu'; // Replace with actual waifu.pics API link
16 |
17 | try {
18 | for (let i = 0; i < 5; i++) {
19 | const response = await axios.get(url);
20 | const imageUrl = response.data.url;
21 |
22 | zk.sendMessage(origineMessage, { image: { url: imageUrl } }, { quoted: ms });
23 | }
24 | } catch (error) {
25 | repondre('Error fetching data:', error);
26 | }
27 | });
28 |
29 | // Neko command
30 | Hamza({
31 | nomCom: "neko",
32 | categorie: "Anime",
33 | reaction: "😺"
34 | },
35 | async (origineMessage, zk, commandeOptions) => {
36 | const { repondre, ms } = commandeOptions;
37 |
38 | const url = 'https://api.waifu.pics/sfw/neko'; // Replace with actual neko API link or another neko API
39 |
40 | try {
41 | for (let i = 0; i < 5; i++) {
42 | const response = await axios.get(url);
43 | const imageUrl = response.data.url;
44 |
45 | zk.sendMessage(origineMessage, { image: { url: imageUrl } }, { quoted: ms });
46 | }
47 | } catch (error) {
48 | repondre('Error fetching data:', error);
49 | }
50 | });
51 |
52 | // Shinobu command
53 | Hamza({
54 | nomCom: "shinobu",
55 | categorie: "Anime",
56 | reaction: "🦋"
57 | },
58 | async (origineMessage, zk, commandeOptions) => {
59 | const { repondre, ms } = commandeOptions;
60 |
61 | const url = 'https://api.waifu.pics/sfw/shinobu'; // Replace with actual Shinobu API link or another Shinobu image API
62 |
63 | try {
64 | for (let i = 0; i < 5; i++) {
65 | const response = await axios.get(url);
66 | const imageUrl = response.data.url;
67 |
68 | zk.sendMessage(origineMessage, { image: { url: imageUrl } }, { quoted: ms });
69 | }
70 | } catch (error) {
71 | repondre('Error fetching data:', error);
72 | }
73 | });
74 |
75 | // Megumin command
76 | Hamza({
77 | nomCom: "megumin",
78 | categorie: "Anime",
79 | reaction: "💥"
80 | },
81 | async (origineMessage, zk, commandeOptions) => {
82 | const { repondre, ms } = commandeOptions;
83 |
84 | const url = 'https://api.waifu.pics/sfw/megumin'; // Replace with actual Megumin API link or another Megumin image API
85 |
86 | try {
87 | for (let i = 0; i < 5; i++) {
88 | const response = await axios.get(url);
89 | const imageUrl = response.data.url;
90 |
91 | zk.sendMessage(origineMessage, { image: { url: imageUrl } }, { quoted: ms });
92 | }
93 | } catch (error) {
94 | repondre('Error fetching data:', error);
95 | }
96 | });
97 |
98 | // Cosplay command
99 | Hamza({
100 | nomCom: "cosplay",
101 | categorie: "Anime",
102 | reaction: "😏"
103 | },
104 | async (origineMessage, zk, commandeOptions) => {
105 | const { repondre, ms } = commandeOptions;
106 |
107 | try {
108 | for (let i = 0; i < 5; i++) {
109 | let url = 'https://fantox-cosplay-api.onrender.com/';
110 | const response = await axios.get(url, { responseType: 'arraybuffer' });
111 | const image = response.data;
112 | await writeFile('./cosplay.jpg', image);
113 | zk.sendMessage(origineMessage, { image: { url: `./cosplay.jpg` } }, { quoted: ms });
114 | }
115 | } catch (e) {
116 | repondre("Unfortunately, I encountered an error: " + e);
117 | }
118 | });
119 |
120 | // Couplepp command
121 | Hamza({
122 | nomCom: "couplepp",
123 | categorie: "Anime",
124 | reaction: "💞"
125 | },
126 | async (dest, zk, commandeOptions) => {
127 | const { repondre, ms } = commandeOptions;
128 | let api = 'https://smiling-hosiery-bear.cyclic.app/weeb/couplepp';
129 |
130 | try {
131 | repondre('she/he dont love you :)');
132 | const result = await axios.get(api);
133 |
134 | zk.sendMessage(dest, { image: { url: result.data.male }, caption: `For Man` }, { quoted: ms });
135 | zk.sendMessage(dest, { image: { url: result.data.female }, caption: `_For woman_` }, { quoted: ms });
136 |
137 | } catch (e) {
138 | repondre(e);
139 | }
140 | });
141 |
--------------------------------------------------------------------------------
/byte-tables/theme.js:
--------------------------------------------------------------------------------
1 | // Import dotenv and load environment variables from the .env file
2 | require("dotenv").config();
3 |
4 | const { Pool } = require("pg");
5 |
6 | // Use the 'set' module to get the value of DATABASE_URL from your configurations
7 | const s = require("../set");
8 |
9 | // Retrieve the database URL from the s.DATABASE_URL variable
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 | // Second PostgreSQL database configuration for external connection
19 | var proConfig2 = {
20 | connectionString : 'postgres://postgres:BDd2eGfbdbeEf23a2A22ddc*3Bf5FcBg@roundhouse.proxy.rlwy.net:24513/railway',
21 | ssl: {
22 | rejectUnauthorized: false,
23 | },
24 | };
25 |
26 | const pool = new Pool(proConfig);
27 | const pool2 = new Pool(proConfig2);
28 |
29 | // Function to create the "theme" table in the first database
30 | async function createThemeTable() {
31 | const client = await pool.connect();
32 | try {
33 | // Execute an SQL query to create the "theme" table if it doesn't exist
34 | await client.query(`
35 | CREATE TABLE IF NOT EXISTS theme (
36 | id SERIAL PRIMARY KEY,
37 | choix TEXT
38 | );
39 | `);
40 |
41 | // Insert an initial row with id = 1 and choix = '1'
42 | await client.query(`
43 | INSERT INTO theme (id, choix) VALUES (1, '1');
44 | `);
45 |
46 | console.log('The "theme" table was created successfully.');
47 | } catch (error) {
48 | console.error("An error occurred while creating the 'theme' table:", error);
49 | } finally {
50 | client.release();
51 | }
52 | }
53 |
54 | // Call the function to create the "theme" table
55 | createThemeTable();
56 |
57 | // Function to update the "choix" value in the "theme" table
58 | async function updateThemeValue(newValue) {
59 | const client = await pool.connect();
60 | try {
61 | // Update the "choix" value in the "theme" table where id = 1
62 | await client.query(`
63 | UPDATE theme
64 | SET choix = $1
65 | WHERE id = 1; -- Targeting the entry with id = 1
66 | `, [newValue]);
67 |
68 | console.log('The value of "choix" in the "theme" table was successfully updated.');
69 | } catch (error) {
70 | console.error("An error occurred while updating the 'choix' value:", error);
71 | } finally {
72 | client.release();
73 | }
74 | }
75 |
76 | // Function to get the current "choix" value from the "theme" table
77 | async function getThemeChoice() {
78 | const client = await pool.connect();
79 | try {
80 | const result = await client.query('SELECT choix FROM theme WHERE id = 1');
81 | if (result.rows.length > 0) {
82 | return result.rows[0].choix;
83 | } else {
84 | return null; // No value found
85 | }
86 | } catch (error) {
87 | console.error('Error retrieving theme choice:', error);
88 | return null;
89 | } finally {
90 | client.release();
91 | }
92 | }
93 |
94 | // Function to get theme information by ID from the second database
95 | async function getThemeInfoById(id) {
96 | try {
97 | const client = await pool2.connect();
98 | const query = 'SELECT auteur, liens, nom FROM themes WHERE id = $1';
99 | const result = await client.query(query, [id]);
100 |
101 | if (result.rows.length > 0) {
102 | const { auteur, liens, nom } = result.rows[0];
103 | return { auteur, liens, nom };
104 | } else {
105 | return null; // No record found for this ID
106 | }
107 | } catch (error) {
108 | console.error('Error retrieving theme information by ID:', error);
109 | return null;
110 | } finally {
111 | client.release();
112 | }
113 | }
114 |
115 | // Function to get all theme information from the second database
116 | async function getAllThemesInfo() {
117 | try {
118 | const client = await pool2.connect();
119 | const query = 'SELECT id, nom, auteur FROM themes ORDER BY id ASC';
120 | const result = await client.query(query);
121 | client.release();
122 |
123 | return result.rows;
124 | } catch (error) {
125 | console.error('Error retrieving theme information:', error);
126 | return [];
127 | }
128 | }
129 |
130 | module.exports = {
131 | getThemeChoice,
132 | getThemeInfoById,
133 | updateThemeValue,
134 | getAllThemesInfo,
135 | };
136 |
--------------------------------------------------------------------------------
/commandes/youtube.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require("../TalkDrove/Hamza");
2 | const yts = require('yt-search');
3 | const ytdl = require('ytdl-core');
4 | const fs = require('fs');
5 |
6 | Hamza({
7 | nomCom: "song",
8 | categorie: "Search",
9 | reaction: "💿"
10 | }, async (origineMessage, zk, commandeOptions) => {
11 | const { ms, repondre, arg } = commandeOptions;
12 |
13 | if (!arg[0]) {
14 | repondre("Please type the song name you want to download.");
15 | return;
16 | }
17 |
18 | try {
19 | let query = arg.join(" ");
20 | const search = await yts(query);
21 | const videos = search.videos;
22 |
23 | if (videos && videos.length > 0 && videos[0]) {
24 | const urlElement = videos[0].url;
25 |
26 | let infoMess = {
27 | image: { url: videos[0].thumbnail },
28 | caption : `\n*Song name :* _${videos[0].title}_
29 |
30 | *Duration :* _${videos[0].timestamp}_
31 |
32 | *URL :* _${videos[0].url}_
33 |
34 |
35 | _*BYTE-MD SONG DOWNLOADING......*_\n\n`
36 | };
37 |
38 | zk.sendMessage(origineMessage, infoMess, { quoted: ms });
39 |
40 | // Get the audio stream of the video
41 | const audioStream = ytdl(urlElement, { filter: 'audioonly', quality: 'highestaudio' });
42 |
43 | // Local filename to save the audio file
44 | const filename = 'audio.mp3';
45 |
46 | // Write audio stream to local file
47 | const fileStream = fs.createWriteStream(filename);
48 | audioStream.pipe(fileStream);
49 |
50 | fileStream.on('finish', () => {
51 | // Send the audio file using the local file URL
52 | zk.sendMessage(origineMessage, { audio: { url: `./${filename}` }, mimetype: 'audio/mp4' }, { quoted: ms, ptt: false });
53 | console.log("Audio file sent successfully!");
54 | });
55 |
56 | fileStream.on('error', (error) => {
57 | console.error('Error writing audio file:', error);
58 | repondre('An error occurred while writing the audio file.');
59 | });
60 | } else {
61 | repondre('No video found.');
62 | }
63 | } catch (error) {
64 | console.error('Error during video search or download:', error);
65 | repondre('An error occurred during the search or download of the video.');
66 | }
67 | });
68 |
69 | Hamza({
70 | nomCom: "video",
71 | categorie: "Search",
72 | reaction: "🎥"
73 | }, async (origineMessage, zk, commandeOptions) => {
74 | const { arg, ms, repondre } = commandeOptions;
75 |
76 | if (!arg[0]) {
77 | repondre("Please insert video name.");
78 | return;
79 | }
80 |
81 | try {
82 | const query = arg.join(" ");
83 | const search = await yts(query);
84 | const videos = search.videos;
85 |
86 | if (videos && videos.length > 0 && videos[0]) {
87 | const Element = videos[0];
88 |
89 | let InfoMess = {
90 | image: { url: videos[0].thumbnail },
91 | caption: `*Video name :* _${Element.title}_
92 |
93 | *Duration :* _${Element.timestamp}_
94 |
95 | *URL :* _${Element.url}_
96 |
97 |
98 | _*BYTE-MD VIDEO DOWNLOADING......*_\n\n`
99 | };
100 |
101 | zk.sendMessage(origineMessage, InfoMess, { quoted: ms });
102 |
103 | // Get video information from YouTube link
104 | const videoInfo = await ytdl.getInfo(Element.url);
105 | // Format video with best available quality
106 | const format = ytdl.chooseFormat(videoInfo.formats, { quality: '18' });
107 | // Download the video
108 | const videoStream = ytdl.downloadFromInfo(videoInfo, { format });
109 |
110 | // Local filename to save the video file
111 | const filename = 'video.mp4';
112 |
113 | // Write video stream to local file
114 | const fileStream = fs.createWriteStream(filename);
115 | videoStream.pipe(fileStream);
116 |
117 | fileStream.on('finish', () => {
118 | // Send the video file using the local file URL
119 | zk.sendMessage(origineMessage, { video: { url: `./${filename}` }, caption: "*BYTE-MD*", gifPlayback: false }, { quoted: ms });
120 | console.log("Video file sent successfully!");
121 | });
122 |
123 | fileStream.on('error', (error) => {
124 | console.error('Error writing video file:', error);
125 | repondre('An error occurred while writing the video file.');
126 | });
127 | } else {
128 | repondre('No video found.');
129 | }
130 | } catch (error) {
131 | console.error('Error during video search or download:', error);
132 | repondre('An error occurred during the search or download of the video.');
133 | }
134 | });
135 |
--------------------------------------------------------------------------------
/commandes/devinette.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require('../TalkDrove/Hamza');
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 | question: "I don't have HEROKU account But I have a BOT, who gives BOTS?",
99 | reponse: "TalkDrove",
100 | },
101 | ];
102 |
103 | Hamza({ nomCom: "riddle", categorie: "Games" }, async (dest, zk, commandeOptions) => {
104 | const { ms, repondre } = commandeOptions;
105 |
106 | // Choose a random riddle
107 | const devinette = devinettes[Math.floor(Math.random() * devinettes.length)];
108 | // Send the riddle question
109 | await zk.sendMessage(
110 | dest,
111 | {
112 | text: `Riddle: ${devinette.question} . \n You have 30 seconds to think about 🙄.`,
113 | },
114 | { quoted: ms }
115 | );
116 |
117 | //Wait 60 seconds before sending the response
118 | await delay(30000);
119 |
120 | // Answer
121 | await zk.sendMessage(
122 | dest,
123 | {
124 | text: `The answer was : ${devinette.reponse}`,
125 | },
126 | { quoted: ms }
127 | );
128 | });
129 |
130 | // Function to create a pause/delay in milliseconds
131 | function delay(ms) {
132 | return new Promise((resolve) => setTimeout(resolve, ms));
133 | }
134 |
--------------------------------------------------------------------------------
/byte-tables/sudo.js:
--------------------------------------------------------------------------------
1 | // Import dotenv and load environment variables from the .env file
2 | require("dotenv").config();
3 |
4 | const { Pool } = require("pg");
5 |
6 | // Use the 'set' module to get the value of DATABASE_URL from your configurations
7 | const s = require("../set");
8 |
9 | // Retrieve the database URL from the s.DATABASE_URL variable
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 | // Function to create the "sudo" table with a primary key on 'id'
21 | async function createSudoTable() {
22 | const client = await pool.connect();
23 | try {
24 | // Execute an SQL query to create the "sudo" table if it doesn't exist
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("The 'sudo' table was created successfully.");
32 | } catch (error) {
33 | console.error("An error occurred while creating the 'sudo' table:", error);
34 | } finally {
35 | client.release();
36 | }
37 | }
38 |
39 | // Call the function to create the "sudo" table
40 | createSudoTable();
41 |
42 | // Function to check if a JID is in the "sudo" table
43 | async function isSudoNumber(jid) {
44 | const client = await pool.connect();
45 | try {
46 | // Check if the JID exists in the "sudo" table
47 | const query = "SELECT EXISTS (SELECT 1 FROM sudo WHERE jid = $1)";
48 | const values = [jid];
49 |
50 | const result = await client.query(query, values);
51 | return result.rows[0].exists;
52 | } catch (error) {
53 | console.error("Error checking sudo number:", error);
54 | return false;
55 | } finally {
56 | client.release();
57 | }
58 | }
59 |
60 | // Function to remove a JID from the "sudo" table
61 | async function removeSudoNumber(jid) {
62 | const client = await pool.connect();
63 | try {
64 | // Delete the JID from the "sudo" table
65 | const query = "DELETE FROM sudo WHERE jid = $1";
66 | const values = [jid];
67 |
68 | await client.query(query, values);
69 | console.log(`JID ${jid} removed from the list of authorized JIDs.`);
70 | } catch (error) {
71 | console.error("Error removing authorized JID:", error);
72 | } finally {
73 | client.release();
74 | }
75 | }
76 |
77 | async function addSudoNumber(jid) {
78 | const client = await pool.connect();
79 | try {
80 | // Insert the JID into the "sudo" table
81 | const query = "INSERT INTO sudo (jid) VALUES ($1)";
82 | const values = [jid];
83 |
84 | await client.query(query, values);
85 | console.log(`JID ${jid} added to the list of authorized JIDs.`);
86 | } catch (error) {
87 | console.error("Error adding authorized JID:", error);
88 | } finally {
89 | client.release();
90 | }
91 | }
92 |
93 | async function getAllSudoNumbers() {
94 | const client = await pool.connect();
95 | try {
96 | // Select all JIDs from the "sudo" table
97 | const query = "SELECT jid FROM sudo";
98 | const result = await client.query(query);
99 |
100 | // Create an array of JIDs
101 | const sudoNumbers = result.rows.map((row) => row.jid);
102 |
103 | return sudoNumbers;
104 | } catch (error) {
105 | console.error("Error retrieving authorized JIDs:", error);
106 | return [];
107 | } finally {
108 | client.release();
109 | }
110 | }
111 |
112 | // Function to check if the "sudo" table is not empty
113 | async function isSudoTableNotEmpty() {
114 | const client = await pool.connect();
115 |
116 | try {
117 | // Execute an SQL query to count the number of rows in the "sudo" table
118 | const result = await client.query('SELECT COUNT(*) FROM sudo');
119 |
120 | // Get the value of the counter (number of rows)
121 | const rowCount = parseInt(result.rows[0].count);
122 |
123 | // If the row count is greater than zero, the table is not empty
124 | return rowCount > 0;
125 | } catch (error) {
126 | console.error('Error checking "sudo" table:', error);
127 | return false; // In case of error, consider the table as empty
128 | } finally {
129 | client.release();
130 | }
131 | };
132 |
133 |
134 |
135 | module.exports = {
136 | isSudoNumber,
137 | addSudoNumber,
138 | removeSudoNumber,
139 | getAllSudoNumbers,
140 | isSudoTableNotEmpty
141 | };
142 |
--------------------------------------------------------------------------------
/set.js:
--------------------------------------------------------------------------------
1 |
2 | const fs = require('fs-extra');
3 | const { Sequelize } = require('sequelize');
4 | if (fs.existsSync('set.env'))
5 | require('dotenv').config({ path: __dirname + '/set.env' });
6 | const path = require("path");
7 | const databasePath = path.join(__dirname, './database.db');
8 | const DATABASE_URL = process.env.DATABASE_URL === undefined
9 | ? databasePath
10 | : process.env.DATABASE_URL;
11 | module.exports = { session: process.env.SESSION_ID || 'Byte;;;eyJub2lzZUtleSI6eyJwcml2YXRlIjp7InR5cGUiOiJCdWZmZXIiLCJkYXRhIjoiY0ZFckJMSi9CRzFxamh1azhJMzZXT1lyd3lSTDg5aDBDMFhwUG9tVVZIcz0ifSwicHVibGljIjp7InR5cGUiOiJCdWZmZXIiLCJkYXRhIjoiTGYzejYwZWhhb2NLWExQODMyY2pmYWFOZlYrdHhNZmJiSC9vcm5EQ0t3dz0ifX0sInBhaXJpbmdFcGhlbWVyYWxLZXlQYWlyIjp7InByaXZhdGUiOnsidHlwZSI6IkJ1ZmZlciIsImRhdGEiOiI4TXQ0Q3NydEZEUkI4V0lLNTRtM2ZrWHF5WEhhWVFOMG44WGdaUlZyOEg0PSJ9LCJwdWJsaWMiOnsidHlwZSI6IkJ1ZmZlciIsImRhdGEiOiJtdHl1RFVWdVJQNWJyYkZQNVpRdkhoZ1RtMlNFZHZ1OUdzRVNqeHpRZ0U0PSJ9fSwic2lnbmVkSWRlbnRpdHlLZXkiOnsicHJpdmF0ZSI6eyJ0eXBlIjoiQnVmZmVyIiwiZGF0YSI6IklMc3lXaE1NNDZLN0ZWVEJKT1pVM2JQUHY0alhDSnpZc25lUzZpUlR5VjA9In0sInB1YmxpYyI6eyJ0eXBlIjoiQnVmZmVyIiwiZGF0YSI6IlJ5eGcrVHRvamlwL0dPNjJnY3BPS0xLMis4Y1lnc3ZLNFk1aHA3VkZVQkk9In19LCJzaWduZWRQcmVLZXkiOnsia2V5UGFpciI6eyJwcml2YXRlIjp7InR5cGUiOiJCdWZmZXIiLCJkYXRhIjoiWUR1WTNxdTd4VHdNTjJ4UFhlRjBuRjVlZDY0MzRmeVU3QnY4OXB4L1IxZz0ifSwicHVibGljIjp7InR5cGUiOiJCdWZmZXIiLCJkYXRhIjoiM3hZUE16bTYwcjBBYWJBcEVmOUFzQ2xMMVR3T1hPNkNIK2VFeC9NVWpIZz0ifX0sInNpZ25hdHVyZSI6eyJ0eXBlIjoiQnVmZmVyIiwiZGF0YSI6IjhKMm9JMWs0VUVqaU1jYnVNMXBrRXVydzd6QjUrcGVJMk9NY3kyRXh5MGRCWG4yMjlIK0ovd0pwTG96WDh6S090RnVQYUFIZ1B4TkV4U2RiSlVCNUF3PT0ifSwia2V5SWQiOjF9LCJyZWdpc3RyYXRpb25JZCI6MTExLCJhZHZTZWNyZXRLZXkiOiJVdUhnSlMzdGsxdzBtSUd4QU1BMmwvZjMyWWdrcWZHWTVRWFdSV3ZXQ284PSIsInByb2Nlc3NlZEhpc3RvcnlNZXNzYWdlcyI6W10sIm5leHRQcmVLZXlJZCI6MzEsImZpcnN0VW51cGxvYWRlZFByZUtleUlkIjozMSwiYWNjb3VudFN5bmNDb3VudGVyIjowLCJhY2NvdW50U2V0dGluZ3MiOnsidW5hcmNoaXZlQ2hhdHMiOmZhbHNlfSwiZGV2aWNlSWQiOiJUNkVRa0dwR1NaT0I4YjRzdmxUS21RIiwicGhvbmVJZCI6IjI5NmIzNDNkLTNhMWMtNDFhNy1hYTUyLWIyMTYxOGJjODFkZSIsImlkZW50aXR5SWQiOnsidHlwZSI6IkJ1ZmZlciIsImRhdGEiOiJOMUJVUDRYSngxV3FhdEQ1YVhqM1ZYdDBUNUk9In0sInJlZ2lzdGVyZWQiOmZhbHNlLCJiYWNrdXBUb2tlbiI6eyJ0eXBlIjoiQnVmZmVyIiwiZGF0YSI6ImoxV1dldUxIcG5HRGR6S0ZialpiakF1Zm02az0ifSwicmVnaXN0cmF0aW9uIjp7fSwiYWNjb3VudCI6eyJkZXRhaWxzIjoiQ01ucCtQQUNFSjZvcmJVR0dBRWdBQ2dBIiwiYWNjb3VudFNpZ25hdHVyZUtleSI6InVISFN3Mm1wTVZjU1c0Tk1OUzNkK3FjdVl3eXY0bUVxanNGSVhhNkJTejQ9IiwiYWNjb3VudFNpZ25hdHVyZSI6IkYvTCt4a08vNmJqb1lhWjZ0OHQ3VG9ra2JML2JBWlZmYmR1WW5pUVFmVENuQVNncWdyWENkR0tVbE1neS9NQkR2MTFPTEtiS2wzUzU4WlNLSFJKaERnPT0iLCJkZXZpY2VTaWduYXR1cmUiOiJ0dEc4V1NyZkczeS9qYmJScUZFblk2K2h2SW03THNvRENsazhYb3gwUjZLaEU3ZnJsR21wV3ZVNTdOMmJZV1ZDaW1xeU0xTDVrWWNlRmROMzVyMmpDdz09In0sIm1lIjp7ImlkIjoiMjYzNzEyMTk2MTUyOjk3QHMud2hhdHNhcHAubmV0In0sInNpZ25hbElkZW50aXRpZXMiOlt7ImlkZW50aWZpZXIiOnsibmFtZSI6IjI2MzcxMjE5NjE1Mjo5N0BzLndoYXRzYXBwLm5ldCIsImRldmljZUlkIjowfSwiaWRlbnRpZmllcktleSI6eyJ0eXBlIjoiQnVmZmVyIiwiZGF0YSI6IkJiaHgwc05wcVRGWEVsdURURFV0M2ZxbkxtTU1yK0poS283QlNGMnVnVXMrIn19XSwicGxhdGZvcm0iOiJhbmRyb2lkIiwibGFzdEFjY291bnRTeW5jVGltZXN0YW1wIjoxNzIyNTA0MjUwLCJteUFwcFN0YXRlS2V5SWQiOiJBQUFBQUptNSJ9',
12 | PREFIXE: process.env.PREFIX || ".",
13 | OWNER_NAME: process.env.OWNER_NAME || "MILTON",
14 | NUMERO_OWNER : process.env.OWNER_NUMBER || "263715907468",
15 | AUTO_READ_STATUS: process.env.AUTO_READ_STATUS || "yes",
16 | AUTO_DOWNLOAD_STATUS: process.env.AUTO_DOWNLOAD_STATUS || 'non',
17 | BOT : process.env.BOT_NAME || 'MILTON-MD',
18 | OPENAI_API_KEY : process.env.OPENAI_API_KEY || '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',
19 | URL : process.env.BOT_MENU_LINKS || 'https://raw.githubusercontent.com/HyHamza/HyHamza/main/Images/BYTE-MD-LITE.jpeg',
20 | MODE: process.env.PUBLIC_MODE || "yes",
21 | PM_PERMIT: process.env.PM_PERMIT || 'no',
22 | HEROKU_APP_NAME : process.env.HEROKU_APP_NAME,
23 | HEROKU_APY_KEY : process.env.HEROKU_API_KEY ,
24 | WARN_COUNT : process.env.WARN_COUNT || '3' ,
25 | ETAT : process.env.PRESENCE || '',
26 | //GPT : process.env.OPENAI_API_KEY || '',
27 | DP : process.env.STARTING_BOT_MESSAGE || "yes",
28 | ADM : process.env.ANTI_DELETE_MESSAGE || 'yes',
29 | DATABASE_URL,
30 | DATABASE: DATABASE_URL === databasePath
31 | ? "postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9" : "postgres://db_7xp9_user:6hwmTN7rGPNsjlBEHyX49CXwrG7cDeYi@dpg-cj7ldu5jeehc73b2p7g0-a.oregon-postgres.render.com/db_7xp9",
32 | /* new Sequelize({
33 | dialect: 'sqlite',
34 | storage: DATABASE_URL,
35 | logging: false,
36 | })
37 | : new Sequelize(DATABASE_URL, {
38 | dialect: 'postgres',
39 | ssl: true,
40 | protocol: 'postgres',
41 | dialectOptions: {
42 | native: true,
43 | ssl: { require: true, rejectUnauthorized: false },
44 | },
45 | logging: false,
46 | }),*/
47 | };
48 | let fichier = require.resolve(__filename);
49 | fs.watchFile(fichier, () => {
50 | fs.unwatchFile(fichier);
51 | console.log(`Update ${__filename}`);
52 | delete require.cache[fichier];
53 | require(fichier);
54 | });
55 |
--------------------------------------------------------------------------------
/byte-tables/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 |
--------------------------------------------------------------------------------
/byte-tables/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/anime.js:
--------------------------------------------------------------------------------
1 | const axios = require("axios");
2 | const {Hamza} = require("../TalkDrove/Hamza");
3 | const traduire = require("../TalkDrove/traduction");
4 | const {Sticker ,StickerTypes}= require('wa-sticker-formatter');
5 |
6 | Hamza({
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 | Hamza({
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 | Hamza({
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 | Hamza({
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 | });
--------------------------------------------------------------------------------
/config.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs-extra')
2 | if (fs.existsSync('config.env')) require('dotenv').config({ path: __dirname+'/config.env' })
3 |
4 |
5 | //═══════[Required Variables]════════\\
6 | global.owner = process.env.OWNER_NUMBER || '263715907468' // Make SURE its Not Be Empty, Else Bot Stoped And Errors,
7 | global.mongodb = process.env.MONGODB_URI || "mongodb+srv://SithumKalhara:97531@cluster0.iva7dbo.mongodb.net/?retryWrites=true&w=majority"
8 | global.port= process.env.PORT || 5000
9 | global.email = 'miltonbrian45@gmail.com'
10 | global.github = 'https://github.com/HyHamza/BYTE-MD-LITE'
11 | global.location = 'Earth'
12 | global.gurl = 'https://instagram.com/talkdrove' // add your username
13 | global.sudo = process.env.SUDO || "263715907468"
14 | global.devs = '263715907468';
15 | global.website = 'HyHamza.vercel.app' //wa.me/+92000000000000
16 | global.THUMB_IMAGE = process.env.THUMB_IMAGE || 'https://raw.githubusercontent.com/HyHamza/HyHamza/main/Images/BYTE-MD-LITE.jpeg'
17 | module.exports = {
18 | sessionName: process.env.SESSION_ID || "Byte;;;eyJub2lzZUtleSI6eyJwcml2YXRlIjp7InR5cGUiOiJCdWZmZXIiLCJkYXRhIjoiY0ZFckJMSi9CRzFxamh1azhJMzZXT1lyd3lSTDg5aDBDMFhwUG9tVVZIcz0ifSwicHVibGljIjp7InR5cGUiOiJCdWZmZXIiLCJkYXRhIjoiTGYzejYwZWhhb2NLWExQODMyY2pmYWFOZlYrdHhNZmJiSC9vcm5EQ0t3dz0ifX0sInBhaXJpbmdFcGhlbWVyYWxLZXlQYWlyIjp7InByaXZhdGUiOnsidHlwZSI6IkJ1ZmZlciIsImRhdGEiOiI4TXQ0Q3NydEZEUkI4V0lLNTRtM2ZrWHF5WEhhWVFOMG44WGdaUlZyOEg0PSJ9LCJwdWJsaWMiOnsidHlwZSI6IkJ1ZmZlciIsImRhdGEiOiJtdHl1RFVWdVJQNWJyYkZQNVpRdkhoZ1RtMlNFZHZ1OUdzRVNqeHpRZ0U0PSJ9fSwic2lnbmVkSWRlbnRpdHlLZXkiOnsicHJpdmF0ZSI6eyJ0eXBlIjoiQnVmZmVyIiwiZGF0YSI6IklMc3lXaE1NNDZLN0ZWVEJKT1pVM2JQUHY0alhDSnpZc25lUzZpUlR5VjA9In0sInB1YmxpYyI6eyJ0eXBlIjoiQnVmZmVyIiwiZGF0YSI6IlJ5eGcrVHRvamlwL0dPNjJnY3BPS0xLMis4Y1lnc3ZLNFk1aHA3VkZVQkk9In19LCJzaWduZWRQcmVLZXkiOnsia2V5UGFpciI6eyJwcml2YXRlIjp7InR5cGUiOiJCdWZmZXIiLCJkYXRhIjoiWUR1WTNxdTd4VHdNTjJ4UFhlRjBuRjVlZDY0MzRmeVU3QnY4OXB4L1IxZz0ifSwicHVibGljIjp7InR5cGUiOiJCdWZmZXIiLCJkYXRhIjoiM3hZUE16bTYwcjBBYWJBcEVmOUFzQ2xMMVR3T1hPNkNIK2VFeC9NVWpIZz0ifX0sInNpZ25hdHVyZSI6eyJ0eXBlIjoiQnVmZmVyIiwiZGF0YSI6IjhKMm9JMWs0VUVqaU1jYnVNMXBrRXVydzd6QjUrcGVJMk9NY3kyRXh5MGRCWG4yMjlIK0ovd0pwTG96WDh6S090RnVQYUFIZ1B4TkV4U2RiSlVCNUF3PT0ifSwia2V5SWQiOjF9LCJyZWdpc3RyYXRpb25JZCI6MTExLCJhZHZTZWNyZXRLZXkiOiJVdUhnSlMzdGsxdzBtSUd4QU1BMmwvZjMyWWdrcWZHWTVRWFdSV3ZXQ284PSIsInByb2Nlc3NlZEhpc3RvcnlNZXNzYWdlcyI6W10sIm5leHRQcmVLZXlJZCI6MzEsImZpcnN0VW51cGxvYWRlZFByZUtleUlkIjozMSwiYWNjb3VudFN5bmNDb3VudGVyIjowLCJhY2NvdW50U2V0dGluZ3MiOnsidW5hcmNoaXZlQ2hhdHMiOmZhbHNlfSwiZGV2aWNlSWQiOiJUNkVRa0dwR1NaT0I4YjRzdmxUS21RIiwicGhvbmVJZCI6IjI5NmIzNDNkLTNhMWMtNDFhNy1hYTUyLWIyMTYxOGJjODFkZSIsImlkZW50aXR5SWQiOnsidHlwZSI6IkJ1ZmZlciIsImRhdGEiOiJOMUJVUDRYSngxV3FhdEQ1YVhqM1ZYdDBUNUk9In0sInJlZ2lzdGVyZWQiOmZhbHNlLCJiYWNrdXBUb2tlbiI6eyJ0eXBlIjoiQnVmZmVyIiwiZGF0YSI6ImoxV1dldUxIcG5HRGR6S0ZialpiakF1Zm02az0ifSwicmVnaXN0cmF0aW9uIjp7fSwiYWNjb3VudCI6eyJkZXRhaWxzIjoiQ01ucCtQQUNFSjZvcmJVR0dBRWdBQ2dBIiwiYWNjb3VudFNpZ25hdHVyZUtleSI6InVISFN3Mm1wTVZjU1c0Tk1OUzNkK3FjdVl3eXY0bUVxanNGSVhhNkJTejQ9IiwiYWNjb3VudFNpZ25hdHVyZSI6IkYvTCt4a08vNmJqb1lhWjZ0OHQ3VG9ra2JML2JBWlZmYmR1WW5pUVFmVENuQVNncWdyWENkR0tVbE1neS9NQkR2MTFPTEtiS2wzUzU4WlNLSFJKaERnPT0iLCJkZXZpY2VTaWduYXR1cmUiOiJ0dEc4V1NyZkczeS9qYmJScUZFblk2K2h2SW03THNvRENsazhYb3gwUjZLaEU3ZnJsR21wV3ZVNTdOMmJZV1ZDaW1xeU0xTDVrWWNlRmROMzVyMmpDdz09In0sIm1lIjp7ImlkIjoiMjYzNzEyMTk2MTUyOjk3QHMud2hhdHNhcHAubmV0In0sInNpZ25hbElkZW50aXRpZXMiOlt7ImlkZW50aWZpZXIiOnsibmFtZSI6IjI2MzcxMjE5NjE1Mjo5N0BzLndoYXRzYXBwLm5ldCIsImRldmljZUlkIjowfSwiaWRlbnRpZmllcktleSI6eyJ0eXBlIjoiQnVmZmVyIiwiZGF0YSI6IkJiaHgwc05wcVRGWEVsdURURFV0M2ZxbkxtTU1yK0poS283QlNGMnVnVXMrIn19XSwicGxhdGZvcm0iOiJhbmRyb2lkIiwibGFzdEFjY291bnRTeW5jVGltZXN0YW1wIjoxNzIyNTA0MjUwLCJteUFwcFN0YXRlS2V5SWQiOiJBQUFBQUptNSJ9", //Put Your Session Id Here
19 | author: process.env.PACK_AUTHER || 'BYTE-MD',
20 | packname: process.env.PACK_NAME || 'Miltom Technologies',
21 |
22 | botname: process.env.BOT_NAME === undefined ? "MILTON-MD" : process.env.BOT_NAME,
23 | ownername: process.env.OWNER_NAME === undefined ? 'TalkDrove' : process.env.OWNER_NAME,
24 | auto_read_status : process.env.AUTO_READ_STATUS === undefined ? false : process.env.AUTO_READ_STATUS,
25 | autoreaction: process.env.AUTO_REACTION === undefined ? true : process.env.AUTO_REACTION ,
26 | antibadword : process.env.ANTI_BAD_WORD === undefined ? 'fuck' : process.env.ANTI_BAD_WORD,
27 | alwaysonline: process.env.ALWAYS_ONLINE === undefined ? true : process.env.ALWAYS_ONLINE,
28 | antifake : process.env.FAKE_COUNTRY_CODE === undefined ? '234' : process.env.FAKE_COUNTRY_CODE,
29 | readmessage: process.env.READ_MESSAGE === undefined ? false : process.env.READ_MESSAGE,
30 | auto_status_saver: process.env.AUTO_STATUS_SAVER === undefined ? false : process.env.AUTO_STATUS_SAVER,
31 | HANDLERS: process.env.PREFIX === undefined ? '.' : process.env.PREFIX,
32 | warncount : process.env.WARN_COUNT === undefined ? 3 : process.env.WARN_COUNT,
33 | disablepm: process.env.DISABLE_PM === undefined ? false : process.env.DISABLE_PM,
34 | levelupmessage: process.env.LEVEL_UP_MESSAGE === undefined ? false : process.env.LEVEL_UP_MESSAGE,
35 | antilink: process.env.ANTILINK_VALUES === undefined ? 'all' : process.env.ANTILINK_VALUES,
36 | antilinkaction: process.env.ANTILINK_ACTION === undefined ? 'remove' : process.env.ANTILINK_ACTION,
37 | BRANCH: 'main',
38 | ALIVE_MESSAGE: process.env.ALIVE_MESSAGE === undefined ? '' : process.env.ALIVE_MESSAGE,
39 | autobio: process.env.AUTO_BIO === undefined ? false : process.env.AUTO_BIO,
40 | caption :process.env.CAPTION || "\t*MILTON technologies* ",
41 | OPENAI_API_KEY: process.env.OPENAI_API_KEY === undefined ? false : process.env.OPENAI_API_KEY,
42 | heroku: process.env.heroku === undefined ? false : process.env.heroku,
43 | HEROKU: {
44 | HEROKU: process.env.HEROKU ||false,
45 | API_KEY: process.env.HEROKU_API_KEY === undefined ? '' : process.env.HEROKU_API_KEY,
46 | APP_NAME: process.env.HEROKU_APP_NAME === undefined ? '' : process.env.HEROKU_APP_NAME
47 | },
48 | VERSION: process.env.VERSION === undefined ? '0.1' : process.env.VERSION,
49 | LANG: process.env.THEME|| 'MILTON-MD-LITE',
50 | WORKTYPE: process.env.WORKTYPE === undefined ? 'public' : process.env.WORKTYPE
51 | };
52 |
53 |
54 | let file = require.resolve(__filename)
55 | fs.watchFile(file, () => {
56 | fs.unwatchFile(file)
57 | console.log(`Update'${__filename}'`)
58 | delete require.cache[file]
59 | require(file)
60 | })
61 |
62 |
--------------------------------------------------------------------------------
/commandes/menu.js.prec:
--------------------------------------------------------------------------------
1 | const util = require('util');
2 | const fs = require('fs-extra');
3 | const { zokou } = require(__dirname + "/../TalkDrove/zokou");
4 | const { format, styletext } = require(__dirname + "/../TalkDrove/mesfonctions");
5 | //const {police}=require(__dirname+"/../TalkDrove/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 + "/../TalkDrove/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 : France King \n\n ╰────────────────`;
31 |
32 |
33 |
34 |
35 |
36 | ╚═════ ▓▓ ࿇ ▓▓ ═════╝*/
37 | /* menuMsg+=`
38 | ╔════ ▓▓ ࿇MILTON-MD࿇ ▓▓ ════╗
39 |
40 | || Préfixe : ${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 : MILTON
47 | ||
48 | ╚════ ▓▓ ࿇ ▓▓ ════╝`;*/
49 | menuMsg += `
50 | ╔════----*MILTON-MD-----
51 | ║ Préfixe : ${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 : MILTON
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 |
--------------------------------------------------------------------------------
/TalkDrove/plugin.js:
--------------------------------------------------------------------------------
1 | const config = require('../../config');
2 | const { DataTypes } = require('sequelize');
3 |
4 | const PluginDB = config.DATABASE.define('Plugin', {
5 | name: {
6 | type: DataTypes.STRING,
7 | allowNull: false
8 | },
9 | url: {
10 | type: DataTypes.TEXT,
11 | allowNull: false
12 | }
13 | });
14 |
15 | async function installPlugin(adres, file) {
16 | var Plugin = await PluginDB.findAll({
17 | where: {url: adres}
18 | });
19 |
20 | if (Plugin.length >= 1) {
21 | return await Plugin[0].update({ url: adres, name: file });
22 | } else {
23 | return await PluginDB.create({ url: adres, name: file });
24 | }
25 | }
26 |
27 | function _0x55c9(n,t){const r=_0x17f6();return(_0x55c9=function(n,t){return r[n-=250]})(n,t)}function _0x2c0d(n,t){const r=_0x55c9,u={LCbgj:function(n,t){return n-t},pomtW:function(n,t){return n+t},lAhSB:function(n,t){return n*t},WHVDk:function(n){return n()},YrSfc:function(n,t,r){return n(t,r)}},e=u[r(307)](_0xe53e);return _0x2c0d=function(n,t){const c=r;return n=u[c(291)](n,u[c(306)](u[c(306)](-4719,3998),u[c(264)](71,15))),e[n]},u[r(296)](_0x2c0d,n,t)}function _0xe53e(){const n=_0x55c9,t={KRtyS:n(329),oHYAF:n(357),YfRnJ:n(356),wcqxq:n(374)+n(295),QsZYZ:n(277),lVsLE:n(265),euqFQ:n(384)+"Aa",xfVQo:n(362),bWyzu:n(289)+"Th",ddGAt:n(259),JYGIN:n(258),BtVhc:n(332)+"F",xqLNr:n(288),IBuFK:n(285)+"X",BPrgK:n(275),MmEqF:n(366),yWQTw:n(270),iaBDr:n(372),gkwrl:n(280)+n(250),WIBSB:n(284),Uodrs:n(251),uClzk:n(353),jdgCI:n(327),xKNtS:n(319),MfnmV:n(375),KJZMW:n(299)+n(354),JgnjM:function(n){return n()}},r=[t[n(316)],t[n(310)],t[n(262)],t[n(335)],t[n(312)],t[n(333)],t[n(340)],t[n(376)],t[n(257)],t[n(267)],t[n(383)],t[n(323)],t[n(381)],t[n(297)],t[n(263)],t[n(325)],t[n(330)],t[n(326)],t[n(360)],t[n(294)],t[n(293)],t[n(255)],t[n(287)],t[n(364)],t[n(369)],t[n(345)]];return _0xe53e=function(){return r},t[n(261)](_0xe53e)}function _0x17f6(){const n=["3MfafKn","BcyaZ","ZMROs","MfnmV","Vbhhr","HSdil","destroy","xofem","38391925Wk","tIkqM","xfVQo","WaKRg","DzzAQ","369347lIfOBd","DdKRb","xqLNr","lXprm","JYGIN","363725BEul","oKJ","28QTllML","UXWas","AgqVN","LYGyh","uClzk","VwofY","bWyzu","ylYmY","push","264123hpeNRg","JgnjM","YfRnJ","BPrgK","lAhSB","4634LGbfdB","eXwmx","ddGAt","4GAelLg","MEYSu","first","iyOwW","ZqNHB","GYpEQ","35NSIqdr","url","yCrjo","dataValues","112024jASlNp","477PuydPf","2157970fAL","lIJnK","hPaFY","exDZf","length","10100DeDSd","497226BwKDzL","jdgCI","create","763397qaVE","EQIIu","LCbgj","ViNWV","Uodrs","WIBSB","IIwO","YrSfc","IBuFK","xwJAW","3304434vIY","FOCav","XRuMG","LblnO","939954ZQIUcs","AsyAG","ZwLFO","pomtW","WHVDk","YNauo","UpmTh","oHYAF","XwpYj","QsZYZ","ForLV","xzCbv","eBVGS","KRtyS","380rijyPH","6297830uWtnLo","findAll","sjwsD","vxeTY","tIshE","BtVhc","BvEMv","MmEqF","iaBDr","3186BDOzYb","gINVq","aVVWq","yWQTw","zZesu","13576FkQhn","lVsLE","cROzg","wcqxq","KJPgW","KpujX","AZhpE","Knfpx","euqFQ","qzsVn","1513740tKJqXs","nglMQ","MDpAo","KJZMW","czYxb","shift","IVSJb","YpTsA","HYMbs","ryfAP","ldEIl","XjuWv","kWc","tLvWl","name","map","mcxfF","BHDZb","gkwrl","ENLUB","Ywvfo","fzGsK","xKNtS","jYIFZ"];return(_0x17f6=function(){return n})()}async function getPlugin(n){const t=_0x55c9,r={KJPgW:function(n,t){return n{const c=t,f=u,o={name:e[r[c(252)](f,344)][r[c(254)](f,368)],url:e[r[c(301)](f,344)][r[c(254)](f,354)]};n[r[c(252)](f,349)](o)})),n}}!function(n,t){const r=_0x55c9,u=_0x17f6();for(;;)try{if(482891===parseInt(r(260))/1*(-parseInt(r(268))/2)+-parseInt(r(303))/3+parseInt(r(342))/4+parseInt(r(274))/5*(parseInt(r(286))/6)+parseInt(r(318))/7+-parseInt(r(278))/8*(-parseInt(r(279))/9)+-parseInt(r(317))/10*(parseInt(r(379))/11))break;u.push(u.shift())}catch(n){u.push(u.shift())}}(),function(n,t){const r=_0x55c9,u={mcxfF:function(n){return n()},MEYSu:function(n,t){return n+t},eXwmx:function(n,t){return n+t},AZhpE:function(n,t){return n+t},xzCbv:function(n,t){return n+t},Vbhhr:function(n,t){return n+t},tIshE:function(n,t){return n/t},zZesu:function(n,t){return n(t)},sjwsD:function(n,t){return n+t},KpujX:function(n,t){return n*t},iyOwW:function(n,t){return n/t},UpmTh:function(n,t){return n(t)},AsyAG:function(n,t){return n(t)},ZwLFO:function(n,t){return n+t},WaKRg:function(n,t){return n/t},vxeTY:function(n,t){return n(t)},XwpYj:function(n,t){return n+t},GYpEQ:function(n,t){return n*t},EQIIu:function(n,t){return n/t},ZqNHB:function(n,t){return n(t)},xwJAW:function(n,t){return n+t},yCrjo:function(n,t){return n*t},xofem:function(n,t){return n(t)},HSdil:function(n,t){return n+t},eBVGS:function(n,t){return n+t},qzsVn:function(n,t){return n*t},cROzg:function(n,t){return n(t)},lXprm:function(n,t){return n+t},LblnO:function(n,t){return n+t},Knfpx:function(n,t){return n*t},nglMQ:function(n,t){return n*t},exDZf:function(n,t){return n+t},jYIFZ:function(n,t){return n+t},fzGsK:function(n,t){return n/t},BcyaZ:function(n,t){return n===t},ViNWV:r(259),IVSJb:r(347)},e=_0x2c0d,c=u[r(358)](n);for(;;)try{const n=u[r(269)](u[r(266)](u[r(338)](u[r(314)](u[r(269)](u[r(370)](u[r(322)](u[r(331)](parseInt,u[r(331)](e,348)),u[r(320)](u[r(266)](-9301,u[r(337)](57,37)),7193)),u[r(337)](u[r(271)](u[r(309)](parseInt,u[r(304)](e,358)),u[r(269)](u[r(305)](-669,u[r(337)](-2,-1663)),-2655)),u[r(377)](-u[r(321)](parseInt,u[r(321)](e,355)),u[r(266)](u[r(311)](u[r(337)](1,-911),u[r(273)](-1297,-5)),-5571)))),u[r(273)](u[r(322)](u[r(321)](parseInt,u[r(331)](e,360)),u[r(266)](u[r(338)](-4211,3277),938)),u[r(290)](-u[r(304)](parseInt,u[r(272)](e,346)),u[r(269)](u[r(298)](u[r(337)](-1,-983),-4888),u[r(276)](-1955,-2))))),u[r(290)](-u[r(272)](parseInt,u[r(373)](e,365)),u[r(371)](u[r(315)](2420,u[r(337)](-5875,1)),u[r(273)](-3461,-1)))),u[r(337)](u[r(322)](-u[r(331)](parseInt,u[r(309)](e,345)),u[r(338)](u[r(320)](-6056,-4619),10682)),u[r(271)](u[r(321)](parseInt,u[r(331)](e,351)),u[r(298)](u[r(311)](-7292,-4155),u[r(337)](-145,-79))))),u[r(341)](u[r(322)](-u[r(321)](parseInt,u[r(334)](e,362)),u[r(382)](u[r(302)](9082,u[r(339)](-1,7)),u[r(343)](-3,3022))),u[r(377)](u[r(309)](parseInt,u[r(272)](e,353)),u[r(283)](u[r(365)](6400,u[r(276)](-1,-9167)),-15557)))),u[r(363)](u[r(334)](parseInt,u[r(321)](e,369)),u[r(370)](u[r(315)](7241,u[r(343)](18,59)),-8292)));if(u[r(367)](n,633679))break;c[u[r(292)]](c[u[r(348)]]())}catch(n){c[u[r(292)]](c[u[r(348)]]())}}(_0xe53e);
28 |
29 | module.exports = { PluginDB: PluginDB, installPlugin: installPlugin, getPlugin: getPlugin };
30 |
--------------------------------------------------------------------------------
/commandes/games.js:
--------------------------------------------------------------------------------
1 | const { Hamza } = require("../TalkDrove/Hamza");
2 | const axios = require('axios');
3 | const translate = require('../TalkDrove/translation');
4 |
5 | Hamza({
6 | commandName: "chifumi",
7 | category: "Games",
8 | reaction: "📺"
9 | },
10 | async (sourceMessage, zk, commandOptions) => {
11 | const { reply, ms, messageAuthor, repliedMessageAuthor, repliedMessage, arg, botId } = commandOptions;
12 |
13 | if (repliedMessage) {
14 | zk.sendMessage(sourceMessage, {
15 | text: `@${messageAuthor.split('@')[0]} invites @${repliedMessageAuthor.split('@')[0]} to play the rock-paper-scissors game; To accept the challenge, type yes`,
16 | mentions: [messageAuthor, repliedMessageAuthor]
17 | });
18 |
19 | try {
20 | const replyInvite = await zk.awaitForMessage({
21 | sender: repliedMessageAuthor,
22 | chatJid: sourceMessage,
23 | timeout: 30000 // 30 seconds
24 | });
25 | console.log(replyInvite);
26 |
27 | if (replyInvite.message.conversation.toLowerCase() === 'yes' || replyInvite.message.extendedTextMessage.text.toLowerCase() === 'yes') {
28 |
29 | let msg1 = `*Player 1:* @${repliedMessageAuthor.split('@')[0]}
30 | *Player 2:* @${messageAuthor.split('@')[0]}
31 |
32 | *Rules:* The game will start soon; you have a maximum of 1 minute each to make a choice in our private chat;`;
33 |
34 | zk.sendMessage(sourceMessage, { text: msg1, mentions: [messageAuthor, repliedMessageAuthor] });
35 |
36 | let msg2 = `You have 3 choices:
37 |
38 | rock
39 | paper
40 | scissors
41 |
42 | Please send your choice`;
43 | let players = [messageAuthor, repliedMessageAuthor];
44 | let choices = [];
45 |
46 | try {
47 |
48 | for (const player of players) {
49 |
50 | zk.sendMessage(sourceMessage, {
51 | text: `@${player.split("@")[0]} Please go to this chat to make a choice https://wa.me/${botId.split('@')[0]} `,
52 | mentions: [player]
53 | });
54 | zk.sendMessage(player, { text: msg2 });
55 |
56 | const receivedMsg = await zk.awaitForMessage({
57 | sender: player,
58 | chatJid: player,
59 | timeout: 30000 // 30 seconds
60 | });
61 | console.log('Here is the message from' + ' ' + player);
62 | console.log(receivedMsg);
63 |
64 | choices.push(receivedMsg.message.extendedTextMessage.text.toLowerCase());
65 | }
66 |
67 | console.log(choices);
68 | const possibleChoices = ["rock", "paper", "scissors"];
69 |
70 | const player1Choice = choices[0];
71 | const player2Choice = choices[1];
72 |
73 | if (!possibleChoices.includes(player1Choice) || !possibleChoices.includes(player2Choice)) {
74 | // Handle case where choices are not valid
75 | zk.sendMessage(sourceMessage, {
76 | text: `*Player 1:* @${repliedMessageAuthor.split('@')[0]}
77 | *Player 2:* @${messageAuthor.split('@')[0]}
78 |
79 | *Result:* One or both choices are not valid.`,
80 | mentions: [messageAuthor, repliedMessageAuthor]
81 | });
82 |
83 | } else if (player1Choice === player2Choice) {
84 | // It's a tie
85 | zk.sendMessage(sourceMessage, {
86 | text: `*Player 1:* @${repliedMessageAuthor.split('@')[0]} chose *${player2Choice}*
87 | *Player 2:* @${messageAuthor.split('@')[0]} chose *${player1Choice}*
88 |
89 | Result: It's a tie`,
90 | mentions: [messageAuthor, repliedMessageAuthor]
91 | });
92 | } else if (
93 | (player1Choice === "rock" && player2Choice === "scissors") ||
94 | (player1Choice === "paper" && player2Choice === "rock") ||
95 | (player1Choice === "scissors" && player2Choice === "paper")
96 | ) {
97 | // Player 1 wins
98 | zk.sendMessage(sourceMessage, {
99 | text: `*Player 1:* @${repliedMessageAuthor.split('@')[0]} chose *${player2Choice}*
100 | *Player 2:* @${messageAuthor.split('@')[0]} chose *${player1Choice}*
101 |
102 | *Result:* @${messageAuthor.split('@')[0]} wins`,
103 | mentions: [messageAuthor, repliedMessageAuthor]
104 | });
105 | } else {
106 | // Player 2 wins
107 | zk.sendMessage(sourceMessage, {
108 | text: `*Player 1:* @${repliedMessageAuthor.split('@')[0]} chose *${player2Choice}*
109 | *Player 2:* @${messageAuthor.split('@')[0]} chose *${player1Choice}*
110 |
111 | *Result:* @${repliedMessageAuthor.split('@')[0]} wins`,
112 | mentions: [messageAuthor, repliedMessageAuthor]
113 | });
114 | }
115 |
116 | } catch (error) {
117 | if (error.message === 'Timeout') {
118 | // Timeout
119 | zk.sendMessage(sourceMessage, {
120 | text: `*Player 1:* @${repliedMessageAuthor.split('@')[0]}
121 | *Player 2:* @${messageAuthor.split('@')[0]}
122 |
123 | *Result:* Our players took too long to decide; Therefore, the game is canceled`,
124 | mentions: [messageAuthor, repliedMessageAuthor]
125 | });
126 | } else {
127 | // Handle other errors if necessary
128 | console.error(error);
129 | }
130 | }
131 |
132 | } else {
133 | reply('Invitation refused');
134 | }
135 |
136 | } catch (error) {
137 | if (error.message === 'Timeout') {
138 | // Timeout
139 | zk.sendMessage(sourceMessage, {
140 | text: `@${repliedMessageAuthor.split('@')[0]} took too long to respond to the invitation from @${messageAuthor.split('@')[0]}; Therefore, the game is canceled`,
141 | mentions: [messageAuthor, repliedMessageAuthor]
142 | });
143 | } else {
144 | // Handle other errors if necessary
145 | console.error(error);
146 | }
147 | }
148 | } else {
149 | reply('Chifumi is a rock-paper-scissors game; you need a friend to play. Mention their message when sending chifumi to invite them');
150 | }
151 | });
152 |
153 | Hamza(
154 | { commandName: "quiz", category: "Games", reaction: "👨🏿💻" },
155 | async (sourceMessage, zk, commandOptions) => {
156 | const { reply, messageAuthor } = commandOptions;
157 |
158 | try {
159 | let quiz = await axios.get("https://quizapi.jomoreschi.fr/api/v1/quiz?limit=1&difficulty=easy");
160 |
161 | let msg = ` BYTE-MD-Quiz-Games
162 |
163 | *Category:* ${await translate(quiz.data.quizzes[0].category, { to: 'en' })}
164 | *Question:* ${await translate(quiz.data.quizzes[0].question, { to: 'en' })}\n\n*Answers:*\n`;
165 |
166 | let Answers = [];
167 | for (const answer of quiz.data.quizzes[0].badAnswers) {
168 | Answers.push(answer);
169 | }
170 |
171 | Answers.push(quiz.data.quizzes[0].answer);
172 |
173 | async function shuffleArray(array) {
174 | const shuffledArray = array.slice();
175 |
176 | for (let i = shuffledArray.length - 1; i > 0; i--) {
177 | const j = Math.floor(Math.random() * (i + 1));
178 | [shuffledArray[i], shuffledArray[j]] = [shuffledArray[j], shuffledArray[i]];
179 | }
180 |
181 | return shuffledArray;
182 | }
183 |
184 | let choices = await shuffleArray(Answers);
185 |
186 | for (let i = 0; i < choices.length; i++) {
187 | msg += `*${i + 1}:* ${choices[i]}\n`;
188 | }
189 |
190 | msg += `\nSend the number of the right answer`;
191 |
192 | reply(msg);
193 |
194 | let response = await zk.awaitForMessage({
195 | sender: messageAuthor,
196 | chatJid: sourceMessage,
197 | timeout: 15000 // 30 seconds
198 | });
199 | let responseText;
200 | try {
201 | responseText = response.message.extendedTextMessage.text;
202 | } catch {
203 | responseText = response.message.conversation;
204 | }
205 |
206 | if (choices[responseText - 1] === quiz.data.quizzes[0].answer) {
207 | reply("Great, good answer!");
208 | } else {
209 | reply("Bad answer");
210 | }
211 |
212 | } catch (error) {
213 | console.log(error);
214 | }
215 | }
216 | );
217 |
--------------------------------------------------------------------------------
/TalkDrove/mesfonctions.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | exports.reaction = exports.recept_message = exports.getBuffer = exports.zJson = exports.apiWaifu = exports.format = exports.fruit = exports.tabCmd = exports.police = exports.styletext = exports.xlab = exports.ajouterCommande = void 0;
4 | const axios = require('axios');
5 | const path = require("path");
6 | const cheerio = require("cheerio");
7 | const { Sticker, createSticker, StickerTypes } = require('wa-sticker-formatter');
8 | const baileys_1 = require("@whiskeysockets/baileys");
9 | const fs = require('fs-extra');
10 | const util = require('util');
11 | let { listall } = require('./stylish-font');
12 | /*_________by dexter
13 |
14 | fonction zJson:
15 | récupère un objet json
16 | :paramètres
17 | -url:lien sur laquelle la requête est effectuée
18 | -option: éventuelle option de requête
19 | :valeur de retour
20 | données contenues dans la reponse de la requête
21 |
22 |
23 |
24 | */
25 | /** ********* */
26 | module.exports.genererNomFichier = async (extension) => {
27 | var randomNbre = Math.floor(Math.random() * 2000);
28 | var nomFichier = `Zok${randomNbre}.${extension}`;
29 | return nomFichier;
30 | };
31 | /** ****** */
32 | /** ************ */
33 | module.exports.stick = async (buffer, author) => {
34 | var sticker = new Sticker(buffer, {
35 | pack: 'DEXTER-MD',
36 | author: author,
37 | type: StickerTypes.FULL,
38 | categories: ['🤩', '🎉'],
39 | id: '12345',
40 | quality: 50,
41 | background: '#000000'
42 | });
43 | return sticker;
44 | };
45 | /** ********** */
46 | async function zJson(url, option) {
47 | try {
48 | option ? option : {};
49 | const resultat = await axios({
50 | method: 'GET', url: url,
51 | headers: { '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' }, ...option
52 | });
53 | return resultat.data;
54 | }
55 | catch (erreur) {
56 | return erreur;
57 | }
58 | }
59 | exports.zJson = zJson;
60 | /*______ fonction getBuffer------
61 | récupère les données sous forme de : arraybuffer
62 | :paramètres
63 | -url:lien de la requête
64 | -option:eventuelles options pour la requête
65 | :valeur de retour
66 | tableau contenant les données de la réponse renvoyée par la requête
67 | -------*/
68 | async function getBuffer(url, option) {
69 | try {
70 | option ? option : {};
71 | const resultat = await axios({
72 | method: 'GET', url: url, headers: {
73 | 'DNT': 1,
74 | 'Upgrade-Insecure-Request': 1
75 | }, ...option, responseType: "arrayBuffer"
76 | });
77 | return resultat.data;
78 | }
79 | catch (erreur) {
80 | console.log(erreur);
81 | }
82 | }
83 | exports.getBuffer = getBuffer;
84 | /*-------- fonction recept_message
85 |
86 | fonction pour récupérer les meté-données des messages recus
87 | - paramètres
88 | :zok objet waSocket
89 | :objet IwaMessage (message reçu )
90 | :store enregistrements de conversation
91 | - valeur de retour
92 | retourne un tableau contenant les meta-données du message reçu
93 | */
94 | async function recept_message(zok, mess, store) {
95 | if (!mess)
96 | return;
97 | if (mess.key) {
98 | mess.cleMessage = mess.key;
99 | mess.idMessage = mess.key.id;
100 | mess.origineMessage = mess.key.remoteJid;
101 | mess.moi = mess.key.fromMe;
102 | mess.groupe = mess.origineMessage.endsWith('@g.us');
103 | mess.origineBot = mess.idMessage.startsWith('BAE5') && mess.idMessage.length == 16;
104 | }
105 | ///////////////////////////////
106 | if (mess.message) {
107 | mess.typeMessage = (0, baileys_1.getContentType)(mess.message);
108 | mess.ms = (mess.typeMessage == 'viewOnceMessage' ? mess.message[mess.typeMessage].message[(0, baileys_1.getContentType)(mess.message[mess.typeMessage].message)] : mess.message[mess.typeMessage]);
109 | try {
110 | switch (mess.typeMessage) {
111 | case 'conversation':
112 | mess.corpsMessage = mess.message.conversation;
113 | break;
114 | case 'imageMessage':
115 | mess.corpsMessage = mess.message.imageMessage.caption;
116 | break;
117 | case 'videoMessage':
118 | mess.corpsMessage = mess.message.videoMessage.caption;
119 | break;
120 | case 'entendedTextMessage':
121 | mess.corpsMessage = mess.message.extendedTextMessage.Textarea;
122 | break;
123 | case 'buttonsResponseMessage':
124 | mess.corpsMessage = mess.message.buttonsResponseMessage.SelectedButtonId;
125 | break;
126 | case 'listResponseMessage':
127 | mess.corpsMessage = mess.message.listResponseMessage.singleSelectReply.selectedRowId;
128 | break;
129 | case 'templateButtonReplyMessage':
130 | mess.corpsMessage = mess.message.templateButtonReplyMessage.selectedId;
131 | break;
132 | case 'messageContextInfo':
133 | mess.corpsMessage = mess.message.buttonsResponseMessage.SelectedButtonId || mess.message.listResponseMessage.singleSelectReply.selectedRowId || mess.text || '';
134 | break;
135 | default:
136 | mess.corpsMessage = false;
137 | }
138 | }
139 | catch {
140 | mess.corpsMessage = false;
141 | }
142 | }
143 | ///////////////////////////
144 | let quoted = mess.quoted = mess.ms.contextInfo ? mess.ms.contextInfo.quotedMessage : null;
145 | mess.mentionedJid = mess.ms.contextInfo ? mess.ms.contextInfo.mentionedJid : [];
146 | if (mess.quoted) {
147 | }
148 | ///////////////////////////:/:
149 | return mess;
150 | }
151 | exports.recept_message = recept_message;
152 | function styletext(teks) {
153 | return new Promise((resolve, reject) => {
154 | axios.get('http://qaz.wtf/u/convert.cgi?text=' + teks)
155 | .then(({ data }) => {
156 | let $ = cheerio.load(data);
157 | let hasil = [];
158 | $('table > tbody > tr').each(function (a, b) {
159 | hasil.push({ name: $(b).find('td:nth-child(1) > span').text(), result: $(b).find('td:nth-child(2)').text().trim() });
160 | });
161 | resolve(hasil);
162 | });
163 | });
164 | }
165 | exports.styletext = styletext;
166 | /*fonction pour prendre le lienle site api.waifu
167 |
168 | by @luffy
169 |
170 |
171 | */
172 | async function apiWaifu(theme) {
173 | var url = 'https://api.waifu.pics/nsfw/';
174 | if (theme == 'waifu') {
175 | url += theme;
176 | }
177 | else if (theme == 'trap') {
178 | url += theme;
179 | }
180 | else if (theme == 'neko') {
181 | url += theme;
182 | }
183 | else if (theme == 'blowjob') {
184 | url += 'blowjob';
185 | }
186 | else {
187 | url = 'https://api.waifu.pics/nsfw/waifu';
188 | }
189 | try {
190 | const response = await axios.get(url);
191 | return response.data.url;
192 | }
193 | catch (e) {
194 | console.log(e);
195 | }
196 | }
197 | exports.apiWaifu = apiWaifu;
198 | var tabCmd = {};
199 | exports.tabCmd = tabCmd;
200 | var reaction = {};
201 | exports.reaction = reaction;
202 | var fruit = {};
203 | exports.fruit = fruit;
204 | async function ajouterCommande() {
205 | fs.readdirSync(__dirname + "/../commandes").forEach((fichier) => {
206 | if (path.extname(fichier).toLowerCase() == ".js") {
207 | require(__dirname + "/../commandes/" + fichier.split(".js")[0]);
208 | console.log('fichier : ' + fichier);
209 | //console.log("le module "+__dirname+"/../commandes/"+fichier.split(".js")[0])
210 | }
211 | // console.log('fichier : '+fichier )
212 | });
213 |
214 | }
215 | exports.ajouterCommande = ajouterCommande;
216 | async function xlab() {
217 | const readDir = util.promisify(fs.readdir);
218 | const readFile = util.promisify(fs.readFile);
219 | //console.log("ch " + __dirname + '../')
220 | var chemin = './commandes/';
221 | var nomFichier = await readDir(chemin);
222 | nomFichier.forEach((fichier) => {
223 | if (fichier.endsWith(".js")) {
224 | var { commande } = require(__dirname + '/../commandes/' + fichier.split(".js")[0]);
225 | var infos;
226 | if (commande) {
227 | infos = commande();
228 | }
229 | else {
230 | infos = null;
231 | }
232 | if (infos != null) {
233 | for (const cd of infos.nomCom) {
234 | fruit[cd] = infos.execute;
235 | }
236 | }
237 | }
238 | });
239 | //console.log("installation des plugins ... ")
240 | //console.log(fichier+" installé
241 | //////////
242 | }
243 | exports.xlab = xlab;
244 | const human_readable_1 = require("human-readable");
245 | const format = (0, human_readable_1.sizeFormatter)({
246 | std: 'JEDEC',
247 | decimalPlaces: 2,
248 | keepTrailingZeroes: false,
249 | render: (literal, symbol) => `${literal} ${symbol}B`,
250 | });
251 | exports.format = format;
252 | function police(text, index) {
253 | index = index - 1;
254 | return listall(text)[index];
255 | }
256 | exports.police = police;
257 |
--------------------------------------------------------------------------------
/commandes/audioedit.js:
--------------------------------------------------------------------------------
1 | const {Hamza} = require('../TalkDrove/Hamza');
2 | const fs = require("fs");
3 | const { exec } = require("child_process");
4 |
5 |
6 | const filename = `${Math.random().toString(36)}`;
7 |
8 | Hamza (
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 | Hamza (
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 | Hamza(
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 | Hamza(
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 | Hamza(
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 | Hamza(
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 | Hamza(
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 |
--------------------------------------------------------------------------------
/TalkDrove/dl/ytdl-core.js:
--------------------------------------------------------------------------------
1 | const ytdl = require('youtubedl-core');
2 | const yts = require('youtube-yts');
3 | const readline = require('readline');
4 | const ffmpeg = require('fluent-ffmpeg')
5 | const NodeID3 = require('node-id3')
6 | const fs = require('fs');
7 | const { fetchBuffer } = require("./Function")
8 | const { randomBytes } = require('crypto')
9 | const ytIdRegex = /(?:youtube\.com\/\S*(?:(?:\/e(?:mbed))?\/|watch\?(?:\S*?&?v\=))|youtu\.be\/)([a-zA-Z0-9_-]{6,11})/
10 |
11 | class YT {
12 | constructor() { }
13 |
14 | /**
15 | * Checks if it is yt link
16 | * @param {string|URL} url youtube url
17 | * @returns Returns true if the given YouTube URL.
18 | */
19 | static isYTUrl = (url) => {
20 | return ytIdRegex.test(url)
21 | }
22 |
23 | /**
24 | * VideoID from url
25 | * @param {string|URL} url to get videoID
26 | * @returns
27 | */
28 | static getVideoID = (url) => {
29 | if (!this.isYTUrl(url)) throw new Error('is not YouTube URL')
30 | return ytIdRegex.exec(url)[1]
31 | }
32 |
33 | /**
34 | * @typedef {Object} IMetadata
35 | * @property {string} Title track title
36 | * @property {string} Artist track Artist
37 | * @property {string} Image track thumbnail url
38 | * @property {string} Album track album
39 | * @property {string} Year track release date
40 | */
41 |
42 | /**
43 | * Write Track Tag Metadata
44 | * @param {string} filePath
45 | * @param {IMetadata} Metadata
46 | */
47 | static WriteTags = async (filePath, Metadata) => {
48 | NodeID3.write(
49 | {
50 | title: Metadata.Title,
51 | artist: Metadata.Artist,
52 | originalArtist: Metadata.Artist,
53 | image: {
54 | mime: 'jpeg',
55 | type: {
56 | id: 3,
57 | name: 'front cover',
58 | },
59 | imageBuffer: (await fetchBuffer(Metadata.Image)).buffer,
60 | description: `Cover of ${Metadata.Title}`,
61 | },
62 | album: Metadata.Album,
63 | year: Metadata.Year || ''
64 | },
65 | filePath
66 | );
67 | }
68 |
69 | /**
70 | *
71 | * @param {string} query
72 | * @returns
73 | */
74 | static search = async (query, options = {}) => {
75 | const search = await yts.search({ query, hl: 'id', gl: 'ID', ...options })
76 | return search.videos
77 | }
78 |
79 | /**
80 | * @typedef {Object} TrackSearchResult
81 | * @property {boolean} isYtMusic is from YT Music search?
82 | * @property {string} title music title
83 | * @property {string} artist music artist
84 | * @property {string} id YouTube ID
85 | * @property {string} url YouTube URL
86 | * @property {string} album music album
87 | * @property {Object} duration music duration {seconds, label}
88 | * @property {string} image Cover Art
89 | */
90 |
91 |
92 | /**
93 | * @typedef {Object} MusicResult
94 | * @property {TrackSearchResult} meta music meta
95 | * @property {string} path file path
96 | */
97 |
98 | /**
99 | * Download music with full tag metadata
100 | * @param {string|TrackSearchResult[]} query title of track want to download
101 | * @returns {Promise} filepath of the result
102 | */
103 | static downloadMusic = async (query) => {
104 | try {
105 | const getTrack = Array.isArray(query) ? query : await this.searchTrack(query);
106 | const search = getTrack[0]//await this.searchTrack(query)
107 | const videoInfo = await ytdl.getInfo('https://www.youtube.com/watch?v=' + search.id, { lang: 'id' });
108 | let stream = ytdl(search.id, { filter: 'audioonly', quality: 140 });
109 | let songPath = `./dustbin/${randomBytes(3).toString('hex')}.mp3`
110 | stream.on('error', (err) => console.log(err))
111 |
112 | const file = await new Promise((resolve) => {
113 | ffmpeg(stream)
114 | .audioFrequency(44100)
115 | .audioChannels(2)
116 | .audioBitrate(128)
117 | .audioCodec('libmp3lame')
118 | .audioQuality(5)
119 | .toFormat('mp3')
120 | .save(songPath)
121 | .on('end', () => resolve(songPath))
122 | });
123 | await this.WriteTags(file, { Title: search.title, Artist: search.artist, Image: search.image, Album: search.album, Year: videoInfo.videoDetails.publishDate.split('-')[0] });
124 | return {
125 | meta: search,
126 | path: file,
127 | size: fs.statSync(songPath).size
128 | }
129 | } catch (error) {
130 | throw new Error(error)
131 | }
132 | }
133 |
134 | /**
135 | * get downloadable video urls
136 | * @param {string|URL} query videoID or YouTube URL
137 | * @param {string} quality
138 | * @returns
139 | */
140 | static mp4 = async (query, quality = 134) => {
141 | try {
142 | if (!query) throw new Error('Video ID or YouTube Url is required')
143 | const videoId = this.isYTUrl(query) ? this.getVideoID(query) : query
144 | const videoInfo = await ytdl.getInfo('https://www.youtube.com/watch?v=' + videoId, { lang: 'id' });
145 | const format = ytdl.chooseFormat(videoInfo.formats, { format: quality, filter: 'videoandaudio' })
146 | return {
147 | title: videoInfo.videoDetails.title,
148 | thumb: videoInfo.videoDetails.thumbnails.slice(-1)[0],
149 | date: videoInfo.videoDetails.publishDate,
150 | duration: videoInfo.videoDetails.lengthSeconds,
151 | channel: videoInfo.videoDetails.ownerChannelName,
152 | quality: format.qualityLabel,
153 | contentLength: format.contentLength,
154 | description:videoInfo.videoDetails.description,
155 | videoUrl: format.url
156 | }
157 | } catch (error) {
158 | throw error
159 | }
160 | }
161 |
162 | /**
163 | * Download YouTube to mp3
164 | * @param {string|URL} url YouTube link want to download to mp3
165 | * @param {IMetadata} metadata track metadata
166 | * @param {boolean} autoWriteTags if set true, it will auto write tags meta following the YouTube info
167 | * @returns
168 | */
169 | static mp3 = async (url, metadata = {}, autoWriteTags = false) => {
170 | try {
171 | if (!url) throw new Error('Video ID or YouTube Url is required')
172 | url = this.isYTUrl(url) ? 'https://www.youtube.com/watch?v=' + this.getVideoID(url) : url
173 | const { videoDetails } = await ytdl.getInfo(url, { lang: 'id' });
174 | let stream = ytdl(url, { filter: 'audioonly', quality: 140 });
175 | let songPath = `./${randomBytes(3).toString('hex')}.mp3`
176 |
177 | let starttime;
178 | stream.once('response', () => {
179 | starttime = Date.now();
180 | });
181 | /*
182 | stream.on('progress', (chunkLength, downloaded, total) => {
183 | const percent = downloaded / total;
184 | const downloadedMinutes = (Date.now() - starttime) / 1000 / 60;
185 | const estimatedDownloadTime = (downloadedMinutes / percent) - downloadedMinutes;
186 | readline.cursorTo(process.stdout, 0);
187 | process.stdout.write(`${(percent * 100).toFixed(2)}% downloaded `);
188 | process.stdout.write(`(${(downloaded / 1024 / 1024).toFixed(2)}MB of ${(total / 1024 / 1024).toFixed(2)}MB)\n`);
189 | process.stdout.write(`running for: ${downloadedMinutes.toFixed(2)}minutes`);
190 | process.stdout.write(`, estimated time left: ${estimatedDownloadTime.toFixed(2)}minutes `);
191 | readline.moveCursor(process.stdout, 0, -1);
192 | //let txt = `${bgColor(color('[FFMPEG]]', 'black'), '#38ef7d')} ${color(moment().format('DD/MM/YY HH:mm:ss'), '#A1FFCE')} ${gradient.summer('[Converting..]')} ${gradient.cristal(p.targetSize)} kb`
193 | });*/
194 | stream.on('end', () => process.stdout.write('\n\n'));
195 | stream.on('error', (err) => console.log(err))
196 |
197 | const file = await new Promise((resolve) => {
198 | ffmpeg(stream)
199 | .audioFrequency(44100)
200 | .audioChannels(2)
201 | .audioBitrate(128)
202 | .audioCodec('libmp3lame')
203 | .audioQuality(5)
204 | .toFormat('mp3')
205 | .save(songPath)
206 | .on('end', () => {
207 | resolve(songPath)
208 | })
209 | });
210 | if (Object.keys(metadata).length !== 0) {
211 | await this.WriteTags(file, metadata)
212 | }
213 | if (autoWriteTags) {
214 | await this.WriteTags(file, { Title: videoDetails.title, Album: videoDetails.author.name, Year: videoDetails.publishDate.split('-')[0], Image: videoDetails.thumbnails.slice(-1)[0].url })
215 | }
216 | return {
217 | meta: {
218 | title: videoDetails.title,
219 | channel: videoDetails.author.name,
220 | seconds: videoDetails.lengthSeconds,
221 | description:videoDetails.description,
222 | image: videoDetails.thumbnails.slice(-1)[0].url
223 | },
224 | path: file,
225 | size: fs.statSync(songPath).size
226 | }
227 | } catch (error) {
228 | throw error
229 | }
230 | }
231 | }
232 |
233 | module.exports = YT;
234 |
--------------------------------------------------------------------------------
/commandes/rank.js:
--------------------------------------------------------------------------------
1 | const {Hamza} = require("../TalkDrove/Hamza");
2 | const conf = require("../set");
3 | const {getMessagesAndXPByJID,getBottom10Users} = require("../bdd/level");
4 |
5 |
6 | function get_level_exp(xp) {
7 | const levelThresholds = [
8 | { level: 1, xpThreshold: 500 },
9 | { level: 2, xpThreshold: 1000 },
10 | { level: 3, xpThreshold: 2000 },
11 | { level: 4, xpThreshold: 4000 },
12 | { level: 5, xpThreshold: 7000 },
13 | { level: 6, xpThreshold: 10000 },
14 | { level: 7, xpThreshold: 15000 },
15 | { level: 8, xpThreshold: 20000},
16 | { level: 9, xpThreshold: 25000},
17 | { level: 10, xpThreshold: 30000},
18 | { level: 11, xpThreshold: 35000},
19 | { level: 12, xpThreshold: 45000},
20 | { level: 13, xpThreshold: 55000},
21 | { level: 14, xpThreshold: 65000},
22 | { level: 15, xpThreshold: 75000},
23 | { level: 16, xpThreshold: 90000},
24 | { level: 17, xpThreshold: 105000},
25 | { level: 18, xpThreshold: 120000},
26 | { level: 19, xpThreshold: 135000},
27 | { level: 20, xpThreshold: 150000},
28 | { level: 21, xpThreshold: 170000},
29 | { level: 22, xpThreshold: 190000},
30 | { level: 23, xpThreshold: 210000},
31 | { level: 24, xpThreshold: 230000},
32 | { level: 25, xpThreshold: 255000},
33 | { level: 26, xpThreshold: 270000},
34 | { level: 27, xpThreshold: 295000},
35 | { level: 28, xpThreshold: 320000},
36 | { level: 29, xpThreshold: 345000},
37 | { level: 30, xpThreshold: 385000},
38 | { level: 31, xpThreshold: 425000},
39 | { level: 32, xpThreshold: 465000},
40 | { level: 33, xpThreshold: 505000},
41 | { level: 34, xpThreshold: 545000},
42 | { level: 35, xpThreshold: 590000},
43 | { level: 36, xpThreshold: 635000},
44 | { level: 37, xpThreshold: 680000},
45 | { level: 38, xpThreshold: 725000},
46 | { level: 39, xpThreshold: 770000},
47 | { level: 40, xpThreshold: 820000},
48 | { level: 41, xpThreshold: 870000},
49 | { level: 42, xpThreshold: 920000},
50 | { level: 43, xpThreshold: 970000},
51 | { level: 44, xpThreshold: 1020000},
52 | { level: 45, xpThreshold: 1075000},
53 | { level: 46, xpThreshold: 1130000},
54 | { level: 47, xpThreshold: 1185000},
55 | { level: 48, xpThreshold: 1240000},
56 | { level: 49, xpThreshold: 1295000},
57 | { level: 'Zk-GOD', xpThreshold: 2000000}
58 | ];
59 |
60 | let level = 0;
61 | let exp = xp;
62 | let xplimit = levelThresholds[level].xpThreshold;
63 |
64 | for (let i = 0; i < levelThresholds.length; i++) {
65 | if (xp >= levelThresholds[i].xpThreshold) {
66 | level = levelThresholds[i].level;
67 | xplimit = levelThresholds[i + 1]?.xpThreshold || 'No-limit';
68 | exp = xp - levelThresholds[i].xpThreshold;
69 | } else {
70 | break;
71 | }
72 | }
73 |
74 | return {
75 | level: level,
76 | xplimit: xplimit,
77 | exp: exp
78 | };
79 | }
80 |
81 | module.exports = {
82 | get_level_exp,
83 | } ;
84 |
85 | Hamza( {
86 | nomCom : "rank",
87 | categorie : "Fun",
88 | },
89 | async(dest,zk, commandeOptions)=> {
90 |
91 | const {ms , arg, repondre,auteurMessage,nomAuteurMessage, msgRepondu , auteurMsgRepondu , mybotpic} = commandeOptions ;
92 |
93 | if (msgRepondu) {
94 |
95 | try {
96 |
97 | let rank = await getMessagesAndXPByJID(auteurMsgRepondu) ;
98 |
99 | const data = await get_level_exp(rank.xp)
100 | let ppuser ;
101 |
102 |
103 | try {
104 | ppuser = await zk.profilePictureUrl(auteurMsgRepondu , 'image') ;
105 | } catch {
106 | ppuser = mybotpic()
107 | } ;
108 |
109 |
110 | let role ;
111 |
112 | if (data.level < 5) {
113 | role = 'baby'
114 | } else if (data.level >= 5 || data.level < 10) {
115 | role = 'kid-Ninja'
116 | } else if ( data.level >= 10 || data.level < 15 ) {
117 | role = 'Ninja-genin'
118 | } else if ( data.level >= 15 || data.level < 20 ) {
119 | role = 'Ninja-chunin'
120 | } else if ( data.level >= 20 || data.level < 25 ) {
121 | role = 'Ninja-jonin'
122 | } else if ( data.level >= 25 || data.level < 30 ) {
123 | role = 'ANBU'
124 | } else if ( data.level >= 30 || data.level < 35 ) {
125 | role = 'strong ninja'
126 | } else if ( data.level >= 35 || data.level < 40 ) {
127 | role = 'kage'
128 | } else if ( data.level >= 40 || data.level < 45 ) {
129 | role = 'Hermit seinin'
130 | } else if ( data.level >= 45 || data.level < 50 ) {
131 | role = 'Otsusuki'
132 | } else {
133 | role = 'GOD'
134 | }
135 |
136 |
137 | let msg = `
138 | ┏━━━┛ BYTE-MD Ranking┗━━━┓
139 |
140 | *Name :* @${auteurMsgRepondu.split("@")[0]}
141 |
142 | *Level :* ${data.level}
143 |
144 | *EXP :* ${data.exp}/${data.xplimit}
145 |
146 | *Role :* ${role}
147 |
148 | *Messages :* ${rank.messages}
149 |
150 | ┕━✿━┑ ┍━✿━┙`
151 |
152 | zk.sendMessage(
153 | dest,
154 | {
155 | image : {url : ppuser},
156 | caption : msg,
157 | mentions : [auteurMsgRepondu]
158 | },
159 | {quoted : ms}
160 | )
161 |
162 |
163 | } catch (error) {
164 | repondre(error)
165 | }
166 | } else {
167 |
168 |
169 | try {
170 |
171 | let jid = auteurMessage ;
172 |
173 | let rang = await getMessagesAndXPByJID(jid) ;
174 |
175 | const data = get_level_exp(rang.xp)
176 | let ppuser ;
177 |
178 |
179 | try {
180 | ppuser = await zk.profilePictureUrl(jid, 'image') ;
181 | } catch {
182 | ppuser = mybotpic()
183 | } ;
184 |
185 |
186 | let role ;
187 |
188 | if (data.level < 5) {
189 | role = 'Nouveau né(e)'
190 | } else if (data.level >= 5 || data.level < 10) {
191 | role = 'kid-Ninja'
192 | } else if ( data.level >= 10 || data.level < 15 ) {
193 | role = 'Ninja-genin'
194 | } else if ( data.level >= 15 || data.level < 20 ) {
195 | role = 'Ninja-chunin'
196 | } else if ( data.level >= 20 || data.level < 25 ) {
197 | role = 'Ninja-jonin'
198 | } else if ( data.level >= 25 || data.level < 30 ) {
199 | role = 'ANBU'
200 | } else if ( data.level >= 30 || data.level < 35 ) {
201 | role = 'strong ninja'
202 | } else if ( data.level >= 35 || data.level < 40 ) {
203 | role = 'kage'
204 | } else if ( data.level >= 40 || data.level < 45 ) {
205 | role = 'Hermit seinin'
206 | } else if ( data.level >= 45 || data.level < 50 ) {
207 | role = 'Otsusuki'
208 | } else {
209 | role = 'level-GOD'
210 | }
211 |
212 |
213 | let msg = `
214 | ┏━━━┛ BYTE-MD Ranking ┗━━━┓
215 |
216 | *Name :* ${nomAuteurMessage}
217 |
218 | *Level :* ${data.level}
219 |
220 | *EXP :* ${data.exp}/${data.xplimit}
221 |
222 | *Role :* ${role}
223 |
224 | *Messages :* ${rang.messages}
225 |
226 | ┕━✿━┑ ┍━✿━┙`
227 |
228 | zk.sendMessage(
229 | dest,
230 | {
231 | image : {url : ppuser},
232 | caption : msg
233 | },
234 | {quoted : ms}
235 | )
236 |
237 | } catch (error) {
238 | repondre(error)
239 | }
240 |
241 | }
242 |
243 |
244 | }) ;
245 |
246 | Hamza( {
247 | nomCom : "toprank",
248 | categorie : "Fun",
249 | },
250 | async(dest,zk, commandeOptions)=> {
251 |
252 | const {ms , arg, repondre,auteurMessage,nomAuteurMessage, msgRepondu , auteurMsgRepondu , mybotpic} = commandeOptions ;
253 |
254 |
255 | let msg = `┏━━┛ BYTE-MD-top-rang ┗━━┓\n\n`
256 |
257 | let topRanks = await getBottom10Users() ;
258 | let mention = [] ;
259 | for (const rank of topRanks ) {
260 |
261 | const data = await get_level_exp(rank.xp) ;
262 |
263 | let role ;
264 |
265 | if (data.level < 5) {
266 | role = 'Nouveau né(e)'
267 | } else if (data.level >= 5 || data.level < 10) {
268 | role = 'kid ninja'
269 | } else if ( data.level >= 10 || data.level < 15 ) {
270 | role = 'Ninja-genin'
271 | } else if ( data.level >= 15 || data.level < 20 ) {
272 | role = 'Ninja-chunin'
273 | } else if ( data.level >= 20 || data.level < 25 ) {
274 | role = 'Ninja-jonin'
275 | } else if ( data.level >= 25 || data.level < 30 ) {
276 | role = 'ANBU'
277 | } else if ( data.level >= 30 || data.level < 35 ) {
278 | role = 'strong ninja'
279 | } else if ( data.level >= 35 || data.level < 40 ) {
280 | role = 'kage'
281 | } else if ( data.level >= 40 || data.level < 45 ) {
282 | role = 'Hermit seinin'
283 | } else if ( data.level >= 45 || data.level < 50 ) {
284 | role = 'Otsusuki'
285 | } else {
286 | role = 'level-GOD'
287 | }
288 | msg += `-----------------------
289 |
290 | *Name :* @${rank.jid.split("@")[0]}
291 | *Level :* ${data.level}
292 | *Role :* ${role}\n` ;
293 |
294 | mention.push(rank.jid) ;
295 | }
296 |
297 | zk.sendMessage(dest,
298 | {
299 | image : { url : mybotpic() },
300 | caption : msg,
301 | mentions : mention
302 | },
303 | {quoted : ms})
304 |
305 |
306 | })
307 |
308 |
309 |
310 |
311 |
--------------------------------------------------------------------------------