process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'; import './config.js'; import { createRequire } from "module"; import path, { join } from 'path'; import { fileURLToPath, pathToFileURL } from 'url'; import { platform } from 'process';

global.__filename = function filename(pathURL = import.meta.url, rmPrefix = platform !== 'win32') { return rmPrefix ? /file:////.test(pathURL) ? fileURLToPath(pathURL) : pathURL : pathToFileURL(pathURL).toString(); };

global.__dirname = function dirname(pathURL) { return path.dirname(global.__filename(pathURL, true)); };

global.__require = function require(dir = import.meta.url) { return createRequire(dir); };

import * as ws from 'ws'; import { readdirSync, statSync, unlinkSync, existsSync, readFileSync, watch } from 'fs'; import yargs from 'yargs'; import { spawn } from 'child_process'; import lodash from 'lodash'; import syntaxerror from 'syntax-error'; import { tmpdir } from 'os'; import { format } from 'util'; import { makeWASocket, protoType, serialize } from './lib/simple.js'; import { Low, JSONFile } from 'lowdb'; import pino from 'pino'; import { mongoDB, mongoDBV2 } from './lib/mongoDB.js';

const { useMultiFileAuthState, DisconnectReason, fetchLatestBaileysVersion } = await import('@adiwajshing/baileys');

const { CONNECTING } = ws; const { chain } = lodash; const PORT = process.env.PORT || process.env.SERVER_PORT || 3000;

protoType(); serialize();

global.API = (name, path = '/', query = {}, apikeyqueryname) => { return (name in global.APIs ? global.APIs[name] : name) + path + (query || apikeyqueryname ? '?' + new URLSearchParams(Object.entries({ ...query, ...(apikeyqueryname ? { [apikeyqueryname]: global.APIKeys[name in global.APIs ? global.APIs[name] : name] } : {}) })) : ''); };

global.prefix = new RegExp('^[' + (opts['prefix'] || '/!'));

global.timestamp = { start: new Date };

const __dirname = global.__dirname(import.meta.url); global.opts = new Object(yargs(process.argv.slice(2)).exitProcess(false).parse());

// Add the following code to notify all groups and the owner number when the bot is online const wss = new ws.Server({ port: PORT }); wss.on('listening', () => { console.log('Bot is online'); // Send message to all groups wss.clients.forEach(client => { client.send('Bot is online'); }); // Send message to owner number const ownerNumber = '1234567890'; // Replace with the actual owner number wss.clients.forEach(client => { if (client.number === ownerNumber) { client.send('Bot is online'); } }); }); wss.on('connection', (client) => { console.log('Client connected'); client.on('message', (message) => { console.log('Received message:', message); }); client.on('close', () => { console.log('Client disconnected'); }); });

rubahlah dan tambahkan code javascript pada code dibawah ini ketika bot online maka bot akan memberi tahu ke semua group dan nomor owner bahwa dia onlineprocessenvNODE_TLS_REJECT_UNAUTHORIZED = 0;impo

原文地址: https://www.cveoy.top/t/topic/i7Ny 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录