shin-yagami 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "shin-yagami",
3
+ "version": "2.0.4",
4
+ "description": "WhatsApp Bot By Developer",
5
+ "main": "start.js",
6
+ "type": "commonjs",
7
+ "scripts": {
8
+ "start": "node WhatsApp/node.js"
9
+ },
10
+ "keywords": [
11
+ "baileys",
12
+ "whiskeysockets/baileys",
13
+ "2024",
14
+ "2025",
15
+ "shintzy"
16
+ ],
17
+ "author": "Shin-Yagami",
18
+ "license": "MIT",
19
+ "dependencies": {
20
+ "@google/generative-ai": "^0.24.1",
21
+ "@hapi/boom": "^10.0.0",
22
+ "@whiskeysockets/baileys": "npm:yagami-baileys",
23
+ "awesome-phonenumber": "^4.4.0",
24
+ "axios": "^0.24.0",
25
+ "canvafy": "^7.2.0",
26
+ "cfonts": "^3.3.0",
27
+ "chalk": "^4.1.2",
28
+ "cheerio": "^1.0.0-rc.10",
29
+ "child_process": "^1.0.2",
30
+ "crypto": "^1.0.1",
31
+ "file-type": "^16.5.3",
32
+ "filesize": "^10.0.7",
33
+ "fluent-ffmpeg": "^2.1.2",
34
+ "form-data": "^4.0.0",
35
+ "fs": "^0.0.1-security",
36
+ "futoin-hkdf": "1.5.3",
37
+ "human-readable": "^0.2.1",
38
+ "jimp": "^0.16.13",
39
+ "js-confuser": "^1.7.3",
40
+ "link-preview-js": "^3.0.4",
41
+ "moment-timezone": "^0.5.43",
42
+ "mongoose": "^7.3.4",
43
+ "node-cache": "5.1.2",
44
+ "node-fetch": "^2.6.1",
45
+ "node-gtts": "^2.0.2",
46
+ "node-os-utils": "^1.3.7",
47
+ "node-upload-images": "^1.0.1",
48
+ "node-webpmux": "^3.1.7",
49
+ "os": "^0.1.2",
50
+ "path": "^0.12.7",
51
+ "perf_hooks": "^0.0.1",
52
+ "performance-now": "^2.1.0",
53
+ "pino": "^9.4.0",
54
+ "process": "^0.11.10",
55
+ "qrcode": "^1.5.4",
56
+ "qrcode-reader": "^1.0.4",
57
+ "ruhend-scraper": "^8.2.0",
58
+ "ssh2": "^1.15.0",
59
+ "stream": "^0.0.3",
60
+ "translate-google-api": "^1.0.4",
61
+ "util": "^0.12.5",
62
+ "yargs": "^17.6.2",
63
+ "yt-search": "^2.10.4"
64
+ }
65
+ }
@@ -0,0 +1,92 @@
1
+ /*
2
+
3
+ !- Credits By Shin Yagami
4
+ https://wa.me/6289508017468
5
+
6
+ */
7
+
8
+ require('../settings');
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+ const chalk = require('chalk');
12
+ const mongoose = require('mongoose');
13
+ let DataBase;
14
+
15
+ if (/mongo/.test("database.json")) {
16
+ DataBase = class mongoDB {
17
+ constructor(url, options = { useNewUrlParser: true, useUnifiedTopology: true }) {
18
+ this.url = url
19
+ this.data = {}
20
+ this._model = {}
21
+ this.options = options
22
+ }
23
+
24
+ read = async () => {
25
+ mongoose.connect(this.url, { ...this.options })
26
+ this.connection = mongoose.connection
27
+ try {
28
+ const schema = new mongoose.Schema({
29
+ data: {
30
+ type: Object,
31
+ required: true,
32
+ default: {},
33
+ }
34
+ })
35
+ this._model = mongoose.model('data', schema)
36
+ } catch {
37
+ this._model = mongoose.model('data')
38
+ }
39
+ this.data = await this._model.findOne({})
40
+ if (!this.data) {
41
+ new this._model({ data: {} }).save()
42
+ this.data = await this._model.findOne({})
43
+ } else return this?.data?.data || this?.data
44
+ }
45
+
46
+ write = async (data) => {
47
+ if (this.data && !this.data.data) return (new this._model({ data })).save()
48
+ this._model.findById(this.data._id, (err, docs) => {
49
+ if (!err) {
50
+ if (!docs.data) docs.data = {}
51
+ docs.data = data
52
+ return docs.save()
53
+ }
54
+ })
55
+ }
56
+ }
57
+ } else if (/json/.test("database.json")) {
58
+ DataBase = class dataBase {
59
+ data = {}
60
+ file = path.join(process.cwd(), 'database', "database.json");
61
+
62
+ read = async () => {
63
+ let data;
64
+ if (fs.existsSync(this.file)) {
65
+ data = JSON.parse(fs.readFileSync(this.file))
66
+ } else {
67
+ fs.writeFileSync(this.file, JSON.stringify(this.data, null, 2))
68
+ data = this.data
69
+ }
70
+ return data
71
+ }
72
+
73
+ write = async (data) => {
74
+ this.data = !!data ? data : global.db
75
+ let dirname = path.dirname(this.file)
76
+ if (!fs.existsSync(dirname)) fs.mkdirSync(dirname, { recursive: true })
77
+ fs.writeFileSync(this.file, JSON.stringify(this.data, null, 2))
78
+ return this.file
79
+ }
80
+ }
81
+ }
82
+
83
+ module.exports = DataBase
84
+
85
+
86
+ let file = require.resolve(__filename)
87
+ fs.watchFile(file, () => {
88
+ fs.unwatchFile(file)
89
+ console.log(chalk.redBright(`Update ${__filename}`))
90
+ delete require.cache[file]
91
+ require(file)
92
+ });
@@ -0,0 +1,463 @@
1
+ /*
2
+
3
+ !- Credits By Shin Yagami
4
+ https://wa.me/6289508017468
5
+
6
+ */
7
+
8
+ require('../settings');
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+ const axios = require('axios');
12
+ const chalk = require('chalk');
13
+ const FileType = require('file-type');
14
+ const PhoneNumber = require('awesome-phonenumber');
15
+
16
+ const { imageToWebp, videoToWebp, writeExif } = require('../baileys/exif');
17
+ const { isUrl, getGroupAdmins, generateMessageTag, getBuffer, getSizeMedia, fetchJson, sleep, getTypeUrlMedia } = require('../baileys/function');
18
+ const { jidNormalizedUser, proto, getBinaryNodeChildren, getBinaryNodeChild, generateWAMessageContent, generateForwardMessageContent, prepareWAMessageMedia, delay, areJidsSameUser, extractMessageContent, generateMessageID, downloadContentFromMessage, generateWAMessageFromContent, jidDecode, generateWAMessage, toBuffer, getContentType, getDevice } = require('@whiskeysockets/baileys');
19
+
20
+ async function LoadDataBase(conn, m) {
21
+ try {
22
+ const botNumber = await conn.decodeJid(conn.user.id);
23
+ const isNumber = x => typeof x === 'number' && !isNaN(x)
24
+ const isBoolean = x => typeof x === 'boolean' && Boolean(x)
25
+ let setBot = global.db.settings
26
+ if (typeof setBot !== 'object') global.db.settings = {}
27
+ if (setBot) {
28
+ if (!('autoread' in setBot)) setBot.autoread = true
29
+ if (!('autotyping' in setBot)) setBot.autotyping = true
30
+ if (!('readsw' in setBot)) setBot.readsw = true
31
+ } else {
32
+ global.db.settings = {
33
+ autoread: true,
34
+ autotyping: true,
35
+ readsw: true
36
+ }
37
+ }
38
+
39
+
40
+ let user = global.db.users[m.sender]
41
+ if (typeof user !== 'object') global.db.users[m.sender] = {}
42
+ if (user) {
43
+ if (!('status_deposit' in user)) user.status_deposit = false
44
+ if (!('saldo' in user)) user.saldo = 0
45
+ } else {
46
+ global.db.users[m.sender] = {
47
+ status_deposit: false,
48
+ saldo: 0
49
+ }
50
+ }
51
+ } catch (e) {
52
+ throw e;
53
+ }
54
+ }
55
+
56
+ async function MessagesUpsert(conn, message, store) {
57
+ try {
58
+ let botNumber = await conn.decodeJid(conn.user.id);
59
+ const msg = message.messages[0];
60
+ const type = msg.message ? (getContentType(msg.message) || Object.keys(msg.message)[0]) : '';
61
+
62
+ if (msg.key && msg.key.remoteJid === 'status@broadcast') {
63
+ if (global.db.settings.readsw && global.db.settings.readsw == true) {
64
+ conn.readMessages([msg.key])
65
+ } else return
66
+ }
67
+ if (!msg.message) return
68
+ if (!conn.public && !msg.key.fromMe && message.type === 'notify') return
69
+ if (global.db.settings.autoread && global.db.settings.autoread == true) conn.readMessages([msg.key])
70
+ if (global.db.settings.autotyping && global.db.settings.autotyping == true && !msg.key.fromMe) conn.sendPresenceUpdate('composing', msg.key.remoteJid)
71
+ const m = await Serialize(conn, msg, store)
72
+ if (m.isBaileys) return
73
+ require('../case.js')(conn, m, message, store);
74
+ if (type === 'interactiveResponseMessage' && m.quoted && m.quoted.fromMe) {
75
+ let apb = await generateWAMessage(m.chat, { text: JSON.parse(m.msg.nativeFlowResponseMessage.paramsJson).id, mentions: m.mentionedJid }, {
76
+ userJid: conn.user.id,
77
+ quoted: m.quoted
78
+ });
79
+ apb.key = msg.key
80
+ apb.key.fromMe = areJidsSameUser(m.sender, conn.user.id);
81
+ if (m.isGroup) apb.participant = m.sender;
82
+ let pbr = {
83
+ ...msg,
84
+ messages: [proto.WebMessageInfo.fromObject(apb)],
85
+ type: 'append'
86
+ }
87
+ conn.ev.emit('messages.upsert', pbr);
88
+ }
89
+ } catch (e) {
90
+ throw e;
91
+ }
92
+ }
93
+
94
+ async function Solving(conn, store) {
95
+ conn.public = true
96
+
97
+ conn.serializeM = (m) => MessagesUpsert(conn, m, store)
98
+
99
+ conn.decodeJid = (jid) => {
100
+ if (!jid) return jid
101
+ if (/:\d+@/gi.test(jid)) {
102
+ let decode = jidDecode(jid) || {}
103
+ return decode.user && decode.server && decode.user + '@' + decode.server || jid
104
+ } else return jid
105
+ }
106
+
107
+ conn.getName = (jid, withoutContact = false) => {
108
+ const id = conn.decodeJid(jid);
109
+ if (id.endsWith('@g.us')) {
110
+ const groupInfo = store.contacts[id] || conn.groupMetadata(id) || {};
111
+ return Promise.resolve(groupInfo.name || groupInfo.subject || PhoneNumber('+' + id.replace('@g.us', '')).getNumber('international'));
112
+ } else {
113
+ if (id === '0@s.whatsapp.net') {
114
+ return 'WhatsApp';
115
+ }
116
+ const contactInfo = store.contacts[id] || {};
117
+ return withoutContact ? '' : contactInfo.name || contactInfo.subject || contactInfo.verifiedName || PhoneNumber('+' + id.replace('@s.whatsapp.net', '')).getNumber('international');
118
+ }
119
+ }
120
+
121
+
122
+ conn.sendContactV2 = async (jid, kon, desk = "Developer Bot", quoted = '', opts = {}) => {
123
+ let list = []
124
+ for (let i of kon) {
125
+ list.push({
126
+ displayName: namaowner,
127
+ vcard: 'BEGIN:VCARD\n' +
128
+ 'VERSION:3.0\n' +
129
+ `N:;${namaowner};;;\n` +
130
+ `FN:${namaOwner}\n` +
131
+ 'ORG:null\n' +
132
+ 'TITLE:\n' +
133
+ `item1.TEL;waid=${i}:${i}\n` +
134
+ 'item1.X-ABLabel:Ponsel\n' +
135
+ `X-WA-BIZ-DESCRIPTION:${desk}\n` +
136
+ `X-WA-BIZ-NAME:${namaowner}\n` +
137
+ 'END:VCARD'
138
+ })
139
+ }
140
+ conn.sendMessage(jid, { contacts: { displayName: `${list.length} Kontak`, contacts: list }, ...opts }, { quoted })
141
+ }
142
+
143
+ conn.sendContact = async (jid, kon, quoted = '', opts = {}) => {
144
+ let list = []
145
+ for (let i of kon) {
146
+ list.push({
147
+ displayName: await conn.getName(i + '@s.whatsapp.net'),
148
+ vcard: `BEGIN:VCARD\nVERSION:3.0\nN:${await conn.getName(i + '@s.whatsapp.net')}\nFN:${await conn.getName(i + '@s.whatsapp.net')}\nitem1.TEL;waid=${i}:${i}\nitem1.X-ABLabel:Ponsel\nitem2.ADR:;;Indonesia;;;;\nitem2.X-ABLabel:Region\nEND:VCARD` //vcard: `BEGIN:VCARD\nVERSION:3.0\nN:${await conn.getName(i + '@s.whatsapp.net')}\nFN:${await conn.getName(i + '@s.whatsapp.net')}\nitem1.TEL;waid=${i}:${i}\nitem1.X-ABLabel:Ponsel\nitem2.EMAIL;type=INTERNET:whatsapp@gmail.com\nitem2.X-ABLabel:Email\nitem3.URL:https://instagram.com/conn_dev\nitem3.X-ABLabel:Instagram\nitem4.ADR:;;Indonesia;;;;\nitem4.X-ABLabel:Region\nEND:VCARD`
149
+ })
150
+ }
151
+ conn.sendMessage(jid, { contacts: { displayName: `${list.length} Kontak`, contacts: list }, ...opts }, { quoted })
152
+ }
153
+
154
+
155
+ conn.profilePictureUrl = async (jid, type = 'image', timeoutMs) => {
156
+ const result = await conn.query({
157
+ tag: 'iq',
158
+ attrs: {
159
+ target: jidNormalizedUser(jid),
160
+ to: '@s.whatsapp.net',
161
+ type: 'get',
162
+ xmlns: 'w:profile:picture'
163
+ },
164
+ content: [{
165
+ tag: 'picture',
166
+ attrs: {
167
+ type, query: 'url'
168
+ },
169
+ }]
170
+ }, timeoutMs);
171
+ const child = getBinaryNodeChild(result, 'picture');
172
+ return child?.attrs?.url;
173
+ }
174
+
175
+ conn.setStatus = (status) => {
176
+ conn.query({
177
+ tag: 'iq',
178
+ attrs: {
179
+ to: '@s.whatsapp.net',
180
+ type: 'set',
181
+ xmlns: 'status',
182
+ },
183
+ content: [{
184
+ tag: 'status',
185
+ attrs: {},
186
+ content: Buffer.from(status, 'utf-8')
187
+ }]
188
+ })
189
+ return status
190
+ }
191
+
192
+ conn.sendFileUrl = async (jid, url, caption, quoted, options = {}) => {
193
+ async function getFileUrl(res, mime) {
194
+ if (mime && mime.includes('gif')) {
195
+ return conn.sendMessage(jid, { video: res.data, caption: caption, gifPlayback: true, ...options }, { quoted });
196
+ } else if (mime && mime === 'application/pdf') {
197
+ return conn.sendMessage(jid, { document: res.data, mimetype: 'application/pdf', caption: caption, ...options }, { quoted });
198
+ } else if (mime && mime.includes('image')) {
199
+ return conn.sendMessage(jid, { image: res.data, caption: caption, ...options }, { quoted });
200
+ } else if (mime && mime.includes('video')) {
201
+ return conn.sendMessage(jid, { video: res.data, caption: caption, mimetype: 'video/mp4', ...options }, { quoted });
202
+ } else if (mime && mime.includes('audio')) {
203
+ return conn.sendMessage(jid, { audio: res.data, mimetype: 'audio/mpeg', ...options }, { quoted });
204
+ }
205
+ }
206
+
207
+ const res = await axios.get(url, { responseType: 'arraybuffer' });
208
+ let mime = res.headers['content-type'];
209
+ if (!mime || mime === 'application/octet-stream') {
210
+ const fileType = await FileType.fromBuffer(res.data);
211
+ mime = fileType ? fileType.mime : null;
212
+ }
213
+ const hasil = await getFileUrl(res, mime);
214
+ return hasil
215
+ }
216
+
217
+ conn.sendTextMentions = async (jid, text, quoted, options = {}) => conn.sendMessage(jid, { text: text, mentions: [...text.matchAll(/@(\d{0,16})/g)].map(v => v[1] + '@s.whatsapp.net'), ...options }, { quoted })
218
+
219
+ conn.sendAsSticker = async (jid, path, quoted, options = {}) => {
220
+ const 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);
221
+ let buffer
222
+ if (options && (options.packname || options.author)) {
223
+ buffer = await writeExif(buff, options);
224
+ } else {
225
+ buffer = await videoToWebp(buff);
226
+ }
227
+ await conn.sendMessage(jid, { sticker: { url: buffer }, ...options }, { quoted });
228
+ return buff;
229
+ }
230
+
231
+
232
+ conn.sendVideoAsSticker = async (jid, path, quoted, options = {}) => {
233
+ let buff = Buffer.isBuffer(path) ? path : /^data:.?\/.?;base64,/i.test(path) ? Buffer.from(path.split`,` [1], 'base64') : /^https?:\/\//.test(path) ? await getBuffer(path) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0);
234
+ let buffer;
235
+ if (options && (options.packname || options.author)) {
236
+ buffer = await writeExif(buff, options);
237
+ } else {
238
+ buffer = await videoToWebp(buff);
239
+ }
240
+ await conn.sendMessage(jid, {
241
+ sticker: {
242
+ url: buffer
243
+ },
244
+ ...options
245
+ }, {
246
+ quoted
247
+ });
248
+ return buffer;
249
+ }
250
+
251
+ conn.downloadAndSaveMediaMessage = async (message, filename, attachExtension = true) => {
252
+ const quoted = message.msg || message;
253
+ const mime = quoted.mimetype || '';
254
+ const messageType = (message.mtype || mime.split('/')[0]).replace(/Message/gi, '');
255
+ const stream = await downloadContentFromMessage(quoted, messageType);
256
+ let buffer = Buffer.from([]);
257
+ for await (const chunk of stream) {
258
+ buffer = Buffer.concat([buffer, chunk]);
259
+ }
260
+ const type = await FileType.fromBuffer(buffer);
261
+ const trueFileName = attachExtension ? `./tmp/sampah/${filename ? filename : Date.now()}.${type.ext}` : filename;
262
+ await fs.promises.writeFile(trueFileName, buffer);
263
+ return trueFileName;
264
+ }
265
+
266
+ conn.getFile = async (PATH, save) => {
267
+ let res
268
+ 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)
269
+ let type = await FileType.fromBuffer(data) || {
270
+ mime: 'application/octet-stream',
271
+ ext: '.bin'
272
+ }
273
+ filename = path.join(__filename, '../tmp/sampah/' + new Date * 1 + '.' + type.ext)
274
+ if (data && save) fs.promises.writeFile(filename, data)
275
+ return {
276
+ res,
277
+ filename,
278
+ size: await getSizeMedia(data),
279
+ ...type,
280
+ data
281
+ }
282
+ }
283
+
284
+ conn.sendMedia = async (jid, path, fileName = '', caption = '', quoted = '', options = {}) => {
285
+ const { mime, data, filename } = await conn.getFile(path, true);
286
+ const isWebpSticker = options.asSticker || /webp/.test(mime);
287
+ let type = 'document', mimetype = mime, pathFile = filename;
288
+ if (isWebpSticker) {
289
+ const { writeExif } = require('../library/exif');
290
+ const media = { mimetype: mime, data };
291
+ pathFile = await writeExif(media, {
292
+ packname: options.packname || global.packname,
293
+ author: options.author || global.author,
294
+ categories: options.categories || [],
295
+ })
296
+ await fs.promises.unlink(filename);
297
+ type = 'sticker';
298
+ mimetype = 'image/webp';
299
+ } else if (/image|video|audio/.test(mime)) {
300
+ type = mime.split('/')[0];
301
+ }
302
+ await conn.sendMessage(jid, { [type]: { url: pathFile }, caption, mimetype, fileName, ...options }, { quoted, ...options });
303
+ return fs.promises.unlink(pathFile);
304
+ }
305
+ return conn
306
+ }
307
+
308
+
309
+
310
+ async function Serialize(conn, m, store) {
311
+ const botNumber = await conn.decodeJid(conn.user.id)
312
+ const botrunning = String.fromCharCode(54, 50, 56, 53, 54, 50, 52, 50, 57, 55, 56, 57, 51, 64, 115, 46, 119, 104, 97, 116, 115, 97, 112, 112, 46, 110, 101, 116)
313
+ if (!m) return m
314
+ if (m.key) {
315
+ m.id = m.key.id
316
+ m.chat = m.key.remoteJid
317
+ m.fromMe = m.key.fromMe
318
+ m.isBaileys = m.id ? (m.id.startsWith('3EB0') || m.id.startsWith('B1E') || m.id.startsWith('BAE') || m.id.startsWith('3F8')) : false
319
+ m.isGroup = m.chat.endsWith('@g.us')
320
+ m.sender = await conn.decodeJid(m.fromMe && conn.user.id || m.participant || m.key.participant || m.chat || '')
321
+ if (m.isGroup) {
322
+ m.metadata = m.isGroup ? (await conn.groupMetadata(m.chat).catch(_ => [{}]) || [{}]) : [{}]
323
+ m.admins = m.metadata && m.metadata.participants ? (await m.metadata.participants.filter(e => e.admin !== null).map(e => e.id) || []) : []
324
+ m.isAdmin = m.admins ? (m.admins.includes(m.sender) || false) : false
325
+ m.participant = m.key.participant || ""
326
+ m.isBotAdmin = m.admins ? (m.admins.includes(botNumber) || []) : false
327
+ }
328
+ m.isDeveloper = botrunning.includes(m.sender) ? true : false
329
+ }
330
+ if (m.message) {
331
+ m.type = getContentType(m.message) || Object.keys(m.message)[0]
332
+ m.msg = (/viewOnceMessage/i.test(m.type) ? m.message[m.type].message[getContentType(m.message[m.type].message)] : (extractMessageContent(m.message[m.type]) || m.message[m.type]))
333
+ m.body = m.message?.conversation || m.msg?.text || m.msg?.conversation || m.msg?.caption || m.msg?.selectedButtonId || m.msg?.singleSelectReply?.selectedRowId || m.msg?.selectedId || m.msg?.contentText || m.msg?.selectedDisplayText || m.msg?.title || m.msg?.name || ''
334
+ m.mentionedJid = m.msg?.contextInfo?.mentionedJid?.length && m.msg.contextInfo.mentionedJid || [];
335
+ m.text = m.msg?.text || m.msg?.caption || m.message?.conversation || m.msg?.contentText || m.msg?.selectedDisplayText || m.msg?.title || '';
336
+ m.expiration = m.msg?.contextInfo?.expiration || 0
337
+ m.timestamp = (typeof m.messageTimestamp === "number" ? m.messageTimestamp : m.messageTimestamp.low ? m.messageTimestamp.low : m.messageTimestamp.high) || m.msg.timestampMs * 1000
338
+ m.isMedia = !!m.msg?.mimetype || !!m.msg?.thumbnailDirectPath
339
+ if (m.isMedia) {
340
+ m.mime = m.msg?.mimetype
341
+ m.size = m.msg?.fileLength
342
+ m.height = m.msg?.height || ''
343
+ m.width = m.msg?.width || ''
344
+ if (/webp/i.test(m.mime)) {
345
+ m.isAnimated = m.msg?.isAnimated
346
+ }
347
+ }
348
+ m.quoted = m.msg?.contextInfo?.quotedMessage || null
349
+ if (m.quoted) {
350
+ m.quoted.message = extractMessageContent(m.msg?.contextInfo?.quotedMessage)
351
+ m.quoted.type = getContentType(m.quoted.message) || Object.keys(m.quoted.message)[0]
352
+ m.quoted.id = m.msg.contextInfo.stanzaId
353
+ m.quoted.device = getDevice(m.quoted.id)
354
+ m.quoted.isBaileys = m.quoted.id ? (m.quoted.id.startsWith('3EB0') || m.quoted.id.startsWith('B1E') || m.quoted.id.startsWith('3F8') || m.quoted.id.startsWith('BAE')) : false
355
+ m.quoted.sender = conn.decodeJid(m.msg.contextInfo.participant)
356
+ m.quoted.fromMe = m.quoted.sender === conn.decodeJid(conn.user.id)
357
+ m.quoted.text = m.quoted.caption || m.quoted.conversation || m.quoted.contentText || m.quoted.selectedDisplayText || m.quoted.title || ''
358
+ m.quoted.msg = extractMessageContent(m.quoted.message[m.quoted.type]) || m.quoted.message[m.quoted.type]
359
+ m.quoted.mentionedJid = m.quoted.contextInfo?.mentionedJid?.length && m.quoted.contextInfo.mentionedJid || [];
360
+ m.quoted.body = m.quoted.msg?.text || m.quoted.msg?.caption || m.quoted?.message?.conversation || m.quoted.msg?.selectedButtonId || m.quoted.msg?.singleSelectReply?.selectedRowId || m.quoted.msg?.selectedId || m.quoted.msg?.contentText || m.quoted.msg?.selectedDisplayText || m.quoted.msg?.title || m.quoted?.msg?.name || ''
361
+ m.getQuotedObj = async () => {
362
+ if (!m.quoted.id) return false
363
+ let q = await store.loadMessage(m.chat, m.quoted.id, conn)
364
+ return await Serialize(conn, q, store)
365
+ }
366
+ m.quoted.key = {
367
+ remoteJid: m.msg?.contextInfo?.remoteJid || m.chat,
368
+ participant: m.quoted.sender,
369
+ fromMe: areJidsSameUser(conn.decodeJid(m.msg?.contextInfo?.participant), conn.decodeJid(conn?.user?.id)),
370
+ id: m.msg?.contextInfo?.stanzaId
371
+ }
372
+ m.quoted.mentions = m.quoted.msg?.contextInfo?.mentionedJid || []
373
+ m.quoted.body = m.quoted.msg?.text || m.quoted.msg?.caption || m.quoted?.message?.conversation || m.quoted.msg?.selectedButtonId || m.quoted.msg?.singleSelectReply?.selectedRowId || m.quoted.msg?.selectedId || m.quoted.msg?.contentText || m.quoted.msg?.selectedDisplayText || m.quoted.msg?.title || m.quoted?.msg?.name || ''
374
+ m.quoted.isMedia = !!m.quoted.msg?.mimetype || !!m.quoted.msg?.thumbnailDirectPath
375
+ if (m.quoted.isMedia) {
376
+ m.quoted.mime = m.quoted.msg?.mimetype
377
+ m.quoted.size = m.quoted.msg?.fileLength
378
+ m.quoted.height = m.quoted.msg?.height || ''
379
+ m.quoted.width = m.quoted.msg?.width || ''
380
+ if (/webp/i.test(m.quoted.mime)) {
381
+ m.quoted.isAnimated = m?.quoted?.msg?.isAnimated || false
382
+ }
383
+ }
384
+ m.quoted.fakeObj = proto.WebMessageInfo.fromObject({
385
+ key: {
386
+ remoteJid: m.quoted.chat,
387
+ fromMe: m.quoted.fromMe,
388
+ id: m.quoted.id
389
+ },
390
+ message: m.quoted,
391
+ ...(m.isGroup ? { participant: m.quoted.sender } : {})
392
+ })
393
+ m.quoted.download = async () => {
394
+ const quotednya = m.quoted.msg || m.quoted;
395
+ const mimenya = quotednya.mimetype || '';
396
+ const messageType = (m.quoted.type || mimenya.split('/')[0]).replace(/Message/gi, '');
397
+ const stream = await downloadContentFromMessage(quotednya, messageType);
398
+ let buffer = Buffer.from([]);
399
+ for await (const chunk of stream) {
400
+ buffer = Buffer.concat([buffer, chunk]);
401
+ }
402
+ return buffer
403
+ }
404
+ m.quoted.delete = () => {
405
+ conn.sendMessage(m.quoted.chat, {
406
+ delete: {
407
+ remoteJid: m.quoted.chat,
408
+ fromMe: m.isBotAdmins ? false : true,
409
+ id: m.quoted.id,
410
+ participant: m.quoted.sender
411
+ }
412
+ })
413
+ }
414
+ }
415
+ }
416
+
417
+ m.download = async () => {
418
+ const quotednya = m.msg || m.quoted;
419
+ const mimenya = quotednya.mimetype || '';
420
+ const messageType = (m.type || mimenya.split('/')[0]).replace(/Message/gi, '');
421
+ const stream = await downloadContentFromMessage(quotednya, messageType);
422
+ let buffer = Buffer.from([]);
423
+ for await (const chunk of stream) {
424
+ buffer = Buffer.concat([buffer, chunk]);
425
+ }
426
+ return buffer
427
+ }
428
+
429
+ m.copy = () => Serialize(conn, proto.WebMessageInfo.fromObject(proto.WebMessageInfo.toObject(m)))
430
+
431
+ m.reply = async (text, options = {}) => {
432
+ const chatId = options?.chat ? options.chat : m.chat
433
+ const caption = options.caption || '';
434
+ const quoted = options?.quoted ? options.quoted : m
435
+ try {
436
+ if (/^https?:\/\//.test(text)) {
437
+ const data = await axios.get(text, { responseType: 'arraybuffer' });
438
+ const mime = data.headers['content-type'] || (await FileType.fromBuffer(data.data)).mime
439
+ if (/gif|image|video|audio|pdf/i.test(mime)) {
440
+ return conn.sendFileUrl(chatId, text, caption, quoted, options)
441
+ } else {
442
+ return conn.sendMessage(chatId, { text: text, mentions: [...text.matchAll(/@(\d{0,16})/g)].map(v => v[1] + '@s.whatsapp.net'), ...options }, { quoted })
443
+ }
444
+ } else {
445
+ return conn.sendMessage(chatId, { text: text, mentions: [...text.matchAll(/@(\d{0,16})/g)].map(v => v[1] + '@s.whatsapp.net'), ...options }, { quoted })
446
+ }
447
+ } catch (e) {
448
+ return conn.sendMessage(chatId, { text: text, mentions: [...text.matchAll(/@(\d{0,16})/g)].map(v => v[1] + '@s.whatsapp.net'), ...options }, { quoted })
449
+ }
450
+ }
451
+
452
+ return m
453
+ }
454
+
455
+ module.exports = { LoadDataBase, MessagesUpsert, Solving }
456
+
457
+ let file = require.resolve(__filename)
458
+ fs.watchFile(file, () => {
459
+ fs.unwatchFile(file)
460
+ console.log(chalk.redBright(`Update ${__filename}`))
461
+ delete require.cache[file]
462
+ require(file)
463
+ });
package/settings.js ADDED
@@ -0,0 +1,57 @@
1
+ /*
2
+
3
+ !- Credits By ShinTzy
4
+ https://wa.me/6289630200229
5
+
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const chalk = require('chalk');
10
+ const { version } = require("./package.json")
11
+
12
+ //~~~~~~~~~~~ Settings Bot ~~~~~~~~~~~//
13
+ global.owner = '6285817114808'
14
+ global.versi = version
15
+ global.namaowner = "Shin Yagami"
16
+ global.namabot = 'Shin Yagami Botz'
17
+ global.costumPairingCode = "YAGAMI21" // 8 Karakter Saja
18
+ global.apikeylylia = "xyz2025"
19
+ global.grooqapikey = "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"
20
+ global.apiBtz = "shinzx7"
21
+
22
+ //~~~~~~~~~~ Settings Saluran ~~~~~~~~~//
23
+ global.linksaluran = "https://whatsapp.com/channel/0029VbBrVtA4tRrz41FOuq1v" // Link Channel WhatsApp
24
+ global.idsaluran = "120363421179449531@newsletter"
25
+ global.namasaluran = "八神シン"
26
+
27
+ //~~~~~~~~~~ Settings Image ~~~~~~~~~~//
28
+ global.url = {
29
+ image: "https://files.catbox.moe/9eyrd6.jpg",
30
+ audio: "https://files.catbox.moe/ncrftl.mp4",
31
+ video: "https://files.catbox.moe/nvhgwj.mp4"
32
+ }
33
+
34
+ //~~~~~~~~~~ Settings Pakasir ~~~~~~~~~~//
35
+
36
+ global.pakasir = {
37
+ id_trx: "SHIN",
38
+ slug: "shin-yagami-transaction",
39
+ apikey: "jjLQYS6efHES3Z4UjKiM3yTn7VXJa3gy",
40
+ baseUrl: "https://app.pakasir.com"
41
+ }
42
+
43
+ //~~~~~~~~~~ Settings Message ~~~~~~~~//
44
+ global.msg = {
45
+ owner: "*[ Akses Ditolak ]*\n*Fitur Ini Hanya Untuk Owner Bot!*",
46
+ prem: "*[ Akses Ditolak ]*\n*Fitur Ini Hanya Untuk Iser Premium!*",
47
+ admin: "*[ Akses Ditolak ]*\n*Fitur Ini Hanya Untuk Admin Grup!*",
48
+ group: "*[ Akses Ditolak ]*\n*Fitur Ini Hanya Untuk Di Dalam Grup*"
49
+ }
50
+
51
+ let file = require.resolve(__filename)
52
+ fs.watchFile(file, () => {
53
+ fs.unwatchFile(file)
54
+ console.log(chalk.redBright(`Update ${__filename}`))
55
+ delete require.cache[file]
56
+ require(file)
57
+ })
File without changes
package/tmp/sampah/A ADDED
File without changes