0% found this document useful (0 votes)
11 views14 pages

Lastforthinkwithsame

Uploaded by

langzytzy009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views14 pages

Lastforthinkwithsame

Uploaded by

langzytzy009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 14

// Import necessary modules

require('./config');
const {
default: ryoroykoConnect, makeWASocket, useMultiFileAuthState,
DisryoroykoectReason, fetchLatestBaileysVersion,
generateForwardMessageContent, prepareWAMessageMedia,
generateWAMessageFromContent,
generateMessageID, downloadContentFromMessage, makeInMemoryStore, jidDecode,
proto,
DisconnectReason, getAggregateVotesInPollMessage
} = require("@whiskeysockets/baileys")
const pino = require('pino')
const chalk = require('chalk')
const { Boom } = require('@hapi/boom')
const fs = require('fs')
const FileType = require('file-type')
const path = require('path')
const figlet = require('figlet')
const _ = require('lodash')
const PhoneNumber = require('awesome-phonenumber')
const { spawn } = require('child_process')
const colors = require('@colors/colors/safe')
const CFonts = require('cfonts')
const { say } = require('cfonts')
const moment = require('moment-timezone')
const readline = require("readline")
const yargs = require('yargs/yargs')
const NodeCache = require("node-cache")
var low
try {
low = require('lowdb')
} catch (e) {
low = require('./lib/lowdb')
}

const { Low, JSONFile } = low


const mongoDB = require('./lib/mongoDB')

const { imageToWebp, videoToWebp, writeExifImg, writeExifVid } =


require('./lib/exif');
const { smsg, isUrl, generateMessageTag, getBuffer, getSizeMedia, fetchJson,
sleep } = require('./lib/myfunction');

const { color } = require('./lib/color');

const usePairingCode = global.connect;

// warna sempak bapak kau


const listcolor = ['red', 'blue', 'magenta'];
const randomcolor = listcolor[Math.floor(Math.random() * listcolor.length)];

//Puki
const question = (text) => {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

return new Promise((resolve) => {


rl.question(color(text, randomcolor), (answer) => {
resolve(answer);
rl.close();
});
});
};

async function ryoroykoStart() {


const store = makeInMemoryStore({ logger: pino().child({ level: 'silent', stream:
'store' }) });
const { state, saveCreds } = await useMultiFileAuthState(`./$
{global.sessionName}`);
const { version, isLatest } = await fetchLatestBaileysVersion();
const resolveMsgBuffer = new NodeCache()

const ryoroyko = ryoroykoConnect({


isLatest,
keepAliveIntervalMs: 50000,
printQRInTerminal: !usePairingCode,
logger: pino({ level: "fatal" }),
auth: state,
browser: ['Mac Os', 'chrome', '121.0.6167.159'],
version: [2, 2413, 1],
generateHighQualityLinkPreview: true,
resolveMsgBuffer,
})

if (usePairingCode && !ryoroyko.authState.creds.registered) {


say(`ZxV\nV4\n`, {
font: 'block',
align: 'center',
gradient: [randomcolor, randomcolor]
})

say(`Create By TheFraszBoxyGen\nYOUTUBE : TheFraszBoxyGen\nTelegram : Fraszzz09\


nInstagram : hagiii09`, {
font: 'console',
align: 'center',
gradient: [randomcolor, randomcolor]
})
const phoneNumber = await question(`<!> MASUKAN NOMOR TELPON DENGAN BERAWALAN
KODE NEGARA (JANGAN GUNAKAN 0) ✓ \n<✓ > EXAMPLE : 628981609354\n <+> NOMOR LU : `);
// Request and display the pairing code
const code = await ryoroyko.requestPairingCode(phoneNumber.trim());
console.log(color(`[ # ] enter that code into WhatsApp, motherfucker : ${code}`,
`${randomcolor}`));
}

// Status
ryoroyko.public = true

global.opts = new Object(yargs(process.argv.slice(2)).exitProcess(false).parse())


global.db = new Low(
/https?:\/\//.test(opts['db'] || '') ?
new cloudDBAdapter(opts['db']) : /mongodb/.test(opts['db']) ?
new mongoDB(opts['db']) :
new JSONFile(`./dtbs/database.json`)
)
global.DATABASE = global.db // Backwards Compatibility
global.loadDatabase = async function loadDatabase() {
if (global.db.READ) return new Promise((resolve) => setInterval(function () { (!
global.db.READ ? (clearInterval(this), resolve(global.db.data == null ?
global.loadDatabase() : global.db.data)) : null) }, 1 * 1000))
if (global.db.data !== null) return
global.db.READ = true
await global.db.read()
global.db.READ = false
global.db.data = {
users: {},
chats: {},
game: {},
database: {},
settings: {},
setting: {},
others: {},
sticker: {},
...(global.db.data || {})}
global.db.chain = _.chain(global.db.data)}
loadDatabase()

if (global.db) setInterval(async () => {


if (global.db.data) await global.db.write()
}, 30 * 1000)

ryoroyko.decodeJid = (jid) => {


if (!jid) return jid;
if (/:\d+@/gi.test(jid)) {
let decode = jidDecode(jid) || {};
return decode.user && decode.server && decode.user + '@' + decode.server ||
jid;
} else return jid;
};

ryoroyko.ev.on('contacts.update', update => {


for (let contact of update) {
let id = ryoroyko.decodeJid(contact.id);
if (store && store.contacts) store.contacts[id] = { id, name:
contact.notify };
}
});

ryoroyko.setStatus = (status) => {


ryoroyko.query({
tag: 'iq',
attrs: {
to: '@s.whatsapp.net',
type: 'set',
xmlns: 'status',
},
content: [{
tag: 'status',
attrs: {},
content: Buffer.from(status, 'utf-8')
}]
});
return status;
};
ryoroyko.getName = (jid, withoutContact = false) => {
id = ryoroyko.decodeJid(jid)
withoutContact = ryoroyko.withoutContact || withoutContact
let v
if (id.endsWith("@g.us")) return new Promise(async (resolve) => {
v = store.contacts[id] || {}
if (!(v.name || v.subject)) v = ryoroyko.groupMetadata(id) || {}
resolve(v.name || v.subject || PhoneNumber('+' +
id.replace('@s.whatsapp.net', '')).getNumber('international'))
})
else v = id === '0@s.whatsapp.net' ? {
id,
name: 'WhatsApp'
} : id === ryoroyko.decodeJid(ryoroyko.user.id) ?
ryoroyko.user :
(store.contacts[id] || {})
return (withoutContact ? '' : v.name) || v.subject || v.verifiedName ||
PhoneNumber('+' + jid.replace('@s.whatsapp.net', '')).getNumber('international')
}

ryoroyko.sendContact = async (jid, kon, quoted = '', opts = {}) => {


let list = []
for (let i of kon) {
list.push({
displayName: await vision.getName(i),
vcard: `BEGIN:VCARD\nVERSION:3.0\nN:${await ryoroyko.getName(i)}\nFN:$
{await ryoroyko.getName(i)}\nitem1.TEL;waid=${i.split('@')[0]}:${i.split('@')[0]}\
nitem1.X-ABLabel:Ponsel\nEND:VCARD`
})
}
ryoroyko.sendMessage(jid, { contacts: { displayName: `${list.length} Kontak`,
contacts: list }, ...opts }, { quoted })
}

ryoroyko.serializeM = (m) => smsg(ryoroyko, m, store);

ryoroyko.ev.on('connection.update', async (update) => {


const {
connection,
lastDisconnect
} = update
try {
if (connection === 'close') {
let reason = new Boom(lastDisconnect?.error)?.output.statusCode
if (reason === DisconnectReason.badSession) {
console.log(`Bad Session File, Please Delete Session and Scan
Again`);
ryoroyko()
} else if (reason === DisconnectReason.connectionClosed) {
console.log("Connection closed, reconnecting....");
ryoroykoStart();
} else if (reason === DisconnectReason.connectionLost) {
console.log("Connection Lost from Server, reconnecting...");
ryoroykoStart();
} else if (reason === DisconnectReason.connectionReplaced) {
console.log("Connection Replaced, Another New Session Opened,
Please Close Current Session First");
ryoroyko()
} else if (reason === DisconnectReason.loggedOut) {
console.log(`Device Logged Out, Please Scan Again And Run.`);
ryoroykoStart();
} else if (reason === DisconnectReason.restartRequired) {
console.log("Restart Required, Restarting...");
ryoroykoStart();
} else if (reason === DisconnectReason.timedOut) {
console.log("Connection TimedOut, Reconnecting...");
ryoroykoStart();
} else ryoroyko.end(`Unknown DisconnectReason: ${reason}|$
{connection}`)
}
if (update.connection == "connecting" ||
update.receivedPendingNotifications == "false") {
console.log(color(`Mengkoneksikan`,`${randomcolor}`)) //Console-1
}

if (update.connection == "open" || update.receivedPendingNotifications


== "true") {
say(`ZxV\nV4\n`, {
font: 'block',
align: 'center',
gradient: [randomcolor, randomcolor]
})
say(`Create By Thezetetsuboxygen\nYOUTUBE : Thezetetsuboxygen\nTelegram :
ygen_good\nInstagram : ryo.r0yko`, {
font: 'console',
align: 'center',
gradient: [randomcolor, randomcolor]
})

await sleep(30000)
ryoroyko.sendMessage(`628981609354@s.whatsapp.net`, { text: `❗?BOT BERHASIL
CONNECT

Don't resell this script, because that will cause the bugs to be fixed quickly

By using this script, you acknowledge and agree that the use of this script is
entirely at your own risk. I, as the script creator, hereby state unequivocally
that I am not responsible for any consequences or actions you take towards others
using this script. Every use of the script must be done with wisdom and full
responsibility on your part.

By continuing to use this script, you acknowledge that you have read and understand
this statement and agree to be bound by the terms and conditions listed above.`})
}

} catch (err) {
console.log('Error Di Connection.update ' + err);
ryoroykoStart()
}

})

ryoroyko.ev.on('messages.update', async chatUpdate => {


for(const { key, update } of chatUpdate) {
if(update.pollUpdates && key.fromMe) {
const pollCreation = await getMessage(key)
if(pollCreation) {
const pollUpdate = await
getAggregateVotesInPollMessage({
message: pollCreation,
pollUpdates: update.pollUpdates,
})
var toCmd = pollUpdate.filter(v => v.voters.length !== 0)
[0]?.name
if (toCmd == undefined) return
var prefCmd = prefix+toCmd
ryoroyko.appenTextMessage(prefCmd, chatUpdate)
}
}
}
})

/**
*
* @param {*} jid
* @param {*} url
* @param {*} caption
* @param {*} quoted
* @param {*} options
*/
ryoroyko.sendFileUrl = async (jid, url, caption, quoted, options = {}) => {
let mime = '';
let res = await axios.head(url)
mime = res.headers['content-type']
if (mime.split("/")[1] === "gif") {
return ryoroyko.sendMessage(jid, { video: await getBuffer(url), caption:
caption, gifPlayback: true, ...options}, { quoted: quoted, ...options})
}
let type = mime.split("/")[0]+"Message"
if(mime === "application/pdf"){
return ryoroyko.sendMessage(jid, { document: await getBuffer(url), mimetype:
'application/pdf', caption: caption, ...options}, { quoted: quoted, ...options })
}
if(mime.split("/")[0] === "image"){
return ryoroyko.sendMessage(jid, { image: await getBuffer(url), caption:
caption, ...options}, { quoted: quoted, ...options})
}
if(mime.split("/")[0] === "video"){
return ryoroyko.sendMessage(jid, { video: await getBuffer(url), caption:
caption, mimetype: 'video/mp4', ...options}, { quoted: quoted, ...options })
}
if(mime.split("/")[0] === "audio"){
return ryoroyko.sendMessage(jid, { audio: await getBuffer(url), caption:
caption, mimetype: 'audio/mpeg', ...options}, { quoted: quoted, ...options })
}
}

/**
*
* @param {*} jid
* @param {*} name
* @param [*] values
* @returns
*/
ryoroyko.sendPoll = (jid, name = '', values = [], selectableCount = 1) =>
{ return ryoroyko.sendMessage(jid, { poll: { name, values, selectableCount }}) }
/**
*
* @param {*} jid
* @param {*} text
* @param {*} quoted
* @param {*} options
* @returns
*/
ryoroyko.sendText = (jid, text, quoted = '', options) =>
ryoroyko.sendMessage(jid, { text: text, ...options }, { quoted, ...options })

/**
*
* @param {*} jid
* @param {*} path
* @param {*} caption
* @param {*} quoted
* @param {*} options
* @returns
*/
ryoroyko.sendImage = async (jid, path, caption = '', quoted = '', options) => {
let buffer = Buffer.isBuffer(path) ? path :
/^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,`[1], 'base64') :
/^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ?
fs.readFileSync(path) : Buffer.alloc(0)
return await ryoroyko.sendMessage(jid, { image: buffer, caption:
caption, ...options }, { quoted })
}

/**
*
* @param {*} jid
* @param {*} path
* @param {*} caption
* @param {*} quoted
* @param {*} options
* @returns
*/
ryoroyko.sendVideo = async (jid, path, caption = '', quoted = '', gif = false,
options) => {
let buffer = Buffer.isBuffer(path) ? path :
/^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,`[1], 'base64') :
/^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ?
fs.readFileSync(path) : Buffer.alloc(0)
return await ryoroyko.sendMessage(jid, { video: buffer, caption: caption,
gifPlayback: gif, ...options }, { quoted })
}

/**
*
* @param {*} jid
* @param {*} path
* @param {*} quoted
* @param {*} mime
* @param {*} options
* @returns
*/
ryoroyko.sendAudio = async (jid, path, quoted = '', ptt = false, options) => {
let buffer = Buffer.isBuffer(path) ? path :
/^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,`[1], 'base64') :
/^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ?
fs.readFileSync(path) : Buffer.alloc(0)
return await ryoroyko.sendMessage(jid, { audio: buffer, ptt:
ptt, ...options }, { quoted })
}

/**
*
* @param {*} jid
* @param {*} text
* @param {*} quoted
* @param {*} options
* @returns
*/
ryoroyko.sendTextWithMentions = async (jid, text, quoted, options = {}) =>
ryoroyko.sendMessage(jid, { text: text, mentions:
[...text.matchAll(/@(\d{0,16})/g)].map(v => v[1] +
'@s.whatsapp.net'), ...options }, { quoted })

/**
*
* @param {*} jid
* @param {*} path
* @param {*} quoted
* @param {*} options
* @returns
*/
ryoroyko.sendImageAsSticker = async (jid, path, quoted, options = {}) => {
let buff = Buffer.isBuffer(path) ? path :
/^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,`[1], 'base64') :
/^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ?
fs.readFileSync(path) : Buffer.alloc(0)
let buffer
if (options && (options.packname || options.author)) {
buffer = await writeExifImg(buff, options)
} else {
buffer = await imageToWebp(buff)
}

await ryoroyko.sendMessage(jid, { sticker: { url: buffer }, ...options }, {


quoted })
return buffer
}

/**
*
* @param {*} jid
* @param {*} path
* @param {*} quoted
* @param {*} options
* @returns
*/
ryoroyko.sendVideoAsSticker = async (jid, path, quoted, options = {}) => {
let buff = Buffer.isBuffer(path) ? path :
/^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,`[1], 'base64') :
/^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ?
fs.readFileSync(path) : Buffer.alloc(0)
let buffer
if (options && (options.packname || options.author)) {
buffer = await writeExifVid(buff, options)
} else {
buffer = await videoToWebp(buff)
}

await ryoroyko.sendMessage(jid, { sticker: { url: buffer }, ...options }, {


quoted })
return buffer
}

/**
*
* @param {*} message
* @param {*} filename
* @param {*} attachExtension
* @returns
*/
ryoroyko.downloadAndSaveMediaMessage = async (message, filename,
attachExtension = true) => {
let quoted = message.msg ? message.msg : message
let mime = (message.msg || message).mimetype || ''
let messageType = message.mtype ? message.mtype.replace(/Message/gi, '') :
mime.split('/')[0]
const stream = await downloadContentFromMessage(quoted, messageType)
let buffer = Buffer.from([])
for await(const chunk of stream) {
buffer = Buffer.concat([buffer, chunk])
}
let type = await FileType.fromBuffer(buffer)
trueFileName = attachExtension ? (filename + '.' + type.ext) : filename
// save to file
await fs.writeFileSync(trueFileName, buffer)
return trueFileName
}

ryoroyko.downloadMediaMessage = async (message) => {


let mime = (message.msg || message).mimetype || ''
let messageType = message.mtype ? message.mtype.replace(/Message/gi, '') :
mime.split('/')[0]
const stream = await downloadContentFromMessage(message, messageType)
let buffer = Buffer.from([])
for await(const chunk of stream) {
buffer = Buffer.concat([buffer, chunk])
}

return buffer
}

/**
*
* @param {*} jid
* @param {*} path
* @param {*} filename
* @param {*} caption
* @param {*} quoted
* @param {*} options
* @returns
*/
ryoroyko.sendMedia = async (jid, path, fileName = '', caption = '', quoted =
'', options = {}) => {
let types = await ryoroyko.getFile(path, true)
let { mime, ext, res, data, filename } = types
if (res && res.status !== 200 || file.length <= 65536) {
try { throw { json: JSON.parse(file.toString()) } }
catch (e) { if (e.json) throw e.json }
}
let type = '', mimetype = mime, pathFile = filename
if (options.asDocument) type = 'document'
if (options.asSticker || /webp/.test(mime)) {
let { writeExif } = require('./lib/exif')
let media = { mimetype: mime, data }
pathFile = await writeExif(media, { packname: options.packname ?
options.packname : global.packname, author: options.author ? options.author :
global.author, categories: options.categories ? options.categories : [] })
await fs.promises.unlink(filename)
type = 'sticker'
mimetype = 'image/webp'
}
else if (/image/.test(mime)) type = 'image'
else if (/video/.test(mime)) type = 'video'
else if (/audio/.test(mime)) type = 'audio'
else type = 'document'
await ryoroyko.sendMessage(jid, { [type]: { url: pathFile }, caption,
mimetype, fileName, ...options }, { quoted, ...options })
return fs.promises.unlink(pathFile)
}

/**
*
* @param {*} jid
* @param {*} message
* @param {*} forceForward
* @param {*} options
* @returns
*/
ryoroyko.copyNForward = async (jid, message, forceForward = false, options =
{}) => {
let vtype
if (options.readViewOnce) {
message.message = message.message &&
message.message.ephemeralMessage && message.message.ephemeralMessage.message ?
message.message.ephemeralMessage.message : (message.message || undefined)
vtype = Object.keys(message.message.viewOnceMessage.message)[0]
delete(message.message && message.message.ignore ?
message.message.ignore : (message.message || undefined))
delete message.message.viewOnceMessage.message[vtype].viewOnce
message.message = {
...message.message.viewOnceMessage.message
}
}

let mtype = Object.keys(message.message)[0]


let content = await generateForwardMessageContent(message, forceForward)
let ctype = Object.keys(content)[0]
let context = {}
if (mtype != "conversation") context = message.message[mtype].contextInfo
content[ctype].contextInfo = {
...context,
...content[ctype].contextInfo
}
const waMessage = await generateWAMessageFromContent(jid, content,
options ? {
...content[ctype],
...options,
...(options.contextInfo ? {
contextInfo: {
...content[ctype].contextInfo,
...options.contextInfo
}
} : {})
} : {})
await ryoroyko.relayMessage(jid, waMessage.message, { messageId:
waMessage.key.id })
return waMessage
}

ryoroyko.cMod = (jid, copy, text = '', sender = ryoroyko.user.id, options = {})


=> {
//let copy = message.toJSON()
let mtype = Object.keys(copy.message)[0]
let isEphemeral = mtype === 'ephemeralMessage'
if (isEphemeral) {
mtype = Object.keys(copy.message.ephemeralMessage.message)[0]
}
let msg = isEphemeral ? copy.message.ephemeralMessage.message :
copy.message
let content = msg[mtype]
if (typeof content === 'string') msg[mtype] = text || content
else if (content.caption) content.caption = text || content.caption
else if (content.text) content.text = text || content.text
if (typeof content !== 'string') msg[mtype] = {
...content,
...options
}
if (copy.key.participant) sender = copy.key.participant = sender ||
copy.key.participant
else if (copy.key.participant) sender = copy.key.participant = sender
|| copy.key.participant
if (copy.key.remoteJid.includes('@s.whatsapp.net')) sender = sender ||
copy.key.remoteJid
else if (copy.key.remoteJid.includes('@broadcast')) sender = sender ||
copy.key.remoteJid
copy.key.remoteJid = jid
copy.key.fromMe = sender === ryoroyko.user.id

return proto.WebMessageInfo.fromObject(copy)
}

ryoroyko.sendFile = async (jid, path, filename = '', caption = '', quoted, ptt =
false, options = {}) => {
let type = await ryoroyko.getFile(path, true);
let { res, data: file, filename: pathFile } = type;

if (res && res.status !== 200 || file.length <= 65536) {


try {
throw {
json: JSON.parse(file.toString())
};
} catch (e) {
if (e.json) throw e.json;
}
}

let opt = {
filename
};

if (quoted) opt.quoted = quoted;


if (!type) options.asDocument = true;

let mtype = '',


mimetype = type.mime,
convert;

if (/webp/.test(type.mime) || (/image/.test(type.mime) && options.asSticker))


mtype = 'sticker';
else if (/image/.test(type.mime) || (/webp/.test(type.mime) && options.asImage))
mtype = 'image';
else if (/video/.test(type.mime)) mtype = 'video';
else if (/audio/.test(type.mime)) {
convert = await (ptt ? toPTT : toAudio)(file, type.ext);
file = convert.data;
pathFile = convert.filename;
mtype = 'audio';
mimetype = 'audio/ogg; codecs=opus';
} else mtype = 'document';

if (options.asDocument) mtype = 'document';

delete options.asSticker;
delete options.asLocation;
delete options.asVideo;
delete options.asDocument;
delete options.asImage;

let message = { ...options, caption, ptt, [mtype]: { url: pathFile }, mimetype };


let m;

try {
m = await ryoroyko.sendMessage(jid, message, { ...opt, ...options });
} catch (e) {
//console.error(e)
m = null;
} finally {
if (!m) m = await ryoroyko.sendMessage(jid, { ...message, [mtype]: file },
{ ...opt, ...options });
file = null;
return m;
}
}

/**
*
* @param {*} path
* @returns
*/
ryoroyko.getFile = async (PATH, save) => {
let res
let data = Buffer.isBuffer(PATH) ? PATH :
/^data:.*?\/.*?;base64,/i.test(PATH) ? Buffer.from(PATH.split`,`[1], 'base64') :
/^https?:\/\//.test(PATH) ? await (res = await getBuffer(PATH)) :
fs.existsSync(PATH) ? (filename = PATH, fs.readFileSync(PATH)) : typeof PATH ===
'string' ? PATH : Buffer.alloc(0)
//if (!Buffer.isBuffer(data)) throw new TypeError('Result is not a buffer')
let type = await FileType.fromBuffer(data) || {
mime: 'application/octet-stream',
ext: '.bin'
}
filename = path.join(__filename, '../src/' + new Date * 1 + '.' + type.ext)
if (data && save) fs.promises.writeFile(filename, data)
return {
res,
filename,
size: await getSizeMedia(data),
...type,
data
}

ryoroyko.ev.on('messages.upsert', async chatUpdate => {


//console.log(JSON.stringify(chatUpdate, undefined, 2))
try {
mek = chatUpdate.messages[0]
if (!mek.message) return
mek.message = (Object.keys(mek.message)[0] === 'ephemeralMessage') ?
mek.message.ephemeralMessage.message : mek.message
if (mek.key && mek.key.remoteJid === 'status@broadcast') return
if (!ryoroyko.public && !mek.key.fromMe && chatUpdate.type ===
'notify') return
if (mek.key.id.startsWith('BAE5') && mek.key.id.length === 16) return
if (mek.key.id.startsWith('FatihArridho_')) return
m = smsg(ryoroyko, mek, store)
require("./ryozingod")(ryoroyko, m, chatUpdate, store)
} catch (err) {
console.log(err)
}
})

async function getMessage(key){


if (store) {
const msg = await store.loadMessage(key.remoteJid, key.id)
return msg?.message
}
return {
conversation: "Hi, I'm thezetsuboxygen :D"
}
}
//respon polling
ryoroyko.ev.on('messages.update', async chatUpdate => {
for(const { key, update } of chatUpdate) {
if(update.pollUpdates && key.fromMe) {
const pollCreation = await getMessage(key)
if(pollCreation) {
const pollUpdate = await
getAggregateVotesInPollMessage({
message: pollCreation,
pollUpdates: update.pollUpdates,
})
var toCmd = pollUpdate.filter(v => v.voters.length !== 0)
[0]?.name
if (toCmd == undefined) return
var prefCmd = prefix+toCmd
ryoroyko.appenTextMessage(prefCmd, chatUpdate)
}
}
}
})

//Simpan Kredensial
ryoroyko.ev.process(
async (events) => {
if (events['presence.update']) {
await ryoroyko.sendPresenceUpdate('available');
}
if (events['creds.update']) {
await saveCreds();
}
}
)

return ryoroyko
}

ryoroykoStart()

let file = require.resolve(__filename);


fs.watchFile(file, () => {
fs.unwatchFile(file);
console.log(chalk.yellowBright(`Update File Terbaru ${__filename}`));
delete require.cache[file];
require(file);
});

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy