|
| 1 | +// Inventor : Aguz Familia/@FokusDotId (Fokus ID) |
| 2 | +// Edited : ImYanXiao |
| 3 | + |
| 4 | +import fs from 'fs' |
| 5 | +import fetch from 'node-fetch' |
| 6 | +import axios from 'axios' |
| 7 | +import moment from 'moment-timezone' |
| 8 | +import { createRequire } from 'module'; |
| 9 | +const require = createRequire(import.meta.url); |
| 10 | + |
| 11 | +function pickRandom(list) { |
| 12 | + return list[Math.floor(list.length * Math.random())]; |
| 13 | +} |
| 14 | + |
| 15 | +function ucapan() { |
| 16 | + const time = moment.tz('Asia/Jakarta').format('HH'); |
| 17 | + if (time >= 18) return "Selamat malam🌃"; |
| 18 | + if (time >= 15) return "Selamat sore🌇"; |
| 19 | + if (time >= 10) return "Selamat siang🌅"; |
| 20 | + if (time >= 4) return "Selamat pagi⛅"; |
| 21 | + return "Selamat Dini hari🌌"; |
| 22 | +} |
| 23 | + |
| 24 | +global.pickRandom = pickRandom; |
| 25 | + |
| 26 | +global.getBuffer = async function getBuffer(url, options = {}) { |
| 27 | + try { |
| 28 | + const res = await axios({ |
| 29 | + method: "get", |
| 30 | + url, |
| 31 | + headers: { |
| 32 | + 'DNT': 1, |
| 33 | + 'User-Agent': 'GoogleBot', |
| 34 | + 'Upgrade-Insecure-Request': 1 |
| 35 | + }, |
| 36 | + ...options, |
| 37 | + responseType: 'arraybuffer' |
| 38 | + }); |
| 39 | + return Buffer.from(res.data); |
| 40 | + } catch (e) { |
| 41 | + console.error(`Error: ${e}`); |
| 42 | + return null; |
| 43 | + } |
| 44 | +}; |
| 45 | + |
| 46 | +let handler = m => m; |
| 47 | + |
| 48 | +handler.all = async function (m) { |
| 49 | + const name = await conn.getName(m.sender) |
| 50 | + let pp; |
| 51 | + try { |
| 52 | + pp = await this.profilePictureUrl(m.sender, 'image') |
| 53 | + } catch (e) { |
| 54 | + pp = 'https://artikel.rumah123.com/wp-content/uploads/sites/41/2023/09/12160753/gambar-foto-profil-whatsapp-kosong.jpg' |
| 55 | + } |
| 56 | + |
| 57 | + // Module |
| 58 | + global.fs = await import('fs'); |
| 59 | + global.fetch = (await import('node-fetch')).default; |
| 60 | + global.bochil = require('@bochilteam/scraper'); |
| 61 | + |
| 62 | + |
| 63 | + global.ucapan = ucapan() |
| 64 | + global.ephemeral = '86400' // 86400 = 24jam, kalo ingin di hilangkan ganti '86400' jadi 'null' atau '' |
| 65 | + |
| 66 | + try { |
| 67 | + global.adReply = { |
| 68 | + contextInfo: { |
| 69 | + forwardingScore: 9999, |
| 70 | + isForwarded:true, |
| 71 | + externalAdReply: { |
| 72 | + //showAdAttribution: true, |
| 73 | + title: global.ucapan, |
| 74 | + body: wm, |
| 75 | + mediaUrl: sgc, |
| 76 | + description: wm3, |
| 77 | + previewType: "PHOTO", |
| 78 | + thumbnail: await (await fetch(pp)).buffer(), |
| 79 | + sourceUrl: "https://github.com/ImYanXiao" |
| 80 | + } |
| 81 | + } |
| 82 | + }; |
| 83 | +} catch (e) { |
| 84 | + console.error(`Error setting adReply: ${e}`); |
| 85 | + global.adReply = {}; |
| 86 | +} |
| 87 | + |
| 88 | + |
| 89 | + try { |
| 90 | + global.doc = pickRandom(["application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.presentationml.presentation", "application/msword", "application/pdf", "application/vnd.android.package-archive", "application/zip"]) |
| 91 | + |
| 92 | + global.social = pickRandom([global.sgh, global.sig, global.snh, global.sgc]) |
| 93 | + try { |
| 94 | + global.flaa = JSON.parse(fs.readFileSync('./lib/flaming.json')); |
| 95 | + global.waifu = JSON.parse(fs.readFileSync('./lib/waifu.json')); |
| 96 | + global.pic = pickRandom(global.waifu); // pastikan waifu didefinisikan |
| 97 | + global.flaaa = pickRandom(global.flaa); // pastikan flaas didefinisikan |
| 98 | +} catch (e) { |
| 99 | + console.error(`Error initializing global variables: ${e}`); |
| 100 | +} |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + global.fakeig = { |
| 105 | + contextInfo: { externalAdReply: { showAdAttribution: true, |
| 106 | + mediaUrl: global.sig, |
| 107 | + mediaType: "VIDEO", |
| 108 | + description: global.sig, |
| 109 | + title: wm3, |
| 110 | + body: wm, |
| 111 | + thumbnailUrl: pp, |
| 112 | + sourceUrl: sig |
| 113 | + } |
| 114 | + } } |
| 115 | +global.fakefb = { |
| 116 | + contextInfo: { externalAdReply: { showAdAttribution: true, |
| 117 | + mediaUrl: "https://Facebook.com/zuck", |
| 118 | + mediaType: "VIDEO", |
| 119 | + description: "https://www.Facebook.com/zuck", |
| 120 | + title: wm3, |
| 121 | + body: wm, |
| 122 | + thumbnailUrl: pp, |
| 123 | + sourceUrl: sgc |
| 124 | + } |
| 125 | + } } |
| 126 | + // Fake Reply/Quoted |
| 127 | + |
| 128 | + global.flocation = { |
| 129 | + key : { |
| 130 | + participant : '0@s.whatsapp.net' |
| 131 | + }, |
| 132 | + message: { |
| 133 | + locationMessage: { |
| 134 | + name: 'Japan`s', |
| 135 | + jpegThumbnail: fs.readFileSync('./thumbnail.jpg') |
| 136 | + } |
| 137 | + } |
| 138 | + } |
| 139 | + global.fpayment = { |
| 140 | + "key": { |
| 141 | + "remoteJid": "0@s.whatsapp.net", |
| 142 | + "fromMe": false, |
| 143 | + "id": "BAE595C600522C9C", |
| 144 | + "participant": "0@s.whatsapp.net" |
| 145 | + }, |
| 146 | + "message": { |
| 147 | + "requestPaymentMessage": { |
| 148 | + "currencyCodeIso4217": wm, |
| 149 | + "amount1000": fsizedoc, |
| 150 | + "requestFrom": "0@s.whatsapp.net", |
| 151 | + "noteMessage": { |
| 152 | + "extendedTextMessage": { |
| 153 | + "text": "Hai Kak " + name |
| 154 | + } |
| 155 | + }, |
| 156 | + "expiryTimestamp": fsizedoc, |
| 157 | + "amount": { |
| 158 | + "value": fsizedoc, |
| 159 | + "offset": fsizedoc, |
| 160 | + "currencyCode": wm |
| 161 | + } |
| 162 | + } |
| 163 | + } |
| 164 | + } |
| 165 | + global.ftroli = { key: { remoteJid: 'status@broadcast', participant: '0@s.whatsapp.net' }, message: { orderMessage: { itemCount: 2023, status: 1, thumbnail: await conn.resize(thumb,300,150), surface: 1, message: wm, orderTitle: wm, sellerJid: '0@s.whatsapp.net' } } } |
| 166 | + global.fkontak = { key: { fromMe: false, participant: `0@s.whatsapp.net`, ...(m.chat ? { remoteJid: `status@broadcast` } : {}) }, message: { 'contactMessage': { 'displayName': wm, 'vcard': `BEGIN:VCARD\nVERSION:3.0\nN:XL;${wm},;;;\nFN:${wm},\nitem1.TEL;waid=${m.sender.split('@')[0]}:${m.sender.split('@')[0]}\nitem1.X-ABLabell:Ponsel\nEND:VCARD`, 'jpegThumbnail': fs.readFileSync('./thumbnail.jpg'), thumbnail: fs.readFileSync('./thumbnail.jpg'),sendEphemeral: true}}} |
| 167 | + global.fvn = { |
| 168 | + key: { |
| 169 | + fromMe: false, |
| 170 | + participant: `0@s.whatsapp.net`, ...(m.chat ? |
| 171 | + { remoteJid: "6285736178354-1625305606@g.us" } : {}) |
| 172 | + }, |
| 173 | + message: { |
| 174 | + "audioMessage": { |
| 175 | + "mimetype":"audio/ogg; codecs=opus", |
| 176 | + "seconds": "999999999999", |
| 177 | + "ptt": "true" |
| 178 | + } |
| 179 | + } |
| 180 | + } |
| 181 | + |
| 182 | + global.ftextt = { |
| 183 | + key: { |
| 184 | + fromMe: false, |
| 185 | + participant: `0@s.whatsapp.net`, ...(m.chat ? |
| 186 | + { remoteJid: "6285736178354-1625305606@g.us" } : {}) |
| 187 | + }, |
| 188 | + message: { |
| 189 | + "extendedTextMessage": { |
| 190 | + "text":wm, |
| 191 | + "title": wm, |
| 192 | + 'jpegThumbnail': fs.readFileSync('./thumbnail.jpg') |
| 193 | + } |
| 194 | + } |
| 195 | + } |
| 196 | + |
| 197 | + global.fliveLoc = { |
| 198 | + key: |
| 199 | + { fromMe: false, |
| 200 | + participant: `0@s.whatsapp.net`, ...(m.chat ? |
| 201 | + { remoteJid: "status@broadcast" } : {}) }, |
| 202 | + message: { "liveLocationMessage": { "caption":"Made By: " + global.nameown ,"h": `${wm}`, 'jpegThumbnail': fs.readFileSync('./thumbnail.jpg')}} |
| 203 | + } |
| 204 | + |
| 205 | + global.fliveLoc2 = { |
| 206 | + key: |
| 207 | + { fromMe: false, |
| 208 | + participant: `0@s.whatsapp.net`, ...(m.chat ? |
| 209 | + { remoteJid: "status@broadcast" } : {}) }, |
| 210 | + message: { "liveLocationMessage": { "title": "ImYanXiao","h": wm, 'jpegThumbnail': fs.readFileSync('./thumbnail.jpg')}} |
| 211 | + } |
| 212 | + |
| 213 | + global.ftoko = { |
| 214 | + key: { |
| 215 | + fromMe: false, |
| 216 | + participant: `0@s.whatsapp.net`, ...(m.chat ? { remoteJid: "17608914335@s.whatsapp.net" } : {}) |
| 217 | + }, |
| 218 | + message: { |
| 219 | + "productMessage": { |
| 220 | + "product": { |
| 221 | + "productImage":{ |
| 222 | + "mimetype": "image/jpeg", |
| 223 | + "jpegThumbnail": fs.readFileSync('./thumbnail.jpg') //Gambarnye |
| 224 | + }, |
| 225 | + "title": wm, //Terserah Di Isi apa |
| 226 | + "description": wm3, |
| 227 | + "currencyCode": "USD", |
| 228 | + "priceAmount1000": "20000000", |
| 229 | + "retailerId": "Ghost", |
| 230 | + "productImageCount": 1 |
| 231 | + }, |
| 232 | + "businessOwnerJid": `0@s.whatsapp.net` |
| 233 | + } |
| 234 | + } |
| 235 | + } |
| 236 | + |
| 237 | + global.fdocs = { |
| 238 | + key : { |
| 239 | + participant : '0@s.whatsapp.net' |
| 240 | + }, |
| 241 | + message: { |
| 242 | + "documentMessage": { |
| 243 | + "title": wm, |
| 244 | + "jpegThumbnail": fs.readFileSync('./thumbnail.jpg') |
| 245 | + } |
| 246 | + } |
| 247 | + } |
| 248 | + |
| 249 | + global.fgclink = { |
| 250 | + "key": { |
| 251 | + "fromMe": false, |
| 252 | + "participant": "0@s.whatsapp.net", |
| 253 | + "remoteJid": "0@s.whatsapp.net" |
| 254 | + }, |
| 255 | + "message": { |
| 256 | + "groupInviteMessage": { |
| 257 | + "groupJid": "6285736178354-1625305606@g.us", |
| 258 | + "inviteCode": "null", |
| 259 | + "groupName": "Kawan Elaina", |
| 260 | + "caption": wm, |
| 261 | + 'jpegThumbnail': fs.readFileSync('./thumbnail.jpg') |
| 262 | + } |
| 263 | + } |
| 264 | + } |
| 265 | + global.fimg = { |
| 266 | + key: { |
| 267 | + participant: '0@s.whatsapp.net' |
| 268 | + }, |
| 269 | + message: { |
| 270 | + imageMessage: { |
| 271 | + url: pic, |
| 272 | + mimetype: 'image/jpeg', |
| 273 | + fileLength: fsizedoc, |
| 274 | + height: 306, |
| 275 | + width: 366, |
| 276 | + jpegThumbnail: fs.readFileSync('./thumbnail.jpg') |
| 277 | + } |
| 278 | + } |
| 279 | + } |
| 280 | + global.fimgv = { |
| 281 | + key: { |
| 282 | + participant: '0@s.whatsapp.net' |
| 283 | + }, |
| 284 | + message: { |
| 285 | + imageMessage: { |
| 286 | + url: pic, |
| 287 | + mimetype: 'image/jpeg', |
| 288 | + fileLength: fsizedoc, |
| 289 | + height: 306, |
| 290 | + width: 366, |
| 291 | + jpegThumbnail: fs.readFileSync('./thumbnail.jpg'), |
| 292 | + viewOnce: true |
| 293 | + } |
| 294 | + } |
| 295 | + } |
| 296 | + |
| 297 | + global.fgif = { |
| 298 | + key: { |
| 299 | + fromMe: false, |
| 300 | + participant: `0@s.whatsapp.net`, ...(m.chat ? |
| 301 | + { remoteJid: "6285736178354-1625305606@g.us" } : {}) |
| 302 | + }, |
| 303 | + message: { |
| 304 | + "videoMessage": { |
| 305 | + "title": wm, |
| 306 | + "h": `Hmm`, |
| 307 | + 'seconds': '999999999', |
| 308 | + 'gifPlayback': 'true', |
| 309 | + 'caption': wm, |
| 310 | + 'jpegThumbnail': fs.readFileSync('./thumbnail.jpg') |
| 311 | + } |
| 312 | + } |
| 313 | + } |
| 314 | + // Random Pick Fake |
| 315 | + let pft = [global.fimg, global.flocation, global.fimgv, global.fpayment, global.ftroli, global.fkontak, global.fvn, global.fvid, global.ftextt, global.fliveLoc, global.fliveLoc2, global.ftoko, global.fdocs, global.fgclink, global.fgif] |
| 316 | + // Get Random |
| 317 | + global.fakes = pft.getRandom() |
| 318 | + |
| 319 | + } catch (e) { |
| 320 | + console.error(`Error in handler.all: ${e}`); |
| 321 | + } |
| 322 | +}; |
| 323 | + |
| 324 | +export default handler; |
0 commit comments