├── .github
└── FUNDING.yml
├── .gitignore
├── Dockerfile
├── README.md
├── assets
├── header.jpg
└── thumb.jpg
├── database.json
├── index.js
├── lib
├── binary.js
├── cloudDBAdapter.js
├── color.js
├── database.js
├── exif.js
├── fdz.jpg
├── function.js
├── lowdb
│ ├── CAF-NAYLA🤙
│ ├── Low.d.ts
│ ├── Low.js
│ ├── LowSync.d.ts
│ ├── LowSync.js
│ ├── MissingAdapterError.d.ts
│ ├── MissingAdapterError.js
│ ├── adapters
│ │ ├── 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
│ │ ├── Nayla.js
│ │ ├── TextFile.d.ts
│ │ ├── TextFile.js
│ │ ├── TextFileSync.d.ts
│ │ └── TextFileSync.js
│ ├── index.d.ts
│ └── index.js
├── mongoDB.js
├── scrape.js
├── simpel.js
├── uploader.js
└── yt.js
├── message
├── fdz.js
└── ind.js
├── package.json
├── setting.json
└── temp
├── hai ini buat samph ya
└── ocr.png
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: ["FERDIZ-afk", "kitagawa-md"]# Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13 | custom: ['https://saweria.co/Ferdizafk','https://trakteer.id/FERDIZ-AFK/tip'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | package-lock.json
3 | sesi.json
4 | database.json
5 | yarn.lock
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM nikolaik/python-nodejs:latest
2 |
3 | RUN apt-get update && \
4 | apt-get install -y \
5 | neofetch \
6 | chromium \
7 | ffmpeg \
8 | wget \
9 | yarn \
10 | mc \
11 | imagemagick && \
12 | rm -rf /var/lib/apt/lists/*
13 |
14 | COPY package.json .
15 | WORKDIR /root/FERDIZ
16 | COPY . .
17 | ENV TZ=Asia/Jakarta
18 | RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
19 |
20 | RUN yarn add sharp
21 | RUN yarn
22 |
23 |
24 | RUN pwd
25 | RUN ls
26 |
27 | EXPOSE 5000
28 | CMD ["npm","start"] #run biasa
29 | #CMD ["node","index.js", "--db","link Monggodb url"]
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # kitagawa-md
2 | Base WhatsApp Bot Multi Device
3 |
4 | ## NOTE
5 | This Script is for everyone, not for Sale
6 | Ngejual SC ORI jahanam brader, neraka menunggumu
7 |
8 |
9 |
10 |
11 | kitagawa-md
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | ## My Project
21 | WhatsApp Bot Multi Device [`FERDIZ-afk/kitagawa-md`](https://github.com/FERDIZ-afk/kitagawa-md)
22 |
23 |
24 | ## UNTUK PENGGUNA WINDOWS/RDP
25 |
26 | * Unduh & Instal Git [`Klik Disini`](https://git-scm.com/downloads)
27 | * Unduh & Instal NodeJS [`Klik Disini`](https://nodejs.org/en/download)
28 | * Unduh & Instal FFmpeg [`Klik Disini`](https://ffmpeg.org/download.html) (**Jangan Lupa Tambahkan FFmpeg ke variabel lingkungan PATH**)
29 |
30 |
31 | ```bash
32 | git clone https://github.com/FERDIZ-afk/kitagawa-md
33 | cd kitagawa-md
34 | yarn
35 | ```
36 |
37 |
38 | ## FOR TERMUX/UBUNTU/SSH USER
39 |
40 | ```bash
41 | apt update && apt upgrade
42 | apt install git -y
43 | apt install nodejs -y
44 | apt install yarn -y
45 | apt install ffmpeg -y
46 | git clone https://github.com/FERDIZ-afk/kitagawa-md
47 | cd kitagawa-md
48 | yarn
49 | npm start
50 | ```
51 |
52 | ## IF ERROR INSTALL MODULE FOR TERMUX
53 |
54 | ```bash
55 | npm i yarn -g
56 | npm i typescript -g
57 | yarn
58 | tsc -p ./node_modules/@adiwajshing/baileys/
59 | npm start
60 | ```
61 |
62 | ## ❗ Warning
63 | WhatsApp bot is still in the development stage, so there are a few bugs
64 | WhatsApp Connection (BETA, not working perfectly)
65 |
66 | Editing Number Owner & session name in [`setting.json`](https://github.com/FERDIZ-afk/kitagawa-md/blob/master/setting.json)
67 |
68 |
69 | ## Thanks To
70 | * [`@adiwajshing/baileys-md`](https://github.com/adiwajshing/baileys/tree/multi-device)
71 | * [`FERDIZ-afk/kitagawa-md`](https://github.com/FERDIZ-afk/kitagawa-md)
72 |
73 | License: [MIT](https://en.wikipedia.org/wiki/MIT_License)
74 |
75 | Support Me
76 | * [`Trakteer`](https://trakteer.id/FERDIZ-AFK/tip)
77 | * [`Saweria`](https://saweria.co/Ferdizafk)
78 |
79 | ## Contact Me
80 | * [`Wangsap`](https://wa.me/62878773955) //owner don't not spam
81 | * [`Igeh`](https://instagram.com/ferdiz_afk)
82 | * [`web site`](https://oni-chan.my.id/)
83 | * [`web rest api`](https://ferdiz-afk.my.id/)
84 |
85 |
86 | ## Note
87 | * JIKA MAU RE-UPLOAD CANTUMKAN NAMA SAYA (FERDIZ-AFK)
88 | * jika mau upload ke github harap di hapus atau di private repository dulu file session nya agar tidak di gunakan oleh orang lain
89 |
90 | Thanks For Donate
91 |
92 |
--------------------------------------------------------------------------------
/assets/header.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FERDIZ-afk/kitagawa-md/deaeb786380f1ceb357d45bff9b0f37a295e9903/assets/header.jpg
--------------------------------------------------------------------------------
/assets/thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FERDIZ-afk/kitagawa-md/deaeb786380f1ceb357d45bff9b0f37a295e9903/assets/thumb.jpg
--------------------------------------------------------------------------------
/database.json:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | Base CASE BOT Baileys-Md By FERDIZ AFK
3 | Free To Use
4 | Give Me Credit Please
5 | plis donk yang tukan nge recode SC jangan hilangin nama gwe donk plis ya
6 |
7 | Don't Sell It!!
8 | */
9 | const {
10 | default: makeWASocket,
11 | DisconnectReason,
12 | AnyMessageContent,
13 | delay,
14 | useSingleFileAuthState,
15 | generateForwardMessageContent,
16 | prepareWAMessageMedia,
17 | generateWAMessageFromContent,
18 | generateMessageID,
19 | downloadContentFromMessage,
20 | makeInMemoryStore,
21 | fetchLatestBaileysVersion,
22 | jidDecode,
23 | proto
24 | } = require('@adiwajshing/baileys')
25 |
26 | const express = require('express');
27 | const {Boom} = require("@hapi/boom")
28 | const pino = require("pino")
29 | const color = require('./lib/color')
30 | const FileType = require('file-type')
31 | const figlet = require('figlet')
32 | const lolcatjs = require('lolcatjs')
33 | const cfonts = require('cfonts')
34 | const fs = require("fs")
35 |
36 | const setting = JSON.parse(fs.readFileSync('./setting.json'))
37 | ownerNumberg = setting.ownerNumberg
38 | namaowner = setting.namaowner
39 |
40 | const _ = require('lodash')
41 | const {
42 | modulewa,
43 | parseMention
44 | } = require('./lib/simpel')
45 |
46 | const {
47 | state,
48 | saveState
49 | } = useSingleFileAuthState(`./${setting.sesion}.json`)
50 |
51 | const yargs = require('yargs')
52 | const {
53 | imageToWebp,
54 | videoToWebp,
55 | writeExifImg,
56 | writeExifVid
57 | } = require('./lib/exif')
58 |
59 | const store = makeInMemoryStore({
60 | logger: pino().child({
61 | level: 'silent',
62 | stream: 'store'
63 | })
64 | })
65 |
66 | var low
67 | try {
68 | low = require('lowdb')
69 | } catch (e) {
70 | low = require('./lib/lowdb')
71 | }
72 |
73 | const {
74 | Low,
75 | JSONFile
76 | } = low
77 | const mongoDB = require('./lib/mongoDB')
78 | const cloudDBAdapter = require('./lib/cloudDBAdapter')
79 |
80 | require('./message/fdz.js')
81 | nocache('./message/fdz.js', module => console.log(`'${module}' Updated!`))
82 |
83 | global.opts = new Object(yargs(process.argv.slice(2)).exitProcess(false).parse())
84 | global.db = new Low(
85 | /https?:\/\//.test(opts['db'] || '') ?
86 | new cloudDBAdapter(opts['db']) : /mongodb/.test(opts['db']) ?
87 | new mongoDB(opts['db']) :
88 | new JSONFile(`./database.json`)
89 | )
90 | global.DATABASE = global.db // Backwards Compatibility
91 | global.loadDatabase = async function loadDatabase() {
92 | if (global.db.READ) return new Promise((resolve) => setInterval(function () { (!global.db.READ ? (clearInterval(this), resolve(global.db.data == null ? global.loadDatabase() : global.db.data)) : null) }, 1 * 1000))
93 | if (global.db.data !== null) return
94 | global.db.READ = true
95 | await global.db.read()
96 | global.db.READ = false
97 | global.db.data = {
98 | users: {},
99 | chats: {},
100 | database: {},
101 | game: {},
102 | settings: {},
103 | others: {},
104 | sticker: {},
105 | ...(global.db.data || {})
106 | }
107 | global.db.chain = _.chain(global.db.data)
108 | }
109 | loadDatabase()
110 |
111 | if (global.db) setInterval(async () => {
112 | if (global.db.data) await global.db.write()
113 | }, 30 * 1000)
114 |
115 | async function runbot() {
116 | let {
117 | version,
118 | isLatest
119 | } = await fetchLatestBaileysVersion()
120 |
121 | const banner = cfonts.render(('Multi device\nKITAGAWA-MD'), {
122 | font: 'block',
123 | color: 'white',
124 | align: 'center',
125 | gradient: ["red", "yellow"],
126 | lineHeight: 1
127 | });
128 |
129 | const fdz = makeWASocket({
130 | logger: pino({
131 | level: 'silent'
132 | }),
133 | printQRInTerminal: true,
134 | browser: ['FERDIZ-AFK', 'Safari', '1.0.0'],
135 | auth: state,
136 | })
137 |
138 | store.bind(fdz.ev)
139 |
140 | fdz.ev.on('messages.upsert', async chatUpdate => {
141 | //console.log(JSON.stringify(chatUpdate, undefined, 2))
142 | try {
143 | mek = chatUpdate.messages[0]
144 | if (!mek.message) return
145 | mek.message = (Object.keys(mek.message)[0] === 'ephemeralMessage') ? mek.message.ephemeralMessage.message : mek.message
146 | if (mek.key && mek.key.remoteJid === 'status@broadcast') return
147 | // if (mek.key.id.startsWith('BAE5') && mek.key.id.length === 16) return
148 | m = modulewa(fdz, mek, store)
149 | m.isBaileys = m.key.id.startsWith('BAE5') || m.key.id.startsWith('3EB0')
150 | require('./message/fdz.js')(fdz, m, mek, chatUpdate, store)
151 | } catch (err) {
152 | console.log(JSON.stringify(err, undefined, 2))
153 | }
154 | })
155 |
156 | fdz.ev.on('messages.update', async chatUpdatelo => {
157 | // console.log(JSON.stringify(chatUpdatelo, undefined, 2))
158 | try {
159 | } catch (err) {
160 | console.log(JSON.stringify(err, undefined, 2))
161 | }
162 | })
163 |
164 | fdz.ws.on('CB:Blocklist', json => {
165 | if (blocked.length > 2) return
166 | for (let i of json[1].blocklist) {
167 | blocked.push(i.replace('c.us', 's.whatsapp.net'))
168 | }
169 | })
170 |
171 | fdz.ws.on("CB:call", async node => {
172 | if (node.content[0].tag === "terminate") {
173 | fdz.sendMessage(node.attrs.from, {
174 | text: `Kamu Telah Melanggar Rules Maka Kamu Akan Terkena *Blokir*!\n\nHubungi Owner Untuk Membuka Kembali Akses!`
175 | })
176 | delay(4000)
177 | let vcard = `BEGIN:VCARD\n` // metadata of the contact card
178 | +
179 | `VERSION:3.0\n` +
180 | `N:;${namaowner}.;;;` +
181 | `FN:${namaowner}.\n` // full name
182 | +
183 | `ORG:OWNER ${namaowner};\n` // the organization of the contact
184 | +
185 | `item1.TEL;type=CELL;type=VOICE;waid=${ownerNumberg}:+${ownerNumberg}\n` // WhatsApp ID + phone number
186 | +
187 | `item1.X-ABLabel:© ${namaowner}\n` +
188 | `item8.X-ABLabel:© WhatsApp Inc.\n` +
189 | `END:VCARD`
190 | fdz.sendMessage(node.attrs.from, {
191 | contacts: {
192 | displayName: `${namaowner}`,
193 | contacts: [{
194 | vcard
195 | }]
196 | }
197 | })
198 | delay(7000)
199 | .then(anu => {
200 | fdz.updateBlockStatus(node.attrs.from, "block")
201 | })
202 | }
203 | })
204 |
205 |
206 | fdz.ws.on("error", async node => {
207 | console.log(JSON.stringify(node, undefined, 2))
208 | })
209 | /*
210 | fdz.ev.on('connection.update', (update) => {
211 | const { connection, lastDisconnect } = update
212 | if (connection === 'close') {
213 | // status.stop()
214 | // reconnect.stop()
215 | // starting.stop()
216 | console.log('Server Ready ✓')
217 | lastDisconnect.error?.output?.statusCode !== DisconnectReason.loggedOut ?
218 | runbot() :
219 | console.log('Wa web terlogout...')
220 | }
221 | })
222 |
223 | */
224 | fdz.ev.on('connection.update', async (update) => {
225 | const {
226 | connection,
227 | lastDisconnect
228 | } = update
229 | if (connection === 'close') {
230 | let reason = new Boom(lastDisconnect?.error)?.output.statusCode
231 | if (reason === DisconnectReason.badSession) {
232 | console.log(`Bad Session File, Please Delete Session and Scan Again`);
233 | } else if (reason === DisconnectReason.connectionClosed) {
234 | console.log("Connection closed, reconnecting....");
235 | runbot();
236 | } else if (reason === DisconnectReason.connectionLost) {
237 | console.log("Connection Lost from Server, reconnecting...");
238 | runbot();
239 | } else if (reason === DisconnectReason.connectionReplaced) {
240 | console.log("Connection Replaced, Another New Session Opened, Please Close Current Session First");
241 | } else if (reason === DisconnectReason.loggedOut) {
242 | console.log(`Device Logged Out, Please Scan Again And Run.`);
243 | } else if (reason === DisconnectReason.restartRequired) {
244 | console.log("Restart Required, Restarting...");
245 | runbot();
246 | } else if (reason === DisconnectReason.timedOut) {
247 | console.log("Connection TimedOut, Reconnecting...");
248 | runbot();
249 | } else fdz.end(`Unknown DisconnectReason: ${reason}|${connection}`)
250 | }
251 | if (update.connection == "connecting" || update.receivedPendingNotifications == "false") {
252 | lolcatjs.fromString(`[Sedang mengkoneksikan]`)
253 | }
254 | if (update.connection == "open" || update.receivedPendingNotifications == "true") {
255 | lolcatjs.fromString(`[Connecting to] WhatsApp web`)
256 | lolcatjs.fromString(`[Connected] ` + JSON.stringify(fdz.user, null, 2))
257 | }
258 | })
259 |
260 | fdz.ev.on('creds.update', () => saveState)
261 | console.log(color(figlet.textSync('----------------', {
262 | horizontalLayout: 'default'
263 | })))
264 | console.log(banner.string)
265 | console.log(color(figlet.textSync('----------------', {
266 | horizontalLayout: 'default'
267 | })))
268 | lolcatjs.fromString('[SERVER] Server Started!')
269 |
270 | fdz.ev.on('presence-update', json => console.log(json))
271 |
272 | /*
273 | fdz.ev.on('group-participants.update', async (anu) => {
274 | console.log(anu)
275 | try {
276 | let metadata = await fdz.groupMetadata(anu.id)
277 | let participants = anu.participants
278 | for (let num of participants) {
279 | // Get Profile Picture User
280 | try {
281 | ppuser = await fdz.profilePictureUrl(num, 'image')
282 | } catch {
283 | ppuser = 'https://i0.wp.com/www.gambarunik.id/wp-content/uploads/2019/06/Top-Gambar-Foto-Profil-Kosong-Lucu-Tergokil-.jpg'
284 | }
285 |
286 | // Get Profile Picture Group
287 | try {
288 | ppgroup = await fdz.profilePictureUrl(anu.id, 'image')
289 | } catch {
290 | ppgroup = 'https://i0.wp.com/www.gambarunik.id/wp-content/uploads/2019/06/Top-Gambar-Foto-Profil-Kosong-Lucu-Tergokil-.jpg'
291 | }
292 |
293 | if (anu.action == 'add') {
294 | fdz.sendMessage(anu.id, {
295 | image: {
296 | url: ppuser
297 | },
298 | contextInfo: {
299 | mentionedJid: [num]
300 | },
301 | caption: `Welcome To ${metadata.subject} @${num.split("@")[0]}`
302 | })
303 | } else if (anu.action == 'remove') {
304 | fdz.sendMessage(anu.id, {
305 | image: {
306 | url: ppuser
307 | },
308 | contextInfo: {
309 | mentionedJid: [num]
310 | },
311 | caption: `@${num.split("@")[0]} Leaving To ${metadata.subject}`
312 | })
313 | }
314 | }
315 | } catch (err) {
316 | console.log(err)
317 | }
318 | })
319 | */
320 | // Setting
321 | fdz.decodeJid = (jid) => {
322 | if (!jid) return jid
323 | if (/:\d+@/gi.test(jid)) {
324 | let decode = jidDecode(jid) || {}
325 | return decode.user && decode.server && decode.user + '@' + decode.server || jid
326 | } else return jid
327 | }
328 |
329 | fdz.ev.on('contacts.update', update => {
330 | for (let contact of update) {
331 | let id = fdz.decodeJid(contact.id)
332 | if (store && store.contacts) store.contacts[id] = {
333 | id,
334 | name: contact.notify
335 | }
336 | }
337 | })
338 |
339 | fdz.getName = (jid, withoutContact = false) => {
340 | id = fdz.decodeJid(jid)
341 | withoutContact = fdz.withoutContact || withoutContact
342 | let v
343 | if (id.endsWith("@g.us")) return new Promise(async (resolve) => {
344 | v = store.contacts[id] || {}
345 | if (!(v.name || v.subject)) v = fdz.groupMetadata(id) || {}
346 | resolve(v.name || v.subject || PhoneNumber('+' + id.replace('@s.whatsapp.net', '')).getNumber('international'))
347 | })
348 | else v = id === '0@s.whatsapp.net' ? {
349 | id,
350 | name: 'WhatsApp'
351 | } : id === fdz.decodeJid(fdz.user.id) ?
352 | fdz.user :
353 | (store.contacts[id] || {})
354 | return (withoutContact ? '' : v.name) || v.subject || v.verifiedName || PhoneNumber('+' + jid.replace('@s.whatsapp.net', '')).getNumber('international')
355 | }
356 |
357 | fdz.sendContact = async (jid, kon, quoted = '', opts = {}) => {
358 | let list = []
359 | for (let i of kon) {
360 | list.push({
361 | displayName: await fdz.getName(i + '@s.whatsapp.net'),
362 | vcard: `BEGIN:VCARD\nVERSION:3.0\nN:${await fdz.getName(i + '@s.whatsapp.net')}\nFN:${await fdz.getName(i + '@s.whatsapp.net')}\nitem1.TEL;waid=${i}:${i}\nitem1.X-ABLabel:Ponsel\nitem2.EMAIL;type=INTERNET:okeae2410@gmail.com\nitem2.X-ABLabel:Email\nitem3.URL:https://instagram.com/cak_haho\nitem3.X-ABLabel:Instagram\nitem4.ADR:;;Indonesia;;;;\nitem4.X-ABLabel:Region\nEND:VCARD`
363 | })
364 | }
365 | fdz.sendMessage(jid, {
366 | contacts: {
367 | displayName: `${list.length} Kontak`,
368 | contacts: list
369 | },
370 | ...opts
371 | }, {
372 | quoted
373 | })
374 | }
375 |
376 |
377 | fdz.serializeM = (m) => modulewa(fdz, m, store)
378 |
379 |
380 |
381 | // Add Other
382 | /** Send Button 5 Image
383 | *
384 | * @param {*} jid
385 | * @param {*} text
386 | * @param {*} footer
387 | * @param {*} image
388 | * @param [*] button
389 | * @param {*} options
390 | * @returns
391 | */
392 | fdz.kirim5butimg = async (jid, text = '', footer = '', img, but = [], options = {}) => {
393 | let message = await prepareWAMessageMedia({
394 | image: img
395 | }, {
396 | upload: fdz.waUploadToServer
397 | })
398 | var template = generateWAMessageFromContent(m.chat, proto.Message.fromObject({
399 | templateMessage: {
400 | hydratedTemplate: {
401 | imageMessage: message.imageMessage,
402 | "hydratedContentText": text,
403 | "hydratedFooterText": footer,
404 | "hydratedButtons": but
405 | }
406 | }
407 | }), options)
408 | fdz.relayMessage(jid, template.message, {
409 | messageId: template.key.id
410 | })
411 | }
412 |
413 | /**
414 | *
415 | * @param {*} jid
416 | * @param {*} buttons
417 | * @param {*} caption
418 | * @param {*} footer
419 | * @param {*} quoted
420 | * @param {*} options
421 | */
422 | fdz.sendButtonText = (jid, buttons = [], text, footer, quoted = '', options = {}) => {
423 | let buttonMessage = {
424 | text,
425 | footer,
426 | buttons,
427 | headerType: 2,
428 | ...options
429 | }
430 | fdz.sendMessage(jid, buttonMessage, {
431 | quoted,
432 | ...options
433 | })
434 | }
435 |
436 | /**
437 | *
438 | * @param {*} jid
439 | * @param {*} text
440 | * @param {*} quoted
441 | * @param {*} options
442 | * @returns
443 | */
444 | fdz.sendText = (jid, text, quoted = '', options) => fdz.sendMessage(jid, {
445 | text: text,
446 | ...options
447 | }, {
448 | quoted
449 | })
450 |
451 | /**
452 | *
453 | * @param {*} jid
454 | * @param {*} path
455 | * @param {*} caption
456 | * @param {*} quoted
457 | * @param {*} options
458 | * @returns
459 | */
460 | fdz.sendImage = async (jid, path, caption = '', quoted = '', options) => {
461 | let buffer = Buffer.isBuffer(path) ? path : /^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,` [1], 'base64') : /^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0)
462 | return await fdz.sendMessage(jid, {
463 | image: buffer,
464 | caption: caption,
465 | ...options
466 | }, {
467 | quoted
468 | })
469 | }
470 |
471 | /**
472 | *
473 | * @param {*} jid
474 | * @param {*} path
475 | * @param {*} caption
476 | * @param {*} quoted
477 | * @param {*} options
478 | * @returns
479 | */
480 | fdz.sendVideo = async (jid, path, caption = '', quoted = '', gif = false, options) => {
481 | let buffer = Buffer.isBuffer(path) ? path : /^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,` [1], 'base64') : /^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0)
482 | return await fdz.sendMessage(jid, {
483 | video: buffer,
484 | caption: caption,
485 | gifPlayback: gif,
486 | ...options
487 | }, {
488 | quoted
489 | })
490 | }
491 |
492 | /**
493 | *
494 | * @param {*} jid
495 | * @param {*} path
496 | * @param {*} quoted
497 | * @param {*} mime
498 | * @param {*} options
499 | * @returns
500 | */
501 | fdz.sendAudio = async (jid, path, quoted = '', ptt = false, options) => {
502 | let buffer = Buffer.isBuffer(path) ? path : /^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,` [1], 'base64') : /^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0)
503 | return await fdz.sendMessage(jid, {
504 | audio: buffer,
505 | ptt: ptt,
506 | ...options
507 | }, {
508 | quoted
509 | })
510 | }
511 |
512 | /**
513 | *
514 | * @param {*} jid
515 | * @param {*} text
516 | * @param {*} quoted
517 | * @param {*} options
518 | * @returns
519 | */
520 | fdz.sendTextWithMentions = async (jid, text, quoted, options = {}) => fdz.sendMessage(jid, {
521 | text: text,
522 | contextInfo: {
523 | mentionedJid: [...text.matchAll(/@(\d{0,16})/g)].map(v => v[1] + '@s.whatsapp.net')
524 | },
525 | ...options
526 | }, {
527 | quoted
528 | })
529 |
530 | /**
531 | *
532 | * @param {*} jid
533 | * @param {*} path
534 | * @param {*} quoted
535 | * @param {*} options
536 | * @returns
537 | */
538 | fdz.sendImageAsSticker = async (jid, path, quoted, options = {}) => {
539 | let buff = Buffer.isBuffer(path) ? path : /^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,` [1], 'base64') : /^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0)
540 | let buffer
541 | if (options && (options.packname || options.author)) {
542 | buffer = await writeExifImg(buff, options)
543 | } else {
544 | buffer = await imageToWebp(buff)
545 | }
546 |
547 | await fdz.sendMessage(jid, {
548 | sticker: {
549 | url: buffer
550 | },
551 | ...options
552 | }, {
553 | quoted
554 | })
555 | return buffer
556 | }
557 |
558 | /**
559 | *
560 | * @param {*} jid
561 | * @param {*} path
562 | * @param {*} quoted
563 | * @param {*} options
564 | * @returns
565 | */
566 | fdz.sendVideoAsSticker = async (jid, path, quoted, options = {}) => {
567 | let buff = Buffer.isBuffer(path) ? path : /^data:.*?\/.*?;base64,/i.test(path) ? Buffer.from(path.split`,` [1], 'base64') : /^https?:\/\//.test(path) ? await (await getBuffer(path)) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0)
568 | let buffer
569 | if (options && (options.packname || options.author)) {
570 | buffer = await writeExifVid(buff, options)
571 | } else {
572 | buffer = await videoToWebp(buff)
573 | }
574 |
575 | await fdz.sendMessage(jid, {
576 | sticker: {
577 | url: buffer
578 | },
579 | ...options
580 | }, {
581 | quoted
582 | })
583 | return buffer
584 | }
585 |
586 | /**
587 | *
588 | * @param {*} message
589 | * @param {*} filename
590 | * @param {*} attachExtension
591 | * @returns
592 | */
593 | fdz.downloadAndSaveMediaMessage = async (message, filename, attachExtension = true) => {
594 | let quoted = message.msg ? message.msg : message
595 | let mime = (message.msg || message).mimetype || ''
596 | let messageType = message.mtype ? message.mtype.replace(/Message/gi, '') : mime.split('/')[0]
597 | const stream = await downloadContentFromMessage(quoted, messageType)
598 | let buffer = Buffer.from([])
599 | for await (const chunk of stream) {
600 | buffer = Buffer.concat([buffer, chunk])
601 | }
602 | let type = await FileType.fromBuffer(buffer)
603 | trueFileName = attachExtension ? (filename + '.' + type.ext) : filename
604 | // save to file
605 | await fs.writeFileSync(trueFileName, buffer)
606 | return trueFileName
607 | }
608 |
609 | fdz.downloadMediaMessage = async (message) => {
610 | let mime = (message.msg || message).mimetype || ''
611 | let messageType = message.mtype ? message.mtype.replace(/Message/gi, '') : mime.split('/')[0]
612 | const stream = await downloadContentFromMessage(message, messageType)
613 | let buffer = Buffer.from([])
614 | for await (const chunk of stream) {
615 | buffer = Buffer.concat([buffer, chunk])
616 | }
617 | return buffer
618 | }
619 |
620 | /**
621 | *
622 | * @param {*} jid
623 | * @param {*} path
624 | * @param {*} filename
625 | * @param {*} caption
626 | * @param {*} quoted
627 | * @param {*} options
628 | * @returns
629 | */
630 | fdz.sendMedia = async (jid, path, fileName = '', caption = '', quoted = '', options = {}) => {
631 | let types = await fdz.getFile(path, true)
632 | let {
633 | mime,
634 | ext,
635 | res,
636 | data,
637 | filename: pathFile
638 | } = types
639 | if (res && res.status !== 200 || file.length <= 65536) {
640 | try {
641 | throw {
642 | json: JSON.parse(file.toString())
643 | }
644 | } catch (e) {
645 | if (e.json) throw e.json
646 | }
647 | }
648 | let opt = {}
649 | if (quoted) opt.quoted = quoted
650 | let type = '',
651 | mimetype = mime
652 | if (options.asDocument) type = 'document'
653 | if (/webp/.test(mime)) type = 'sticker'
654 | else if (/image/.test(mime)) type = 'image'
655 | else if (/video/.test(mime)) type = 'video'
656 | else if (/audio/.test(mime)) type = 'audio'
657 | else type = 'document'
658 | await fdz.sendMessage(jid, {
659 | [type]: {
660 | url: pathFile
661 | },
662 | caption,
663 | mimetype,
664 | fileName,
665 | ...options
666 | }, {
667 | ...opt,
668 | ...options
669 | })
670 | return fs.promises.unlink(pathFile)
671 | }
672 |
673 | /**
674 | *
675 | * @param {*} jid
676 | * @param {*} message
677 | * @param {*} forceForward
678 | * @param {*} options
679 | * @returns
680 | */
681 | fdz.copyNForward = async (jid, message, forceForward = false, options = {}) => {
682 | let vtype
683 | if (options.readViewOnce) {
684 | message.message = message.message && message.message.ephemeralMessage && message.message.ephemeralMessage.message ? message.message.ephemeralMessage.message : (message.message || undefined)
685 | vtype = Object.keys(message.message.viewOnceMessage.message)[0]
686 | delete(message.message && message.message.ignore ? message.message.ignore : (message.message || undefined))
687 | delete message.message.viewOnceMessage.message[vtype].viewOnce
688 | message.message = {
689 | ...message.message.viewOnceMessage.message
690 | }
691 | }
692 |
693 | let mtype = Object.keys(message.message)[0]
694 | let content = await generateForwardMessageContent(message, forceForward)
695 | let ctype = Object.keys(content)[0]
696 | let context = {}
697 | if (mtype != "conversation") context = message.message[mtype].contextInfo
698 | content[ctype].contextInfo = {
699 | ...context,
700 | ...content[ctype].contextInfo
701 | }
702 | const waMessage = await generateWAMessageFromContent(jid, content, options ? {
703 | ...content[ctype],
704 | ...options,
705 | ...(options.contextInfo ? {
706 | contextInfo: {
707 | ...content[ctype].contextInfo,
708 | ...options.contextInfo
709 | }
710 | } : {})
711 | } : {})
712 | await fdz.relayMessage(jid, waMessage.message, {
713 | messageId: waMessage.key.id
714 | })
715 | return waMessage
716 | }
717 |
718 |
719 | fdz.cMod = (jid, copy, text = '', sender = fdz.user.id, options = {}) => {
720 | //let copy = message.toJSON()
721 | let mtype = Object.keys(copy.message)[0]
722 | let isEphemeral = mtype === 'ephemeralMessage'
723 | if (isEphemeral) {
724 | mtype = Object.keys(copy.message.ephemeralMessage.message)[0]
725 | }
726 | let msg = isEphemeral ? copy.message.ephemeralMessage.message : copy.message
727 | let content = msg[mtype]
728 | if (typeof content === 'string') msg[mtype] = text || content
729 | else if (content.caption) content.caption = text || content.caption
730 | else if (content.text) content.text = text || content.text
731 | if (typeof content !== 'string') msg[mtype] = {
732 | ...content,
733 | ...options
734 | }
735 | if (copy.key.participant) sender = copy.key.participant = sender || copy.key.participant
736 | else if (copy.key.participant) sender = copy.key.participant = sender || copy.key.participant
737 | if (copy.key.remoteJid.includes('@s.whatsapp.net')) sender = sender || copy.key.remoteJid
738 | else if (copy.key.remoteJid.includes('@broadcast')) sender = sender || copy.key.remoteJid
739 | copy.key.remoteJid = jid
740 | copy.key.fromMe = sender === fdz.user.id
741 |
742 | return proto.WebMessageInfo.fromObject(copy)
743 | }
744 |
745 |
746 | /**
747 | *
748 | * @param {*} path
749 | * @returns
750 | */
751 | fdz.getFile = async (PATH, save) => {
752 | let res
753 | 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)
754 | //if (!Buffer.isBuffer(data)) throw new TypeError('Result is not a buffer')
755 | let type = await FileType.fromBuffer(data) || {
756 | mime: 'application/octet-stream',
757 | ext: '.bin'
758 | }
759 | filename = path.join(__filename, '../src/' + new Date * 1 + '.' + type.ext)
760 | if (data && save) fs.promises.writeFile(filename, data)
761 | return {
762 | res,
763 | filename,
764 | size: await getSizeMedia(data),
765 | ...type,
766 | data
767 | }
768 | }
769 |
770 | // return fdz
771 |
772 |
773 | }
774 | runbot()
775 |
776 | /**
777 | * Uncache if there is file change
778 | * @param {string} module Module name or path
779 | * @param {function} cb
780 | */
781 | function nocache(module, cb = () => {}) {
782 | console.log('Module', `'${module}'`, 'is now being watched for changes')
783 | fs.watchFile(require.resolve(module), async () => {
784 | await uncache(require.resolve(module))
785 | cb(module)
786 | })
787 | }
788 |
789 | /**
790 | * Uncache a module
791 | * @param {string} module Module name or path
792 | */
793 | function uncache(module = '.') {
794 | return new Promise((resolve, reject) => {
795 | try {
796 | delete require.cache[require.resolve(module)]
797 | resolve()
798 | } catch (e) {
799 | reject(e)
800 | }
801 | })
802 | }
803 |
804 |
805 |
806 |
807 |
808 | const app = express();
809 | //const port = 3000;
810 | const PORT = process.env.PORT || 5000
811 |
812 | app.listen(PORT, () => {
813 | console.log(`Example app listening at http://localhost:${PORT}`)
814 | })
815 |
816 |
817 | app.get('/', (req, res) => res.send('Hello World!'))
818 |
819 |
820 | // CAF
821 | // run in main file
822 |
--------------------------------------------------------------------------------
/lib/binary.js:
--------------------------------------------------------------------------------
1 | async function dBinary(str) {
2 | var newBin = str.split(" ")
3 | var binCode = []
4 | for (i = 0; i < newBin.length; i++) {
5 | binCode.push(String.fromCharCode(parseInt(newBin[i], 2)))
6 | }
7 | return binCode.join("")
8 | }
9 |
10 | async function eBinary(str = '') {
11 | let res = ''
12 | res = str.split('').map(char => {
13 | return char.charCodeAt(0).toString(2);
14 | }).join(' ')
15 | return res
16 | }
17 |
18 | module.exports = {
19 | dBinary,
20 | eBinary
21 | }
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/color.js:
--------------------------------------------------------------------------------
1 | const chalk = require('chalk')
2 |
3 | module.exports = color = (text, color) => {
4 | return !color ? chalk.green(text) : chalk.keyword(color)(text)
5 | }
--------------------------------------------------------------------------------
/lib/database.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 | const _fs = require('fs')
3 | const { promises: fs } = _fs
4 |
5 | class Database {
6 | /**
7 | * Create new Database
8 | * @param {String} filepath Path to specified json database
9 | * @param {...any} args JSON.stringify arguments
10 | */
11 | constructor(filepath, ...args) {
12 | this.file = path.resolve(filepath)
13 | this.logger = console
14 |
15 | this._load()
16 |
17 | this._jsonargs = args
18 | this._state = false
19 | this._queue = []
20 | this._interval = setInterval(async () => {
21 | if (!this._state && this._queue && this._queue[0]) {
22 | this._state = true
23 | await this[this._queue.shift()]().catch(this.logger.error)
24 | this._state = false
25 | }
26 | }, 1000)
27 |
28 | }
29 |
30 | get data() {
31 | return this._data
32 | }
33 |
34 | set data(value) {
35 | this._data = value
36 | this.save()
37 | }
38 |
39 | /**
40 | * Queue Load
41 | */
42 | load() {
43 | this._queue.push('_load')
44 | }
45 |
46 | /**
47 | * Queue Save
48 | */
49 | save() {
50 | this._queue.push('_save')
51 | }
52 |
53 | _load() {
54 | try {
55 | return this._data = _fs.existsSync(this.file) ? JSON.parse(_fs.readFileSync(this.file)) : {}
56 | } catch (e) {
57 | this.logger.error(e)
58 | return this._data = {}
59 | }
60 | }
61 |
62 | async _save() {
63 | let dirname = path.dirname(this.file)
64 | if (!_fs.existsSync(dirname)) await fs.mkdir(dirname, { recursive: true })
65 | await fs.writeFile(this.file, JSON.stringify(this._data, ...this._jsonargs))
66 | return this.file
67 | }
68 | }
69 |
70 | module.exports = Database
--------------------------------------------------------------------------------
/lib/exif.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs')
2 | const {
3 | tmpdir
4 | } = require("os")
5 | const Crypto = require("crypto")
6 | const ff = require('fluent-ffmpeg')
7 | const webp = require("node-webpmux")
8 | const path = require("path")
9 |
10 |
11 | async function imageToWebp(media) {
12 |
13 | const tmpFileOut = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`)
14 | const tmpFileIn = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.jpg`)
15 |
16 | fs.writeFileSync(tmpFileIn, media)
17 |
18 | await new Promise((resolve, reject) => {
19 | ff(tmpFileIn)
20 | .on("error", reject)
21 | .on("end", () => resolve(true))
22 | .addOutputOptions([
23 | "-vcodec",
24 | "libwebp",
25 | "-vf",
26 | "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"
27 | ])
28 | .toFormat("webp")
29 | .save(tmpFileOut)
30 | })
31 |
32 | const buff = fs.readFileSync(tmpFileOut)
33 | fs.unlinkSync(tmpFileOut)
34 | fs.unlinkSync(tmpFileIn)
35 | return buff
36 | }
37 |
38 | async function videoToWebp(media) {
39 |
40 | const tmpFileOut = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`)
41 | const tmpFileIn = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.mp4`)
42 |
43 | fs.writeFileSync(tmpFileIn, media)
44 |
45 | await new Promise((resolve, reject) => {
46 | ff(tmpFileIn)
47 | .on("error", reject)
48 | .on("end", () => resolve(true))
49 | .addOutputOptions([
50 | "-vcodec",
51 | "libwebp",
52 | "-vf",
53 | "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",
54 | "-loop",
55 | "0",
56 | "-ss",
57 | "00:00:00",
58 | "-t",
59 | "00:00:05",
60 | "-preset",
61 | "default",
62 | "-an",
63 | "-vsync",
64 | "0"
65 | ])
66 | .toFormat("webp")
67 | .save(tmpFileOut)
68 | })
69 |
70 | const buff = fs.readFileSync(tmpFileOut)
71 | fs.unlinkSync(tmpFileOut)
72 | fs.unlinkSync(tmpFileIn)
73 | return buff
74 | }
75 |
76 | async function writeExifImg(media, metadata) {
77 | let wMedia = await imageToWebp(media)
78 | const tmpFileIn = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`)
79 | const tmpFileOut = path.join(tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`)
80 | fs.writeFileSync(tmpFileIn, wMedia)
81 |
82 | if (metadata.packname || metadata.author) {
83 | const img = new webp.Image()
84 | const json = {
85 | "sticker-pack-id": `https://github.com/DikaArdnt/Hisoka-Morou`,
86 | "sticker-pack-name": metadata.packname,
87 | "sticker-pack-publisher": metadata.author,
88 | "emojis": metadata.categories ? metadata.categories : [""]
89 | }
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 = {
111 | "sticker-pack-id": `https://github.com/DikaArdnt/Hisoka-Morou`,
112 | "sticker-pack-name": metadata.packname,
113 | "sticker-pack-publisher": metadata.author,
114 | "emojis": metadata.categories ? metadata.categories : [""]
115 | }
116 | 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])
117 | const jsonBuff = Buffer.from(JSON.stringify(json), "utf-8")
118 | const exif = Buffer.concat([exifAttr, jsonBuff])
119 | exif.writeUIntLE(jsonBuff.length, 14, 4)
120 | await img.load(tmpFileIn)
121 | fs.unlinkSync(tmpFileIn)
122 | img.exif = exif
123 | await img.save(tmpFileOut)
124 | return tmpFileOut
125 | }
126 | }
127 |
128 | module.exports = {
129 | imageToWebp,
130 | videoToWebp,
131 | writeExifImg,
132 | writeExifVid
133 | }
--------------------------------------------------------------------------------
/lib/fdz.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FERDIZ-afk/kitagawa-md/deaeb786380f1ceb357d45bff9b0f37a295e9903/lib/fdz.jpg
--------------------------------------------------------------------------------
/lib/function.js:
--------------------------------------------------------------------------------
1 | const axios = require("axios");
2 | const fs = require("fs");
3 | const TinyURL = require('tinyurl');
4 | const FormData = require("form-data");
5 | const {
6 | default: Axios
7 | } = require('axios');
8 | const cheerio = require("cheerio");
9 | const ffmpeg = require("fluent-ffmpeg");
10 |
11 |
12 |
13 |
14 | exports.getRandom = (ext) => {
15 | return `${Math.floor(Math.random() * 10000)}${ext}`
16 | }
17 |
18 | exports.getBuffer = async (url, options) => {
19 | try {
20 | options ? options : {}
21 | const res = await axios({
22 | method: "get",
23 | url,
24 | headers: {
25 | 'DNT': 1,
26 | 'Upgrade-Insecure-Request': 1
27 | },
28 | ...options,
29 | responseType: 'arraybuffer'
30 | })
31 | return res.data
32 | } catch (e) {
33 | console.log(`Error : ${e}`)
34 | }
35 | }
36 |
37 | exports.getGroupAdmins = function(participants) {
38 | let admins = []
39 | for (let i of participants) {
40 | i.admin !== null ? admins.push(i.id) : ''
41 | }
42 | return admins
43 | }
44 |
45 | exports.runtime = function(seconds) {
46 | seconds = Number(seconds);
47 | var d = Math.floor(seconds / (3600 * 24));
48 | var h = Math.floor(seconds % (3600 * 24) / 3600);
49 | var m = Math.floor(seconds % 3600 / 60);
50 | var s = Math.floor(seconds % 60);
51 | var dDisplay = d > 0 ? d + (d == 1 ? " day, " : " days, ") : "0 day, ";
52 | var hDisplay = h > 0 ? h + (h == 1 ? " hour, " : " hours, ") : "0 hour, ";
53 | var mDisplay = m > 0 ? m + (m == 1 ? " minute, " : " minutes, ") : "0 minute, ";
54 | var sDisplay = s > 0 ? s + (s == 1 ? " second" : " seconds") : "0 second ";
55 | return dDisplay + hDisplay + mDisplay + sDisplay;
56 | }
57 |
58 | exports.sleep = async (ms) => {
59 | return new Promise(resolve => setTimeout(resolve, ms));
60 | }
61 |
62 | exports.url = (url) => {
63 | return url.match(new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%.+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%+.~#?&/=]*)/, 'gi'))
64 | }
65 |
66 | exports.short = (url) => {
67 | return TinyURL.shorten(url)
68 |
69 |
70 | }
71 |
72 | exports.convert = async (input) => {
73 | return new Promise(async (resolve, reject) => {
74 | const Path = "./anu.webp";
75 | await ffmpeg(input)
76 | .outputOptions(['-vcodec', 'libwebp', "-framerate", "20", '-vf', `crop=w='min(min(iw\,ih)\,512)':h='min(min(iw\,ih)\,512)',scale=512:512:flags=lanczos:force_original_aspect_ratio=decrease,format=rgba,pad=512:512:(ow-iw)/2:(oh-ih)/2:color=#00000000,setsar=1,fps=15`, "-q:v", "50", "-fs", "1M", '-loop', '0', '-preset', 'default', '-an', '-vsync', '0', '-s', '512:512'])
77 | .save(Path)
78 | .on("error", (err) => {
79 | if (fs.existsSync(Path))
80 | fs.unlinkSync(Path);
81 | if (fs.existsSync(input))
82 | fs.unlinkSync(input);
83 | return reject(new Error(err));
84 | })
85 | .on('end', () => {
86 | if (fs.existsSync(input))
87 | fs.unlinkSync(input);
88 | return resolve(Path);
89 | });
90 | });
91 | };
92 |
93 |
94 | exports.webp2mp4File = (path) => {
95 | return new Promise((resolve, reject) => {
96 | const bodyForm = new FormData()
97 | bodyForm.append('new-image-url', '')
98 | bodyForm.append('new-image', fs.createReadStream(path))
99 | Axios({
100 | method: 'post',
101 | url: 'https://s6.ezgif.com/webp-to-mp4',
102 | data: bodyForm,
103 | headers: {
104 | 'Content-Type': `multipart/form-data; boundary=${bodyForm._boundary}`
105 | }
106 | }).then(({
107 | data
108 | }) => {
109 | const bodyFormThen = new FormData()
110 | const $ = cheerio.load(data)
111 | const file = $('input[name="file"]').attr('value')
112 | const token = $('input[name="token"]').attr('value')
113 | const convert = $('input[name="file"]').attr('value')
114 | const gotdata = {
115 | file: file,
116 | token: token,
117 | convert: convert
118 | }
119 | bodyFormThen.append('file', gotdata.file)
120 | bodyFormThen.append('token', gotdata.token)
121 | bodyFormThen.append('convert', gotdata.convert)
122 | Axios({
123 | method: 'post',
124 | url: 'https://ezgif.com/webp-to-mp4/' + gotdata.file,
125 | data: bodyFormThen,
126 | headers: {
127 | 'Content-Type': `multipart/form-data; boundary=${bodyFormThen._boundary}`
128 | }
129 | }).then(({
130 | data
131 | }) => {
132 | const $ = cheerio.load(data)
133 | const result = 'https:' + $('div#output > p.outfile > video > source').attr('src')
134 | resolve({
135 | status: true,
136 | message: "Created By Riyan",
137 | result: result
138 | })
139 | }).catch(reject)
140 | }).catch(reject)
141 | })
142 | }
--------------------------------------------------------------------------------
/lib/lowdb/CAF-NAYLA🤙:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/lowdb/MissingAdapterError.d.ts:
--------------------------------------------------------------------------------
1 | export declare class MissingAdapterError extends Error {
2 | constructor();
3 | }
4 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/lowdb/adapters/Nayla.js:
--------------------------------------------------------------------------------
1 | //Ga ada apa apa
2 | //Property of CAF
3 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 };
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/lib/scrape.js:
--------------------------------------------------------------------------------
1 | const axios = require("axios")
2 | const cheerio = require("cheerio")
3 | const qs = require("qs")
4 |
5 | exports.pinterest = (querry) => {
6 | return new Promise(async (resolve, reject) => {
7 | axios.get('https://id.pinterest.com/search/pins/?autologin=true&q=' + querry, {
8 | headers: {
9 | "cookie": " _auth=1; _pinterest_sess=TWc9PSZqMTAzbGFRTDRKZXZNbVdiWTV3R241OUFUREphNTgzY3c2c2ZNYzJTUkdqbkphNjBadUV2NG1hMnp1U2x6RkhnRXVqMENKeFZRdUR2QytUN1B2Z0JjSzFJdmZKOEQzdmJYaDRKNHBzNitWdGVSamJUMnZVcHh5VVJZb1N1aWFBZDFVZGlsSk1XcEN2Q01oZFpaT2gvckpKQmxGTm5vZXVXRGZEbzBWcUNzVXY2enlVTkxqUG9yY2I1STE0Q05yeUJJcTR3a0M2UEZWUjZDZ2F1eUhacDRJVDY0TTZiYk9zWlJZV3dxc3VEaFpSeXFuNThOWlNQYVlTaUwwQ0pMK1UwRTc1eWFVVmg4amtKMmtEQnZPRDVUZzdGZUQ4YzdJeUZHUHR4UTZyRWxjMFdQQjlncUl0OGNZUFY4ZTRseE5tcFZlMkVRdTRITzdMSENvK0JWcUh1N2JhVDBKa0IwR2JwYlhSaDg0c2VxSXhiRUNTV3dmU3VIYXdPNVAzM28wS05zYTdVRzdXakQvY25JSWZ2aTFKWlRRcnI1U2w4ZG5kKzcyMWZ5UFhPOCtsUzlXSytTc3BUOVU5RGZOc25lL25Tc2ljK0NVTmxVY2h4OHFNL25KTWFISUhhZnV4T0lYRlZNYkx4d0dweHBYdE9kNmVGSW5NL2xTSnc2OVZkMU9EQzdxZ0dSaTFyWTFoWXRqVXVTZWlNdkhacG10ZUE1SjY4SVg4TDdSVklHN1hQSmRobHJnN05hc3lWSkVPOFl1SzFGWUhPMFczYllBdHVYYUNNSjJWVUsza3NKeVVoUWY4emgvM2ZKTFlGbmJ1cVMyY3ZqWkYxSGVWZWFSZHVHK2hGZUY0Qi9sUTZ6K0xMdVFjeXZzaHFXck0xUWQwcGlEUjhJZTlJOUdWaVZPQnJiYWJ1TExEYkZMSVV2c2F6WkZOd0hJTjVOWE8yTkJKdDUwUlpKU05ZYXpWWVloMzB6VjAxVWZrYmgvQ1d5empVNXhNUDJJYy8yN3dhckV4aEpJWnl0TTdnVVE4dlE1andSNTBaa25hc1lnPT0mK2Fnc0U1UnIrSE14Q2dmTE1RbmhQSlFjSFlBPQ=="
10 | }
11 | }).then(({
12 | data
13 | }) => {
14 | const $ = cheerio.load(data)
15 | const result = [];
16 | const hasil = [];
17 | $('div > a').get().map(b => {
18 | const link = $(b).find('img').attr('src')
19 | result.push(link)
20 | });
21 | result.forEach(v => {
22 | if (v == undefined) return
23 | hasil.push(v.replace(/236/g, '736'))
24 | })
25 | hasil.shift();
26 | resolve(hasil)
27 | })
28 | })
29 | }
30 |
31 | exports.igstalk = (username) => {
32 | function _0x36dc(_0xd42027, _0x25716b) {
33 | var _0x3ecb7c = _0x3ecb();
34 | return _0x36dc = function(_0x36dca1, _0x1286e2) {
35 | _0x36dca1 = _0x36dca1 - 0x11a;
36 | var _0x52a15e = _0x3ecb7c[_0x36dca1];
37 | return _0x52a15e;
38 | }, _0x36dc(_0xd42027, _0x25716b);
39 | }(function(_0x1e331e, _0x1e749a) {
40 | var _0x3bb40d = _0x36dc,
41 | _0x11d40f = _0x1e331e();
42 | while (!![]) {
43 | try {
44 | var _0xedd2a9 = parseInt(_0x3bb40d(0x11a)) / 0x1 * (parseInt(_0x3bb40d(0x11c)) / 0x2) + parseInt(_0x3bb40d(0x11d)) / 0x3 + parseInt(_0x3bb40d(0x125)) / 0x4 * (-parseInt(_0x3bb40d(0x127)) / 0x5) + -parseInt(_0x3bb40d(0x122)) / 0x6 + -parseInt(_0x3bb40d(0x124)) / 0x7 + parseInt(_0x3bb40d(0x121)) / 0x8 * (parseInt(_0x3bb40d(0x11e)) / 0x9) + parseInt(_0x3bb40d(0x126)) / 0xa;
45 | if (_0xedd2a9 === _0x1e749a) break;
46 | else _0x11d40f['push'](_0x11d40f['shift']());
47 | } catch (_0x353773) {
48 | _0x11d40f['push'](_0x11d40f['shift']());
49 | }
50 | }
51 | }(_0x3ecb, 0x4e018));
52 | return new Promise(async (_0x4f4161, _0x2476da) => {
53 | var _0x4339d6 = _0x36dc;
54 | axios[_0x4339d6(0x11f)](_0x4339d6(0x123) + username + _0x4339d6(0x128), {
55 | 'headers': {
56 | 'cookie': _0x4339d6(0x11b)
57 | }
58 | })[_0x4339d6(0x120)](({
59 | data: _0x549496
60 | }) => {
61 | _0x4f4161(_0x549496);
62 | });
63 | });
64 |
65 | function _0x3ecb() {
66 | var _0x1ee859 = ['1635669MvnaFB', 'get', 'then', '16waRkNe', '3751182GYDbYc', 'https://www.instagram.com/', '584325PrCYsS', '76kcFoiv', '2406270NCZEKF', '78935XTAbbM', '/?__a=1', '1077JsIaks', 'csrftoken=576KQM9GPVuBe6PAYExBJXQ9bXa5Qv4t;\x20ds_user_id=9663089280;\x20sessionid=9663089280%3AOfOywvlQcHSAzi%3A9;', '764WlsQYb', '937842QWdkgL'];
67 | _0x3ecb = function() {
68 | return _0x1ee859;
69 | };
70 | return _0x3ecb();
71 | }
72 | }
73 |
74 |
75 | exports.igdl = (url) => {
76 |
77 | return new Promise(async (resolve, reject) => {
78 | axios.request({
79 | url: 'https://www.instagramsave.com/download-instagram-videos.php',
80 | method: 'GET',
81 | headers: {
82 | "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
83 | "cookie": "PHPSESSID=ugpgvu6fgc4592jh7ht9d18v49; _ga=GA1.2.1126798330.1625045680; _gid=GA1.2.1475525047.1625045680; __gads=ID=92b58ed9ed58d147-221917af11ca0021:T=1625045679:RT=1625045679:S=ALNI_MYnQToDW3kOUClBGEzULNjeyAqOtg"
84 | }
85 | })
86 | .then(({
87 | data
88 | }) => {
89 | const $ = cheerio.load(data)
90 | const token = $('#token').attr('value')
91 | let config = {
92 | headers: {
93 | 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
94 | "sec-ch-ua": '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
95 | "cookie": "PHPSESSID=ugpgvu6fgc4592jh7ht9d18v49; _ga=GA1.2.1126798330.1625045680; _gid=GA1.2.1475525047.1625045680; __gads=ID=92b58ed9ed58d147-221917af11ca0021:T=1625045679:RT=1625045679:S=ALNI_MYnQToDW3kOUClBGEzULNjeyAqOtg",
96 | "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
97 | },
98 | data: {
99 | 'url': url,
100 | 'action': 'post',
101 | 'token': token
102 | }
103 | }
104 | axios.post('https://www.instagramsave.com/system/action.php', qs.stringify(config.data), {
105 | headers: config.headers
106 | })
107 | .then(({
108 | data
109 | }) => {
110 | resolve(data)
111 | })
112 | })
113 | .catch(reject)
114 | })
115 |
116 |
117 | }
--------------------------------------------------------------------------------
/lib/simpel.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Create By Dika Ardnt.
3 | * Contact Me on wa.me/6288292024190
4 | * Follow https://github.com/DikaArdnt
5 | */
6 |
7 | const {
8 | default: makeWASocket,
9 | DisconnectReason,
10 | AnyMessageContent,
11 | delay,
12 | useSingleFileAuthState,
13 | generateForwardMessageContent,
14 | prepareWAMessageMedia,
15 | generateWAMessageFromContent,
16 | generateMessageID,
17 | downloadContentFromMessage,
18 | makeInMemoryStore,
19 | fetchLatestBaileysVersion,
20 | jidDecode,
21 | getContentType,
22 | proto
23 | } = require('@adiwajshing/baileys')
24 |
25 |
26 |
27 | const chalk = require('chalk')
28 | const fs = require('fs')
29 | const Crypto = require('crypto')
30 | const axios = require('axios')
31 | const moment = require('moment-timezone')
32 | const {
33 | sizeFormatter
34 | } = require('human-readable')
35 | const util = require('util')
36 | const Jimp = require('jimp')
37 | const {
38 | defaultMaxListeners
39 | } = require('stream')
40 |
41 |
42 | const unixTimestampSeconds = (date = new Date()) => Math.floor(date.getTime() / 1000)
43 |
44 | exports.unixTimestampSeconds = unixTimestampSeconds
45 |
46 | exports.generateMessageTag = (epoch) => {
47 | let tag = (0, exports.unixTimestampSeconds)().toString();
48 | if (epoch)
49 | tag += '.--' + epoch; // attach epoch if provided
50 | return tag;
51 | }
52 |
53 | exports.processTime = (timestamp, now) => {
54 | return moment.duration(now - moment(timestamp * 1000)).asSeconds()
55 | }
56 |
57 | exports.getRandom = (ext) => {
58 | return `${Math.floor(Math.random() * 10000)}${ext}`
59 | }
60 |
61 | exports.getBuffer = async (url, options) => {
62 | try {
63 | options ? options : {}
64 | const res = await axios({
65 | method: "get",
66 | url,
67 | headers: {
68 | 'DNT': 1,
69 | 'Upgrade-Insecure-Request': 1
70 | },
71 | ...options,
72 | responseType: 'arraybuffer'
73 | })
74 | return res.data
75 | } catch (err) {
76 | return err
77 | }
78 | }
79 |
80 | exports.fetchJson = async (url, options) => {
81 | try {
82 | options ? options : {}
83 | const res = await axios({
84 | method: 'GET',
85 | url: url,
86 | headers: {
87 | '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'
88 | },
89 | ...options
90 | })
91 | return res.data
92 | } catch (err) {
93 | return err
94 | }
95 | }
96 |
97 | exports.runtime = function(seconds) {
98 | seconds = Number(seconds);
99 | var d = Math.floor(seconds / (3600 * 24));
100 | var h = Math.floor(seconds % (3600 * 24) / 3600);
101 | var m = Math.floor(seconds % 3600 / 60);
102 | var s = Math.floor(seconds % 60);
103 | var dDisplay = d > 0 ? d + (d == 1 ? " day, " : " days, ") : "";
104 | var hDisplay = h > 0 ? h + (h == 1 ? " hour, " : " hours, ") : "";
105 | var mDisplay = m > 0 ? m + (m == 1 ? " minute, " : " minutes, ") : "";
106 | var sDisplay = s > 0 ? s + (s == 1 ? " second" : " seconds") : "";
107 | return dDisplay + hDisplay + mDisplay + sDisplay;
108 | }
109 |
110 | exports.clockString = (ms) => {
111 | let h = isNaN(ms) ? '--' : Math.floor(ms / 3600000)
112 | let m = isNaN(ms) ? '--' : Math.floor(ms / 60000) % 60
113 | let s = isNaN(ms) ? '--' : Math.floor(ms / 1000) % 60
114 | return [h, m, s].map(v => v.toString().padStart(2, 0)).join(':')
115 | }
116 |
117 | exports.sleep = async (ms) => {
118 | return new Promise(resolve => setTimeout(resolve, ms));
119 | }
120 |
121 | exports.isUrl = (url) => {
122 | return url.match(new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/, 'gi'))
123 | }
124 |
125 | exports.getTime = (format, date) => {
126 | if (date) {
127 | return moment(date).locale('id').format(format)
128 | } else {
129 | return moment.tz('Asia/Jakarta').locale('id').format(format)
130 | }
131 | }
132 |
133 | exports.formatDate = (n, locale = 'id') => {
134 | let d = new Date(n)
135 | return d.toLocaleDateString(locale, {
136 | weekday: 'long',
137 | day: 'numeric',
138 | month: 'long',
139 | year: 'numeric',
140 | hour: 'numeric',
141 | minute: 'numeric',
142 | second: 'numeric'
143 | })
144 | }
145 |
146 | exports.tanggal = (numer) => {
147 | myMonths = ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"];
148 | myDays = ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jum’at', 'Sabtu'];
149 | var tgl = new Date(numer);
150 | var day = tgl.getDate()
151 | bulan = tgl.getMonth()
152 | var thisDay = tgl.getDay(),
153 | thisDay = myDays[thisDay];
154 | var yy = tgl.getYear()
155 | var year = (yy < 1000) ? yy + 1900 : yy;
156 | const time = moment.tz('Asia/Jakarta').format('DD/MM HH:mm:ss')
157 | let d = new Date
158 | let locale = 'id'
159 | let gmt = new Date(0).getTime() - new Date('1 January 1970').getTime()
160 | let weton = ['Pahing', 'Pon', 'Wage', 'Kliwon', 'Legi'][Math.floor(((d * 1) + gmt) / 84600000) % 5]
161 |
162 | return `${thisDay}, ${day} - ${myMonths[bulan]} - ${year}`
163 | }
164 |
165 | exports.formatp = sizeFormatter({
166 | std: 'JEDEC', //'SI' = default | 'IEC' | 'JEDEC'
167 | decimalPlaces: 2,
168 | keepTrailingZeroes: false,
169 | render: (literal, symbol) => `${literal} ${symbol}B`,
170 | })
171 |
172 | exports.jsonformat = (string) => {
173 | return JSON.stringify(string, null, 2)
174 | }
175 |
176 | function format(...args) {
177 | return util.format(...args)
178 | }
179 |
180 | exports.logic = (check, inp, out) => {
181 | if (inp.length !== out.length) throw new Error('Input and Output must have same length')
182 | for (let i in inp)
183 | if (util.isDeepStrictEqual(check, inp[i])) return out[i]
184 | return null
185 | }
186 |
187 | exports.generateProfilePicture = async (buffer) => {
188 | const jimp = await Jimp.read(buffer)
189 | const min = jimp.getWidth()
190 | const max = jimp.getHeight()
191 | const cropped = jimp.crop(0, 0, min, max)
192 | return {
193 | img: await cropped.scaleToFit(720, 720).getBufferAsync(Jimp.MIME_JPEG),
194 | preview: await cropped.scaleToFit(720, 720).getBufferAsync(Jimp.MIME_JPEG)
195 | }
196 | }
197 |
198 | exports.bytesToSize = (bytes, decimals = 2) => {
199 | if (bytes === 0) return '0 Bytes';
200 |
201 | const k = 1024;
202 | const dm = decimals < 0 ? 0 : decimals;
203 | const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
204 |
205 | const i = Math.floor(Math.log(bytes) / Math.log(k));
206 |
207 | return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
208 | }
209 |
210 | exports.getSizeMedia = (path) => {
211 | return new Promise((resolve, reject) => {
212 | if (/http/.test(path)) {
213 | axios.get(path)
214 | .then((res) => {
215 | let length = parseInt(res.headers['content-length'])
216 | let size = exports.bytesToSize(length, 3)
217 | if (!isNaN(length)) resolve(size)
218 | })
219 | } else if (Buffer.isBuffer(path)) {
220 | let length = Buffer.byteLength(path)
221 | let size = exports.bytesToSize(length, 3)
222 | if (!isNaN(length)) resolve(size)
223 | } else {
224 | reject('error gatau apah')
225 | }
226 | })
227 | }
228 |
229 | exports.parseMention = (text = '') => {
230 | return [...text.matchAll(/@([0-9]{5,16}|0)/g)].map(v => v[1] + '@s.whatsapp.net')
231 | }
232 |
233 |
234 | /**
235 | * Serialize Message
236 | * @param {WAConnection} conn
237 | * @param {Object} m
238 | * @param {store} store
239 | */
240 | exports.modulewa = (conn, m, store) => {
241 |
242 | conn.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 | conn.copyNForward = async (jid, message, forceForward = false, options = {}) => {
251 | let vtype
252 | if (options.readViewOnce) {
253 | message.message = message.message && message.message.ephemeralMessage && message.message.ephemeralMessage.message ? message.message.ephemeralMessage.message : (message.message || undefined)
254 | vtype = Object.keys(message.message.viewOnceMessage.message)[0]
255 | delete(message.message && message.message.ignore ? message.message.ignore : (message.message || undefined))
256 | delete message.message.viewOnceMessage.message[vtype].viewOnce
257 | message.message = {
258 | ...message.message.viewOnceMessage.message
259 | }
260 | }
261 |
262 | let mtype = Object.keys(message.message)[0]
263 | let content = await generateForwardMessageContent(message, forceForward)
264 | let ctype = Object.keys(content)[0]
265 | let context = {}
266 | if (mtype != "conversation") context = message.message[mtype].contextInfo
267 | content[ctype].contextInfo = {
268 | ...context,
269 | ...content[ctype].contextInfo
270 | }
271 | const waMessage = await generateWAMessageFromContent(jid, content, options ? {
272 | ...content[ctype],
273 | ...options,
274 | ...(options.contextInfo ? {
275 | contextInfo: {
276 | ...content[ctype].contextInfo,
277 | ...options.contextInfo
278 | }
279 | } : {})
280 | } : {})
281 | await conn.relayMessage(jid, waMessage.message, {
282 | messageId: waMessage.key.id
283 | })
284 | return waMessage
285 | }
286 |
287 | conn.downloadMediaMessage = async (message) => {
288 | let mime = (message.msg || message).mimetype || ''
289 | let messageType = message.mtype ? message.mtype.replace(/Message/gi, '') : mime.split('/')[0]
290 | const stream = await downloadContentFromMessage(message, messageType)
291 | let buffer = Buffer.from([])
292 | for await (const chunk of stream) {
293 | buffer = Buffer.concat([buffer, chunk])
294 | }
295 |
296 | return buffer
297 | }
298 |
299 |
300 | if (!m) return m
301 | let M = proto.WebMessageInfo
302 | if (m.key) {
303 | m.id = m.key.id
304 | m.isBaileys = m.id.startsWith('BAE5') && m.id.length === 16
305 | m.chat = m.key.remoteJid
306 | m.fromMe = m.key.fromMe
307 | m.isGroup = m.chat.endsWith('@g.us')
308 | m.sender = conn.decodeJid(m.fromMe && conn.user.id || m.participant || m.key.participant || m.chat || '')
309 | if (m.isGroup) m.participant = conn.decodeJid(m.key.participant) || ''
310 | }
311 | if (m.message) {
312 | m.mtype = getContentType(m.message)
313 | m.msg = (m.mtype == 'viewOnceMessage' ? m.message[m.mtype].message[getContentType(m.message[m.mtype].message)] : m.message[m.mtype])
314 | m.body = m.message.conversation || m.msg.caption || m.msg.text || (m.mtype == 'listResponseMessage') && m.msg.singleSelectReply.selectedRowId || (m.mtype == 'buttonsResponseMessage') && m.msg.selectedButtonId || (m.mtype == 'viewOnceMessage') && m.msg.caption || m.text
315 | let quoted = m.quoted = m.msg.contextInfo ? m.msg.contextInfo.quotedMessage : null
316 | m.mentionedJid = m.msg.contextInfo ? m.msg.contextInfo.mentionedJid : []
317 | if (m.quoted) {
318 | let type = getContentType(quoted)
319 | m.quoted = m.quoted[type]
320 |
321 | if (['productMessage'].includes(type)) {
322 | type = getContentType(m.quoted)
323 | m.quoted = m.quoted[type]
324 | }
325 |
326 | if (typeof m.quoted === 'string') m.quoted = {
327 | text: m.quoted
328 | }
329 | m.quoted.mtype = type
330 | m.quoted.id = m.msg.contextInfo.stanzaId
331 | m.quoted.chat = m.msg.contextInfo.remoteJid || m.chat
332 | m.quoted.isBaileys = m.quoted.id ? m.quoted.id.startsWith('BAE5') && m.quoted.id.length === 16 : false
333 | m.quoted.sender = conn.decodeJid(m.msg.contextInfo.participant)
334 | m.quoted.fromMe = m.quoted.sender === (conn.user && conn.user.id)
335 | m.quoted.text = m.quoted.text || m.quoted.caption || m.quoted.conversation || m.quoted.contentText || m.quoted.selectedDisplayText || m.quoted.title || ''
336 | m.quoted.mentionedJid = m.msg.contextInfo ? m.msg.contextInfo.mentionedJid : []
337 |
338 | m.getQuotedObj = m.getQuotedMessage = async () => {
339 | if (!m.quoted.id) return false
340 | let q = await store.loadMessage(m.chat, m.quoted.id, conn)
341 | return exports.modulewa(conn, q, store)
342 | }
343 | let vM = m.quoted.fakeObj = M.fromObject({
344 | key: {
345 | remoteJid: m.quoted.chat,
346 | fromMe: m.quoted.fromMe,
347 | id: m.quoted.id
348 | },
349 | message: quoted,
350 | ...(m.isGroup ? {
351 | participant: m.quoted.sender
352 | } : {})
353 | })
354 |
355 | /**
356 | *
357 | * @returns
358 | */
359 | m.quoted.delete = () => conn.sendMessage(m.quoted.chat, {
360 | delete: vM.key
361 | })
362 |
363 | /**
364 | *
365 | * @param {*} jid
366 | * @param {*} forceForward
367 | * @param {*} options
368 | * @returns
369 | */
370 | m.quoted.copyNForward = (jid, forceForward = false, options = {}) => conn.copyNForward(jid, vM, forceForward, options)
371 |
372 | /**
373 | *
374 | * @returns
375 | */
376 | m.quoted.download = () => conn.downloadMediaMessage(m.quoted)
377 | }
378 | }
379 | if (m.msg.url) m.download = () => conn.downloadMediaMessage(m.msg)
380 | m.text = m.msg.text || m.msg.caption || m.message.conversation || m.msg.contentText || m.msg.selectedDisplayText || m.msg.title || ''
381 | /**
382 | * Reply to this message
383 | * @param {String|Object} text
384 | * @param {String|false} chatId
385 | * @param {Object} options
386 | */
387 | m.reply = (text, chatId = m.chat, options = {}) => Buffer.isBuffer(text) ? conn.sendMedia(chatId, text, 'file', '', m, {
388 | ...options
389 | }) : conn.sendText(chatId, text, m, {
390 | ...options
391 | })
392 | /**
393 | * Copy this message
394 | */
395 | m.copy = () => exports.modulewa(conn, M.fromObject(M.toObject(m)))
396 |
397 | /**
398 | *
399 | * @param {*} jid
400 | * @param {*} forceForward
401 | * @param {*} options
402 | * @returns
403 | */
404 | m.copyNForward = (jid = m.chat, forceForward = false, options = {}) => conn.copyNForward(jid, m, forceForward, options)
405 |
406 | return m
407 | }
408 |
409 |
410 | let file = require.resolve(__filename)
411 | fs.watchFile(file, () => {
412 | fs.unwatchFile(file)
413 | console.log(chalk.redBright(`Update ${__filename}`))
414 | delete require.cache[file]
415 | require(file)
416 | })
--------------------------------------------------------------------------------
/lib/uploader.js:
--------------------------------------------------------------------------------
1 | let axios = require('axios')
2 | let BodyForm = require('form-data')
3 | let {
4 | fromBuffer
5 | } = import('file-type')
6 | let fetch = require('node-fetch')
7 | let fs = require('fs')
8 | let cheerio = require('cheerio')
9 |
10 |
11 |
12 | function TelegraPh(Path) {
13 | return new Promise(async (resolve, reject) => {
14 | if (!fs.existsSync(Path)) return reject(new Error("File not Found"))
15 | try {
16 | const form = new BodyForm();
17 | form.append("file", fs.createReadStream(Path))
18 | const data = await axios({
19 | url: "https://telegra.ph/upload",
20 | method: "POST",
21 | headers: {
22 | ...form.getHeaders()
23 | },
24 | data: form
25 | })
26 | return resolve("https://telegra.ph" + data.data[0].src)
27 | } catch (err) {
28 | return reject(new Error(String(err)))
29 | }
30 | })
31 | }
32 |
33 | async function UploadFileUgu(input) {
34 | return new Promise(async (resolve, reject) => {
35 | const form = new BodyForm();
36 | form.append("files[]", fs.createReadStream(input))
37 | await axios({
38 | url: "https://uguu.se/upload.php",
39 | method: "POST",
40 | headers: {
41 | "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",
42 | ...form.getHeaders()
43 | },
44 | data: form
45 | }).then((data) => {
46 | resolve(data.data.files[0])
47 | }).catch((err) => reject(err))
48 | })
49 | }
50 |
51 | function webp2mp4File(path) {
52 | return new Promise((resolve, reject) => {
53 | const form = new BodyForm()
54 | form.append('new-image-url', '')
55 | form.append('new-image', fs.createReadStream(path))
56 | axios({
57 | method: 'post',
58 | url: 'https://s6.ezgif.com/webp-to-mp4',
59 | data: form,
60 | headers: {
61 | 'Content-Type': `multipart/form-data; boundary=${form._boundary}`
62 | }
63 | }).then(({
64 | data
65 | }) => {
66 | const bodyFormThen = new BodyForm()
67 | const $ = cheerio.load(data)
68 | const file = $('input[name="file"]').attr('value')
69 | bodyFormThen.append('file', file)
70 | bodyFormThen.append('convert', "Convert WebP to MP4!")
71 | axios({
72 | method: 'post',
73 | url: 'https://ezgif.com/webp-to-mp4/' + file,
74 | data: bodyFormThen,
75 | headers: {
76 | 'Content-Type': `multipart/form-data; boundary=${bodyFormThen._boundary}`
77 | }
78 | }).then(({
79 | data
80 | }) => {
81 | const $ = cheerio.load(data)
82 | const result = 'https:' + $('div#output > p.outfile > video > source').attr('src')
83 | resolve({
84 | status: true,
85 | message: "Created By MRHRTZ",
86 | result: result
87 | })
88 | }).catch(reject)
89 | }).catch(reject)
90 | })
91 | }
92 |
93 | module.exports = {
94 | TelegraPh,
95 | UploadFileUgu,
96 | webp2mp4File
97 | }
--------------------------------------------------------------------------------
/lib/yt.js:
--------------------------------------------------------------------------------
1 | const axios = require("axios")
2 |
3 | /**
4 | * To Download Media From YouTube
5 | *
6 | * @param {String} url
7 | *
8 | * @return Object
9 | */
10 | exports.yt = async (url) => {
11 | if (url.includes("youtu")) {
12 | let form = new URLSearchParams()
13 | form.append("q", url)
14 | form.append("vt", "home")
15 | let {
16 | data
17 | } = await axios("https://yt5s.com/api/ajaxSearch", {
18 | method: "POST",
19 | headers: {
20 | accept: "*/*",
21 | "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
22 | cookie: "_ga=GA1.2.554524686.1642841938; _gid=GA1.2.1657844542.1642841938; __atuvc=1|3; __atssc=google;1; __cflb=04dToSoFRg9oqH9pYF2En9gKJK4fe8D4nMCRWYbL7f; _gat_gtag_UA_122831834_4=1; _PN_SBSCRBR_FALLBACK_DENIED=1642857938152"
23 | },
24 | data: form
25 | })
26 | let res = await axios("https://backend.svcenter.xyz/api/convert-by-45fc4be8916916ba3b8d61dd6e0d6994", {
27 | method: "POST",
28 | headers: {
29 | accept: "*/*",
30 | "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
31 | "x-requested-key": "de0cfuirtgf67a"
32 | },
33 | data: new URLSearchParams(Object.entries({
34 | v_id: data.vid,
35 | ftype: "mp3",
36 | fquality: 128,
37 | token: data.token,
38 | timeExpire: data.timeExpires,
39 | client: "yt5s.com"
40 | }))
41 | })
42 | let result = await axios("https://jjjkl2.uoyadfrrea.xyz/api/json/convert", {
43 | method: "POST",
44 | headers: {
45 | accept: "*/*",
46 | "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
47 | },
48 | data: new URLSearchParams(Object.entries({
49 | v_id: data.vid,
50 | ftype: "mp4",
51 | fquality: "360p",
52 | fname: data.title,
53 | token: data.token,
54 | timeExpire: data.timeExpires,
55 | }))
56 | })
57 | return {
58 | dl: {
59 | mp3: res.data.d_url,
60 | mp4: result.data.result
61 | },
62 | title: data.title,
63 | author: data.a,
64 | duration: data.t,
65 | size: {
66 | mp3: data.links.mp3["2"].size,
67 | mp4: data.links.mp4["7"].size,
68 | }
69 | }
70 | }
71 | }
--------------------------------------------------------------------------------
/message/fdz.js:
--------------------------------------------------------------------------------
1 | /*
2 | Base CASE BOT Baileys-Md By FERDIZ AFK
3 | Free To Use
4 | Give Me Credit Please
5 |
6 | Don't Sell It!!
7 | */
8 |
9 | // Module
10 | const {
11 | default: makeWASocket,
12 | DisconnectReason,
13 | AnyMessageContent,
14 | delay,
15 | useSingleFileAuthState,
16 | generateForwardMessageContent,
17 | prepareWAMessageMedia,
18 | generateWAMessageFromContent,
19 | generateMessageID,
20 | downloadContentFromMessage,
21 | makeInMemoryStore,
22 | fetchLatestBaileysVersion,
23 | jidDecode,
24 | proto
25 | } = require('@adiwajshing/baileys')
26 |
27 | const moment = require("moment-timezone")
28 | const fs = require("fs")
29 | const axios = require("axios")
30 | const cheerio = require('cheerio')
31 | const fetch = require('node-fetch')
32 | const {exec,spawn} = require("child_process")
33 | const ffmpeg = require("fluent-ffmpeg")
34 | const Carbon = require("unofficial-carbon-now")
35 | const tesseract = require("node-tesseract-ocr")
36 | const {modulewa,parseMention} = require('../lib/simpel')
37 |
38 |
39 | //------------------------------------------------------------------------
40 | // Library
41 |
42 |
43 | const color = require("../lib/color.js")
44 | const {
45 | getBuffer,
46 | getRandom,
47 | getGroupAdmins,
48 | runtime,
49 | sleep,
50 | short,
51 | webp2mp4File,
52 | convert
53 | } = require("../lib/function.js")
54 | const {
55 | pinterest,
56 | igstalk,
57 | igdl
58 | } = require("../lib/scrape.js")
59 | const {
60 | yt
61 | } = require("../lib/yt.js")
62 | const ind = require("./ind.js")
63 |
64 | const setting = JSON.parse(fs.readFileSync('./setting.json'))
65 |
66 | prefix = setting.prefix
67 | ownerNumber = setting.ownerNumber
68 | ownerNumberg = setting.ownerNumberg
69 | stickerInfo = setting.stickerInfo
70 | namabot = setting.namabot
71 | namaowner = setting.namaowner
72 | backup = setting.backup
73 |
74 | blocked = [] // jangan DiUbah
75 |
76 | module.exports = fdz = async (fdz, m, mek, chatUpdate, store) => {
77 | try {
78 | msg = m
79 | const content = JSON.stringify(mek.message)
80 | const type = Object.keys(mek.message)[0];
81 | 1
82 | var body = (m.mtype === 'conversation') ? m.message.conversation : (m.mtype == 'imageMessage') ? m.message.imageMessage.caption : (m.mtype == 'videoMessage') ? m.message.videoMessage.caption : (m.mtype == 'extendedTextMessage') ? m.message.extendedTextMessage.text : (m.mtype == 'buttonsResponseMessage') ? m.message.buttonsResponseMessage.selectedButtonId : (m.mtype == 'listResponseMessage') ? m.message.listResponseMessage.singleSelectReply.selectedRowId : (m.mtype == 'templateButtonReplyMessage') ? m.message.templateButtonReplyMessage.selectedId : (m.mtype === 'messageContextInfo') ? (m.message.buttonsResponseMessage?.selectedButtonId || m.message.listResponseMessage?.singleSelectReply.selectedRowId || m.text) : ''
83 | // var body = (type === 'conversation' && msg.message.conversation) ? msg.message.conversation : (type == 'imageMessage') && msg.message.imageMessage.caption ? msg.message.imageMessage.caption : (type == 'documentMessage') && msg.message.documentMessage.caption ? msg.message.documentMessage.caption : (type == 'videoMessage') && msg.message.videoMessage.caption ? msg.message.videoMessage.caption : (type == 'extendedTextMessage') && msg.message.extendedTextMessage.text ? msg.message.extendedTextMessage.text : (type == 'buttonsResponseMessage' && msg.message.buttonsResponseMessage.selectedButtonId) ? msg.message.buttonsResponseMessage.selectedButtonId : (type == 'templateButtonReplyMessage') && msg.message.templateButtonReplyMessage.selectedId ? msg.message.templateButtonReplyMessage.selectedId : (type === 'listResponseMessage' && msg.message.listResponseMessage.selectedRowId) ? msg.message.listResponseMessage.selectedRowId : ""
84 | var budy = (typeof m.text == 'string' ? m.text : '')
85 | //console.log(body)
86 | global.fdz
87 |
88 | const timezone = moment(Date.now()).tz('Asia/Jakarta').locale('id').format('DD/MM/YY HH:mm:ss z')
89 | let time = moment.tz("Asia/Jakarta").format("HH:mm:ss")
90 | const ucapan = moment(Date.now()).tz('Asia/Jakarta').locale('id').format('a')
91 | const fromMe = msg.key.fromMe
92 | const from = m.key.remoteJid //|| fromMe
93 |
94 | const args = budy.trim().split(/ +/).slice(1)
95 | const q = text = args.join(' ')
96 | const quoted = m.quoted ? m.quoted : m
97 | const mime = (quoted.msg || quoted).mimetype || ''
98 |
99 | const pushName = msg.pushName
100 | const isGroup = msg.key.remoteJid.endsWith('@g.us')
101 | const sender = isGroup ? (msg.key.participant ? msg.key.participant : msg.participant) : msg.key.remoteJid
102 | const isOwner = isGroup ? sender.includes(ownerNumberg) : sender.includes(ownerNumber)
103 | const botNumber = fdz.user.id.split(':')[0] + '@s.whatsapp.net'
104 | const groupMetadata = isGroup ? await fdz.groupMetadata(from) : ''
105 | const groupMembers = participants = isGroup ? await groupMetadata.participants : ''
106 | const groupAdmins = isGroup ? ind.getGroupAdmins(groupMembers) : ''
107 | const isBotGroupAdmins = groupAdmins.includes(botNumber) || false
108 | const isGroupAdmins = isGroup ? groupAdmins.includes(sender) : false
109 |
110 | const isImage = (type == 'imageMessage')
111 | const isVideo = (type == 'videoMessage')
112 | const isSticker = (type == 'stickerMessage')
113 | const isQuotedMsg = (type == 'extendedTextMessage')
114 |
115 | const isQuotedImage = isQuotedMsg ? content.includes('imageMessage') ? true : false : false
116 | const isQuotedAudio = isQuotedMsg ? content.includes('audioMessage') ? true : false : false
117 | const isQuotedDocument = isQuotedMsg ? content.includes('documentMessage') ? true : false : false
118 | const isQuotedVideo = isQuotedMsg ? content.includes('videoMessage') ? true : false : false
119 | const isQuotedSticker = isQuotedMsg ? content.includes('stickerMessage') ? true : false : false
120 | const isviewOnce = isQuotedMsg ? content.includes('viewOnceMessage') ? true : false : false
121 | // const command = body.slice(0).trim().split(/ +/).shift().toLowerCase()
122 | const command = body.toLowerCase().split(' ')[0] || ''
123 | const isCmd = budy.startsWith(prefix)
124 |
125 |
126 | // Database
127 | const isNumber = x => typeof x === 'number' && !isNaN(x)
128 | try {
129 | let users = global.db.data.users[m.sender]
130 | if (typeof users !== 'object') global.db.data.users[m.sender] = {}
131 | if (users) {
132 | if (!isNumber(users.afkTime)) users.afkTime = -1
133 | if (!('banned' in users)) users.banned = false
134 | if (!('afkReason' in users)) users.afkReason = ''
135 | } else global.db.data.users[m.sender] = {
136 | afkTime: -1,
137 | banned: false,
138 | afkReason: '',
139 | }
140 |
141 | let chats = global.db.data.chats[m.chat]
142 | if (typeof chats !== 'object') global.db.data.chats[m.chat] = {}
143 | if (chats) {
144 | if (!('antionce' in chats)) chats.antionce = true
145 | if (!('mute' in chats)) chats.mute = false
146 | if (!('antispam' in chats)) chats.antispam = true
147 | if (!('antidelete' in chats)) chats.antidelete = false
148 | if (!('setDemote' in chats)) chat.setDemote = ''
149 | if (!('setPromote' in chats)) chat.setPromote = ''
150 | if (!('setWelcome' in chats)) chat.setWelcome = ''
151 | if (!('setLeave' in chats)) chats.setLeave = ''
152 | } else global.db.data.chats[m.chat] = {
153 | antionce: true,
154 | mute: false,
155 | antispam: true,
156 | antidelete: false,
157 | setDemote: '',
158 | setPromote: '',
159 | setWelcome: '',
160 | setLeave: '',
161 | }
162 |
163 | let settings = global.db.data.settings[botNumber]
164 | if (typeof settings !== 'object') global.db.data.settings[botNumber] = {}
165 | if (settings) {
166 | if (!('available' in settings)) settings.available = false
167 | if (!('composing' in settings)) settings.composing = false
168 | if (!('recording' in settings)) settings.recording = false
169 | } else global.db.data.settings[botNumber] = {
170 | available: false,
171 | composing: false,
172 | recording: false,
173 | }
174 | } catch (err) {
175 | console.log(JSON.stringify(err, undefined, 2))
176 | }
177 |
178 |
179 | fdz.ws.on('CB:Blocklist', json => {
180 | if (blocked.length > 2) return
181 | for (let i of json[1].blocklist) {
182 | blocked.push(i.replace('c.us', 's.whatsapp.net'))
183 | }
184 | })
185 |
186 | const reply = (texto) => {
187 | fdz.sendMessage(m.chat, {
188 | text: texto,
189 | mentions: [sender]
190 | }, {
191 | quoted: mek
192 | })
193 | }
194 | global.reply
195 | const replylink = async (teks, judul, isi, quo) => {
196 | fdz.sendMessage(from, {
197 | text: teks,
198 | contextInfo: {
199 | "externalAdReply": {
200 | title: judul,
201 | body: isi,
202 | mediaType: 3,
203 | "thumbnail": fs.readFileSync('./assets/thumb.jpg')
204 | }
205 | }
206 | }, {
207 | sendEphemeral: true,
208 | quoted: quo
209 | })
210 | }
211 | const textImg = (teks, buffer = fs.readFileSync("assets/thumb.jpg"), mess, men) => {
212 | return fdz.sendMessage(from, {
213 | text: teks,
214 | jpegThumbnail: buffer,
215 | mention: men ? men : []
216 | }, {
217 | quoted: mess ? mess : msg
218 | })
219 | }
220 |
221 | const isUrl = (uri) => {
222 | return uri.match(new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%.+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%+.~#?&/=]*)/, 'gi'))
223 | }
224 |
225 |
226 |
227 |
228 | //auto backup sesion
229 | if (backup) {
230 | if (time == "12:00:00") {
231 | fdz.sendMessage(ownerNumber, {
232 | document: fs.readFileSync(`./${setting.sesion}.json`),
233 | fileName: "session.json",
234 | mimetype: "application/json"
235 | })
236 | }
237 | if (time == "18:00:00") {
238 | fdz.sendMessage(ownerNumber, {
239 | document: fs.readFileSync(`./${setting.sesion}.json`),
240 | fileName: "session.json",
241 | mimetype: "application/json"
242 | })
243 | }
244 | if (time == "00:00:00") {
245 | fdz.sendMessage(ownerNumber, {
246 | document: fs.readFileSync(`./${setting.sesion}.json`),
247 | fileName: "session.json",
248 | mimetype: "application/json"
249 | })
250 | }
251 | if (time == "06:00:00") {
252 | fdz.sendMessage(ownerNumber, {
253 | document: fs.readFileSync(`./${setting.sesion}.json`),
254 | fileName: "session.json",
255 | mimetype: "application/json"
256 | })
257 | }
258 | }
259 |
260 |
261 | //OCR setting
262 | const configocr = {
263 | lang: "eng",
264 | oem: 1,
265 | psm: 3,
266 | }
267 |
268 | if (m.isGroup && m.mtype == 'viewOnceMessage') {
269 | let teks = `「 *Anti ViewOnce Message* 」
270 |
271 | 🤠 *Name* : ${pushName}
272 | 👾 *User* : @${sender.split("@")[0]}
273 | ⏰ *Clock* : ${moment.tz('Asia/Jakarta').format('HH:mm:ss')} WIB
274 |
275 | 💫 *MessageType* : ${m.mtype}`
276 |
277 | reply(teks)
278 | await sleep(500)
279 | m.copyNForward(m.chat, true, {
280 | readViewOnce: true
281 | }, {
282 | quoted: mek
283 | }).catch(_ => reply('Mungkin dah pernah dibuka bot'))
284 | }
285 |
286 |
287 | //Reply no prefix
288 | if (body == "prefix") {
289 | await reply(" *Prefix saat ini:* " + prefix)
290 | } else if (body == "Prefix") {
291 | await reply(" *Prefix saat ini:* " + prefix)
292 | }
293 |
294 | /*
295 | anu = args.join(' ').split('|')
296 | satu = anu[0] !== '' ? anu[0] : "💖"
297 | const reactionMessage = {
298 | react: {
299 | text: satu,
300 | key: m.key
301 | }
302 | }
303 | sleep(5000)
304 | const sendMsg = await fdz.sendMessage(m.chat, reactionMessage)
305 | */
306 |
307 |
308 | /*if (db.data.chats[m.chat].antilink) {
309 | if (budy.match(`chat.whatsapp.com`)) {
310 | if (!isGroup) return //textImg("Perintah Ini Hanya Bisa Digunakan di Group!")
311 | m.reply(`「 ANTI LINK 」\n\nKamu terdeteksi mengirim link group, maaf kamu akan di kick !`)
312 | if (!isBotGroupAdmins) return m.reply(`Ehh bot gak admin T_T`)
313 | let gclink = (`https://chat.whatsapp.com/` + await fdz.groupInviteCode(m.chat))
314 | let isLinkThisGc = new RegExp(gclink, 'i')
315 | let isgclink = isLinkThisGc.test(m.text)
316 | if (isOwner) return m.reply(`Ehh maaf kamu owner bot ku`)
317 | if (isgclink) return m.reply(`Ehh maaf gak jadi, karena kamu ngirim link group ini`)
318 | if (isGroupAdmins) return m.reply(`Ehh maaf kamu admin`)
319 | setTimeout(() => {
320 | fdz.groupParticipantsUpdate(m.chat, [m.sender], 'remove')
321 | }, 4000)
322 | }
323 | // }
324 | */
325 |
326 |
327 | // Afk
328 | function clockString(ms) {
329 | let h = isNaN(ms) ? '--' : Math.floor(ms / 3600000)
330 | let m = isNaN(ms) ? '--' : Math.floor(ms / 60000) % 60
331 | let s = isNaN(ms) ? '--' : Math.floor(ms / 1000) % 60
332 | return h + 'Jam ' + m + 'Menit ' + s + 'Detik '
333 | }
334 | const mentionUser = [...new Set([...(m.mentionedJid || []), ...(m.quoted ? [m.quoted.sender] : [])])]
335 | for (let jid of mentionUser) {
336 | let user = global.db.data.users[jid]
337 | if (!user) continue
338 | let afkTime = user.afkTime
339 | if (!afkTime || afkTime < 0) continue
340 | let reason = user.afkReason || ''
341 | m.reply(`
342 | Jangan Tag Dia!
343 | Dia Sedang AFK ${reason ? 'Dengan Alasan ' + reason : 'Tanpa Alasan'}
344 | Selama ${clockString(new Date - afkTime)}
345 | `.trim())
346 | }
347 |
348 | if (db.data.users[m.sender].afkTime > -1) {
349 | let user = global.db.data.users[m.sender]
350 | m.reply(`
351 | Kamu Telah Berhenti AFK${user.afkReason ? ' Setelah ' + user.afkReason : ''}
352 | Selama ${clockString(new Date - user.afkTime)}
353 | `.trim())
354 | user.afkTime = -1
355 | user.afkReason = ''
356 | }
357 |
358 |
359 | if (isCmd) {
360 | fdz.sendReadReceipt(m.chat, m.sender, [m.key.id])
361 | console.log(color('[CMD]', 'cyan'), color(moment(msg.messageTimestamp * 1000).format('DD/MM/YY HH:mm:ss'), 'orange'), color(command, 'cyan'), color(pushName, 'orange'), color(sender, 'lime'))
362 | }
363 |
364 |
365 | //---------------------------------------------------------------------------------------
366 | // Function
367 |
368 | async function downloadAndSaveMediaMessage(type_file, path_file) {
369 | if (type_file === 'image') {
370 | var stream = await downloadContentFromMessage(msg.message.imageMessage || msg.message.extendedTextMessage?.contextInfo.quotedMessage.imageMessage, 'image')
371 | let buffer = Buffer.from([])
372 | for await (const chunk of stream) {
373 | buffer = Buffer.concat([buffer, chunk])
374 | }
375 | await fs.writeFileSync(path_file, buffer)
376 | return fs.readFileSync(path_file)
377 | } else if (type_file === 'video') {
378 | var stream = await downloadContentFromMessage(msg.message.videoMessage || msg.message.extendedTextMessage?.contextInfo.quotedMessage.videoMessage, 'video')
379 | let buffer = Buffer.from([])
380 | for await (const chunk of stream) {
381 | buffer = Buffer.concat([buffer, chunk])
382 | }
383 | fs.writeFileSync(path_file, buffer)
384 | return fs.readFileSync(path_file)
385 | } else if (type_file === 'sticker') {
386 | var stream = await downloadContentFromMessage(msg.message.stickerMessage || msg.message.extendedTextMessage?.contextInfo.quotedMessage.stickerMessage, 'sticker')
387 | let buffer = Buffer.from([])
388 | for await (const chunk of stream) {
389 | buffer = Buffer.concat([buffer, chunk])
390 | }
391 | fs.writeFileSync(path_file, buffer)
392 | return fs.readFileSync(path_file)
393 | } else if (type_file === 'audio') {
394 | var stream = await downloadContentFromMessage(msg.message.audioMessage || msg.message.extendedTextMessage?.contextInfo.quotedMessage.audioMessage, 'audio')
395 | let buffer = Buffer.from([])
396 | for await (const chunk of stream) {
397 | buffer = Buffer.concat([buffer, chunk])
398 | }
399 | fs.writeFileSync(path_file, buffer)
400 | return fs.readFileSync(path_file)
401 | }
402 | }
403 |
404 |
405 | const sendFileFromUrl = async (from, url, caption, msg, men) => {
406 | let mime = '';
407 | let res = await axios.head(url)
408 | mime = res.headers['content-type']
409 | if (mime.split("/")[1] === "gif") {
410 | return fdz.sendMessage(from, {
411 | video: await convertGif(url),
412 | caption: caption,
413 | gifPlayback: true,
414 | mentions: men ? men : []
415 | }, {
416 | quoted: msg
417 | })
418 | }
419 | let type = mime.split("/")[0] + "Message"
420 | if (mime.split("/")[0] === "image") {
421 | return fdz.sendMessage(from, {
422 | image: await getBuffer(url),
423 | caption: caption,
424 | mentions: men ? men : []
425 | }, {
426 | quoted: msg
427 | })
428 | } else if (mime.split("/")[0] === "video") {
429 | return fdz.sendMessage(from, {
430 | video: await getBuffer(url),
431 | caption: caption,
432 | mentions: men ? men : []
433 | }, {
434 | quoted: msg
435 | })
436 | } else if (mime.split("/")[0] === "audio") {
437 | return fdz.sendMessage(from, {
438 | audio: await getBuffer(url),
439 | caption: caption,
440 | mentions: men ? men : [],
441 | mimetype: 'audio/mpeg'
442 | }, {
443 | quoted: msg
444 | })
445 | } else {
446 | return fdz.sendMessage(from, {
447 | document: await getBuffer(url),
448 | mimetype: mime,
449 | caption: caption,
450 | mentions: men ? men : []
451 | }, {
452 | quoted: msg
453 | })
454 | }
455 | }
456 |
457 |
458 |
459 | //----------------------------------------------------------------------------------------
460 |
461 | if (isOwner) {
462 | if (budy.startsWith(">")) {
463 | console.log(color('[EVAL] MODE >'), color(moment(mek.messageTimestamp * 1000).format('DD/MM/YY HH:mm:ss'), 'yellow'), color(`Owner!`))
464 | const ev = (sul) => {
465 | var sat = JSON.stringify(sul, null, 2)
466 | var bang = util.format(sat)
467 | if (sat == undefined) {
468 | bang = util.format(sul)
469 | }
470 | return textImg(bang)
471 | }
472 | try {
473 | let evaled = await eval(`(async () => { return ${budy.slice(2)} })()`)
474 | if (typeof evaled !== 'string') evaled = require('util').inspect(evaled)
475 | textImg(`${evaled}`)
476 | } catch (err) {
477 | textImg(`${err}`)
478 | }
479 | } else if (budy.startsWith(">>")) {
480 | console.log(color('[EVAL] MODE >>'), color(moment(mek.messageTimestamp * 1000).format('DD/MM/YY HH:mm:ss'), 'yellow'), color(`Owner!`))
481 | try {
482 | var text = util.format(await eval(`(async() => { return ${args.join(" ")} })()`))
483 | reply(text)
484 | } catch (err) {
485 | textImg(`${err}`)
486 | }
487 | } else if (budy.startsWith("$ ")) {
488 | console.log(color('[EXEC]'), color(moment(mek.messageTimestamp * 1000).format('DD/MM/YY HH:mm:ss'), 'yellow'), color(`Owner!`))
489 | exec(budy.slice(2), (err, stdout) => {
490 | if (err) return textImg(`${err}`)
491 | if (stdout) textImg(`${stdout}`)
492 | })
493 | } else if (budy.startsWith("<")) {
494 | console.log(color('[EVAL] MODE <'), color(moment(mek.messageTimestamp * 1000).format('DD/MM/YY HH:mm:ss'), 'yellow'), color(`Owner!`))
495 | try {
496 | return textImg(JSON.stringify(eval(`${args.join(' ')}`), null, '\t'))
497 | } catch (err) {
498 | textImg(`${err}`)
499 | }
500 | } else if (budy.startsWith(".>")) {
501 | console.log(color('[EVAL] MODE .>'), color(moment(mek.messageTimestamp * 1000).format('DD/MM/YY HH:mm:ss'), 'yellow'), color(`Owner!`))
502 | if (!q) return textImg('codenya mana kak')
503 | syntaxerror = require('syntax-error')
504 | _syntax = ''
505 | _text = args.join(' ')
506 | try {
507 | evalll = await eval(`;(async () => { return ${args.join(' ')} })()`)
508 | textImg(require('util').format(evalll))
509 | } catch (e) {
510 | let err = await syntaxerror(_text, 'Execution Function', {
511 | allowReturnOutsideFunction: true,
512 | allowAwaitOutsideFunction: true
513 | })
514 | if (err) _syntax = '```' + err + '```\n\n'
515 | _return = e
516 | await textImg(_syntax + require('util').format(_return))
517 | }
518 | }
519 |
520 | }
521 |
522 |
523 | //----------------------------------------------------------------------------------------------
524 | //MENU
525 |
526 | // Please Don't Change This T_T
527 |
528 | switch (command) {
529 |
530 | case prefix + 'afk': {
531 | let user = global.db.data.users[m.sender]
532 | user.afkTime = +new Date
533 | user.afkReason = text
534 | m.reply(`Sekarang ${m.pushName} Telah Afk${text ? ' Dengan Alasan: ' + text : 'Tanpa Alasan'}`)
535 | }
536 | break
537 |
538 |
539 | case prefix + 'apatuh':
540 | case prefix + 'read': {
541 | if (!isviewOnce) return reply('Itu bukan pesan viewOnce')
542 | pel = `*User* : @${m.quoted.sender.split("@")[0]} mengirim pesan viewOnce `
543 | fdz.sendMessage(from, { text: pel, mentions: [m.quoted.sender] }, {quoted: mek })
544 | await sleep(2000)
545 | m.quoted.copyNForward(m.chat, true, { readViewOnce: true }).catch(_ => reply('Mungkin dah pernah dibuka bot'))
546 | m.quoted.copyNForward(m.chat, true).catch(_ => reply('Mungkin dah pernah dibuka bot'))
547 | }
548 | break
549 |
550 | case prefix + 'ulangi': {
551 | if (!m.quoted) return m.reply('Reply Pesannya!!')
552 | m.quoted.copyNForward(m.chat, true, {quoted: mek }).catch(_ => reply('error'))
553 | }
554 | break
555 |
556 | case prefix + 'sendowner': {
557 | if (!isOwner) return reply(`hanya bisa di gunakan owner untuk backup`)
558 | if (!m.quoted) return m.reply('Reply Pesannya!!')
559 | m.quoted.copyNForward(sender, true, {quoted: mek }).catch(_ => reply('error'))
560 | }
561 | break
562 |
563 | case prefix + 'q':
564 | case prefix + 'quoted': {
565 | if (!m.quoted) return m.reply('Reply Pesannya!!')
566 | try {
567 | if (!m.quoted) return m.reply('Reply Pesannya!!')
568 | let wokwol = await fdz.serializeM(await m.getQuotedObj())
569 | if (!wokwol.quoted) return m.reply('Pesan Yang anda reply tidak mengandung reply')
570 | await wokwol.quoted.copyNForward(m.chat, true)
571 | } catch (err) {
572 | textImg(`${err}`)
573 | }
574 | }
575 | break
576 |
577 | case prefix+'report':
578 |
579 | if (args.length < 1) return reply(`Kirim perintah ${command} laporan`)
580 | reply(`Sukses Kirim Ke Owner, Main² banned!`)
581 | for (let i of ownerNumber) {
582 |
583 | fdz.sendMessage(i, {
584 | text: `*[ PANGGILAN USER ]*\nMessage nya : ${q}`,
585 | mentions: [sender]
586 | }, {
587 | quoted: mek
588 | })
589 |
590 | }
591 | break
592 |
593 | /*
594 | case prefix + "menu":
595 | case prefix + "help": {
596 |
597 | const menuBut = [{
598 | index: 1,
599 | urlButton: {
600 | displayText: 'Source Code',
601 | url: 'https://github.com/ichizza/Chizza-md'
602 | }
603 | }, // Please Don't Change This T_T
604 | {
605 | index: 2,
606 | callButton: {
607 | displayText: 'Owner',
608 | phoneNumber: '+6285755495437'
609 | }
610 | },
611 | {
612 | index: 3,
613 | quickReplyButton: {
614 | displayText: 'MENU',
615 | id: prefix + 'allmenu'
616 | }
617 | },
618 | {
619 | index: 4,
620 | quickReplyButton: {
621 | displayText: 'RULES',
622 | id: prefix + 'rules'
623 | }
624 | },
625 | ]
626 |
627 |
628 | await fdz.sendMessage(from, {
629 | caption: `*「${namabot}」*
630 | Hai Kak ${pushName}.
631 | Saya ${namabot}, Silahkan Pilih Pilihan Fitur Yang Ada.
632 | maaf kak jika ada beberapa yang error
633 | soalnya script bot ini masih dalam pengembangan
634 |
635 | Terima Kasih Sudah Menggunakan bot ini.!`,
636 | location: {
637 | jpegThumbnail: fs.readFileSync("./assets/header.jpg")
638 | },
639 | templateButtons: menuBut,
640 | footer: 'ᴮᵉᵗᵃ ᵂʰᵃᵗˢᵃᵖᵖ ᴮᵒᵗ ᴹᵘˡᵗⁱ ᴰᵉᵛⁱᶜᵉ ❤️🔥'
641 | }, )
642 | }
643 | break
644 |
645 | */
646 |
647 | case prefix + 'list': {
648 |
649 | const sections = [
650 |
651 | {
652 | title: "Section 1",
653 | rows: [{
654 | title: "owner",
655 | rowId: ".owner"
656 | },
657 | {
658 | title: "owner",
659 | rowId: ".owner",
660 | description: "This is a description"
661 | }
662 | ]
663 | },
664 | {
665 | title: "Section 2",
666 | rows: [{
667 | title: "Option 3",
668 | rowId: ".owner"
669 | },
670 | {
671 | title: "Option 4",
672 | rowId: ".owner",
673 | description: "This is a description V2"
674 | }
675 | ]
676 | },
677 | ]
678 |
679 | const listMessage = {
680 | text: "This is a list",
681 | footer: "nice footer, link: https://google.com",
682 | title: "Amazing boldfaced list title",
683 | buttonText: "Required, text on the button to vie the list",
684 | sections
685 | }
686 |
687 | const sendMsg = await fdz.sendMessage(from, listMessage)
688 | }
689 | break
690 |
691 | case prefix + "menu":
692 | case prefix + "help": {
693 | const buttonsDefault = [
694 |
695 | { urlButton: { displayText: `Rest-api`, url : `https://ferdiz-afk.my.id` } },
696 | { urlButton: { displayText: `Youtube Channel`, url : `https://youtube.com` } },
697 | // { quickReplyButton: { displayText: `💰 Donasi`, id: `${prefix}donate` } },
698 | { quickReplyButton: { displayText: `Pemilik Bot`, id: `${prefix}owner` } }
699 | // { quickReplyButton: { displayText: `Info Bot`, id: `${prefix}infobot` } },
700 | ]
701 |
702 | var teks = ind.allmenu(sender, prefix, pushName, isOwner)
703 | fdz.sendMessage(from, { caption: teks, image: {url: `https://i.pinimg.com/736x/f0/d3/28/f0d328d2f116501a495f7981376a8d3f.jpg`}, templateButtons: buttonsDefault, footer: `©${namaowner}` , mentions: [sender]} )
704 | }
705 |
706 |
707 | break
708 |
709 | case prefix + "sewa":
710 | textImg(ind.rent())
711 | break
712 |
713 |
714 | //About Menu
715 | case prefix + "owner":
716 | case prefix + "owner": {
717 | let vcard = `BEGIN:VCARD\n` // metadata of the contact card
718 | +
719 | `VERSION:3.0\n` +
720 | 'N:;FERDI Z-AFK.;;;' +
721 | 'FN:FERDI Z-AFK.\n' // full name
722 | +
723 | `ORG:OWNER FERDI Z-AFK;\n` // the organization of the contact
724 | +
725 | `item1.TEL;type=CELL;type=VOICE;waid=6287877173955:+62 878-7717-3955\n` // WhatsApp ID + phone number
726 | +
727 | `item1.X-ABLabel:© FERDI Z-AFK\n` +
728 | `item2.EMAIL;type=INTERNET:ferdizakyla@gmail.com\n` +
729 | `item2.X-ABLabel:Email-owner\n` +
730 | `item3.URL:https://github.com/FERDIZ-afk/\n` +
731 | `item3.X-ABLabel:Github\n` +
732 | `item4.URL:https://ferdiz-my.id/\n` +
733 | `item4.X-ABLabel:Rest-api\n` +
734 | `item5.URL:https://oni-chan.my.id/\n` +
735 | `item5.X-ABLabel:Profil-github\n` +
736 | `item6.ADR:;;Region;;;;\n` +
737 | `item6.X-ABLabel:Negara-Indonesia\n` +
738 | `item7.ADR:;;city;;;;\n` +
739 | `item7.X-ABLabel:Kota-PACITAN\n` +
740 | `item8.X-ABLabel:© WhatsApp Inc.\n`
741 | // kalau bukan WhatsApp bisnis yang di bawah ini hapus aja ya
742 | +
743 | `X-WA-BIZ-NAME: OWNER FDZ\n` +
744 | `X-WA-BIZ-DESCRIPTION:from wa import info-user
745 | import json
746 |
747 | P = info-user.user()
748 | L = p.length.json
749 | L.text
750 | print (L)
751 |
752 | >>Results
753 |
754 | Full Name : FERDI ZAKY LUTHFI ARIDHO
755 | Nick name panggilan : FERDI-Z , FERDI
756 | Console-logs : F3RZALUT4R
757 | Gender : laki²
758 | alamat : Jawa timur, Pacitan, punung
759 | Status : seorang penyendiri,hanya memiliki teman virtual
760 |
761 | My website
762 | https://oni-chan.my.id/
763 |
764 | https://oni-chan.my.id/bot-nulis-online/\n\n`
765 | //end bisnis
766 | +
767 | `END:VCARD`
768 | fdz.sendMessage(from, {
769 | contacts: {
770 | displayName: `FERDI Z-AFK`,
771 | contacts: [{
772 | vcard
773 | }]
774 | }
775 | }, {
776 | quoted: mek
777 | })
778 | }
779 | break
780 |
781 |
782 | case prefix + 'creator': {
783 | // ganti ae kalau mau ganti sama code lu
784 | const _0x201eb9 = _0x1524;
785 | (function(_0x22b1eb, _0x31d123) {
786 | const _0x2394aa = _0x1524,
787 | _0x14e102 = _0x22b1eb();
788 | while (!![]) {
789 | try {
790 | const _0x105690 = -parseInt(_0x2394aa(0x1cd)) / 0x1 + parseInt(_0x2394aa(0x1cc)) / 0x2 + parseInt(_0x2394aa(0x1c9)) / 0x3 + parseInt(_0x2394aa(0x1c8)) / 0x4 + parseInt(_0x2394aa(0x1c5)) / 0x5 * (-parseInt(_0x2394aa(0x1d1)) / 0x6) + parseInt(_0x2394aa(0x1ca)) / 0x7 + parseInt(_0x2394aa(0x1ce)) / 0x8;
791 | if (_0x105690 === _0x31d123) break;
792 | else _0x14e102['push'](_0x14e102['shift']());
793 | } catch (_0x517230) {
794 | _0x14e102['push'](_0x14e102['shift']());
795 | }
796 | }
797 | }(_0x590a, 0xce0b6));
798 | let list = [];
799 |
800 | function _0x1524(_0x379058, _0x48b010) {
801 | const _0x590a72 = _0x590a();
802 | return _0x1524 = function(_0x15249e, _0x289b3d) {
803 | _0x15249e = _0x15249e - 0x1c5;
804 | let _0x4968dc = _0x590a72[_0x15249e];
805 | return _0x4968dc;
806 | }, _0x1524(_0x379058, _0x48b010);
807 | }
808 | list[_0x201eb9(0x1d0)]({
809 | 'displayName': _0x201eb9(0x1d3),
810 | 'vcard': _0x201eb9(0x1c7)
811 | }, {
812 | 'displayName': _0x201eb9(0x1cb),
813 | 'vcard': _0x201eb9(0x1c6)
814 | }, {
815 | 'displayName': 'LeonGanz',
816 | 'vcard': _0x201eb9(0x1d2)
817 | }), await fdz['sendMessage'](from, {
818 | 'contacts': {
819 | 'displayName': '' + list[_0x201eb9(0x1cf)],
820 | 'contacts': list
821 | }
822 | }, {
823 | 'quoted': m
824 | });
825 |
826 | function _0x590a() {
827 | const _0xb0754c = ['93464lGIkgk', 'length', 'push', '28260OTcKOT', 'BEGIN:VCARD\x0aVERSION:3.0\x0aN:LeonGanz\x0aFN:LeonGanz\x0aORG:\x20LeonGanz;\x0aitem1.TEL;waid=6285608625102:+62\x20856-0862-5102\x0aitem1.X-ABLabel:Ponsel\x0aitem2.EMAIL;type=INTERNET:leonganz.kry@gmail.con\x0aitem2.X-ABLabel:Email\x0aitem3.URL:https://github.com/LeonGantengz/\x0aitem3.X-ABLabel:Github\x0aitem4.URL:https://bl4ck-lion.github.io/index.php/\x0aitem4.X-ABLabel:Rest-api\x0aitem5.URL:https://github.com/LeonGantengz/\x0aitem5.X-ABLabel:Profil-github\x0aitem4.ADR:;;Indonesia;;;;\x0aitem4.X-ABLabel:Region\x0aitem8.X-ABLabel:©\x20Rama\x20Agung\x0aEND:VCARD', '©\x20FERDIZ-AFK', '1420IPAhIK', 'BEGIN:VCARD\x0aVERSION:3.0\x0aN:C\x20A\x20F\x0aFN:C\x20A\x20F\x0aORG:\x20C\x20A\x20F;\x0aitem1.TEL;waid=6283167714830:+62-831-6771-4830\x0aitem1.X-ABLabel:Ponsel\x0aitem3.URL:https://github.com/CAF-ID\x0aitem3.X-ABLabel:\x20github\x0aitem4.ADR:;;Indonesia;;;;\x0aitem4.X-ABLabel:Region\x0aEND:VCARD', 'BEGIN:VCARD\x0aVERSION:3.0\x0aN:FERDIZ-AFK;©;;;\x0aFN:©\x20FERDIZ-AFK\x0aORG:\x20Creator\x20©\x20FERDIZ-AFK;\x0aitem1.TEL;type=CELL;type=VOICE;waid=6287877173955:+62\x20878-7717-3955\x0aitem1.X-ABLabel:©\x20FERDI\x20Z-AFK\x0aitem2.EMAIL;type=INTERNET:ferdizakyla@gmail.com\x0aitem2.X-ABLabel:Email-owner\x0aitem3.URL:https://github.com/FERDIZ-afk/\x0aitem3.X-ABLabel:Github\x0aitem4.URL:https://ferdiz-my.id/\x0aitem4.X-ABLabel:Rest-api\x0aitem5.URL:https://oni-chan.my.id/\x0aitem5.X-ABLabel:Profil-github\x0aitem6.ADR:;;Region;;;;\x0aitem6.X-ABLabel:Negara-Indonesia\x0aitem7.ADR:;;city;;;;\x0aitem7.X-ABLabel:Kota-PACITAN\x0aitem8.X-ABLabel:©\x20WhatsApp\x20Inc.\x0aEND:VCARD', '6345348lCkrKd', '5050509hoetyB', '1683878BvsXlE', 'CAF', '184460eCMLyj', '1432709wdevjb'];
828 | _0x590a = function() {
829 | return _0xb0754c;
830 | };
831 | return _0x590a();
832 | }
833 | }
834 | break
835 |
836 | case prefix + "donate":
837 | case prefix + "donasi":
838 | textImg(ind.donate())
839 | break
840 | case prefix + "rules":
841 | case prefix + "rule":
842 | textImg(ind.rules(prefix))
843 | break
844 | // Owner Menu
845 |
846 | case prefix + "join": {
847 | if (!isOwner) return reply(`hanya bisa di gunakan owner `)
848 | if (!q) return textImg(ind.wrongFormat(prefix))
849 | if (!q.includes("https://chat.whatsapp.com/")) return textImg(ind.wrongFormat(prefix))
850 | try {
851 | const response = await fdz.groupAcceptInvite(q.split("https://chat.whatsapp.com/")[1])
852 | console.log(color('[JOIN GROUP]', 'lime'), color(response, 'cyan'))
853 | } catch (err) {
854 | textImg("Pastikan Link Group Benar Dan Tidak Kadaluarsa!")
855 | }
856 | }
857 | break
858 |
859 | case prefix+ 'bc': case prefix+ 'broadcast': case prefix+ 'bcall': {
860 | if (!isOwner) return reply(`hanya bisa di gunakan owner `)
861 | if (!text) throw `Text mana?\n\nExample : ${command} bot nih`
862 | let anu = await Object.keys(db.data.chats) //store.chats.all().map(v => v.id)
863 | m.reply(`Mengirim Broadcast Ke ${anu.length} Chat\nWaktu Selesai ${anu.length * 1.5} detik`)
864 | for (let yoi of anu) {
865 | await sleep(1500)
866 | let btn = [{
867 | urlButton: {
868 | displayText: 'Source Code',
869 | url: 'https://github.com/DikaArdnt/Hisoka-Morou'
870 | }
871 | }, {
872 | callButton: {
873 | displayText: 'Number Phone Owner',
874 | phoneNumber: '+62 882-9202-4190'
875 | }
876 | }, {
877 | quickReplyButton: {
878 | displayText: 'Status Bot',
879 | id: 'ping'
880 | }
881 | }, {
882 | quickReplyButton: {
883 | displayText: 'Contact Owner',
884 | id: 'owner'
885 | }
886 | }, {
887 | quickReplyButton: {
888 | displayText: 'Script',
889 | id: 'sc'
890 | }
891 | }]
892 | fatihgans = fs.readFileSync('./assets/thumb.jpg')
893 | let txt = `「 Broadcast Bot 」\n\n${text}`
894 | fdz.sendMessage(from, { caption: txt, image: {url: `https://i.pinimg.com/736x/f0/d3/28/f0d328d2f116501a495f7981376a8d3f.jpg`}, templateButtons: buttonsDefault, footer: `©${namaowner}` , mentions: [sender]} )
895 | // fdz.send5ButImg(yoi, txt, fdz.user.name, fatihgans, btn)
896 | }
897 | m.reply('Sukses Broadcast')
898 | }
899 | break
900 |
901 | case prefix + 'listgc': {
902 | let anu = await store.chats.all().filter(v => v.id.endsWith('@g.us')).map(v => v.id)
903 | let teks = `⬣ *LIST GROUP CHAT*\n\nTotal Group : ${anu.length} Group\n\n`
904 | for (let i of anu) {
905 | let metadata = await fdz.groupMetadata(i)
906 | teks += `⬡ *Nama :* ${metadata.subject}\n⬡ *Owner :* ${metadata.owner !== undefined ? '@' + metadata.owner.split`@`[0] : 'Tidak diketahui'}\n⬡ *ID :* ${metadata.id}\n⬡ *Dibuat :* ${moment(metadata.creation * 1000).tz('Asia/Jakarta').format('DD/MM/YYYY HH:mm:ss')}\n⬡ *Member :* ${metadata.participants.length}\n\n────────────────────────\n\n`
907 | }
908 | fdz.sendMessage(m.chat, {text: teks,mentions: []}, {quoted: m })
909 |
910 |
911 |
912 |
913 | }
914 | break
915 |
916 | case prefix + "leave":
917 | try {
918 | if (!isOwner) return reply(`hanya bisa di gunakan owner `)
919 | if (q) {
920 | await fdz.groupLeave(q)
921 | console.log(color('[Leave GROUP]', 'lime'), color(q, 'cyan'))
922 | } else {
923 | await fdz.groupLeave(from)
924 | console.log(color('[Leave GROUP]', 'lime'), color(from, 'cyan'))
925 | }
926 | } catch (err) {
927 | textImg("Pastikan Link Group Benar Dan Tidak Kadaluarsa!")
928 | }
929 | break
930 |
931 | case prefix + "setppbot":
932 | case prefix + "setpp":
933 |
934 | if (!isOwner) return
935 | if (isImage || isQuotedImage) {
936 | let ppimg = await downloadAndSaveMediaMessage('image', 'ppeehhh.jpeg')
937 | await fdz.updateProfilePicture(botNumber, {
938 | url: 'ppeehhh.jpeg'
939 | })
940 | textImg("Done!")
941 | } else {
942 | textImg(ind.wrongFormat(prefix))
943 | }
944 |
945 | break
946 |
947 | case prefix + 'setprefix':
948 | if (args.length < 1) return
949 | if (!isOwner) return reply(`hanya buat admin`)
950 | try {
951 | prefix = args[0]
952 | setting.prefix = prefix
953 | fs.writeFileSync('./setting.json', JSON.stringify(setting, null, '\t'))
954 | reply(`Prefix berhasil di ubah menjadi : ${prefix}`)
955 | } catch (err) {
956 | textImg(err)
957 | }
958 | break
959 |
960 |
961 |
962 | case prefix + 'backup':
963 | case prefix + 'sesion':
964 | if (!isOwner) return reply(`hanya bisa di gunakan owner untuk backup`)
965 | try {
966 | fdz.sendMessage(sender, {
967 | document: fs.readFileSync(`./${setting.sesion}.json`),
968 | fileName: "session.json",
969 | mimetype: "application/json"
970 | })
971 | } catch (err) {
972 | textImg(err)
973 | }
974 | break
975 |
976 |
977 | case prefix + 'react': {
978 | try {
979 | anu = args.join(' ').split('|')
980 | satu = anu[0] !== '' ? anu[0] : "💖"
981 | const reactionMessage = {
982 | react: {
983 | text: satu,
984 | key: {
985 | remoteJid: m.chat,
986 | fromMe: false,
987 | id: quoted.id
988 | }
989 | }
990 | }
991 | const sendMsg = await fdz.sendMessage(m.chat, reactionMessage)
992 | } catch (err) {
993 | textImg(err)
994 | }
995 | }
996 | break
997 |
998 | //System Menu
999 | case prefix + "del":
1000 | case prefix + "delete":
1001 | case prefix + "hapus":
1002 | if (!isQuotedMsg) return textImg(ind.wrongFormat(prefix))
1003 | if (msg.message.extendedTextMessage.contextInfo.participant = botNumber) {
1004 | fdz.sendMessage(from, {
1005 | delete: {
1006 | remoteJid: from,
1007 | fromMe: true,
1008 | id: msg.message.extendedTextMessage.contextInfo.stanzaId,
1009 | participant: botNumber
1010 | }
1011 | })
1012 |
1013 | } else {
1014 | textImg(ind.wrongFormat(prefix))
1015 | }
1016 |
1017 | break
1018 |
1019 |
1020 | case prefix + "runtime":
1021 | const formater = (seconds) => {
1022 | const pad = (s) => {
1023 | return (s < 10 ? '0' : '') + s
1024 | }
1025 | const hrs = Math.floor(seconds / (60 * 60))
1026 | const mins = Math.floor(seconds % (60 * 60) / 60)
1027 | const secs = Math.floor(seconds % 60)
1028 | return ' ' + pad(hrs) + ':' + pad(mins) + ':' + pad(secs)
1029 | }
1030 | const uptime = process.uptime()
1031 | await textImg(`*── 「 BOT UPTIME 」 ──*\n\n❏${formater(uptime)}`)
1032 | break
1033 |
1034 | //Group Menu
1035 |
1036 | case prefix +'totag': {
1037 | if (!isGroup) return textImg("Perintah Ini Hanya Bisa Digunakan di Group!")
1038 | if (!isGroupAdmins) return textImg("Perintah Ini Hanya Bisa Digunakan Oleh Admin Group!")
1039 | if (!isBotGroupAdmins) return textImg("Jadikan Bot Admin Dahulu!")
1040 | if (quoted.mtype == 'conversation') {
1041 | fdz.sendMessage(m.chat, { text : quoted.text , mentions: participants.map(a => a.id), contextInfo: { forwardingScore: 5, isForwarded: true } }, { quoted: m })
1042 | } else {
1043 | let _msg = JSON.parse(JSON.stringify(quoted.fakeObj.message))
1044 | if (typeof _msg[quoted.mtype].contextInfo !== 'object') _msg[quoted.mtype].contextInfo = {}
1045 | if (typeof _msg[quoted.mtype].contextInfo.mentionedJid !== 'array') _msg[quoted.mtype].contextInfo.mentionedJid = participants.map(a => a.id)
1046 | let _pesan = quoted.fakeObj
1047 | _pesan.message = _msg
1048 | fdz.copyNForward(m.chat, _pesan, true)
1049 | }
1050 | }
1051 | break
1052 |
1053 |
1054 |
1055 |
1056 | case prefix + "revoke":
1057 | if (!isGroup) return textImg("Perintah Ini Hanya Bisa Digunakan di Group!")
1058 | if (!isGroupAdmins) return textImg("Perintah Ini Hanya Bisa Digunakan Oleh Admin Group!")
1059 | if (!isBotGroupAdmins) return textImg("Jadikan Bot Admin Dahulu!")
1060 | try {
1061 | const code = await fdz.groupRevokeInvite(from)
1062 | fdz.sendMessage(from, {
1063 | text: "Link Group Telah DiUbah Oleh Admin @" + sender.split('@')[0].split(":")[0],
1064 | contextInfo: {
1065 | mentionedJid: [sender]
1066 | }
1067 | })
1068 | fdz.sendMessage(sender, {
1069 | text: `New Group Link: https://chat.whatsapp.com/${code}`
1070 | }, {
1071 | quoted: msg
1072 | })
1073 |
1074 |
1075 | } catch (err) {
1076 |
1077 | textImg(`${err}`)
1078 |
1079 | }
1080 | break
1081 |
1082 | case prefix + "add":
1083 | if (!isGroup) return textImg("Perintah Ini Hanya Bisa Digunakan di Group!")
1084 | if (!isGroupAdmins) return textImg("Perintah Ini Hanya Bisa Digunakan Oleh Admin Group!")
1085 | if (!isBotGroupAdmins) return textImg("Jadikan Bot Admin Dahulu!")
1086 | let users = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
1087 | await fdz.groupParticipantsUpdate(m.chat, [users], 'add').then((res) => reply(res)).catch((err) => reply(err))
1088 | break
1089 |
1090 |
1091 | case prefix+'linkgrup': case prefix+'link': case prefix+'linkgc':
1092 | if (!isGroup) return reply(mess.OnlyGrup)
1093 | if (!isBotGroupAdmins) return reply(mess.BotAdmin)
1094 | var url = await fdz.groupInviteCode(from).catch(() => reply(mess.error.api))
1095 | url = 'https://chat.whatsapp.com/'+url
1096 | reply(url)
1097 | break
1098 |
1099 | case prefix + "kick": {
1100 | if (!isGroup) return textImg("Perintah Ini Hanya Bisa Digunakan di Group!")
1101 | if (!isGroupAdmins) return textImg("Perintah Ini Hanya Bisa Digunakan Oleh Admin Group!")
1102 | if (!isBotGroupAdmins) return textImg("Jadikan Bot Admin Dahulu!")
1103 | let users = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
1104 | await fdz.groupParticipantsUpdate(m.chat, [users], 'remove').then((res) => reply(res)).catch((err) => reply(err))
1105 | }
1106 | break
1107 |
1108 |
1109 | case prefix + "promote": {
1110 | if (!isGroup) return textImg("Perintah Ini Hanya Bisa Digunakan di Group!")
1111 | if (!isGroupAdmins) return textImg("Perintah Ini Hanya Bisa Digunakan Oleh Admin Group!")
1112 | if (!isBotGroupAdmins) return textImg("Jadikan Bot Admin Dahulu!")
1113 | let users = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
1114 | await fdz.groupParticipantsUpdate(m.chat, [users], 'promote').then((res) => reply(res)).catch((err) => reply(err))
1115 | }
1116 | break
1117 |
1118 | case prefix + "demote": {
1119 | if (!isGroup) return textImg("Perintah Ini Hanya Bisa Digunakan di Group!")
1120 | if (!isGroupAdmins) return textImg("Perintah Ini Hanya Bisa Digunakan Oleh Admin Group!")
1121 | if (!isBotGroupAdmins) return textImg("Jadikan Bot Admin Dahulu!")
1122 | let users = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
1123 | await fdz.groupParticipantsUpdate(m.chat, [users], 'demote').then((res) => reply(res)).catch((err) => reply(err))
1124 | }
1125 | break
1126 |
1127 |
1128 |
1129 | case prefix + "getpp": {
1130 | if (!isGroup) return textImg("Perintah Ini Hanya Bisa Digunakan di Group!")
1131 | if (!q) return reply("Masukan nomor!")
1132 | let users = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
1133 | reply(`sedang dalam proses`)
1134 | if (users.length > 0) {
1135 | await fdz.profilePictureUrl(users, 'image').then(async (pp) => {
1136 | fdz.sendMessage(from, {
1137 | image: await getBuffer(pp)
1138 | }, {
1139 | quoted: msg
1140 | })
1141 | }).catch(_ => {
1142 | reply("No Profile")
1143 | })
1144 | }
1145 | }
1146 | break;
1147 |
1148 | case prefix + "leave":
1149 | if (!isGroup) return textImg("Perintah Ini Hanya Bisa Digunakan di Group!")
1150 | if (!isGroupAdmins) return textImg("Perintah Ini Hanya Bisa Digunakan Oleh Admin Group!")
1151 | try {
1152 | fdz.groupLeave(from)
1153 | } catch (err) {
1154 | fdz.groupLeave(from)
1155 |
1156 | }
1157 | break
1158 |
1159 | case prefix + 'listadmin':
1160 | if (!isGroup) return reply(mess.only.group)
1161 | let numberAdmin = [];
1162 | var teks = `*List admin of group*\n*${groupMetadata.subject}*\n*Total* : ${groupAdmins.length}\n\n`;
1163 | for (let adm of groupMembers) {
1164 | if (adm.admin !== null) {
1165 | numberAdmin.push(adm.id);
1166 | teks += `*[${numberAdmin.length}]* @${adm.id.split("@")[0]}\n`;
1167 | }
1168 | }
1169 | await fdz.sendMessage(from, {
1170 | text: teks,
1171 | mentions: numberAdmin
1172 | }, {
1173 | quoted: m
1174 | });
1175 | break
1176 |
1177 | case prefix + "group":
1178 | if (!isGroup) return textImg("Perintah Ini Hanya Bisa Digunakan di Group!")
1179 | if (!isGroupAdmins) return textImg("Perintah Ini Hanya Bisa Digunakan Oleh Admin Group!")
1180 | if (!isBotGroupAdmins) return textImg("Jadikan Bot Admin Dahulu!")
1181 | if (q === "open") {
1182 | await fdz.groupSettingUpdate(from, 'not_announcement')
1183 | textImg("*Group Dibuka Oleh Admin:* " + pushName)
1184 |
1185 | } else if (q === "close") {
1186 | await fdz.groupSettingUpdate(from, 'announcement')
1187 | textImg("*Group Ditutup Oleh Admin:* " + pushName)
1188 |
1189 | } else {
1190 |
1191 | textImg(ind.wrongFormat(prefix))
1192 | }
1193 | break
1194 |
1195 |
1196 | case prefix + 'hidetag':
1197 | if (!isGroup) return textImg(ind.groupOnly())
1198 | // if (isGroupAdmins || isOwner) {
1199 | fdz.sendMessage(from, {
1200 | text: q ? q : '',
1201 | mentions: groupMembers.map(a => a.id)
1202 | })
1203 | /* } else {
1204 | textImg(ind.adminsOnly())
1205 | }
1206 | */
1207 | break
1208 |
1209 | // Anime Menu
1210 | case prefix + "anime":
1211 | if (!q) return textImg(ind.wrongFormat(prefix))
1212 | await replylink(ind.wait(), "Anime", `~> Request By ${pushName}`, msg)
1213 | try {
1214 | const getanime = await hxz.otakudesu(q)
1215 | let c = `┌──「 *A N I M E* 」
1216 | => *Judul:* ${getanime.jepang}
1217 | => *Rate:* ${getanime.rate}
1218 | => *Producer:* ${getanime.producer}
1219 | => *Status:* ${getanime.status}
1220 | => *Last Eps:* ${getanime.episode}
1221 | => *Release:* ${getanime.rilis}
1222 | => *Studio:* ${getanime.studio}
1223 | => *Genre:* ${getanime.genre}
1224 |
1225 | => *Description:* ${getanime.desc}
1226 | `
1227 | sendFileFromUrl(from, getanime.img, c)
1228 | } catch (err) {
1229 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1230 | }
1231 |
1232 | break
1233 |
1234 | case prefix + "manga":
1235 | if (!q) return textImg(ind.wrongFormat(prefix))
1236 | await replylink(ind.wait(), "Manga", `~> Request By ${pushName}`, msg)
1237 | try {
1238 | const getmanga = await xfar.Manga(q)
1239 | let hajdhsdjask = `「 *M A N G A* 」\n\n`
1240 |
1241 | for (audhjd of getmanga) {
1242 | hajdhsdjask += `*Judul:* ${audhjd.judul}\n`
1243 | hajdhsdjask += `*Link:* ${audhjd.link}\n\n`
1244 | }
1245 |
1246 | sendFileFromUrl(from, getmanga[0].thumbnail, hajdhsdjask)
1247 | } catch (err) {
1248 |
1249 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1250 | }
1251 |
1252 |
1253 | break
1254 |
1255 |
1256 | case prefix + "character":
1257 | case prefix + "chara":
1258 | case prefix + "char":
1259 |
1260 | if (!q) return textImg(ind.wrongFormat(prefix))
1261 | await replylink(ind.wait(), "Character", `~> Request By ${pushName}`, msg)
1262 | try {
1263 | const getchar = await hxz.chara(q)
1264 | for (let i = 0; i < 3; i++) {
1265 | sendFileFromUrl(from, getchar[i], `*${q}*`)
1266 | }
1267 | } catch (err) {
1268 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1269 | }
1270 | break
1271 |
1272 | case prefix + "waifu":
1273 | await replylink(ind.wait(), "Waifu", `~> Request By ${pushName}`, msg)
1274 | try {
1275 | const {
1276 | data
1277 | } = await axios.get("https://api.waifu.im/random/?selected_tags=waifu")
1278 | sendFileFromUrl(from, data.images[0].url, data.images[0].tags[0].description)
1279 | } catch (err) {
1280 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1281 | }
1282 | break
1283 |
1284 | //Search Menu
1285 | case prefix + "film":
1286 | case prefix + "movie":
1287 | if (!q) return textImg(ind.wrongFormat(prefix))
1288 | await replylink(ind.wait(), "Movie", `~> Request By ${pushName}`, msg)
1289 | try {
1290 | const getfilm = await xfar.Film(q)
1291 | let ahgsdash = `「 *M O V I E* 」\n\n`
1292 |
1293 | for (audhjd of getfilm) {
1294 | ahgsdash += `*Judul:* ${audhjd.judul}\n`
1295 | ahgsdash += `*Quality:* ${audhjd.quality}\n`
1296 | ahgsdash += `*Type:* ${audhjd.type}\n`
1297 | ahgsdash += `*Date:* ${audhjd.upload}\n`
1298 | ahgsdash += `*Link:* ${audhjd.link}\n\n`
1299 | }
1300 | sendFileFromUrl(from, getfilm[0].thumb, ahgsdash)
1301 | } catch (err) {
1302 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1303 | }
1304 | break
1305 |
1306 | case prefix + "lirik":
1307 | case prefix + "lyrics":
1308 | case prefix + "lyric":
1309 | if (!q) return textImg(ind.wrongFormat(prefix))
1310 | await replylink(ind.wait(), "Lyrics", `~> Request By ${pushName}`, msg)
1311 | try {
1312 | const {
1313 | data
1314 | } = await axios.get("https://www.lyricsfreak.com/search.php?a=search&q=" + q)
1315 | let $ = cheerio.load(data)
1316 | let h1 = $('.song');
1317 | const hh = h1.attr('href')
1318 | const huu = await axios.get('https://www.lyricsfreak.com' + hh)
1319 | let s = cheerio.load(huu.data)
1320 | let h2 = s('.lyrictxt').text();
1321 | textImg(`「 *L I R I K* 」\n\n${h2}`)
1322 | } catch (err) {
1323 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1324 | }
1325 | break
1326 | case prefix + "wattpad":
1327 | if (!q) return textImg(ind.wrongFormat(prefix))
1328 | await replylink(ind.wait(), "Wattpad", `~> Request By ${pushName}`, msg)
1329 | try {
1330 | const getwp = await xfar.Wattpad(q)
1331 | let hajdhsdjasks = `「 *WATTPAD* 」\n\n`
1332 | for (audhjds of getwp) {
1333 | hajdhsdjasks += `*Judul:* ${audhjds.judul}\n`
1334 | hajdhsdjasks += `*Read:* ${audhjds.dibaca}\n`
1335 | hajdhsdjasks += `*Rating:* ${audhjds.divote}\n`
1336 | hajdhsdjasks += `*Link:* ${audhjds.url}\n`
1337 | hajdhsdjasks += `*Desc:* ${audhjds.description}\n\n`
1338 | }
1339 | sendFileFromUrl(from, getwp[0].thumb, hajdhsdjasks)
1340 | } catch (err) {
1341 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1342 | }
1343 | break
1344 |
1345 |
1346 | case prefix + "webtoon":
1347 | case prefix + "webtoons":
1348 | if (!q) return textImg(ind.wrongFormat(prefix))
1349 | await replylink(ind.wait(), "Webtoon", `~> Request By ${pushName}`, msg)
1350 | try {
1351 | const getwt = await xfar.Webtoons(q)
1352 | let hajdhsdjaskp = `「 *WEBTOON* 」\n\n`
1353 | for (audhjds of getwt) {
1354 | hajdhsdjaskp += `*Judul:* ${audhjds.judul}\n`
1355 | hajdhsdjaskp += `*like:* ${audhjds.like}\n`
1356 | hajdhsdjaskp += `*Creator:* ${audhjds.creator}\n`
1357 | hajdhsdjaskp += `*Genre:* ${audhjds.genre}\n`
1358 | hajdhsdjaskp += `*Link:* ${audhjds.url}\n\n`
1359 | }
1360 | textImg(hajdhsdjaskp)
1361 | } catch (err) {
1362 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1363 | }
1364 | break
1365 |
1366 | case prefix + "drakor":
1367 | if (!q) return textImg(ind.wrongFormat(prefix))
1368 | await replylink(ind.wait(), "Drakor", `~> Request By ${pushName}`, msg)
1369 | try {
1370 | const getdr = await xfar.Drakor(q)
1371 | let hajdhsdjaska = `「 *DRAKOR* 」\n\n`
1372 | for (audhjds of getdr) {
1373 | hajdhsdjaska += `*Judul:* ${audhjds.judul}\n`
1374 | hajdhsdjaska += `*Tahun:* ${audhjds.years}\n`
1375 | hajdhsdjaska += `*Genre:* ${audhjds.genre}\n`
1376 | hajdhsdjaska += `*Link:* ${audhjds.url}\n\n`
1377 | }
1378 | sendFileFromUrl(from, getdr[0].thumbnail, hajdhsdjaska)
1379 | } catch (err) {
1380 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1381 | }
1382 | break
1383 |
1384 |
1385 | case prefix + "pinterest":
1386 | if (!q) return textImg(ind.wrongFormat(prefix))
1387 | await replylink(ind.wait(), "Pinterest", `~> Request By ${pushName}`, msg)
1388 | try {
1389 | const pin = await pinterest(q)
1390 | let pilih = await Math.floor(Math.random() * pin.length)
1391 | let cap = await short(pin[pilih])
1392 | sendFileFromUrl(from, pin[pilih], cap)
1393 | } catch (err) {
1394 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1395 | }
1396 | break
1397 |
1398 | case prefix + "gcsearch":
1399 | if (!q) return textImg(ind.wrongFormat(prefix))
1400 | await replylink(ind.wait(), "Gc Search", `~> Request By ${pushName}`, msg)
1401 | try {
1402 | if (!isGroup) {
1403 | let getgc = await hxz.linkwa(q)
1404 | let fgashghfgasjfn = `┌──「 *G R O U P* 」\n│\n`
1405 |
1406 | for (sjka of getgc) {
1407 | fgashghfgasjfn += `├「*${sjka.nama} 」\n`
1408 | fgashghfgasjfn += `├「${sjka.link} 」\n│\n`
1409 | }
1410 | textImg(fgashghfgasjfn)
1411 | } else {
1412 | textImg("Result akan dikirim ke private chat untuk menghindari antilink")
1413 | let getgc = await hxz.linkwa(q)
1414 | let fgashghfgasjfn = `┌──「 *G R O U P* 」\n│\n`
1415 | for (sjka of getgc) {
1416 | fgashghfgasjfn += `├「*${sjka.nama} 」\n`
1417 | fgashghfgasjfn += `├「${sjka.link} 」\n│\n`
1418 | }
1419 | fdz.sendMessage(sender, {
1420 | text: fgashghfgasjfn
1421 | }, {
1422 | quoted: msg
1423 | })
1424 | }
1425 | } catch (err) {
1426 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1427 | }
1428 | break
1429 |
1430 | case prefix + "igstalk":
1431 | case prefix + "instagramstalk":
1432 | if (!q) return textImg(ind.wrongFormat(prefix))
1433 | await replylink(ind.wait(), "IG Stalk", `~> Request By ${pushName}`, msg)
1434 | try {
1435 | fetch(`https://ferdiz-afk.my.id/api/ig/stalk?username=${q}`)
1436 | .then((res) => res.json())
1437 | .then((data) => {
1438 | let cap = `⭔ Username : ${q}\n`
1439 | cap += `⭔ Nickname : ${data.data.fullname}\n`
1440 | cap += `⭔ Followers : ${data.data.followers}\n`
1441 | cap += `⭔ Following : ${data.data.following}\n`
1442 | // cap += `⭔ Bussines : ${data.data.}\n`
1443 | cap += `⭔ Profesional : ${data.data.professional_account}\n`
1444 | cap += `⭔ Verified : ${data.data.verified_user}\n`
1445 | cap += `⭔ Private : ${data.data.private_user}\n`
1446 | cap += `⭔ Bio :\n${data.data.bio}\n`
1447 | cap += `⭔ Url : ${data.data.external_url}\n`
1448 | sendFileFromUrl(from, data.data.picturl, cap)
1449 | });
1450 |
1451 | } catch (err) {
1452 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1453 | }
1454 | break
1455 |
1456 | // Media Menu
1457 | case prefix + "toimg":
1458 | if (!isQuotedSticker) return textImg(ind.wrongFormat(prefix))
1459 | await replylink(ind.wait(), "Sticker To Image", `~> Request By ${pushName}`, msg)
1460 | let rand = await Math.floor(Math.random() * 7613786)
1461 | var rand1 = rand + '.webp'
1462 | let buffer = await downloadAndSaveMediaMessage("sticker", "./" + rand1)
1463 |
1464 | var rand2 = rand + '.png'
1465 | fs.writeFileSync(`./${rand1}`, buffer)
1466 | if (isQuotedSticker && msg.message.extendedTextMessage.contextInfo.quotedMessage.stickerMessage.isAnimated !== true) {
1467 | exec(`ffmpeg -i ./${rand1} ./${rand2}`, (err) => {
1468 | fs.unlinkSync(`./${rand1}`)
1469 | if (err) return textImg(err)
1470 | fdz.sendMessage(from, {
1471 | image: fs.readFileSync(`${rand2}`)
1472 | }, {
1473 | quoted: msg
1474 | })
1475 |
1476 | fs.unlinkSync(`${rand2}`)
1477 | })
1478 | } else {
1479 |
1480 | /*
1481 | webp2mp4File(`./${rand1}`).then( data => {
1482 | fs.unlinkSync(`./${rand1}`)
1483 | fdz.sendMessage(from, { video: { url: data.result }}, { quoted: msg })
1484 |
1485 | })*/
1486 | }
1487 | break
1488 |
1489 | case prefix + 'tomp4':
1490 | case prefix + 'tovideo': {
1491 | if (!quoted) throw m.reply('Reply Image')
1492 | if (!/webp/.test(mime)) throw m.reply(`balas stiker dengan caption *${command}*`)
1493 | await replylink(ind.wait(), "tomp4", `~> Request By ${pushName}`, msg)
1494 | let {
1495 | webp2mp4File
1496 | } = require('../lib/uploader')
1497 | let media = await fdz.downloadAndSaveMediaMessage(quoted)
1498 | let webpToMp4 = await webp2mp4File(media)
1499 | await fdz.sendMessage(m.chat, {
1500 | video: {
1501 | url: webpToMp4.result,
1502 | caption: 'Convert Webp To Video'
1503 | }
1504 | }, {
1505 | quoted: m
1506 | })
1507 | await fs.unlinkSync(media)
1508 | }
1509 | break
1510 |
1511 |
1512 |
1513 |
1514 | case prefix + 'sticker':
1515 | case prefix + 's':
1516 | case prefix + 'stickergif':
1517 | case prefix + 'sgif': {
1518 |
1519 | if (!quoted) throw m.reply(`Balas Video/Image Dengan Caption ${prefix + command}`)
1520 | // m.reply(mess.wait)
1521 |
1522 | anu = args.join(' ').split('|')
1523 | satu = anu[0] !== '' ? anu[0] : stickerInfo.pack
1524 | dua = typeof anu[1] !== 'undefined' ? anu[1] : stickerInfo.author
1525 |
1526 | if (/image/.test(mime)) {
1527 | await replylink(ind.wait(), "Sticker image", `~> Request By ${pushName}`, msg)
1528 | let media = await quoted.download()
1529 | let encmedia = await fdz.sendImageAsSticker(m.chat, media, m, {
1530 | packname: satu,
1531 | author: dua
1532 | })
1533 | await fs.unlinkSync(encmedia)
1534 | } else if (/video/.test(mime)) {
1535 | await replylink(ind.wait(), "Sticker gif", `~> Request By ${pushName}`, msg)
1536 | if ((quoted.msg || quoted).seconds > 11) return m.reply('Maksimal 10 detik!')
1537 | let media = await quoted.download()
1538 | let encmedia = await fdz.sendVideoAsSticker(m.chat, media, m, {
1539 | packname: satu,
1540 | author: dua
1541 | })
1542 | await fs.unlinkSync(encmedia)
1543 | } else {
1544 | throw m.reply(`Kirim Gambar/Video Dengan Caption ${prefix + command}\nDurasi Video 1-9 Detik`)
1545 | }
1546 | }
1547 | break
1548 |
1549 |
1550 |
1551 | case prefix + "ocr":
1552 | try {
1553 | if (isImage) {
1554 | await replylink(ind.wait(), "OCR", `~> Request By ${pushName}`, msg)
1555 | let media = await downloadAndSaveMediaMessage("image", "temp/ocr.png")
1556 | const asjfhasjkfhasji = await tesseract
1557 | .recognize(media, configocr)
1558 |
1559 | textImg(asjfhasjkfhasji)
1560 | } else if (isQuotedImage) {
1561 | await replylink(ind.wait(), "OCR", `~> Request By ${pushName}`, msg)
1562 | let media = await downloadAndSaveMediaMessage("image", "temp/ocr.png")
1563 | const asjfhasjkfhasjia = await tesseract
1564 | .recognize(media, configocr)
1565 | textImg(asjfhasjkfhasjia)
1566 | }
1567 | } catch (err) {
1568 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1569 |
1570 |
1571 | }
1572 | break
1573 | //Maker Menu
1574 | case prefix + "carbon":
1575 | case prefix + "code":
1576 | // if (!q) return textImg(ind.wrongFormat(prefix))
1577 | await replylink(ind.wait(), "Carbon Now-Sh", `~> Request By ${pushName}`, msg)
1578 | try {
1579 | tex = m.quoted ? m.quoted.text ? m.quoted.text : q ? q : m.text : q ? q : m.text
1580 | const carbon = new Carbon.createCarbon()
1581 | .setCode(tex).setBackgroundColor('#1b3648')
1582 | const bufferr = await Carbon.generateCarbon(carbon)
1583 | fdz.sendMessage(from, {
1584 | image: bufferr
1585 | }, {
1586 | quoted: msg
1587 | })
1588 | } catch (err) {
1589 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1590 | }
1591 | break
1592 |
1593 | //CASE MODIFIKASI ARDA
1594 | //CASE PERTAMAKALINYA MAKER GET BUFFER
1595 | case prefix + 'ktpmaker':
1596 | if (!q) return reply(`*Pengunaan :*\n${command} Nik| Provinsi| Kabupaten |Nama |TempatTanggalLahir |JenisKel |Alamat |RtRw |KelDesa |Kecamatan |Agama |Status |Pekerjaan |Region |Berlaku |golongan darah |LinkGambar\n\n${command} 6287877173955 |Provinsi Jawa Barat |Kabupaten Bekasi |Arda Store |Bekasi |Laki-Laki |Bintara Jaya |02/05 |Karang Indah |Bekasi Barat |Islam |Jomblo |Ngoding |Indonesia |2021-2080 |abc |https://i.ibb.co/qrQX5DC/IMG-20220401-WA0084.jpg\n\n\n*「 INFO IMAGE 」*\nUntuk Gambar Profil KTP\nUpload Dari Web Berikut Ini\n\nhttps://i.waifu.pics\nhttps://c.top4top.io\n\nCONTOH HASIL NYA\nhttps://i.ibb.co/qrQX5DC/IMG-20220401-WA0084.jpg\nhttps://k.top4top.io/p_2208264hn0.jpg`)
1597 | //if (isLimit(senderNumber, isPremium, isOwner, limitCount, user)) return setReply(mess.limit)
1598 | get_args = args.join(" ").split("|")
1599 | nik = get_args[0]
1600 | prov = get_args[1]
1601 | kabu = get_args[2]
1602 | name = get_args[3]
1603 | ttl = get_args[4]
1604 | jk = get_args[5]
1605 | jl = get_args[6]
1606 | rtrw = get_args[7]
1607 | lurah = get_args[8]
1608 | camat = get_args[9]
1609 | agama = get_args[10]
1610 | nikah = get_args[11]
1611 | kerja = get_args[12]
1612 | warga = get_args[13]
1613 | until = get_args[14]
1614 | gd = get_args[15]
1615 | img = get_args[16]
1616 | await replylink(ind.wait(), "ktpmaker", `~> Request By ${pushName}`, msg)
1617 | bikin = (`https://ferdiz-afk.my.id/api/Fmake/ktpmaker?nik=${nik}&nama=${name}&ttl=${ttl}&jk=${jk}&gd=${gd}&almt=${jl}&rtw=${rtrw}&kel=${lurah}&kc=${camat}&agm=${agama}&st=${nikah}&krj=${kerja}&ngr=${warga}&blk=${until}&prv=${prov}&kab=${kabu}&picturl=${img}`)
1618 | console.log(bikin)
1619 | ardaktp = await getBuffer(bikin)
1620 | await fdz.sendMessage(from, {
1621 | image: ardaktp,
1622 | caption: `done kak`
1623 | }, {
1624 | quoted: m
1625 | })
1626 | await sleep(5000)
1627 | break;
1628 |
1629 |
1630 | case prefix +'nulis': {
1631 | if (args.length < 1) return reply(`*Usage*: ${command} nama&kelas&nomo&kata\n*Example*: ${command} udin&20&17&blablabla`)
1632 | var bodi = args.join(" ")
1633 | var nama = bodi.split("&")[0];
1634 | var kelas = bodi.split("&")[1];
1635 | var no = bodi.split("&")[2];
1636 | var aksarane = bodi.split("&")[3];
1637 | await replylink(ind.wait(), "nulis", `~> Request By ${pushName}`, msg)
1638 | rakz = await getBuffer(`https://ferdiz-afk.my.id/api/Fmake/nulis?nama=${nama}&no=${no}&kelas=${kelas}&text=${aksarane}`)
1639 | await fdz.sendMessage(from, {
1640 | image: rakz,
1641 | caption: `done kak`
1642 | }, {
1643 | quoted: m
1644 | })
1645 | }
1646 | break;
1647 |
1648 | case prefix +"sertiff1": {
1649 | if (args.length < 1) return reply(`*Example*: ${command} udin`)
1650 | pll = body.slice(10);
1651 | await replylink(ind.wait(), "sertiff1", `~> Request By ${pushName}`, msg)
1652 | rakz = await getBuffer(`https://ferdiz-afk.my.id/api/Fmake/sertiff?text=${pll}&text2=Garena%20ep%20ep`)
1653 | await fdz.sendMessage(from, {
1654 | image: rakz,
1655 | caption: `done kak`
1656 | }, {
1657 | quoted: m
1658 | })
1659 | }
1660 | break
1661 |
1662 |
1663 |
1664 | // Downloader Menu
1665 | /*
1666 | case prefix + "tiktok":
1667 | case prefix + "tik":
1668 | case prefix + "tt":
1669 | case prefix + "ttdl":
1670 | if (!q) return textImg(ind.wrongFormat(prefix))
1671 | if (!isUrl) return textImg(ind.noUrl())
1672 | await replylink(ind.wait(), "Tiktok", `~> Request By ${pushName}`, msg)
1673 | try {
1674 | const gettt = await hxz.ttdownloader(q)
1675 | console.log(gettt)
1676 | sendFileFromUrl(from, gettt.nowm, `*Request By:* ${pushName}`, msg)
1677 | } catch (err) {
1678 | console.log(err)
1679 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1680 | }
1681 | break
1682 |
1683 | case prefix + "ytmp3":
1684 | case prefix + "mp3":
1685 | if (!q) return textImg(ind.wrongFormat(prefix))
1686 | if (!isUrl) return textImg(ind.noUrl())
1687 | await replylink(ind.wait(), "Youtube Mp3", `~> Request By ${pushName}`, msg)
1688 | try {
1689 | const getmp3 = await xfar.Youtube(q)
1690 | let sifugtgfrasdjkfhsdj = `┌──「 *YTMP3* 」
1691 | │
1692 | ├ *Title:* ${getmp3.title}
1693 | ├ *Duration:* ${getmp3.duration}
1694 | ├ *Size:* ${getmp3.medias[7].formattedSize}
1695 | │
1696 | └──「 *I C Z A* 」`
1697 |
1698 | sendFileFromUrl(from, getmp3.thumbnail, sifugtgfrasdjkfhsdj, msg)
1699 | sendFileFromUrl(from, getmp3.medias[7].url, sifugtgfrasdjkfhsdj, msg)
1700 | } catch (err) {
1701 |
1702 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1703 | }
1704 | break
1705 |
1706 |
1707 | case prefix + "ytmp4":
1708 | case prefix + "mp4":
1709 | if (!q) return textImg(ind.wrongFormat(prefix))
1710 | if (!isUrl) return textImg(ind.noUrl())
1711 | await replylink(ind.wait(), "Youtube Mp4", `~> Request By ${pushName}`, msg)
1712 | try {
1713 | const getmp4 = await xfar.Youtube(q)
1714 | let asjdghfashgfashgf = `┌──「 *YTMP4* 」
1715 | │
1716 | ├ *Title:* ${getmp4.title}
1717 | ├ *Duration:* ${getmp4.duration}
1718 | ├ *Size:* ${getmp4.medias[1].formattedSize}
1719 | │
1720 | └──「 *I C Z A* 」`
1721 | sendFileFromUrl(from, getmp4.thumbnail, asjdghfashgfashgf, msg)
1722 | sendFileFromUrl(from, getmp4.medias[1].url, asjdghfashgfashgf, msg)
1723 | } catch (err) {
1724 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1725 | }
1726 | break
1727 |
1728 | case prefix + "yts":
1729 | case prefix + "ytsearch":
1730 | if (!q) return textImg(ind.wrongFormat(prefix))
1731 | await replylink(ind.wait(), "Youtube Search", `~> Request By ${pushName}`, msg)
1732 | try {
1733 | const getyts = await yts(q)
1734 | let afhasuyduytsduyt = `┌──「 *YT SEARCH* 」\n│\n`
1735 |
1736 | for (i of getyts.all) {
1737 | afhasuyduytsduyt += `├ *Title:* ${i.title}\n`
1738 | afhasuyduytsduyt += `├ *Url* ${i.url}\n│\n`
1739 | }
1740 | afhasuyduytsduyt += "└──「 *I C Z A* 」"
1741 | sendFileFromUrl(from, getyts.all[0].image, afhasuyduytsduyt)
1742 | } catch (err) {
1743 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1744 | }
1745 | break
1746 |
1747 | case prefix + "play":
1748 | case prefix + "ytplay":
1749 | if (!q) return textImg(ind.wrongFormat(prefix))
1750 | await replylink(ind.wait(), "Youtube Play", `~> Request By ${pushName}`, msg)
1751 | try {
1752 | const waitget = await yts(q)
1753 | const getplay = await xfar.Youtube(waitget.all[0].url)
1754 | let ashgasfgashfash = `┌──「 *PLAY* 」
1755 | │
1756 | ├ *Title:* ${getplay.title}
1757 | ├ *Duration:* ${getplay.duration}
1758 | ├ *Size:* ${getplay.medias[7].formattedSize}
1759 | │
1760 | └──「 *I C Z A* 」`
1761 |
1762 | sendFileFromUrl(from, getplay.thumbnail, ashgasfgashfash, msg)
1763 | sendFileFromUrl(from, getplay.medias[7].url, ashgasfgashfash, msg)
1764 | } catch (err) {
1765 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1766 | }
1767 |
1768 | break
1769 |
1770 | case prefix + "fb":
1771 | case prefix + "facebook":
1772 | if (!q) return textImg(ind.wrongFormat(prefix))
1773 | if (!isUrl) return textImg(ind.noUrl())
1774 | await replylink(ind.wait(), "Facebook", `~> Request By ${pushName}`, msg)
1775 | try {
1776 | const getfb = await xfar.Facebook(q)
1777 | let abdvhjasdashjh = `── 「 *FACEBOOK* 」 ──
1778 | *Title:* ${getfb.title}
1779 | *Type:* ${getfb.medias[0].extension}
1780 | *Quality:* ${getfb.medias[0].quality}`
1781 | sendFileFromUrl(from, getfb.medias[0].url, abdvhjasdashjh, msg)
1782 | } catch (err) {
1783 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1784 | }
1785 | break
1786 |
1787 | case prefix + "twitter":
1788 | case prefix + "twiter":
1789 | case prefix + "twt":
1790 | if (!q) return textImg(ind.wrongFormat(prefix))
1791 | if (!isUrl) return textImg(ind.noUrl())
1792 | await replylink(ind.wait(), "Twitter", `~> Request By ${pushName}`, msg)
1793 | try {
1794 | const gettwt = await xfar.Twitter(q)
1795 | sendFileFromUrl(from, gettwt.medias[1].url, txt, msg)
1796 | } catch (err) {
1797 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1798 | }
1799 | break
1800 |
1801 |
1802 | case prefix + "ig":
1803 | case prefix + "igdl":
1804 | case prefix + "instagram":
1805 | if (!q) return textImg(ind.wrongFormat(prefix))
1806 | if (!isUrl) return textImg(ind.noUrl())
1807 | await replylink(ind.wait(), "Instagram ", `~> Request By ${pushName}`, msg)
1808 | try {
1809 |
1810 | const getig = await hxz.igdl(q)
1811 | let gasdfghasfghasfy = `┌──「 *INSTAGRAM* 」
1812 | ├ *Request By:* ${pushName}
1813 | └──「 *I C Z A* 」`
1814 |
1815 | for (i of getig.medias) {
1816 | if (i.type == 'video') {
1817 | fdz.sendMessage(from, {
1818 | video: {
1819 | url: i.downloadUrl
1820 | },
1821 | caption: gasdfghasfghasfy
1822 | }, {
1823 | quoted: msg
1824 | })
1825 | } else {
1826 | fdz.sendMessage(from, {
1827 | image: {
1828 | url: i.downloadUrl
1829 | },
1830 | caption: gasdfghasfghasfy
1831 | }, {
1832 | quoted: msg
1833 | })
1834 | }
1835 | }
1836 | } catch (err) {
1837 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1838 | }
1839 | break
1840 |
1841 |
1842 | case prefix + "tr":
1843 | case prefix + "translate":
1844 | if (!q) return textImg(ind.wrongFormat(prefix))
1845 | await replylink(ind.wait(), "Translate", `~> Request By ${pushName}`, msg)
1846 | try {
1847 | const trs = await translate(q.slice(2), {
1848 | to: q.split(" ")[0]
1849 | })
1850 | textImg(trs)
1851 | } catch (err) {
1852 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1853 | }
1854 |
1855 | break
1856 | */
1857 |
1858 | case prefix + "gempa":
1859 | await replylink(ind.wait(), "BMKG Gempa", `~> Request By ${pushName}`, msg)
1860 | try {
1861 | const {
1862 | data
1863 | } = await axios.get("https://data.bmkg.go.id/DataMKG/TEWS/autogempa.json")
1864 | let asbnfvashfgyjas = `┌──「 *G E M P A* 」
1865 | │
1866 | ├ *TimeStamp:* ${data.Infogempa.gempa.Tanggal}
1867 | ├ *Time:* ${data.Infogempa.gempa.Jam}
1868 | ├ *Coordinates:* ${data.Infogempa.gempa.Coordinates}
1869 | ├ *Magnitude:* ${data.Infogempa.gempa.Magnitude}
1870 | ├ *Depth:* ${data.Infogempa.gempa.Kedalaman}
1871 | ├ *Region:* ${data.Infogempa.gempa.Wilayah}
1872 | ├ *Potention:* ${data.Infogempa.gempa.Potensi}
1873 | ├ *Effect:* ${data.Infogempa.gempa.Dirasakan}
1874 | │
1875 | └──「 *I C Z A* 」 `
1876 | sendFileFromUrl(from, "https://data.bmkg.go.id/DataMKG/TEWS/" + data.Infogempa.gempa.Shakemap, asbnfvashfgyjas)
1877 | } catch (err) {
1878 | textImg(ind.err(budy.split(" ")[0].split(prefix)[1], err))
1879 | }
1880 | break
1881 |
1882 | default:
1883 |
1884 | //----------------------------------------------------------------------------------------------------
1885 | }
1886 |
1887 |
1888 |
1889 | } catch (err) {
1890 | console.log(color('[ERR]', 'red'), color(err, 'cyan'))
1891 | // console.log(color('[ERR]', 'red'), color(JSON.stringify(err, undefined, 2), 'cyan'))
1892 | }
1893 | }
1894 |
1895 |
1896 | // Milik Bersama ©CAF FERDIZ leon
--------------------------------------------------------------------------------
/message/ind.js:
--------------------------------------------------------------------------------
1 | const moment = require("moment-timezone");
2 | const fs = require("fs");
3 | moment.tz.setDefault("Asia/Jakarta").locale("id");
4 | let dt = moment(Date.now()).tz('Asia/Jakarta').locale('id').format('a')
5 | const ucapanWaktu = "Selamat "+dt.charAt(0).toUpperCase() + dt.slice(1)
6 |
7 | const more = String.fromCharCode(8206)
8 | const readmore = more.repeat(4001)
9 |
10 | function toCommas(x) {
11 | x = x.toString()
12 | var pattern = /(-?\d+)(\d{3})/;
13 | while (pattern.test(x))
14 | x = x.replace(pattern, "$1,$2");
15 | return x;
16 | }
17 |
18 |
19 |
20 |
21 |
22 |
23 | exports.allmenu = (sender, prefix, pushname, isOwner) => {
24 |
25 | return `*── 「 - MD Beta 」 ──*
26 |
27 | _*${ucapanWaktu} ${pushname !== undefined ? pushname : 'Kak'}*_
28 |
29 | Library : *Baileys-MD*.
30 | Prefix : ( ${prefix} )
31 | Tanggal Server : ${moment.tz('Asia/Jakarta').format('DD/MM/YY')}
32 | Waktu Server : ${moment.tz('Asia/Jakarta').format('HH:mm:ss')}
33 |
34 | Note : Anggap _<>_ *Tidak Ada*
35 |
36 | _Ada Bug? Ketik ${prefix}report Bug mu_
37 | ${readmore}
38 | *( 📍 ) Main Menu*
39 | || ${prefix}afk
40 | || ${prefix}menu
41 | || ${prefix}owner
42 | || ${prefix}rules
43 | || ${prefix}donasi
44 | || ${prefix}creator
45 | || ${prefix}ulangi
46 | || ${prefix}owner
47 | || ${prefix}react default 💖
48 | || ${prefix}delete
49 |
50 | *( ✏️ ) Converter/Tools*
51 | || ${prefix}sticker
52 | || ${prefix}toimg
53 | || ${prefix}tomp4
54 |
55 | *( ⌛ ) Downloader*
56 |
57 | *( ♻️ ) Random Menu*
58 |
59 | *( 📛 ) Nsfw User Free*
60 |
61 | *( ⚠️ ) Premium User*
62 |
63 | *( 🎨 ) Menu Maker*
64 | || ${prefix}carbon
65 | || ${prefix}sertiff1
66 |
67 | *( 🍻 ) Maker From Image*
68 | || ${prefix}ktpmaker
69 |
70 |
71 | *( 🪀 ) Menu Lain Nya*
72 | || ${prefix}igstalk
73 | || ${prefix}gempa
74 | *( ☪️ ) Islamic Menu*
75 |
76 | *( ✍️ ) Menu Tulis*
77 | || ${prefix}nulis
78 |
79 | *( 🔎 ) Search Menu*
80 |
81 | *( 🎮 ) Game & Fun Menu*
82 |
83 | *( 🏦 ) Payment & Bank*
84 |
85 | *( 👥 ) Group Menu*
86 | || ${prefix}kick <@tag>
87 | || ${prefix}add [ _number_ ]//<@tag>
88 | || ${prefix}promote <@tag>
89 | || ${prefix}demote <@tag>
90 | || ${prefix}getpp <@tag>
91 | || ${prefix}revoke
92 | || ${prefix}linkgc
93 | || ${prefix}listadmin
94 | || ${prefix}hidetag
95 | || ${prefix}totag
96 | || ${prefix}group [ open/close ]
97 |
98 | *( 🧑🏻💻 ) Owner Menu*
99 | || > evalcode
100 | || < evalcode-2
101 | || $ exec
102 | || ${prefix}setppbot
103 | || ${prefix}setprefix
104 | || ${prefix}join [ _link gc_ ]
105 | || ${prefix}leave
106 | || ${prefix}backup
107 | || ${prefix}read
108 |
109 | => [ *THANKS TO* ]
110 |
111 | ✄ *CAF*
112 | ✄ *Fatih*
113 | ✄ *FERDIZ AFK*
114 | ⋗⋗⋗⋗⋗⋗⋗⋗⋗⋗⋗⋗⋗⋗⋗⋗⋗⋗⋗
115 | `
116 | }
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 | exports.wait = () => {
127 | return ("Mohon tunggu sebentar~")
128 | }
129 |
130 | exports.rules = (prefix) => {
131 | return `
132 | *── 「 RULES 」 ──*
133 | 1. Jangan spam bot.
134 | Sanksi: *WARN/SOFT BLOCK*
135 | 2. Jangan telepon bot.
136 | Sanksi: *SOFT BLOCK*
137 | 3. Jangan mengeksploitasi bot.
138 | Sanksi: *PERMANENT BLOCK*
139 | Jika sudah dipahami rules-nya, silakan ketik *${prefix}menu* untuk memulai!
140 |
141 | *Note:* Bot Masih Dalam Program Beta.Jika Bot Tidak Merespon Di Grup Silahkan Gunakan Di Private Chat!
142 | `
143 | }
144 |
145 | exports.wrongFormat = (prefix) => {
146 | return `Format salah ‼️ Silakan cek cara penggunaan di *${prefix}allmenu*.`
147 | }
148 |
149 | exports.rent = () => {
150 | return `*「 S E W A 」*
151 | Sebelum melakukan pembayaran, hubungi dahulu owner https://wa.me/6287877173955
152 |
153 |
154 |
155 | *NOTE:* Untuk Pulsa Akan Dikenakan Tambahan Rp.5.000`
156 | }
157 | exports.donate = () => {
158 | return `┌──「 *D O N A T E* 」
159 | │
160 | ├ Beri Semangat Owner!
161 | │
162 | ├ *Dana:* 6287877173955
163 | ├ *Gopay:* 6287877173955
164 | ├ *Pulsa:* 6287877173955 (+5k)
165 | ├ *saweria:* https://saweria.co/Ferdizafk
166 | ├ *Trakteer:* https://trakteer.id/FERDIZ-AFK/tip
167 | │
168 | └──「 *FERDI Z-AFK* 」 `
169 |
170 | }
171 |
172 |
173 |
174 | exports.getGroupAdmins = function(participants) {
175 | let admins = []
176 | for (let i of participants) {
177 | i.admin !== null ? admins.push(i.id) : ''
178 | }
179 | return admins
180 | }
181 |
182 | exports.groupOnly = function() {
183 | return "Perintah Ini Hanya Bisa Digunakan di Group!"
184 | }
185 |
186 | exports.adminsOnly = function() {
187 | return "Perintah Ini Hanya Bisa Digunakan Admin Group!"
188 | }
189 |
190 | exports.err = (cmd, err) => {
191 | return `Error ${cmd}: ${err}`
192 | }
193 |
194 | exports.noUrl = () => {
195 | return "Input Harus Berupa Url!"
196 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "FDZ-md",
3 | "version": "1.0.0",
4 | "description": "あの日 ⛅",
5 | "main": "index.js",
6 | "type": "commonjs",
7 | "scripts": {
8 | "start": "nodemon index.js"
9 | },
10 | "nodemonConfig": {
11 | "ext": "js,html,sh,py"
12 | },
13 | "keywords": [
14 | "bot",
15 | "bot-whatsaap",
16 | "md",
17 | "baileys-md",
18 | "kitagawa-md",
19 | "marin-bot",
20 | "kitagawa-bot",
21 | "kitagawa-bot-whatsaap"
22 | ],
23 | "author": "FERDIZ-afk",
24 | "license": "ISC",
25 | "dependencies": {
26 | "@adiwajshing/baileys": "^4.1.0",
27 | "@adiwajshing/keyed-db": "^0.2.4",
28 | "axios": "^0.25.0",
29 | "cfonts": "^2.10.1",
30 | "chalk": "^4.1.2",
31 | "cheerio": "^1.0.0-rc.10",
32 | "child_process": "^1.0.2",
33 | "express": "^4.18.0",
34 | "fake-useragent": "^1.0.1",
35 | "figlet": "^1.5.2",
36 | "file-type": "^16.5.3",
37 | "fluent-ffmpeg": "^2.1.2",
38 | "form-data": "^4.0.0",
39 | "fs": "^0.0.1-security",
40 | "got": "^11.8.2",
41 | "human-readable": "^0.2.1",
42 | "hx-api": "^1.3.2",
43 | "jimp": "^0.16.1",
44 | "lolcatjs": "^2.4.1",
45 | "lowdb": "^2.1.0",
46 | "moment": "^2.29.3",
47 | "moment-timezone": "^0.5.34",
48 | "mongoose": "github:Automattic/mongoose",
49 | "node-fetch": "3.0.0-beta.9",
50 | "node-tesseract-ocr": "^2.2.1",
51 | "node-url-shortener": "^2.0.1",
52 | "node-webpmux": "^3.1.1",
53 | "nodemon": "^2.0.15",
54 | "qrcode-terminal": "^0.12.0",
55 | "qs": "^6.10.3",
56 | "random-useragent": "^0.5.0",
57 | "stream": "^0.0.2",
58 | "syntax-error": "^1.4.0",
59 | "tinyurl": "^1.1.7",
60 | "translate-google": "^1.5.0",
61 | "unofficial-carbon-now": "^1.0.6",
62 | "yargs": "^17.4.1"
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/setting.json:
--------------------------------------------------------------------------------
1 | {
2 | "prefix": ".",
3 | "backup": "true",
4 | "namabot": "MARIN_KITAGAWA - MD",
5 | "namaowner": "FERDI Z-AFK",
6 | "sesion": "sesi",
7 | "thumb": "kitagawa-mf.jpg",
8 | "ownerNumber": [
9 | "6287877173955@s.whatsapp.net"
10 | ],
11 | "ownerNumberg": [
12 | "6287877173955"
13 | ],
14 | "stickerInfo": {
15 | "author": "FERDIZ-AFK\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
16 | "pack": "BOT FERDIZ-AFK"
17 | }
18 | }
--------------------------------------------------------------------------------
/temp/hai ini buat samph ya:
--------------------------------------------------------------------------------
1 | >///<
2 |
--------------------------------------------------------------------------------
/temp/ocr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FERDIZ-afk/kitagawa-md/deaeb786380f1ceb357d45bff9b0f37a295e9903/temp/ocr.png
--------------------------------------------------------------------------------