Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
const {
default: makeWASocket,
useMultiFileAuthState,
downloadContentFromMessage
} = require("@whiskeysockets/baileys");
const { OpenAI } = require("openai");
const { GoogleGenerativeAI } = require("@google/generative-ai");
const qrcode = require("qrcode-terminal");
const fs = require('fs');
const axios = require('axios');
const { exec } = require("child_process");
const path = require("path");
const pino = require('pino');
// ==========================================
// ⚙️ CONFIGURATION
// ==========================================
const OPENAI_KEY = 'YOUR_OPENAI_API_KEY';
const GEMINI_KEY = 'YOUR_GEMINI_API_KEY';
const WEATHER_KEY = 'YOUR_OPENWEATHER_KEY';
const botName = 'NOXM-MD';
const prefix = '.';
const openai = new OpenAI({ apiKey: OPENAI_KEY });
const genAI = new GoogleGenerativeAI(GEMINI_KEY);
if (!fs.existsSync('./tmp')) fs.mkdirSync('./tmp');
const pointDb = './tmp/points.json';
if (!fs.existsSync(pointDb)) fs.writeFileSync(pointDb, JSON.stringify({}));
// ==========================================
// 🛠️ HELPER FUNCTIONS
// ==========================================
function addPoints(userId, amount) {
let data = JSON.parse(fs.readFileSync(pointDb));
data[userId] = (data[userId] || 0) + amount;
fs.writeFileSync(pointDb, JSON.stringify(data));
return data[userId];
}
const getRandom = (ext) =>
${Math.floor(Math.random() * 10000)}${ext};async function imageToWebp(media) {
const tmpIn = path.join(__dirname,
./tmp/${getRandom('.jpg')});const tmpOut = path.join(__dirname,
./tmp/${getRandom('.webp')});fs.writeFileSync(tmpIn, media);
await new Promise((res, rej) => {
exec(
ffmpeg -i ${tmpIn} -vcodec libwebp -filter:v fps=fps=20 -lossless 1 -loop 0 -preset default -an -vsync 0 -s 512:512 ${tmpOut}, (err) => {if (err) rej(err); res();
});
});
const buff = fs.readFileSync(tmpOut);
fs.unlinkSync(tmpIn); fs.unlinkSync(tmpOut);
return buff;
}
// ==========================================
// 🚀 START BOT
// ==========================================
async function startNoxm() {
const { state, saveCreds } = await useMultiFileAuthState('session_noxm');
const sock = makeWASocket({
auth: state,
printQRInTerminal: true,
logger: pino({ level: 'silent' }),
browser: [botName, 'iOS', '1.0.0']
});
│ 👤 User: @${sender.split('@')[0]}
│ 💰 Points: ${myP}
│
│ 🤖 ᴍᴜʟᴛɪ-ᴀɪ ᴇɴɢɪɴᴇ
│ ‣ .gpt | .gemini | .meta | .kling
│
│ 🧠 ᴇᴅᴜ-ᴀɪ (ᴀᴜᴛᴏ-ʟᴀɴɢ)
│ ‣ Chat directly for AI Tutor
│ ‣ .tr [lang] | .wiki | .brainly
│
│ 🔍 sᴇᴀʀᴄʜ ғᴇᴀᴛᴜʀᴇs
│ ‣ .google | .yts | .pin 📌
│
│ 🎮 ɢᴀᴍᴇs (ᴇᴀʀɴ ᴘᴏɪɴᴛs)
│ ‣ .tambang | .polisi | .suit
│ ‣ .tebakbendera | .tebaknegara
│
│ 🎨 ᴄʀᴇᴀᴛɪᴠᴇ & sᴛɪᴄᴋᴇʀ
│ ‣ .brat | .sticker | .genimage | .toimg
│
│ 📥 ᴅᴏᴡɴʟᴏᴀᴅᴇʀ
│ ‣ .play | .ytmp4 | .tiktok | .ig
│
│ 🕋 ʀᴇʟɪɢɪᴏɴ
│ ‣ .sholat | .bible | .quotes
│
│ 🌐 ᴜᴛɪʟs & ᴀᴅᴍɪɴ
│ ‣ .weather | .poll | .tagall
│ ‣ .forward | .points | .del
│
╰──────────────────────────`;
await sock.sendMessage(from, { text: menu, mentions: [sender] });
break;
}
startNoxm();