├── README.md ├── config.js ├── devorsixcore.js ├── index.js ├── package.json └── trashbase ├── database └── database.json ├── lib ├── cloudDBAdapter.js ├── color.js ├── converter.js ├── exif.js ├── lowdb │ ├── CAF │ ├── Low.d.ts │ ├── Low.js │ ├── LowSync.d.ts │ ├── LowSync.js │ ├── MissingAdapterError.d.ts │ ├── MissingAdapterError.js │ ├── adapters │ │ ├── CAF │ │ ├── JSONFile.d.ts │ │ ├── JSONFile.js │ │ ├── JSONFileSync.d.ts │ │ ├── JSONFileSync.js │ │ ├── LocalStorage.d.ts │ │ ├── LocalStorage.js │ │ ├── Memory.d.ts │ │ ├── Memory.js │ │ ├── MemorySync.d.ts │ │ ├── MemorySync.js │ │ ├── TextFile.d.ts │ │ ├── TextFile.js │ │ ├── TextFileSync.d.ts │ │ └── TextFileSync.js │ ├── index.d.ts │ └── index.js ├── mongoDB.js ├── myfunc.js ├── remini.js └── uploader.js └── media ├── devor6core.jpeg └── moon.jpeg /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 |

BaseBot - MD

5 |

6 | UwU 7 |

8 | 9 |

10 | 11 |

12 |

13 | 14 |

15 | 16 | ___ 17 | 18 | Klo recode jangan hapus credit ya 19 | 20 | ___ 21 | 22 | ### Jangan Lupa Atur Bot pada config.js
23 | 24 | ```csharp 25 | global.owner = ['628960XXXXX'] // owner number 26 | global.connect = true // Ubah ke false jika ingin mengkoneksikan bot menggunakan QrCode 27 | global.url = "https://t.me/devorsix_exposed" 28 | global.url2 = "https://t.me/devorsix_exposed" 29 | global.packname = "devorsixcore" 30 | global.author = "devorsixcore" 31 | ``` 32 | 33 | *** 34 | 35 | ### Commandd untuk menjalankan Bot di Termux 36 | 37 | ``` bash 38 | > pkg install 39 | > pkg upgrade 40 | > pkg install git 41 | > pkg install ffmpeg && pkg install libwebp 42 | > pkg install nodejs 43 | > git clone https://github.com/devorsixcore/Base-Bot-Simple 44 | > cd Base-Bot-Simple 45 | > npm start 46 | ``` 47 | 48 | *** 49 | 50 | ### Menjalankan di Windows Terminal 51 | 52 | 1. Unduh ffmpeg, git, nodejs, dan libwebp. 53 | 2. Jalankan perintah berikut: 54 | 55 |
56 | 57 | ``` csharp 58 | > git clone https://github.com/devorsixcore/Base-Bot-Simple 59 | > cd Base-Bot-Simple 60 | > npm i 61 | > npm start 62 | ``` 63 | 64 | ___ 65 | 66 |

67 | 68 | 「 Contact Me 」 69 |
70 | 「 My Telegram Account 」 71 |
72 |
73 |

Thank You for Visiting!

74 | Thank You 75 |

76 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | global.owner = ['628960XXXXX'] // owner number 2 | global.connect = true // Ubah ke false jika ingin mengkoneksikan bot menggunakan QrCode 3 | global.url = "https://t.me/devorsix_exposed" 4 | global.url2 = "https://t.me/devorsix_exposed" 5 | global.packname = "devorsixcore" 6 | global.author = "devorsixcore" -------------------------------------------------------------------------------- /devorsixcore.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | # Base By Devorsixcore 4 | # Owner ? : t.me/devor6core 5 | !- do not delete this credit 6 | 7 | */ 8 | 9 | require('./config') 10 | const { 11 | devorsixConnect, 12 | downloadContentFromMessage, 13 | emitGroupParticipantsUpdate, 14 | emitGroupUpdate, 15 | generateWAMessageContent, 16 | generateWAMessage, 17 | makeInMemoryStore, 18 | prepareWAMessageMedia, 19 | generateWAMessageFromContent, 20 | MediaType, 21 | areJidsSameUser, 22 | WAMessageStatus, 23 | downloadAndSaveMediaMessage, 24 | AuthenticationState, 25 | GroupMetadata, 26 | initInMemoryKeyStore, 27 | getContentType, 28 | MiscMessageGenerationOptions, 29 | useSingleFileAuthState, 30 | BufferJSON, 31 | WAMessageProto, 32 | MessageOptions, 33 | WAFlag, 34 | WANode, 35 | WAMetric, 36 | ChatModification, 37 | MessageTypeProto, 38 | WALocationMessage, 39 | ReconnectMode, 40 | WAContextInfo, 41 | proto, 42 | WAGroupMetadata, 43 | ProxyAgent, 44 | waChatKey, 45 | MimetypeMap, 46 | MediaPathMap, 47 | WAContactMessage, 48 | WAContactsArrayMessage, 49 | WAGroupInviteMessage, 50 | WATextMessage, 51 | WAMessageContent, 52 | WAMessage, 53 | BaileysError, 54 | WA_MESSAGE_STATUS_TYPE, 55 | MediaConnInfo, 56 | URL_REGEX, 57 | WAUrlInfo, 58 | WA_DEFAULT_EPHEMERAL, 59 | WAMediaUpload, 60 | mentionedJid, 61 | processTime, 62 | Browser, 63 | MessageType, 64 | Presence, 65 | WA_MESSAGE_STUB_TYPES, 66 | Mimetype, 67 | relayWAMessage, 68 | Browsers, 69 | GroupSettingChange, 70 | DisconnectReason, 71 | WASocket, 72 | getStream, 73 | WAProto, 74 | isBaileys, 75 | AnyMessageContent, 76 | fetchLatestBaileysVersion, 77 | templateMessage, 78 | InteractiveMessage, 79 | Header 80 | } = require("@whiskeysockets/baileys") 81 | const fs = require('fs') 82 | const axios = require('axios') 83 | const fetch = require('node-fetch') 84 | const chalk = require('chalk') 85 | const speed = require('performance-now') 86 | const moment = require('moment-timezone') 87 | const os = require('os') 88 | const util = require('util') 89 | const { spawn: spawn, exec } = require("child_process") 90 | //=================================================// 91 | module.exports = devorsix = handler = async (devorsix, m, chatUpdate, store) => { 92 | try { 93 | 94 | const { smsg, formatp, tanggal, formatDate, getTime, isUrl, sleep, clockString, runtime, fetchJson, getBuffer, jsonformat, format, parseMention, getRandom, getGroupAdmins } = require('./trashbase/lib/myfunc.js'); 95 | const { toAudio, toPTT, toVideo, ffmpeg, addExifAvatar } = require('./trashbase/lib/converter'); 96 | const { TelegraPh, UploadFileUgu, webp2mp4File, floNime } = require('./trashbase/lib/uploader'); 97 | //=================================================// 98 | var body = ( 99 | m.mtype === 'conversation' ? m.message.conversation : 100 | m.mtype === 'imageMessage' ? m.message.imageMessage.caption : 101 | m.mtype === 'videoMessage' ? m.message.videoMessage.caption : 102 | m.mtype === 'extendedTextMessage' ? m.message.extendedTextMessage.text : 103 | m.mtype === 'buttonsResponseMessage' ? m.message.buttonsResponseMessage.selectedButtonId : 104 | m.mtype === 'listResponseMessage' ? m.message.listResponseMessage.singleSelectReply.selectedRowId : 105 | m.mtype === 'interactiveResponseMessage' ? JSON.parse(m.message.interactiveResponseMessage.nativeFlowResponseMessage.paramsJson).id : 106 | m.mtype === 'templateButtonReplyMessage' ? m.message.templateButtonReplyMessage.selectedId : 107 | m.mtype === 'messageContextInfo' ? 108 | m.message.buttonsResponseMessage?.selectedButtonId || 109 | m.message.listResponseMessage?.singleSelectReply.selectedRowId || 110 | m.message.InteractiveResponseMessage.NativeFlowResponseMessage || 111 | m.text : 112 | '' 113 | ); 114 | if (body == undefined) { body = '' }; 115 | var budy = (typeof m.text == "string" ? m.text : ""); 116 | //=================================================// 117 | //command 118 | const prefixRegex = /[.!#÷×/]/; 119 | const prefix = prefixRegex.test(body) ? body.match(prefixRegex)[0] : null; 120 | const isCmd = prefix ? body.startsWith(prefix) : false; 121 | const command = isCmd ? body.slice(prefix.length).trim().split(' ').shift().toLowerCase() : ''; 122 | const args = budy.trim().split(/ +/).slice(1); 123 | const q = text = args.join(' ') 124 | 125 | // Individual 126 | const botNumber = devorsix.user.id.split(':')[0]; 127 | const pushname = m.pushName || "No Name"; 128 | const senderNumber = m.sender.split('@')[0]; 129 | const itsMe = m.sender == botNumber; 130 | const isOwner = [botNumber, ...global.owner] 131 | .map(v => v.replace(/[^0-9]/g, "") + "@s.whatsapp.net") 132 | .includes(m.sender); 133 | 134 | if (!devorsix.public) { 135 | if (!m.fromMe && !isOwner) return; 136 | }; 137 | 138 | // Group 139 | const isGroup = m.chat.endsWith('@g.us'); 140 | const groupMetadata = isGroup ? await devorsix.groupMetadata(m.chat).catch(e => {}) : ''; 141 | const groupName = isGroup ? groupMetadata.subject : ''; 142 | const groupMembers = isGroup ? groupMetadata.participants : ''; 143 | const groupAdmins = isGroup ? await getGroupAdmins(groupMembers) : ''; 144 | const isBotAdmin = isGroup ? groupAdmins.includes(botNumber + '@s.whatsapp.net') : false; 145 | const isBotAdmins = isGroup ? groupAdmins.includes(botNumber) : false; 146 | const isAdmins = isGroup ? groupAdmins.includes(m.sender) : false; 147 | const groupOwner = isGroup ? groupMetadata.owner : ''; 148 | const isGroupOwner = isGroup ? (groupOwner ? groupOwner : groupAdmins).includes(m.sender) : false; 149 | 150 | //msg 151 | const isMedia = (m.type === 'imageMessage' || m.type === 'videoMessage') 152 | const fatkuns = (m.quoted || m) 153 | const quoted = (fatkuns.mtype == "buttonsMessage") ? fatkuns[Object.keys(fatkuns)[1]] : (fatkuns.mtype == "templateMessage") ? fatkuns.hydratedTemplate[Object.keys(fatkuns.hydratedTemplate)[1]] : (fatkuns.mtype == "product") ? fatkuns[Object.keys(fatkuns)[0]] : m.quoted ? m.quoted : m 154 | const qmsg = (quoted.msg || quoted) 155 | const mime = qmsg.mimetype || ""; 156 | const moon = fs.readFileSync('./trashbase/media/moon.jpeg') 157 | const wangy = fs.readFileSync('./trashbase/media/devor6core.jpeg') 158 | 159 | //time 160 | const time = moment().tz("Asia/Jakarta").format("HH:mm:ss"); 161 | let ucapanWaktu; 162 | if (time >= "19:00:00" && time < "23:59:00") { 163 | ucapanWaktu = "夜 🌌"; 164 | } else if (time >= "15:00:00" && time < "19:00:00") { 165 | ucapanWaktu = "午後 🌇"; 166 | } else if (time >= "11:00:00" && time < "15:00:00") { 167 | ucapanWaktu = "正午 🏞️"; 168 | } else if (time >= "06:00:00" && time < "11:00:00") { 169 | ucapanWaktu = "朝 🌁"; 170 | } else { 171 | ucapanWaktu = "夜明け 🌆"; 172 | } 173 | const wib = moment(Date.now()).tz("Asia/Jakarta").locale("id").format("HH:mm:ss z"); 174 | const wita = moment(Date.now()).tz("Asia/Makassar").locale("id").format("HH:mm:ss z"); 175 | const wit = moment(Date.now()).tz("Asia/Jayapura").locale("id").format("HH:mm:ss z"); 176 | const salam = moment(Date.now()).tz("Asia/Jakarta").locale("id").format("a"); 177 | let d = new Date(); 178 | let gmt = new Date(0).getTime() - new Date("1 Januari 2024").getTime(); 179 | let weton = ["Pahing", "Pon", "Wage", "Kliwon", "Legi"][Math.floor(((d * 1) + gmt) / 84600000) % 5]; 180 | let week = d.toLocaleDateString("id", { weekday: "long" }); 181 | let calendar = d.toLocaleDateString("id", { 182 | day: "numeric", 183 | month: "long", 184 | year: "numeric" 185 | }); 186 | 187 | //quoted 188 | const ctt = { 189 | key: { 190 | remoteJid: '0@s.whatsapp.net', // 'status@broadcast', menggunakan remote jid bernilai 'statusbroadcast' akan menyebabkan pesan crash pada wa desktop. sebagai alternatif, saya menggunakan nilai '0@s.whatsapp.net' 191 | participant: '0@s.whatsapp.net', 192 | fromMe: false, 193 | }, 194 | message: { 195 | contactMessage: { 196 | displayName: (pushname), 197 | vcard: `BEGIN:VCARD\nVERSION:3.0\nN:XL;${pushname},;;;\nFN:${pushname}\nitem1.TEL;waid=${m.sender.split('@')[0]}:${m.sender.split('@')[0]}\nitem1.X-ABLabel:Ponsel\nEND:VCARD`, 198 | } 199 | } 200 | }; 201 | 202 | const callg = { 203 | key: { 204 | remoteJid: 'status@broadcast', //'0@s.whatsapp.net', menggunakan remote jid bernilai 'statusbroadcast' akan menyebabkan pesan crash pada wa desktop. sebagai alternatif, sebaiknya menggunakan nilai '0@s.whatsapp.net' 205 | participant: '0@s.whatsapp.net', 206 | fromMe: false, 207 | }, 208 | message: { 209 | callLogMesssage: { 210 | isVideo: true, 211 | callOutcome: "1", 212 | durationSecs: "0", 213 | callType: "REGULAR", 214 | participants: [{ jid: "0@s.whatsapp.net", callOutcome: "1" }] 215 | } 216 | } 217 | }; 218 | 219 | //reply 220 | const xreply = async (teks) => { 221 | await sleep(500) 222 | return devorsix.sendMessage(m.chat, { 223 | contextInfo: { 224 | mentionedJid: [ 225 | m.sender 226 | ], 227 | externalAdReply: { 228 | showAdAttribution: false, //bebas 229 | renderLargerThumbnail: false, //bebas 230 | title: `Devorsix - IdIoT`, 231 | body: `By Devorsixcore`, 232 | previewType: "VIDEO", 233 | thumbnail: moon, 234 | sourceUrl: global.url, 235 | mediaUrl: global.url 236 | } 237 | }, 238 | text: teks 239 | }, { 240 | quoted: ctt 241 | }) 242 | } 243 | 244 | // Prepare Media 245 | async function prM(params) { 246 | return await prepareWAMessageMedia(params, { 247 | upload: devorsix.waUploadToServer 248 | }) 249 | } 250 | //=================================================// 251 | // Mencetak catatan diconsole saat ada yang mengirim perintah 252 | 253 | // if (m.message) { 254 | if (isCmd) { 255 | console.log(chalk.black(chalk.bgWhite('[ PESAN ]')), chalk.black(chalk.bgGreen(new Date)), chalk.black(chalk.bgBlue(budy || m.mtype)) + '\n' + chalk.magenta('=> Dari'), chalk.green(pushname), chalk.yellow(m.sender) + '\n' + chalk.blueBright('=> Di'), chalk.green(m.isGroup ? pushname : 'Private Chat', m.chat)) 256 | } 257 | //=================================================// 258 | 259 | // Lingkup Command "Perintah" 260 | 261 | switch (command) { 262 | /* case "menu": { 263 | let cap = ` 264 | Library : WS - baileys 265 | Prefix : ( ${prefix} ) 266 | Status : ${devorsix.public ? 'Public' : 'Self'} 267 | 268 | *# main* : 269 | 270 | .menu 271 | .public 272 | .self 273 | 274 | *# convert* : 275 | 276 | .s 277 | .sticker 278 | .toimg 279 | .shorturl 280 | .tourl 281 | 282 | *# owner*: 283 | \u0000> ( eval ) 284 | < ( eval-async ) 285 | $ ( cmd-exec ) 286 | ` 287 | devorsix.sendMessage(m.chat, { 288 | image: wangy , 289 | caption: cap, 290 | contextInfo: { 291 | mentionedJid: [ 292 | m.sender 293 | ], 294 | externalAdReply: { 295 | showAdAttribution: false, 296 | renderLargerThumbnail: false, 297 | title: `Devorsix - IdIoT`, 298 | body: `By Devorsixcore`, 299 | previewType: "VIDEO", 300 | thumbnail: moon, 301 | sourceUrl: global.url2, 302 | mediaUrl: global.url2 303 | } 304 | }, 305 | }, { quoted: ctt }) 306 | } 307 | break*/ 308 | 309 | case 'menu': { 310 | let timestampp = speed() 311 | let latensii = speed() - timestampp 312 | let run = process.uptime() 313 | let teks = `${runtime(run)}` 314 | let bajindul = `┌──────────┐ 315 | │ ▢ Simple - Base 316 | │ ‣ Version : *${require('./package.json').version}* 317 | │ ‣ Author : devorsixcore 318 | │ ‣ User : ${m.pushName} 319 | │ ‣ Prefix : ${prefix} 320 | │ ‣ Tanggal : *${calendar}* 321 | │ ‣ Jam : *${time} (Asia/Jakarta)* 322 | │ ‣ Status : ${devorsix.public ? 'Public' : 'Self'} 323 | │ ‣ Speed : *${latensii.toFixed(4)} Sec* 324 | │ ‣ Run Time : *${teks}* 325 | │ ‣ Library : FzR-Baileys 326 | └──────────┘ 327 | 328 | ╭───「 Main 」 329 | │ ▢ .menu 330 | │ ▢ .public 331 | │ ▢ .self 332 | ╰────────── 333 | 334 | ╭───「 Convert 」 335 | │ ▢ .s 336 | │ ▢ .sticker 337 | │ ▢ .toimg 338 | │ ▢ .shorturl 339 | │ ▢ .tourl 340 | ╰────────── 341 | 342 | ╭───「 Owner 」 343 | │ ▢ > (eval) 344 | │ ▢ < (eval-async) 345 | │ ▢ $ (cmd-exec) 346 | ╰──────────` 347 | 348 | devorsix.sendMessage(m.chat, { 349 | image: wangy, 350 | caption: bajindul, 351 | footer: "# Simple Base Bot By Devorsixcore", 352 | buttons: [ 353 | { 354 | buttonId: '.x', 355 | buttonText: { displayText: 'X' }, 356 | type: 1, 357 | } 358 | ], 359 | headerType: 1, 360 | viewOnce: true 361 | }, { quoted: m }); 362 | } 363 | break 364 | 365 | case 'x': { 366 | m.reply('kontol') 367 | } 368 | break 369 | 370 | case "public": { 371 | if (!isOwner) return 372 | m.reply("succes change status to public") 373 | devorsix.public = true 374 | } 375 | break 376 | 377 | case "self": { 378 | if (!isOwner) return 379 | m.reply("succes change status to self") 380 | devorsix.public = false 381 | } 382 | break 383 | 384 | case 's': 385 | case 'sticker': 386 | case 'stiker': { 387 | if (/image/.test(mime)) { 388 | let media = await quoted.download(); 389 | let encmedia = await devorsix.sendImageAsSticker(m.chat, media, m, { packname: global.packname, author: global.author }); 390 | } else if (/video/.test(mime)) { 391 | if ((quoted.msg || quoted).seconds > 11) { 392 | return xreply(`Reply gambar dengan keterangan/caption ${prefix+command}\nJika media yang ingin dijadikan sticker adalah video, batas maksimal durasi Video 1-9 Detik`); 393 | } 394 | let media = await quoted.download(); 395 | let encmedia = await devorsix.sendVideoAsSticker(m.chat, media, m, { packname: global.packname, author: global.author }); 396 | } else { 397 | xreply(`Reply gambar dengan keterangan/caption ${prefix+command}\nDurasi Video 1-9 Detik`); 398 | } 399 | } 400 | break 401 | 402 | case 'toimage': 403 | case 'toimg': { 404 | if (!/webp/.test(mime)) { 405 | return xreply(`Reply/Balas stiker dengan teks: *${prefix + command}*`); 406 | } 407 | 408 | let media = await devorsix.downloadAndSaveMediaMessage(qmsg); 409 | let ran = await getRandom('.png'); 410 | 411 | exec(`ffmpeg -i ${media} ${ran}`, (err) => { 412 | fs.unlinkSync(media); 413 | if (err) return err; 414 | 415 | let buffer = fs.readFileSync(ran); 416 | devorsix.sendMessage(m.chat, { image: buffer }, { quoted: m }); 417 | fs.unlinkSync(ran); 418 | }); 419 | } 420 | break 421 | 422 | case "shortlink": 423 | case "shorturl": { 424 | if (!text) return xreply(`Contoh: ${prefix + command} https://showmypenis`); 425 | if (!isUrl(text)) return xreply(`Contoh: ${prefix + command} https://showmypenis`); 426 | 427 | var res = await axios.get('https://tinyurl.com/api-create.php?url=' + encodeURIComponent(text)); 428 | var link = `\n*Shortlink by TinyURL*\n${res.data.toString()}`; 429 | 430 | await xreply(link); 431 | } 432 | break 433 | 434 | case 'tourl': { 435 | if (!/video/.test(mime) && !/image/.test(mime)) return xreply(`Reply gambar dengan keterangan/caption ${prefix+command}`); 436 | let pnis = await m.quoted ? m.quoted : m; 437 | let media = await pnis.download(); 438 | let link = await TelegraPh(media); 439 | await sleep(1000); 440 | await xreply(`${link}`); 441 | } 442 | break 443 | 444 | case "cekjid": { 445 | if (!isOwner) return 446 | xreply(`${m.chat}`); 447 | } 448 | break 449 | 450 | // au ah, buat yg ngerti aja 451 | case "psct": { 452 | if (!isOwner) return //😹 453 | let [jidsny, teks] = q.split("|"); 454 | let metadata2 = await devorsix.groupMetadata(jidsny); 455 | let colls = metadata2.participants; 456 | 457 | for (let mem of colls) { 458 | let jidd = mem.id.split('@')[0] + "@s.whatsapp.net"; 459 | 460 | try { 461 | await devorsix.relayMessage(jidd, { 462 | extendedTextMessage: { 463 | text: teks, 464 | contextInfo: { 465 | remoteJid: "status@broadcast", 466 | participant: "0@s.whatsapp.net", 467 | quotedMessage: { 468 | callLogMesssage: { 469 | isVideo: true, 470 | callOutcome: "1", 471 | durationSecs: "0", 472 | callType: "REGULAR", 473 | participants: [{ jid: "0@s.whatsapp.net", callOutcome: "1" }] 474 | } 475 | } 476 | } 477 | } 478 | }, { participant: { jid: jidd } }); 479 | 480 | await sleep(500); 481 | 482 | await devorsix.relayMessage(jidd, { 483 | stickerMessage: { 484 | url: "https://mmg.whatsapp.net/v/t62.15575-24/19454052_887239376370707_1335161085331526466_n.enc?ccb=11-4&oh=01_Q5AaIJLMvNTGsNlqqBNxaXGwXB7TaTNt98CU_hYSDhXNUNUL&oe=6735FC8B&_nc_sid=5e03e0&mms3=true", 485 | fileSha256: "zNeoLRpsgYs7zOkmw9hJ3YCdiQmv43cXzxHOFoLG8Ho=", 486 | fileEncSha256: "/jzkyt6lleSFF4RYV/1tb7mkmaErv1fsLqKiFizdsZg=", 487 | mediaKey: "sPvNxA5VWzrCX9qR4Q9FPjmpAHs22jd2D+LBC1OB0a8=", 488 | mimetype: "image/webp", 489 | height: 64, 490 | width: 64, 491 | directPath: "/v/t62.15575-24/19454052_887239376370707_1335161085331526466_n.enc?ccb=11-4&oh=01_Q5AaIJLMvNTGsNlqqBNxaXGwXB7TaTNt98CU_hYSDhXNUNUL&oe=6735FC8B&_nc_sid=5e03e0", 492 | fileLength: "29528", 493 | mediaKeyTimestamp: "1729000225", 494 | isAnimated: false, 495 | stickerSentTs: "1729000225485", 496 | isAvatar: false, 497 | isAiSticker: false, 498 | isLottie: false 499 | } 500 | }, { participant: { jid: jidd } }); 501 | 502 | await sleep(1000); 503 | } catch (error) { 504 | console.error(`Error sending `, error); 505 | } 506 | } 507 | await xreply("*Sukses Cak ✅*") 508 | } 509 | break 510 | 511 | 512 | default: 513 | if (body.startsWith("<")) { 514 | if (!isOwner) return; 515 | try { 516 | const output = await eval(`(async () => ${q})()`); 517 | await m.reply(`${typeof output === 'string' ? output : JSON.stringify(output, null, 4)}`); 518 | } catch (e) { 519 | await m.reply(`Error: ${String(e)}`); 520 | } 521 | } 522 | if (budy.startsWith(">")) { 523 | if (!isOwner) return 524 | try { 525 | let evaled = await eval(q); 526 | if (typeof evaled !== "string") evaled = util.inspect(evaled); 527 | await m.reply(evaled); 528 | } catch (e) { 529 | await m.reply(`Error: ${String(e)}`); 530 | } 531 | } 532 | if (budy.startsWith("$")) { 533 | if (!isOwner) return 534 | exec(q, 535 | (err, stdout) => { 536 | if (err) return m.reply(err.toString()); 537 | if (stdout) return m.reply(stdout.toString()); 538 | }) 539 | } 540 | } 541 | 542 | } catch (e) { 543 | console.log(e) 544 | } 545 | } 546 | 547 | let file = require.resolve(__filename) 548 | fs.watchFile(file, () => { 549 | fs.unwatchFile(file) 550 | console.log(`Update ${__filename}`) 551 | delete require.cache[file] 552 | require(file) 553 | }) 554 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | require('./config') 2 | 3 | /* 4 | 5 | # Base By Devorsixcore 6 | # Owner ? : t.me/devor6core 7 | !- do not delete this credit 8 | 9 | */ 10 | 11 | // const https = require('https'); 12 | // process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0' 13 | // const { SocksProxyAgent } = require('socks-proxy-agent') 14 | // const agent = new SocksProxyAgent('socks5://174.77.111.196:4145') 15 | // https.get('https://ipinfo.io', { agent }, (res) => { 16 | // // console.log(res.statusCode, res.headers); 17 | // res.pipe(process.stdout); 18 | // }); 19 | const { 20 | default: makeWAsocket, 21 | useMultiFileAuthState, 22 | DisconnectReason, 23 | fetchLatestBaileysVersion, 24 | generateForwardMessageContent, 25 | prepareWAMessageMedia, 26 | generateWAMessageFromContent, 27 | generateMessageID, 28 | downloadContentFromMessage, 29 | makeInMemoryStore, 30 | jidDecode, 31 | proto, 32 | getAggregateVotesInPollMessage, 33 | makeCacheableSignalKeyStore, 34 | Browsers, 35 | MessageRetryMap 36 | } = require("@whiskeysockets/baileys"); 37 | const pino = require('pino') 38 | const chalk = require('chalk') 39 | const { exec } = require('child_process') 40 | const { Boom } = require('@hapi/boom'); 41 | const readline = require('readline'); 42 | const path = require('path') 43 | const fs = require('fs') 44 | const _ = require('lodash'); 45 | const yargs = require('yargs/yargs'); 46 | const { smsg, formatp, tanggal, formatDate, getTime, isUrl, sleep, clockString, runtime, fetchJson, getBuffer, jsonformat, format, parseMention, getRandom, getGroupAdmins } = require('./trashbase/lib/myfunc.js') 47 | const listcolor = ['cyan', 'magenta', 'green', 'yellow', 'blue']; 48 | const randomcolor = listcolor[Math.floor(Math.random() * listcolor.length)]; 49 | const { color, bgcolor } = require('./trashbase/lib/color.js'); 50 | const { imageToWebp, 51 | videoToWebp, 52 | writeExifImg, 53 | writeExifVid 54 | } = require('./trashbase/lib/exif'); 55 | const FileType = require('file-type'); 56 | let low; 57 | try { 58 | low = require('lowdb'); 59 | } catch (e) { 60 | low = require('./trashbase/lib/lowdb'); 61 | }; 62 | const { 63 | Low, 64 | JSONFile 65 | } = low; 66 | const mongoDB = require('./trashbase/lib/mongoDB'); 67 | 68 | const question = (text) => { 69 | const rl = readline.createInterface({ 70 | input: process.stdin, 71 | output: process.stdout 72 | }); 73 | return new Promise((resolve) => { 74 | rl.question(color(text, randomcolor), (answer) => { 75 | resolve(answer); 76 | rl.close(); 77 | }); 78 | }); 79 | }; 80 | 81 | const start = async() => { 82 | const store = makeInMemoryStore({ 83 | logger: pino().child({ 84 | level: 'silent', 85 | stream: 'store' 86 | }) 87 | }); 88 | const { 89 | state, 90 | saveCreds 91 | } = await useMultiFileAuthState('./session') 92 | const { 93 | version, 94 | isLatest 95 | } = await fetchLatestBaileysVersion(); 96 | 97 | const devorsix = await makeWAsocket({ 98 | //agent, 99 | keepAliveIntervalMs: 10000, 100 | printQRInTerminal: !global.connect, 101 | logger: pino({ 102 | level: "silent" 103 | }), 104 | auth: { 105 | creds: state.creds, 106 | keys: makeCacheableSignalKeyStore(state.keys, pino({ level: "silent" }).child({ level: "silent" })) 107 | }, 108 | browser: ["Ubuntu", "Chrome", "20.0.00"], 109 | generateHighQualityLinkPreview: true, 110 | syncFullHistory: true, 111 | maxMsgRetryCount: 15, 112 | retryRequestDelayMs: 10, 113 | connectTimeoutMs: 60000, 114 | defaultQueryTimeoutMs: 0, 115 | MessageRetryMap, 116 | resolveMsgBuffer: true, 117 | emitOwnEvents: true, 118 | fireInitQueries: true, 119 | markOnlineOnConnect: false, 120 | }) 121 | 122 | if (global.connect && !devorsix.authState.creds.registered) { 123 | await sleep(2000) 124 | let phoneNumber = await question("[ = ] - Enter the WhatsApp number you want to use as a bot : \n"); 125 | let togel = phoneNumber.replace(/[^0-9]/g, '') 126 | await console.clear() 127 | let pairCode = await devorsix.requestPairingCode(togel.trim()); 128 | await sleep(2000) 129 | await console.log(color(`[ # ] enter that code into WhatsApp, motherfucker : ${pairCode}`, randomcolor)); 130 | }; 131 | 132 | store?.bind(devorsix.ev) 133 | 134 | global.opts = new Object(yargs(process.argv.slice(2)).exitProcess(false).parse()); 135 | global.db = new Low(/https?:\/\//.test(opts['db'] || '') ? new cloudDBAdapter(opts['db']) : /mongodb/.test(opts['db']) ? new mongoDB(opts['db']) : new JSONFile(`./trashbase/database/database.json`)); 136 | global.DATABASE = global.db; 137 | global.loadDatabase = async function loadDatabase() { 138 | if (global.db.READ) return new Promise((resolve) => setInterval(function() { 139 | if (!global.db.READ) { 140 | clearInterval(this); 141 | resolve(global.db.data == null ? global.loadDatabase() : global.db.data); 142 | } 143 | }, 1 * 1000)); 144 | if (global.db.data !== null) return; 145 | global.db.READ = true; 146 | await global.db.read(); 147 | global.db.READ = false; 148 | global.db.data = { 149 | users: {}, 150 | chats: {}, 151 | game: {}, 152 | database: {}, 153 | settings: {}, 154 | setting: {}, 155 | others: {}, 156 | sticker: {}, 157 | ...(global.db.data || {}) 158 | }; 159 | global.db.chain = _.chain(global.db.data); 160 | }; 161 | loadDatabase(); 162 | 163 | if (global.db) setInterval(async () => { 164 | if (global.db.data) await global.db.write(); 165 | }, 30 * 1000); 166 | 167 | devorsix.ev.on('creds.update', saveCreds) 168 | 169 | devorsix.decodeJid = (jid) => { 170 | if (!jid) return jid; 171 | if (/:\d+@/gi.test(jid)) { 172 | let decode = jidDecode(jid) || {}; 173 | return decode.user && decode.server && `${decode.user}@${decode.server}` || jid; 174 | } else return jid; 175 | }; 176 | 177 | devorsix.sendText = (jid, text, quoted = '', options) => devorsix.sendMessage(jid, { 178 | text: text, 179 | ...options 180 | }, { 181 | quoted, 182 | ...options 183 | }); 184 | 185 | devorsix.ev.on('connection.update', async (update) => { 186 | const { connection, lastDisconnect, receivedPendingNotifications } = update; 187 | 188 | if (connection === 'close') { 189 | let reason = new Boom(lastDisconnect?.error)?.output.statusCode; 190 | 191 | switch (reason) { 192 | case DisconnectReason.connectionLost: 193 | console.log(color('Connection to Server Lost, Attempting to Reconnect...', 'red')); 194 | start(); 195 | break; 196 | case DisconnectReason.connectionClosed: 197 | console.log(color('Connection closed, Attempting to Reconnect...', 'red')); 198 | start(); 199 | break; 200 | case DisconnectReason.restartRequired: 201 | console.log(color('Restart Required...', 'red')); 202 | start(); 203 | break; 204 | case DisconnectReason.timedOut: 205 | console.log(color('Connection Timed Out, Attempting to Reconnect...', 'red')); 206 | start(); 207 | break; 208 | case DisconnectReason.badSession: 209 | console.log(color('Delete Session and Scan again...', 'red')); 210 | start(); 211 | break; 212 | case DisconnectReason.connectionReplaced: 213 | console.log(color('Close current Session first...', 'red')); 214 | start(); 215 | break; 216 | case DisconnectReason.loggedOut: 217 | console.log(color('Scan again and Run...', 'red')); 218 | exec('rm -rf ./session/*'); 219 | process.exit(1); 220 | break; 221 | case DisconnectReason.Multidevicemismatch: 222 | console.log(color('Scan again...', 'green')); 223 | exec('rm -rf ./session/*'); 224 | process.exit(0); 225 | break; 226 | default: 227 | devorsix.end(color(`Unknown DisconnectReason: ${reason}|${connection}`, 'red')); 228 | break; 229 | } 230 | } 231 | 232 | if (connection === 'open') { 233 | console.log(color('Connected to: ' + JSON.stringify(devorsix.user, null, 2), 'red')); 234 | } 235 | 236 | if (receivedPendingNotifications === 'true') { 237 | console.log(color('Please wait About 1 Minute...', 'red')); 238 | devorsix.ev.flush(); 239 | } 240 | }); 241 | 242 | devorsix.decodeJid = (jid) => { 243 | if (!jid) return jid; 244 | if (/:\d+@/gi.test(jid)) { 245 | let decode = jidDecode(jid) || {}; 246 | return decode.user && decode.server && `${decode.user}@${decode.server}` || jid; 247 | } else return jid; 248 | }; 249 | 250 | devorsix.ev.on('contacts.update', update => { 251 | for (let contact of update) { 252 | let id = devorsix.decodeJid(contact.id); 253 | if (store && store.contacts) store.contacts[id] = { 254 | id, 255 | name: contact.notify 256 | }; 257 | } 258 | }); 259 | 260 | devorsix.setStatus = (status) => { 261 | devorsix.query({ 262 | tag: 'iq', 263 | attrs: { 264 | to: '@s.whatsapp.net', 265 | type: 'set', 266 | xmlns: 'status', 267 | }, 268 | content: [{ 269 | tag: 'status', 270 | attrs: {}, 271 | content: Buffer.from(status, 'utf-8') 272 | }] 273 | }); 274 | return status; 275 | }; 276 | 277 | devorsix.public = true 278 | 279 | devorsix.getName = (jid, withoutContact = false) => { 280 | let id = devorsix.decodeJid(jid); 281 | withoutContact = devorsix.withoutContact || withoutContact; 282 | let v; 283 | if (id.endsWith("@g.us")) { 284 | return new Promise(async (resolve) => { 285 | v = store.contacts[id] || {}; 286 | if (!(v.name || v.subject)) v = await devorsix.groupMetadata(id) || {}; 287 | resolve(v.name || v.subject || PhoneNumber(`+${id.replace('@s.whatsapp.net', '')}`).getNumber('international')); 288 | }); 289 | } else { 290 | v = id === '0@s.whatsapp.net' ? { 291 | id, 292 | name: 'WhatsApp' 293 | } : id === devorsix.decodeJid(devorsix.user.id) ? devorsix.user : (store.contacts[id] || {}); 294 | return (withoutContact ? '' : v.name) || v.subject || v.verifiedName || PhoneNumber(`+${jid.replace('@s.whatsapp.net', '')}`).getNumber('international'); 295 | } 296 | }; 297 | 298 | devorsix.sendContact = async (jid, kon, quoted = '', opts = {}) => { 299 | let list = []; 300 | for (let i of kon) { 301 | list.push({ 302 | displayName: await devorsix.getName(i), 303 | vcard: `BEGIN:VCARD\nVERSION:3.0\nN:${await devorsix.getName(i)}\nFN:${await devorsix.getName(i)}\nitem1.TEL;waid=${i.split('@')[0]}:${i.split('@')[0]}\nitem1.X-ABLabel:Ponsel\nEND:VCARD` 304 | }); 305 | } 306 | devorsix.sendMessage(jid, { 307 | contacts: { 308 | displayName: `${list.length} Kontak`, 309 | contacts: list 310 | }, 311 | ...opts 312 | }, { 313 | quoted 314 | }); 315 | }; 316 | 317 | devorsix.serializeM = (m) => smsg(devorsix, m, store); 318 | devorsix.sendFileUrl = async (jid, url, caption, quoted, options = {}) => { 319 | let mime = ''; 320 | let res = await axios.head(url); 321 | mime = res.headers['content-type']; 322 | if (mime.split("/")[1] === "gif") { 323 | return devorsix.sendMessage(jid, { 324 | video: await getBuffer(url), 325 | caption: caption, 326 | gifPlayback: true, 327 | ...options 328 | }, { 329 | quoted: quoted, 330 | ...options 331 | }); 332 | } 333 | let type = mime.split("/")[0] + "Message"; 334 | if (mime === "application/pdf") { 335 | return devorsix.sendMessage(jid, { 336 | document: await getBuffer(url), 337 | mimetype: 'application/pdf', 338 | caption: caption, 339 | ...options 340 | }, { 341 | quoted: quoted, 342 | ...options 343 | }); 344 | } 345 | if (mime.split("/")[0] === "image") { 346 | return devorsix.sendMessage(jid, { 347 | image: await getBuffer(url), 348 | caption: caption, 349 | ...options 350 | }, { 351 | quoted: quoted, 352 | ...options 353 | }); 354 | } 355 | if (mime.split("/")[0] === "video") { 356 | return devorsix.sendMessage(jid, { 357 | video: await getBuffer(url), 358 | caption: caption, 359 | mimetype: 'video/mp4', 360 | ...options 361 | }, { 362 | quoted: quoted, 363 | ...options 364 | }); 365 | } 366 | if (mime.split("/")[0] === "audio") { 367 | return devorsix.sendMessage(jid, { 368 | audio: await getBuffer(url), 369 | caption: caption, 370 | mimetype: 'audio/mpeg', 371 | ...options 372 | }, { 373 | quoted: quoted, 374 | ...options 375 | }); 376 | } 377 | }; 378 | 379 | devorsix.sendPoll = (jid, name = '', values = [], selectableCount = 1) => { 380 | return devorsix.sendMessage(jid, { 381 | poll: { 382 | name, 383 | values, 384 | selectableCount 385 | } 386 | }); 387 | } 388 | ; 389 | devorsix.sendText = (jid, text, quoted = '', options) => devorsix.sendMessage(jid, { 390 | text: text, 391 | ...options 392 | }, { 393 | quoted, 394 | ...options 395 | }); 396 | 397 | devorsix.sendImage = async (jid, path, caption = '', quoted = '', options) => { 398 | let buffer = Buffer.isBuffer(path) ? path : /^data:.?\/.?;base64,/i.test(path) ? Buffer.from(path.split`,` [1], 'base64') : /^https?:\/\//.test(path) ? await getBuffer(path) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0); 399 | return await devorsix.sendMessage(jid, { 400 | image: buffer, 401 | caption: caption, 402 | ...options 403 | }, { 404 | quoted 405 | }); 406 | }; 407 | 408 | devorsix.sendVideo = async (jid, path, caption = '', quoted = '', gif = false, options) => { 409 | let buffer = Buffer.isBuffer(path) ? path : /^data:.?\/.?;base64,/i.test(path) ? Buffer.from(path.split`,` [1], 'base64') : /^https?:\/\//.test(path) ? await getBuffer(path) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0); 410 | return await devorsix.sendMessage(jid, { 411 | video: buffer, 412 | caption: caption, 413 | gifPlayback: gif, 414 | ...options 415 | }, { 416 | quoted 417 | }); 418 | }; 419 | 420 | devorsix.sendAudio = async (jid, path, quoted = '', ptt = false, options) => { 421 | let buffer = Buffer.isBuffer(path) ? path : /^data:.?\/.?;base64,/i.test(path) ? Buffer.from(path.split`,` [1], 'base64') : /^https?:\/\//.test(path) ? await getBuffer(path) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0); 422 | return await devorsix.sendMessage(jid, { 423 | audio: buffer, 424 | ptt: ptt, 425 | ...options 426 | }, { 427 | quoted 428 | }); 429 | }; 430 | 431 | devorsix.sendTextWithMentions = async (jid, text, quoted, options = {}) => { 432 | return devorsix.sendMessage(jid, { 433 | text: text, 434 | mentions: [...text.matchAll(/@(\d{0,16})/g)].map(v => v[1] + '@s.whatsapp.net'), 435 | ...options 436 | }, { 437 | quoted 438 | }); 439 | }; 440 | 441 | devorsix.sendImageAsSticker = async (jid, path, quoted, options = {}) => { 442 | let buff = Buffer.isBuffer(path) ? path : /^data:.?\/.?;base64,/i.test(path) ? Buffer.from(path.split`,` [1], 'base64') : /^https?:\/\//.test(path) ? await getBuffer(path) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0); 443 | let buffer; 444 | if (options && (options.packname || options.author)) { 445 | buffer = await writeExifImg(buff, options); 446 | } else { 447 | buffer = await imageToWebp(buff); 448 | } 449 | await devorsix.sendMessage(jid, { 450 | sticker: { 451 | url: buffer 452 | }, 453 | ...options 454 | }, { 455 | quoted 456 | }); 457 | return buffer; 458 | }; 459 | 460 | devorsix.sendVideoAsSticker = async (jid, path, quoted, options = {}) => { 461 | let buff = Buffer.isBuffer(path) ? path : /^data:.?\/.?;base64,/i.test(path) ? Buffer.from(path.split`,` [1], 'base64') : /^https?:\/\//.test(path) ? await getBuffer(path) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0); 462 | let buffer; 463 | if (options && (options.packname || options.author)) { 464 | buffer = await writeExifVid(buff, options); 465 | } else { 466 | buffer = await videoToWebp(buff); 467 | } 468 | await devorsix.sendMessage(jid, { 469 | sticker: { 470 | url: buffer 471 | }, 472 | ...options 473 | }, { 474 | quoted 475 | }); 476 | return buffer; 477 | }; 478 | 479 | devorsix.downloadAndSaveMediaMessage = async (message, filename, attachExtension = true) => { 480 | let quoted = message.msg ? message.msg : message; 481 | let mime = (message.msg || message).mimetype || ''; 482 | let messageType = message.mtype ? message.mtype.replace(/Message/gi, '') : mime.split('/')[0]; 483 | const stream = await downloadContentFromMessage(quoted, messageType); 484 | let buffer = Buffer.from([]); 485 | for await (const chunk of stream) { 486 | buffer = Buffer.concat([buffer, chunk]); 487 | } 488 | let type = await FileType.fromBuffer(buffer); 489 | let trueFileName = attachExtension ? (filename + '.' + type.ext) : filename; 490 | await fs.writeFileSync(trueFileName, buffer); 491 | return trueFileName; 492 | }; 493 | 494 | devorsix.downloadMediaMessage = async (message) => { 495 | let mime = (message.msg || message).mimetype || ''; 496 | let messageType = message.mtype ? message.mtype.replace(/Message/gi, '') : mime.split('/')[0]; 497 | const stream = await downloadContentFromMessage(message, messageType); 498 | let buffer = Buffer.from([]); 499 | for await (const chunk of stream) { 500 | buffer = Buffer.concat([buffer, chunk]); 501 | } 502 | return buffer; 503 | }; 504 | 505 | devorsix.sendMedia = async (jid, path, fileName = '', caption = '', quoted = '', options = {}) => { 506 | let types = await devorsix.getFile(path, true); 507 | let { 508 | mime, 509 | ext, 510 | res, 511 | data, 512 | filename 513 | } = types; 514 | if (res && res.status !== 200 || file.length <= 65536) { 515 | try { 516 | throw { 517 | json: JSON.parse(file.toString()) 518 | } 519 | } catch (e) { 520 | if (e.json) throw e.json 521 | } 522 | } 523 | let type = '', 524 | mimetype = mime, 525 | pathFile = filename; 526 | if (options.asDocument) type = 'document'; 527 | if (options.asSticker || /webp/.test(mime)) { 528 | let { 529 | writeExif 530 | } = require('./trashbase/lib/exif'); 531 | let media = { 532 | mimetype: mime, 533 | data 534 | }; 535 | pathFile = await writeExif(media, { 536 | packname: options.packname ? options.packname : global.packname, 537 | author: options.author ? options.author : global.author, 538 | categories: options.categories ? options.categories : [] 539 | }); 540 | await fs.promises.unlink(filename); 541 | type = 'sticker'; 542 | mimetype = 'image/webp'; 543 | } else if (/image/.test(mime)) type = 'image'; 544 | else if (/video/.test(mime)) type = 'video'; 545 | else if (/audio/.test(mime)) type = 'audio'; 546 | else type = 'document'; 547 | await devorsix.sendMessage(jid, { 548 | [type]: { 549 | url: pathFile 550 | }, 551 | caption, 552 | mimetype, 553 | fileName, 554 | ...options 555 | }, { 556 | quoted, 557 | ...options 558 | }); 559 | return fs.promises.unlink(pathFile); 560 | } 561 | 562 | devorsix.copyNForward = async (jid, message, forceForward = false, options = {}) => { 563 | let vtype; 564 | if (options.readViewOnce) { 565 | message.message = message.message && message.message.ephemeralMessage && message.message.ephemeralMessage.message ? message.message.ephemeralMessage.message : (message.message || undefined); 566 | vtype = Object.keys(message.message.viewOnceMessage.message)[0]; 567 | delete(message.message && message.message.ignore ? message.message.ignore : (message.message || undefined)); 568 | delete message.message.viewOnceMessage.message[vtype].viewOnce; 569 | message.message = { 570 | ...message.message.viewOnceMessage.message 571 | }; 572 | } 573 | let mtype = Object.keys(message.message)[0]; 574 | let content = await generateForwardMessageContent(message, forceForward); 575 | let ctype = Object.keys(content)[0]; 576 | let context = {}; 577 | if (mtype != "conversation") context = message.message[mtype].contextInfo; 578 | content[ctype].contextInfo = { 579 | ...context, 580 | ...content[ctype].contextInfo 581 | }; 582 | const waMessage = await generateWAMessageFromContent(jid, content, options ? { 583 | ...content[ctype], 584 | ...options, 585 | ...(options.contextInfo ? { 586 | contextInfo: { 587 | ...content[ctype].contextInfo, 588 | ...options.contextInfo 589 | } 590 | } : {}) 591 | } : {}); 592 | await devorsix.relayMessage(jid, waMessage.message, { 593 | messageId: waMessage.key.id 594 | }); 595 | return waMessage; 596 | } 597 | 598 | devorsix.cMod = (jid, copy, text = '', sender = devorsix.user.id, options = {}) => { 599 | // let copy = message.toJSON() 600 | let mtype = Object.keys(copy.message)[0]; 601 | let isEphemeral = mtype === 'ephemeralMessage'; 602 | if (isEphemeral) { 603 | mtype = Object.keys(copy.message.ephemeralMessage.message)[0]; 604 | } 605 | let msg = isEphemeral ? copy.message.ephemeralMessage.message : copy.message; 606 | let content = msg[mtype]; 607 | if (typeof content === 'string') msg[mtype] = text || content; 608 | else if (content.caption) content.caption = text || content.caption; 609 | else if (content.text) content.text = text || content.text; 610 | if (typeof content !== 'string') msg[mtype] = { 611 | ...content, 612 | ...options 613 | }; 614 | if (copy.key.participant) sender = copy.key.participant = sender || copy.key.participant; 615 | else if (copy.key.participant) sender = copy.key.participant = sender || copy.key.participant; 616 | if (copy.key.remoteJid.includes('@s.whatsapp.net')) sender = sender || copy.key.remoteJid; 617 | else if (copy.key.remoteJid.includes('@broadcast')) sender = sender || copy.key.remoteJid; 618 | copy.key.remoteJid = jid; 619 | copy.key.fromMe = sender === devorsix.user.id; 620 | return proto.WebMessageInfo.fromObject(copy); 621 | } 622 | 623 | devorsix.sendFile = async (jid, path, filename = '', caption = '', quoted, ptt = false, options = {}) => { 624 | let type = await devorsix.getFile(path, true); 625 | let { 626 | res, 627 | data: file, 628 | filename: pathFile 629 | } = type; 630 | if (res && res.status !== 200 || file.length <= 65536) { 631 | try { 632 | throw { 633 | json: JSON.parse(file.toString()) 634 | }; 635 | } catch (e) { 636 | if (e.json) throw e.json; 637 | } 638 | } 639 | let opt = { 640 | filename 641 | }; 642 | if (quoted) opt.quoted = quoted; 643 | if (!type) options.asDocument = true; 644 | let mtype = '', 645 | mimetype = type.mime, 646 | convert; 647 | if (/webp/.test(type.mime) || (/image/.test(type.mime) && options.asSticker)) mtype = 'sticker'; 648 | else if (/image/.test(type.mime) || (/webp/.test(type.mime) && options.asImage)) mtype = 'image'; 649 | else if (/video/.test(type.mime)) mtype = 'video'; 650 | else if (/audio/.test(type.mime)) { 651 | convert = await (ptt ? toPTT : toAudio)(file, type.ext); 652 | file = convert.data; 653 | pathFile = convert.filename; 654 | mtype = 'audio'; 655 | mimetype = 'audio/ogg codecs=opus'; 656 | } else mtype = 'document'; 657 | if (options.asDocument) mtype = 'document'; 658 | delete options.asSticker; 659 | delete options.asLocation; 660 | delete options.asVideo; 661 | delete options.asDocument; 662 | delete options.asImage; 663 | let message = { 664 | ...options, 665 | caption, 666 | ptt, 667 | [mtype]: { 668 | url: pathFile 669 | }, 670 | mimetype 671 | }; 672 | let m; 673 | try { 674 | m = await devorsix.sendMessage(jid, message, { 675 | ...opt, 676 | ...options 677 | }); 678 | } catch (e) { 679 | // console.error(e) 680 | m = null; 681 | } finally { 682 | if (!m) m = await devorsix.sendMessage(jid, { 683 | ...message, 684 | [mtype]: file 685 | }, { 686 | ...opt, 687 | ...options 688 | }); 689 | file = null; 690 | return m; 691 | } 692 | } 693 | 694 | devorsix.getFile = async (PATH, save) => { 695 | let res; 696 | 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); 697 | // if (!Buffer.isBuffer(data)) throw new TypeError('Result is not a buffer') 698 | let type = await FileType.fromBuffer(data) || { 699 | mime: 'application/octet-stream', 700 | ext: '.bin' 701 | }; 702 | filename = path.resolve(__dirname, './trashbase/src/' + new Date * 1 + '.' + type.ext); 703 | if (data && save) fs.promises.writeFile(filename, data); 704 | return { 705 | res, 706 | filename, 707 | size: await getSizeMedia(data), 708 | ...type, 709 | data 710 | }; 711 | } 712 | 713 | devorsix.ev.on('creds.update', saveCreds) 714 | 715 | devorsix.ev.on('messages.upsert', async (chatUpdate) => { 716 | try { 717 | let mek = chatUpdate.messages[0]; 718 | if (!mek.message) return; 719 | mek.message = (Object.keys(mek.message)[0] === 'ephemeralMessage') ? mek.message.ephemeralMessage.message : mek.message; 720 | if (mek.key && mek.key.remoteJid === 'status@broadcast') return; 721 | let m = smsg(devorsix, mek, store); 722 | require("./devorsixcore.js")(devorsix, m, chatUpdate, store); 723 | } catch (err) { 724 | console.log(err); 725 | } 726 | }); 727 | return devorsix; 728 | 729 | } 730 | 731 | 732 | start(); 733 | 734 | 735 | let file = require.resolve(__filename); 736 | fs.watchFile(file, () => { 737 | fs.unwatchFile(file); 738 | console.log(chalk.redBright(`Update ${__filename}`)); 739 | delete require.cache[file]; 740 | require(file); 741 | }); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Devor6core-Base", 3 | "version": "2.0.0", 4 | "description": "Simple Base Bot Whatsapp", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "author": "devorsixcore", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@whiskeysockets/baileys": "github:kangfarrel/felzar-baileys", 13 | "axios": "^1.7.7", 14 | "boom": "^7.3.0", 15 | "chalk": "^4.1.2", 16 | "cheerio": "^1.0.0", 17 | "file-type": "^16.5.4", 18 | "fluent-ffmpeg": "^2.1.3", 19 | "form-data": "^4.0.1", 20 | "https": "^1.0.0", 21 | "human-readable": "^0.2.1", 22 | "jimp": "^0.16.13", 23 | "lodash": "^4.17.21", 24 | "lowdb": "^2.1.0", 25 | "moment": "^2.30.1", 26 | "moment-timezone": "^0.5.45", 27 | "mongoose": "^7.4.5", 28 | "node-fetch": "^2.6.1", 29 | "node-webpmux": "^3.2.0", 30 | "os": "^0.1.2", 31 | "performance-now": "^2.1.0", 32 | "pino": "^9.4.0", 33 | "qrcode-terminal": "^0.12.0", 34 | "readline": "^1.3.0", 35 | "socks-proxy-agent": "^8.0.4", 36 | "speed": "^1.2.3", 37 | "yargs": "^17.7.2" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /trashbase/database/database.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /trashbase/lib/cloudDBAdapter.js: -------------------------------------------------------------------------------- 1 | const got = require('got') 2 | 3 | const stringify = obj => JSON.stringify(obj, null, 2) 4 | const parse = str => JSON.parse(str, (_, v) => { 5 | if ( 6 | v !== null && 7 | typeof v === 'object' && 8 | 'type' in v && 9 | v.type === 'Buffer' && 10 | 'data' in v && 11 | Array.isArray(v.data)) { 12 | return Buffer.from(v.data) 13 | } 14 | return v 15 | }) 16 | class CloudDBAdapter { 17 | constructor(url, { 18 | serialize = stringify, 19 | deserialize = parse, 20 | fetchOptions = {} 21 | } = {}) { 22 | this.url = url 23 | this.serialize = serialize 24 | this.deserialize = deserialize 25 | this.fetchOptions = fetchOptions 26 | } 27 | 28 | async read() { 29 | try { 30 | let res = await got(this.url, { 31 | method: 'GET', 32 | headers: { 33 | 'Accept': 'application/json;q=0.9,text/plain' 34 | }, 35 | ...this.fetchOptions 36 | }) 37 | if (res.statusCode !== 200) throw res.statusMessage 38 | return this.deserialize(res.body) 39 | } catch (e) { 40 | return null 41 | } 42 | } 43 | 44 | async write(obj) { 45 | let res = await got(this.url, { 46 | method: 'POST', 47 | headers: { 48 | 'Content-Type': 'application/json' 49 | }, 50 | ...this.fetchOptions, 51 | body: this.serialize(obj) 52 | }) 53 | if (res.statusCode !== 200) throw res.statusMessage 54 | return res.body 55 | } 56 | } 57 | 58 | module.exports = CloudDBAdapter 59 | -------------------------------------------------------------------------------- /trashbase/lib/color.js: -------------------------------------------------------------------------------- 1 | const chalk = require('chalk') 2 | 3 | const color = (text, color) => { 4 | return !color ? chalk.green(text) : chalk.keyword(color)(text) 5 | } 6 | 7 | const bgcolor = (text, bgcolor) => { 8 | return !bgcolor ? chalk.green(text) : chalk.bgKeyword(bgcolor)(text) 9 | } 10 | 11 | const Lognyong = (text, color) => { 12 | return !color ? chalk.yellow('[ ! ] ') + chalk.green(text) : chalk.yellow('=> ') + chalk.keyword(color)(text) 13 | } 14 | 15 | module.exports = { 16 | color, 17 | bgcolor, 18 | Lognyong 19 | } 20 | -------------------------------------------------------------------------------- /trashbase/lib/converter.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | const path = require('path') 3 | const { spawn } = require('child_process') 4 | 5 | function ffmpeg(buffer, args = [], ext = '', ext2 = '') { 6 | return new Promise(async (resolve, reject) => { 7 | try { 8 | let tmp = path.join(__dirname, '../src', + new Date + '.' + ext) 9 | let out = tmp + '.' + ext2 10 | await fs.promises.writeFile(tmp, buffer) 11 | spawn('ffmpeg', [ 12 | '-y', 13 | '-i', tmp, 14 | ...args, 15 | out 16 | ]) 17 | .on('error', reject) 18 | .on('close', async (code) => { 19 | try { 20 | await fs.promises.unlink(tmp) 21 | if (code !== 0) return reject(code) 22 | resolve(await fs.promises.readFile(out)) 23 | await fs.promises.unlink(out) 24 | } catch (e) { 25 | reject(e) 26 | } 27 | }) 28 | } catch (e) { 29 | reject(e) 30 | } 31 | }) 32 | } 33 | 34 | /** 35 | * Convert Audio to Playable WhatsApp Audio 36 | * @param {Buffer} buffer Audio Buffer 37 | * @param {String} ext File Extension 38 | */ 39 | function toAudio(buffer, ext) { 40 | return ffmpeg(buffer, [ 41 | '-vn', 42 | '-ac', '2', 43 | '-b:a', '128k', 44 | '-ar', '44100', 45 | '-f', 'mp3' 46 | ], ext, 'mp3') 47 | } 48 | 49 | /** 50 | * Convert Audio to Playable WhatsApp PTT 51 | * @param {Buffer} buffer Audio Buffer 52 | * @param {String} ext File Extension 53 | */ 54 | function toPTT(buffer, ext) { 55 | return ffmpeg(buffer, [ 56 | '-vn', 57 | '-c:a', 'libopus', 58 | '-b:a', '128k', 59 | '-vbr', 'on', 60 | '-compression_level', '10' 61 | ], ext, 'opus') 62 | } 63 | 64 | /** 65 | * Convert Audio to Playable WhatsApp Video 66 | * @param {Buffer} buffer Video Buffer 67 | * @param {String} ext File Extension 68 | */ 69 | function toVideo(buffer, ext) { 70 | return ffmpeg(buffer, [ 71 | '-c:v', 'libx264', 72 | '-c:a', 'aac', 73 | '-ab', '128k', 74 | '-ar', '44100', 75 | '-crf', '32', 76 | '-preset', 'slow' 77 | ], ext, 'mp4') 78 | } 79 | 80 | module.exports = { 81 | toAudio, 82 | toPTT, 83 | toVideo, 84 | ffmpeg, 85 | } 86 | -------------------------------------------------------------------------------- /trashbase/lib/exif.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Create By Mhankbarbar 3 | * Contact - 4 | * Follow https://github.com/MhankBarBar 5 | */ 6 | 7 | 8 | const fs = require('fs') 9 | const { tmpdir } = require("os") 10 | const Crypto = require("crypto") 11 | const ff = require('fluent-ffmpeg') 12 | const webp = require("node-webpmux") 13 | const path = require("path") 14 | 15 | 16 | async function imageToWebp (media) { 17 | 18 | const tmpFileOut = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`) 19 | const tmpFileIn = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.jpg`) 20 | 21 | fs.writeFileSync(tmpFileIn, media) 22 | 23 | await new Promise((resolve, reject) => { 24 | ff(tmpFileIn) 25 | .on("error", reject) 26 | .on("end", () => resolve(true)) 27 | .addOutputOptions([ 28 | "-vcodec", 29 | "libwebp", 30 | "-vf", 31 | "scale='min(320,iw)':min'(320,ih)':force_original_aspect_ratio=decrease,fps=15, pad=320:320:-1:-1:color=white@0.0, split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse" 32 | ]) 33 | .toFormat("webp") 34 | .save(tmpFileOut) 35 | }) 36 | 37 | const buff = fs.readFileSync(tmpFileOut) 38 | fs.unlinkSync(tmpFileOut) 39 | fs.unlinkSync(tmpFileIn) 40 | return buff 41 | } 42 | 43 | async function videoToWebp (media) { 44 | 45 | const tmpFileOut = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`) 46 | const tmpFileIn = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.mp4`) 47 | 48 | fs.writeFileSync(tmpFileIn, media) 49 | 50 | await new Promise((resolve, reject) => { 51 | ff(tmpFileIn) 52 | .on("error", reject) 53 | .on("end", () => resolve(true)) 54 | .addOutputOptions([ 55 | "-vcodec", 56 | "libwebp", 57 | "-vf", 58 | "scale='min(320,iw)':min'(320,ih)':force_original_aspect_ratio=decrease,fps=15, pad=320:320:-1:-1:color=white@0.0, split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse", 59 | "-loop", 60 | "0", 61 | "-ss", 62 | "00:00:00", 63 | "-t", 64 | "00:00:05", 65 | "-preset", 66 | "default", 67 | "-an", 68 | "-vsync", 69 | "0" 70 | ]) 71 | .toFormat("webp") 72 | .save(tmpFileOut) 73 | }) 74 | 75 | const buff = fs.readFileSync(tmpFileOut) 76 | fs.unlinkSync(tmpFileOut) 77 | fs.unlinkSync(tmpFileIn) 78 | return buff 79 | } 80 | 81 | async function writeExifImg (media, metadata) { 82 | let wMedia = await imageToWebp(media) 83 | const tmpFileIn = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`) 84 | const tmpFileOut = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`) 85 | fs.writeFileSync(tmpFileIn, wMedia) 86 | 87 | if (metadata.packname || metadata.author) { 88 | const img = new webp.Image() 89 | const json = { "sticker-pack-id": `https://github.com/nazedev/naze`, "sticker-pack-name": metadata.packname, "sticker-pack-publisher": metadata.author, "emojis": metadata.categories ? metadata.categories : [""] } 90 | const exifAttr = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00]) 91 | const jsonBuff = Buffer.from(JSON.stringify(json), "utf-8") 92 | const exif = Buffer.concat([exifAttr, jsonBuff]) 93 | exif.writeUIntLE(jsonBuff.length, 14, 4) 94 | await img.load(tmpFileIn) 95 | fs.unlinkSync(tmpFileIn) 96 | img.exif = exif 97 | await img.save(tmpFileOut) 98 | return tmpFileOut 99 | } 100 | } 101 | 102 | async function writeExifVid (media, metadata) { 103 | let wMedia = await videoToWebp(media) 104 | const tmpFileIn = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`) 105 | const tmpFileOut = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`) 106 | fs.writeFileSync(tmpFileIn, wMedia) 107 | 108 | if (metadata.packname || metadata.author) { 109 | const img = new webp.Image() 110 | const json = { "sticker-pack-id": `https://github.com/nazedev/naze`, "sticker-pack-name": metadata.packname, "sticker-pack-publisher": metadata.author, "emojis": metadata.categories ? metadata.categories : [""] } 111 | const exifAttr = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00]) 112 | const jsonBuff = Buffer.from(JSON.stringify(json), "utf-8") 113 | const exif = Buffer.concat([exifAttr, jsonBuff]) 114 | exif.writeUIntLE(jsonBuff.length, 14, 4) 115 | await img.load(tmpFileIn) 116 | fs.unlinkSync(tmpFileIn) 117 | img.exif = exif 118 | await img.save(tmpFileOut) 119 | return tmpFileOut 120 | } 121 | } 122 | 123 | async function writeExif (media, metadata) { 124 | let wMedia = /webp/.test(media.mimetype) ? media.data : /image/.test(media.mimetype) ? await imageToWebp(media.data) : /video/.test(media.mimetype) ? await videoToWebp(media.data) : "" 125 | const tmpFileIn = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`) 126 | const tmpFileOut = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`) 127 | fs.writeFileSync(tmpFileIn, wMedia) 128 | 129 | if (metadata.packname || metadata.author) { 130 | const img = new webp.Image() 131 | const json = { "sticker-pack-id": `https://github.com/nazedev/naze`, "sticker-pack-name": metadata.packname, "sticker-pack-publisher": metadata.author, "emojis": metadata.categories ? metadata.categories : [""] } 132 | const exifAttr = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00]) 133 | const jsonBuff = Buffer.from(JSON.stringify(json), "utf-8") 134 | const exif = Buffer.concat([exifAttr, jsonBuff]) 135 | exif.writeUIntLE(jsonBuff.length, 14, 4) 136 | await img.load(tmpFileIn) 137 | fs.unlinkSync(tmpFileIn) 138 | img.exif = exif 139 | await img.save(tmpFileOut) 140 | return tmpFileOut 141 | } 142 | } 143 | 144 | module.exports = { imageToWebp, videoToWebp, writeExifImg, writeExifVid, writeExif } 145 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/CAF: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/Low.d.ts: -------------------------------------------------------------------------------- 1 | export interface Adapter { 2 | read: () => Promise; 3 | write: (data: T) => Promise; 4 | } 5 | export declare class Low { 6 | adapter: Adapter; 7 | data: T | null; 8 | constructor(adapter: Adapter); 9 | read(): Promise; 10 | write(): Promise; 11 | } 12 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/Low.js: -------------------------------------------------------------------------------- 1 | const { MissingAdapterError } = require('./MissingAdapterError.js'); 2 | class Low { 3 | constructor(adapter) { 4 | this.data = null; 5 | if (adapter) { 6 | this.adapter = adapter; 7 | } 8 | else { 9 | throw new MissingAdapterError(); 10 | } 11 | } 12 | async read() { 13 | this.data = await this.adapter.read(); 14 | } 15 | async write() { 16 | if (this.data) { 17 | await this.adapter.write(this.data); 18 | } 19 | } 20 | } 21 | module.exports = { Low }; 22 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/LowSync.d.ts: -------------------------------------------------------------------------------- 1 | export interface SyncAdapter { 2 | read: () => T | null; 3 | write: (data: T) => void; 4 | } 5 | export declare class LowSync { 6 | adapter: SyncAdapter; 7 | data: T | null; 8 | constructor(adapter: SyncAdapter); 9 | read(): void; 10 | write(): void; 11 | } 12 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/LowSync.js: -------------------------------------------------------------------------------- 1 | const { MissingAdapterError } = require('./MissingAdapterError.js'); 2 | class LowSync { 3 | constructor(adapter) { 4 | this.data = null; 5 | if (adapter) { 6 | this.adapter = adapter; 7 | } 8 | else { 9 | throw new MissingAdapterError(); 10 | } 11 | } 12 | read() { 13 | this.data = this.adapter.read(); 14 | } 15 | write() { 16 | if (this.data !== null) { 17 | this.adapter.write(this.data); 18 | } 19 | } 20 | } 21 | module.exports = { LowSync }; 22 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/MissingAdapterError.d.ts: -------------------------------------------------------------------------------- 1 | export declare class MissingAdapterError extends Error { 2 | constructor(); 3 | } 4 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/MissingAdapterError.js: -------------------------------------------------------------------------------- 1 | class MissingAdapterError extends Error { 2 | constructor() { 3 | super(); 4 | this.message = 'Missing Adapter'; 5 | } 6 | } 7 | module.exports = { MissingAdapterError }; 8 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/CAF: -------------------------------------------------------------------------------- 1 | >\\\< 2 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/JSONFile.d.ts: -------------------------------------------------------------------------------- 1 | import { Adapter } from '../Low.js'; 2 | export declare class JSONFile implements Adapter { 3 | private adapter; 4 | constructor(filename: string); 5 | read(): Promise; 6 | write(obj: T): Promise; 7 | } 8 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/JSONFile.js: -------------------------------------------------------------------------------- 1 | const { TextFile } = require('./TextFile.js'); 2 | class JSONFile { 3 | constructor(filename) { 4 | this.adapter = new TextFile(filename); 5 | } 6 | async read() { 7 | const data = await this.adapter.read(); 8 | if (data === null) { 9 | return null; 10 | } 11 | else { 12 | return JSON.parse(data); 13 | } 14 | } 15 | write(obj) { 16 | return this.adapter.write(JSON.stringify(obj, null, 2)); 17 | } 18 | } 19 | module.exports = { JSONFile }; 20 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/JSONFileSync.d.ts: -------------------------------------------------------------------------------- 1 | import { SyncAdapter } from '../LowSync.js'; 2 | export declare class JSONFileSync implements SyncAdapter { 3 | private adapter; 4 | constructor(filename: string); 5 | read(): T | null; 6 | write(obj: T): void; 7 | } 8 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/JSONFileSync.js: -------------------------------------------------------------------------------- 1 | const { TextFileSync } = require('./TextFileSync.js'); 2 | class JSONFileSync { 3 | constructor(filename) { 4 | this.adapter = new TextFileSync(filename); 5 | } 6 | read() { 7 | const data = this.adapter.read(); 8 | if (data === null) { 9 | return null; 10 | } 11 | else { 12 | return JSON.parse(data); 13 | } 14 | } 15 | write(obj) { 16 | this.adapter.write(JSON.stringify(obj, null, 2)); 17 | } 18 | } 19 | module.exports = { JSONFileSync }; 20 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/LocalStorage.d.ts: -------------------------------------------------------------------------------- 1 | import { SyncAdapter } from '../LowSync.js'; 2 | export declare class LocalStorage implements SyncAdapter { 3 | private key; 4 | constructor(key: string); 5 | read(): T | null; 6 | write(obj: T): void; 7 | } 8 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/LocalStorage.js: -------------------------------------------------------------------------------- 1 | class LocalStorage { 2 | constructor(key) { 3 | this.key = key; 4 | } 5 | read() { 6 | const value = localStorage.getItem(this.key); 7 | if (value === null) { 8 | return null; 9 | } 10 | return JSON.parse(value); 11 | } 12 | write(obj) { 13 | localStorage.setItem(this.key, JSON.stringify(obj)); 14 | } 15 | } 16 | module.exports = { LocalStorage }; 17 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/Memory.d.ts: -------------------------------------------------------------------------------- 1 | import { Adapter } from '../Low.js'; 2 | export declare class Memory implements Adapter { 3 | private data; 4 | read(): Promise; 5 | write(obj: T): Promise; 6 | } 7 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/Memory.js: -------------------------------------------------------------------------------- 1 | class Memory { 2 | constructor() { 3 | this.data = null; 4 | } 5 | read() { 6 | return Promise.resolve(this.data); 7 | } 8 | write(obj) { 9 | this.data = obj; 10 | return Promise.resolve(); 11 | } 12 | } 13 | module.exports = { Memory }; 14 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/MemorySync.d.ts: -------------------------------------------------------------------------------- 1 | import { SyncAdapter } from '../LowSync.js'; 2 | export declare class MemorySync implements SyncAdapter { 3 | private data; 4 | read(): T | null; 5 | write(obj: T): void; 6 | } 7 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/MemorySync.js: -------------------------------------------------------------------------------- 1 | class MemorySync { 2 | constructor() { 3 | this.data = null; 4 | } 5 | read() { 6 | return this.data || null; 7 | } 8 | write(obj) { 9 | this.data = obj; 10 | } 11 | } 12 | module.exports = { MemorySync }; 13 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/TextFile.d.ts: -------------------------------------------------------------------------------- 1 | import { Adapter } from '../Low.js'; 2 | export declare class TextFile implements Adapter { 3 | private filename; 4 | private writer; 5 | constructor(filename: string); 6 | read(): Promise; 7 | write(str: string): Promise; 8 | } 9 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/TextFile.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const { Writer } = require('steno'); 3 | class TextFile { 4 | constructor(filename) { 5 | this.filename = filename; 6 | this.writer = new Writer(filename); 7 | } 8 | async read() { 9 | let data; 10 | try { 11 | data = await fs.promises.readFile(this.filename, 'utf-8'); 12 | } 13 | catch (e) { 14 | if (e.code === 'ENOENT') { 15 | return null; 16 | } 17 | throw e; 18 | } 19 | return data; 20 | } 21 | write(str) { 22 | return this.writer.write(str); 23 | } 24 | } 25 | module.exports = { TextFile }; -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/TextFileSync.d.ts: -------------------------------------------------------------------------------- 1 | import { SyncAdapter } from '../LowSync.js'; 2 | export declare class TextFileSync implements SyncAdapter { 3 | private tempFilename; 4 | private filename; 5 | constructor(filename: string); 6 | read(): string | null; 7 | write(str: string): void; 8 | } 9 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/adapters/TextFileSync.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | class TextFileSync { 4 | constructor(filename) { 5 | this.filename = filename; 6 | this.tempFilename = path.join(path.dirname(filename), `.${path.basename(filename)}.tmp`); 7 | } 8 | read() { 9 | let data; 10 | try { 11 | data = fs.readFileSync(this.filename, 'utf-8'); 12 | } 13 | catch (e) { 14 | if (e.code === 'ENOENT') { 15 | return null; 16 | } 17 | throw e; 18 | } 19 | return data; 20 | } 21 | write(str) { 22 | fs.writeFileSync(this.tempFilename, str); 23 | fs.renameSync(this.tempFilename, this.filename); 24 | } 25 | } 26 | module.exports = { TextFileSync }; 27 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from './adapters/JSONFile.js'; 2 | export * from './adapters/JSONFileSync.js'; 3 | export * from './adapters/LocalStorage.js'; 4 | export * from './adapters/Memory.js'; 5 | export * from './adapters/MemorySync.js'; 6 | export * from './adapters/TextFile.js'; 7 | export * from './adapters/TextFileSync.js'; 8 | export * from './Low.js'; 9 | export * from './LowSync.js'; 10 | -------------------------------------------------------------------------------- /trashbase/lib/lowdb/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('./adapters/JSONFile.js'), 3 | ...require('./adapters/JSONFileSync.js'), 4 | ...require('./adapters/LocalStorage.js'), 5 | ...require('./adapters/Memory.js'), 6 | ...require('./adapters/MemorySync.js'), 7 | ...require('./adapters/TextFile.js'), 8 | ...require('./adapters/TextFileSync.js'), 9 | ...require('./Low.js'), 10 | ...require('./LowSync.js'), 11 | } -------------------------------------------------------------------------------- /trashbase/lib/mongoDB.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose') 2 | const { Schema } = mongoose 3 | 4 | module.exports = class mongoDB { 5 | constructor(url, options = { useNewUrlParser: true, useUnifiedTopology: true }) { 6 | this.url = url 7 | this.data = this._data = this._schema = this._model = {} 8 | this.db 9 | this.options = options 10 | } 11 | async read() { 12 | this.db = await mongoose.connect(this.url, { ...this.options }) 13 | this.connection = mongoose.connection 14 | let schema = this._schema = new Schema({ 15 | data: { 16 | type: Object, 17 | required: true, //depends on whether the field is mandatory or not 18 | default: {} 19 | } 20 | }) 21 | // this._model = mongoose.model('data', schema) 22 | try { this._model = mongoose.model('data', schema) } catch { this._model = mongoose.model('data') } 23 | this._data = await this._model.findOne({}) 24 | if (!this._data) { 25 | this.data = {} 26 | await this.write(this.data) 27 | this._data = await this._model.findOne({}) 28 | } else this.data = this._data.data 29 | return this.data 30 | } 31 | 32 | 33 | async write(data) { 34 | if (!data) return data 35 | if (!this._data) return (new this._model({ data })).save() 36 | this._model.findById(this._data._id, (err, docs) => { 37 | if (!err) { 38 | if (!docs.data) docs.data = {} 39 | docs.data = data 40 | return docs.save() 41 | } 42 | }) 43 | } 44 | } -------------------------------------------------------------------------------- /trashbase/lib/myfunc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created By Dika Ardnt. 3 | * Modified By Devorsixcore 4 | */ 5 | 6 | const { proto, delay, getContentType } = require('@whiskeysockets/baileys'); 7 | const chalk = require('chalk'); 8 | const fs = require('fs'); 9 | const Crypto = require('crypto'); 10 | const axios = require('axios'); 11 | const moment = require('moment-timezone'); 12 | const { sizeFormatter } = require('human-readable'); 13 | const util = require('util'); 14 | const Jimp = require('jimp'); 15 | 16 | const unixTimestampSeconds = (date = new Date()) => Math.floor(date.getTime() / 1000); 17 | exports.unixTimestampSeconds = unixTimestampSeconds; 18 | 19 | exports.generateMessageTag = (epoch) => { 20 | let tag = exports.unixTimestampSeconds().toString(); 21 | if (epoch) tag += '.--' + epoch; // attach epoch if provided 22 | return tag; 23 | }; 24 | 25 | exports.processTime = (timestamp, now) => { 26 | return moment.duration(now - moment(timestamp * 1000)).asSeconds(); 27 | }; 28 | 29 | exports.getRandom = (ext) => `${Math.floor(Math.random() * 10000)}${ext}`; 30 | 31 | exports.getBuffer = async (url, options) => { 32 | try { 33 | options = options || {}; 34 | const res = await axios({ 35 | method: 'get', 36 | url, 37 | headers: { 38 | 'DNT': 1, 39 | 'Upgrade-Insecure-Request': 1, 40 | }, 41 | ...options, 42 | responseType: 'arraybuffer', 43 | }); 44 | return res.data; 45 | } catch (err) { 46 | return err; 47 | } 48 | }; 49 | 50 | exports.fetchJson = async (url, options) => { 51 | try { 52 | options = options || {}; 53 | const res = await axios({ 54 | method: 'GET', 55 | url, 56 | headers: { 57 | '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', 58 | }, 59 | ...options, 60 | }); 61 | return res.data; 62 | } catch (err) { 63 | return err; 64 | } 65 | }; 66 | 67 | exports.runtime = (seconds) => { 68 | seconds = Number(seconds); 69 | const d = Math.floor(seconds / (3600 * 24)); 70 | const h = Math.floor((seconds % (3600 * 24)) / 3600); 71 | const m = Math.floor((seconds % 3600) / 60); 72 | const s = Math.floor(seconds % 60); 73 | return `${d > 0 ? d + (d === 1 ? " day, " : " days, ") : ""} 74 | ${h > 0 ? h + (h === 1 ? " hour, " : " hours, ") : ""} 75 | ${m > 0 ? m + (m === 1 ? " minute, " : " minutes, ") : ""} 76 | ${s > 0 ? s + (s === 1 ? " second" : " seconds") : ""}`.trim(); 77 | }; 78 | 79 | exports.clockString = (ms) => { 80 | const h = isNaN(ms) ? '--' : Math.floor(ms / 3600000); 81 | const m = isNaN(ms) ? '--' : Math.floor(ms / 60000) % 60; 82 | const s = isNaN(ms) ? '--' : Math.floor(ms / 1000) % 60; 83 | return [h, m, s].map(v => v.toString().padStart(2, '0')).join(':'); 84 | }; 85 | 86 | exports.sleep = async (ms) => new Promise(resolve => setTimeout(resolve, ms)); 87 | 88 | exports.isUrl = (url) => url.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/gi); 89 | 90 | exports.getTime = (format, date) => { 91 | return moment(date || moment.tz('Asia/Jakarta')).locale('id').format(format); 92 | }; 93 | 94 | exports.formatDate = (n, locale = 'id') => { 95 | const d = new Date(n); 96 | return d.toLocaleDateString(locale, { 97 | weekday: 'long', 98 | day: 'numeric', 99 | month: 'long', 100 | year: 'numeric', 101 | hour: 'numeric', 102 | minute: 'numeric', 103 | second: 'numeric', 104 | }); 105 | }; 106 | 107 | exports.tanggal = (numer) => { 108 | const myMonths = ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"]; 109 | const myDays = ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jum’at', 'Sabtu']; 110 | const tgl = new Date(numer); 111 | const day = tgl.getDate(); 112 | const bulan = tgl.getMonth(); 113 | const thisDay = myDays[tgl.getDay()]; 114 | const year = (tgl.getFullYear()); 115 | const time = moment.tz('Asia/Jakarta').format('DD/MM HH:mm:ss'); 116 | const gmt = new Date(0).getTime() - new Date('1 January 1970').getTime(); 117 | const weton = ['Pahing', 'Pon', 'Wage', 'Kliwon', 'Legi'][Math.floor(((Date.now() + gmt) / 84600000) % 5)]; 118 | return `${thisDay}, ${day} - ${myMonths[bulan]} - ${year}`; 119 | }; 120 | 121 | exports.formatp = sizeFormatter({ 122 | std: 'JEDEC', // 'SI' = default | 'IEC' | 'JEDEC' 123 | decimalPlaces: 2, 124 | keepTrailingZeroes: false, 125 | render: (literal, symbol) => `${literal} ${symbol}B`, 126 | }); 127 | 128 | exports.jsonformat = (string) => JSON.stringify(string, null, 2); 129 | 130 | exports.logic = (check, inp, out) => { 131 | if (inp.length !== out.length) throw new Error('Input and Output must have same length'); 132 | for (let i in inp) { 133 | if (util.isDeepStrictEqual(check, inp[i])) return out[i]; 134 | } 135 | return null; 136 | }; 137 | 138 | exports.generateProfilePicture = async (buffer) => { 139 | const jimp = await Jimp.read(buffer); 140 | const min = jimp.getWidth(); 141 | const max = jimp.getHeight(); 142 | const cropped = jimp.crop(0, 0, min, max); 143 | return { 144 | img: await cropped.scaleToFit(720, 720).getBufferAsync(Jimp.MIME_JPEG), 145 | preview: await cropped.scaleToFit(720, 720).getBufferAsync(Jimp.MIME_JPEG), 146 | }; 147 | }; 148 | 149 | exports.bytesToSize = (bytes, decimals = 2) => { 150 | if (bytes === 0) return '0 Bytes'; 151 | const k = 1024; 152 | const dm = decimals < 0 ? 0 : decimals; 153 | const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; 154 | const i = Math.floor(Math.log(bytes) / Math.log(k)); 155 | return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; 156 | }; 157 | 158 | exports.getSizeMedia = (path) => { 159 | return new Promise((resolve, reject) => { 160 | if (/http/.test(path)) { 161 | axios.get(path).then((res) => { 162 | const length = parseInt(res.headers['content-length']); 163 | const size = exports.bytesToSize(length, 3); 164 | if (!isNaN(length)) resolve(size); 165 | }).catch(reject); 166 | } else if (Buffer.isBuffer(path)) { 167 | const length = Buffer.byteLength(path); 168 | const size = exports.bytesToSize(length, 3); 169 | if (!isNaN(length)) resolve(size); 170 | } else { 171 | reject('error: invalid input'); 172 | } 173 | }); 174 | }; 175 | 176 | exports.parseMention = (text = '') => { 177 | return [...text.matchAll(/@([0-9]{5,16}|0)/g)].map(v => v[1] + '@s.whatsapp.net'); 178 | }; 179 | 180 | exports.getGroupAdmins = (participants) => { 181 | const admins = []; 182 | for (const i of participants) { 183 | if (i.admin === "superadmin" || i.admin === "admin") { 184 | admins.push(i.id); 185 | } 186 | } 187 | return admins || []; 188 | }; 189 | 190 | /** 191 | * Serialize Message 192 | * @param {WAConnection} conn 193 | * @param {Object} m 194 | * @param {store} store 195 | */ 196 | exports.smsg = (conn, m, store) => { 197 | if (!m) return m; 198 | 199 | let M = proto.WebMessageInfo; 200 | 201 | if (m.key) { 202 | m.id = m.key.id; 203 | m.isBaileys = m.id.startsWith('BAE5') && m.id.length === 16; 204 | m.chat = m.key.remoteJid; 205 | m.fromMe = m.key.fromMe; 206 | m.isGroup = m.chat.endsWith('@g.us'); 207 | m.sender = conn.decodeJid(m.fromMe && conn.user.id || m.participant || m.chat || ''); 208 | 209 | if (m.isGroup) m.participant = conn.decodeJid(m.key.participant) || ''; 210 | } 211 | 212 | if (m.message) { 213 | m.mtype = getContentType(m.message); 214 | m.msg = (m.mtype === 'viewOnceMessage' ? 215 | m.message[m.mtype].message[getContentType(m.message[m.mtype].message)] : 216 | m.message[m.mtype] 217 | ); 218 | 219 | m.body = ( 220 | m.mtype === 'conversation' ? m.message.conversation : 221 | m.mtype === 'imageMessage' ? m.message.imageMessage.caption : 222 | m.mtype === 'videoMessage' ? m.message.videoMessage.caption : 223 | m.mtype === 'extendedTextMessage' ? m.message.extendedTextMessage.text : 224 | m.mtype === 'buttonsResponseMessage' ? m.message.buttonsResponseMessage.selectedButtonId : 225 | m.mtype === 'listResponseMessage' ? m.message.listResponseMessage.singleSelectReply.selectedRowId : 226 | m.mtype === 'interactiveResponseMessage' ? JSON.parse(m.message.interactiveResponseMessage.nativeFlowResponseMessage.paramsJson).id : 227 | m.mtype === 'templateButtonReplyMessage' ? m.message.templateButtonReplyMessage.selectedId : 228 | m.mtype === 'messageContextInfo' ? 229 | m.message.buttonsResponseMessage?.selectedButtonId || 230 | m.message.listResponseMessage?.singleSelectReply.selectedRowId || 231 | m.message.InteractiveResponseMessage.NativeFlowResponseMessage || 232 | m.text : 233 | '' 234 | ) || ''; 235 | 236 | let quoted = m.quoted = m.msg.contextInfo ? m.msg.contextInfo.quotedMessage : null; 237 | m.mentionedJid = m.msg.contextInfo ? m.msg.contextInfo.mentionedJid : []; 238 | 239 | if (m.quoted) { 240 | let type = Object.keys(m.quoted)[0]; 241 | m.quoted = m.quoted[type]; 242 | 243 | if (['productMessage'].includes(type)) { 244 | type = Object.keys(m.quoted)[0]; 245 | m.quoted = m.quoted[type]; 246 | } 247 | 248 | if (typeof m.quoted === 'string') m.quoted = { text: m.quoted }; 249 | 250 | m.quoted.mtype = type; 251 | m.quoted.id = m.msg.contextInfo.stanzaId; 252 | m.quoted.chat = m.msg.contextInfo.remoteJid || m.chat; 253 | m.quoted.isBaileys = m.quoted.id ? m.quoted.id.startsWith('BAE5') && m.quoted.id.length === 16 : false; 254 | m.quoted.sender = conn.decodeJid(m.msg.contextInfo.participant); 255 | m.quoted.fromMe = m.quoted.sender === (conn.user && conn.user.id); 256 | m.quoted.text = m.quoted.text || m.quoted.caption || m.quoted.conversation || m.quoted.contentText || m.quoted.selectedDisplayText || m.quoted.title || ''; 257 | m.quoted.mentionedJid = m.msg.contextInfo ? m.msg.contextInfo.mentionedJid : []; 258 | 259 | m.getQuotedObj = m.getQuotedMessage = async () => { 260 | if (!m.quoted.id) return false; 261 | let q = await store.loadMessage(m.chat, m.quoted.id, conn); 262 | return exports.smsg(conn, q, store); 263 | }; 264 | 265 | let vM = m.quoted.fakeObj = M.fromObject({ 266 | key: { 267 | remoteJid: m.quoted.chat, 268 | fromMe: m.quoted.fromMe, 269 | id: m.quoted.id 270 | }, 271 | message: quoted, 272 | ...(m.isGroup ? { participant: m.quoted.sender } : {}) 273 | }); 274 | 275 | /** 276 | * Delete quoted message 277 | * @returns 278 | */ 279 | m.quoted.delete = () => conn.sendMessage(m.quoted.chat, { delete: vM.key }); 280 | 281 | /** 282 | * Copy and forward the quoted message 283 | * @param {*} jid 284 | * @param {*} forceForward 285 | * @param {*} options 286 | * @returns 287 | */ 288 | m.quoted.copyNForward = (jid, forceForward = false, options = {}) => conn.copyNForward(jid, vM, forceForward, options); 289 | 290 | /** 291 | * Download the quoted message 292 | * @returns 293 | */ 294 | m.quoted.download = () => conn.downloadMediaMessage(m.quoted); 295 | } 296 | } 297 | 298 | if (m.msg.url) m.download = () => conn.downloadMediaMessage(m.msg); 299 | 300 | m.text = m.msg.text || m.msg.caption || m.message.conversation || m.msg.contentText || m.msg.selectedDisplayText || m.msg.title || ''; 301 | 302 | /** 303 | * Reply to this message 304 | * @param {String|Object} text 305 | * @param {String|false} chatId 306 | * @param {Object} options 307 | */ 308 | m.reply = (text, chatId = m.chat, options = {}) => 309 | Buffer.isBuffer(text) ? conn.sendMedia(chatId, text, 'file', '', m, { ...options }) : conn.sendText(chatId, text, m, { ...options }); 310 | 311 | /** 312 | * Copy this message 313 | */ 314 | m.copy = () => exports.smsg(conn, M.fromObject(M.toObject(m))); 315 | 316 | /** 317 | * Copy and forward this message 318 | * @param {*} jid 319 | * @param {*} forceForward 320 | * @param {*} options 321 | * @returns 322 | */ 323 | m.copyNForward = (jid = m.chat, forceForward = false, options = {}) => conn.copyNForward(jid, m, forceForward, options); 324 | 325 | return m; 326 | }; 327 | 328 | // Watch for file changes and reload if necessary 329 | let file = require.resolve(__filename); 330 | fs.watchFile(file, () => { 331 | fs.unwatchFile(file); 332 | console.log(chalk.redBright(`Update ${__filename}`)); 333 | delete require.cache[file]; 334 | require(file); 335 | }); -------------------------------------------------------------------------------- /trashbase/lib/remini.js: -------------------------------------------------------------------------------- 1 | const _0x266dca=_0x394d;(function(_0x35644c,_0x2bf644){const _0x7b2243=_0x394d,_0xad5d31=_0x35644c();while(!![]){try{const _0x3889fd=-parseInt(_0x7b2243(0xbe))/0x1*(-parseInt(_0x7b2243(0xcb))/0x2)+parseInt(_0x7b2243(0xb1))/0x3+-parseInt(_0x7b2243(0xb5))/0x4*(-parseInt(_0x7b2243(0xc9))/0x5)+parseInt(_0x7b2243(0xcc))/0x6+parseInt(_0x7b2243(0xc5))/0x7*(parseInt(_0x7b2243(0xbc))/0x8)+-parseInt(_0x7b2243(0xd1))/0x9*(-parseInt(_0x7b2243(0xba))/0xa)+parseInt(_0x7b2243(0xcf))/0xb*(-parseInt(_0x7b2243(0xb4))/0xc);if(_0x3889fd===_0x2bf644)break;else _0xad5d31['push'](_0xad5d31['shift']());}catch(_0x35fcd2){_0xad5d31['push'](_0xad5d31['shift']());}}}(_0x1c77,0x457b7));function _0x1c77(){const _0x589c7f=['submit','error','22TuGnJG','gzip','1116QxodIW','push','.ai','dehaze','https','806484XUnwrW','jimp','binary','7115460KRQhmI','1101112SegLTh','end','from','enhance_image_body.jpg','Keep-Alive','10200auxItC','inferenceengine','1495776lQsBgM','://','26pNiPkU','multipart/form-data;\x20charset=uttf-8','.ai/','recolor','.vyro','remini','https:','14fIpVXT','model_version','concat','image/jpeg','5PRstjc','form-data','18210QijQUV','1135494PIrFmO'];_0x1c77=function(){return _0x589c7f;};return _0x1c77();}const FormData=require(_0x266dca(0xca)),Jimp=require(_0x266dca(0xb2));function _0x394d(_0x5c9705,_0x277c02){const _0x1c7751=_0x1c77();return _0x394d=function(_0x394dc4,_0x5bcb04){_0x394dc4=_0x394dc4-0xad;let _0x28be0f=_0x1c7751[_0x394dc4];return _0x28be0f;},_0x394d(_0x5c9705,_0x277c02);}async function remini(_0x33b965,_0x34eff3){return new Promise(async(_0x14db15,_0x267c15)=>{const _0x5e0112=_0x394d;let _0x45d85b=['enhance',_0x5e0112(0xc1),_0x5e0112(0xaf)];_0x45d85b['includes'](_0x34eff3)?_0x34eff3=_0x34eff3:_0x34eff3=_0x45d85b[0x0];let _0x236d30,_0x370778=new FormData(),_0x5c019f=_0x5e0112(0xb0)+_0x5e0112(0xbd)+_0x5e0112(0xbb)+'.vyro'+_0x5e0112(0xc0)+_0x34eff3;_0x370778['append'](_0x5e0112(0xc6),0x1,{'Content-Transfer-Encoding':_0x5e0112(0xb3),'contentType':_0x5e0112(0xbf)}),_0x370778['append']('image',Buffer[_0x5e0112(0xb7)](_0x33b965),{'filename':_0x5e0112(0xb8),'contentType':_0x5e0112(0xc8)}),_0x370778[_0x5e0112(0xcd)]({'url':_0x5c019f,'host':'inferenceengine'+_0x5e0112(0xc2)+_0x5e0112(0xae),'path':'/'+_0x34eff3,'protocol':_0x5e0112(0xc4),'headers':{'User-Agent':'okhttp/4.9.3','Connection':_0x5e0112(0xb9),'Accept-Encoding':_0x5e0112(0xd0)}},function(_0x319120,_0x175e8d){const _0xe7b13c=_0x5e0112;if(_0x319120)_0x267c15();let _0x15e24d=[];_0x175e8d['on']('data',function(_0x2918a5,_0x2d4e53){const _0x1e12ae=_0x394d;_0x15e24d[_0x1e12ae(0xad)](_0x2918a5);})['on'](_0xe7b13c(0xb6),()=>{const _0x3eb77e=_0xe7b13c;_0x14db15(Buffer[_0x3eb77e(0xc7)](_0x15e24d));}),_0x175e8d['on'](_0xe7b13c(0xce),_0x90e19c=>{_0x267c15();});});});}module['exports'][_0x266dca(0xc3)]=remini; 2 | -------------------------------------------------------------------------------- /trashbase/lib/uploader.js: -------------------------------------------------------------------------------- 1 | //base by DGXeon 2 | //re-upload? recode? copy code? give credit ya :) 3 | //YouTube: @Lorenzxz 4 | //Instagram: Lorenzxz 5 | //Telegram: t.me/Lorenzobotinc 6 | //GitHub: @Lorenzxz 7 | //WhatsApp: +6283825536262 8 | //want more free bot scripts? subscribe to my youtube channel: https://youtube.com/@Lorenzxz 9 | 10 | let axios = require('axios') 11 | let formData = require('form-data') 12 | let { fromBuffer } = require('file-type') 13 | let fetch = require('node-fetch') 14 | let fs = require('fs') 15 | let cheerio = require('cheerio') 16 | 17 | async function TelegraPh (buffer) { 18 | let { ext } = await fromBuffer(buffer); 19 | let bodyForm = new formData(); 20 | bodyForm.append("fileToUpload", buffer, "file." + ext); 21 | bodyForm.append("reqtype", "fileupload"); 22 | 23 | let res = await fetch("https://catbox.moe/user/api.php", { 24 | method: "POST", 25 | body: bodyForm, 26 | }); 27 | 28 | let data = await res.text(); 29 | return data; 30 | } 31 | 32 | async function UploadFileUgu (input) { 33 | return new Promise (async (resolve, reject) => { 34 | const form = new formData(); 35 | form.append("files[]", fs.createReadStream(input)) 36 | await axios({ 37 | url: "https://uguu.se/upload.php", 38 | method: "POST", 39 | headers: { 40 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36", 41 | ...form.getHeaders() 42 | }, 43 | data: form 44 | }).then((data) => { 45 | resolve(data.data.files[0]) 46 | }).catch((err) => reject(err)) 47 | }) 48 | } 49 | 50 | function webp2mp4File(path) { 51 | return new Promise((resolve, reject) => { 52 | const form = new formData() 53 | form.append('new-image-url', '') 54 | form.append('new-image', fs.createReadStream(path)) 55 | axios({ 56 | method: 'post', 57 | url: 'https://s6.ezgif.com/webp-to-mp4', 58 | data: form, 59 | headers: { 60 | 'Content-Type': `multipart/form-data; boundary=${form._boundary}` 61 | } 62 | }).then(({ data }) => { 63 | const formDataThen = new formData() 64 | const $ = cheerio.load(data) 65 | const file = $('input[name="file"]').attr('value') 66 | formDataThen.append('file', file) 67 | formDataThen.append('convert', "Convert WebP to MP4!") 68 | axios({ 69 | method: 'post', 70 | url: 'https://ezgif.com/webp-to-mp4/' + file, 71 | data: formDataThen, 72 | headers: { 73 | 'Content-Type': `multipart/form-data; boundary=${formDataThen._boundary}` 74 | } 75 | }).then(({ data }) => { 76 | const $ = cheerio.load(data) 77 | const result = 'https:' + $('div#output > p.outfile > video > source').attr('src') 78 | resolve({ 79 | status: true, 80 | message: "Xeorz", 81 | result: result 82 | }) 83 | }).catch(reject) 84 | }).catch(reject) 85 | }) 86 | } 87 | 88 | async function floNime(medianya, options = {}) { 89 | const { ext } = await fromBuffer(medianya) || options.ext 90 | var form = new formData() 91 | form.append('file', medianya, 'tmp.'+ext) 92 | let jsonnya = await fetch('https://flonime.my.id/upload', { 93 | method: 'POST', 94 | body: form 95 | }) 96 | .then((response) => response.json()) 97 | return jsonnya 98 | } 99 | 100 | module.exports = { TelegraPh, UploadFileUgu, webp2mp4File, floNime } 101 | -------------------------------------------------------------------------------- /trashbase/media/devor6core.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devorsixcore/Base-Bot-Simple/3054997224f56d64e311fb16f2458a77f2ce0f73/trashbase/media/devor6core.jpeg -------------------------------------------------------------------------------- /trashbase/media/moon.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devorsixcore/Base-Bot-Simple/3054997224f56d64e311fb16f2458a77f2ce0f73/trashbase/media/moon.jpeg --------------------------------------------------------------------------------