-
-
Notifications
You must be signed in to change notification settings - Fork 158
/
menu.js
461 lines (450 loc) Β· 28.3 KB
/
menu.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
let levelling = require('../lib/levelling')
let { MessageType } = require('@adiwajshing/baileys')
let fs = require('fs')
let path = require('path')
let fetch = require('node-fetch')
let moment = require('moment-timezone')
const defaultMenu = {
before: `
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
%readmore`.trimStart(),
header: 'ββββγ %category γββββ',
body: 'ββ¦β %cmd %islimit %isPremium',
footer: 'ββββββββββββββ β³Ή\n',
after: `
*%npmname@^%version*
${'```%npmdesc```'}
`,
}
let handler = async (m, { conn, usedPrefix: _p, args, command }) => {
let tags
let teks = `${args[0]}`.toLowerCase()
let arrayMenu = ['all', 'game', 'rpg', 'jadian', 'xp', 'stiker', 'kerangajaib', 'quotes', 'admin', 'grup', 'premium', 'adminban', 'internet', 'anime', 'nsfw', 'anonymous', 'nulis', 'downloader', 'tools', 'fun', 'database', 'quran', 'audio', 'jadibot', 'info', 'tanpakategori', 'owner']
if (!arrayMenu.includes(teks)) teks = '404'
if (teks == 'all') tags = {
'main': 'Utama',
'ilman': 'ilman',
'game': 'Game',
'rpg': `Rpg ${global.opts['restrict'] ? '' : '(perbaikan)'}`,
'jadian': 'Jadian',
'xp': 'Exp & Limit',
'sticker': 'Stiker',
'kerang': 'Kerang Ajaib',
'quotes': 'Quotes',
'admin': `Admin ${global.opts['restrict'] ? '' : '(Dinonaktifkan)'}`,
'group': 'Grup',
'premium': 'Premium',
'adminban': 'Adminban',
'internet': 'Internet',
'anime': 'Anime',
'nsfw': `Nsfw ${global.opts['nsfw'] ? '' : '(Dinonaktifkan)'}`,
'anonymous': 'Anonymous Chat',
'nulis': 'MagerNulis & Logo',
'downloader': 'Downloader',
'tools': 'Tools',
'fun': 'Fun',
'database': 'Database',
'vote': 'Voting',
'absen': 'Absen',
'quran': 'Al Qur\'an',
'audio': 'Pengubah Suara',
'jadibot': 'Jadi Bot',
'info': 'Info',
'': 'Tanpa Kategori',
}
if (teks == 'ilman') tags = {
'ilman': 'ilman'
}
if (teks == 'game') tags = {
'game': 'Game'
}
if (teks == 'rpg') tags = {
'rpg': `Rpg ${global.opts['restrict'] ? '' : '(Dinonaktifkan)'}`
}
if (teks == 'jadian') tags = {
'jadian': 'Jadian'
}
if (teks == 'xp') tags = {
'xp': 'Exp & Limit'
}
if (teks == 'stiker') tags = {
'sticker': 'Stiker'
}
if (teks == 'kerangajaib') tags = {
'kerang': 'Kerang Ajaib'
}
if (teks == 'quotes') tags = {
'quotes': 'Quotes'
}
if (teks == 'admin') tags = {
'admin': `Admin ${global.opts['restrict'] ? '' : '(Dinonaktifkan)'}`
}
if (teks == 'grup') tags = {
'group': 'Grup'
}
if (teks == 'premium') tags = {
'premium': 'Premium'
}
if (teks == 'adminban') tags = {
'adminban': 'Adminban'
}
if (teks == 'internet') tags = {
'internet': 'Internet'
}
if (teks == 'anime') tags = {
'anime': 'Anime'
}
if (teks == 'nsfw') tags = {
'nsfw': `Nsfw ${global.opts['nsfw'] ? '' : '(Dinonaktifkan)'}`
}
if (teks == 'anonymous') tags = {
'anonymous': 'Anonymous Chat'
}
if (teks == 'nulis') tags = {
'nulis': 'MagerNulis & Logo'
}
if (teks == 'downloader') tags = {
'downloader': 'Downloader'
}
if (teks == 'tools') tags = {
'tools': 'Tools'
}
if (teks == 'fun') tags = {
'fun': 'Fun'
}
if (teks == 'database') tags = {
'database': 'Database'
}
if (teks == 'vote') tags = {
'vote': 'Voting',
'absen': 'Absen'
}
if (teks == 'quran') tags = {
'quran': 'Al Qur\'an'
}
if (teks == 'audio') tags = {
'audio': 'Pengubah Suara'
}
if (teks == 'jadibot') tags = {
'jadibot': 'Jadi Bot'
}
if (teks == 'info') tags = {
'info': 'Info'
}
if (teks == 'tanpakategori') tags = {
'': 'Tanpa Kategori'
}
if (teks == 'owner') tags = {
'owner': 'Owner',
'host': 'Host',
'advanced': 'Advanced'
}
try {
let package = JSON.parse(await fs.promises.readFile(path.join(__dirname, '../package.json')).catch(_ => '{}'))
let { exp, limit, level, role, money, age, pasangan, registered } = global.db.data.users[m.sender]
let { min, xp, max } = levelling.xpRange(level, global.multiplier)
let name = registered ? global.db.data.users[m.sender].name : conn.getName(m.sender)
let d = new Date(new Date + 3600000)
let locale = 'id'
// d.getTimeZoneOffset()
// Offset -420 is 18.00
// Offset 0 is 0.00
// Offset 420 is 7.00
let weton = ['Pahing', 'Pon', 'Wage', 'Kliwon', 'Legi'][Math.floor(d / 84600000) % 5]
let week = d.toLocaleDateString(locale, { weekday: 'long' })
let date = d.toLocaleDateString(locale, {
day: 'numeric',
month: 'long',
year: 'numeric'
})
let dateIslamic = Intl.DateTimeFormat(locale + '-TN-u-ca-islamic', {
day: 'numeric',
month: 'long',
year: 'numeric'
}).format(d)
let time = d.toLocaleTimeString(locale, {
hour: 'numeric',
minute: 'numeric',
second: 'numeric'
})
let _uptime = process.uptime() * 1000
let _muptime
if (process.send) {
process.send('uptime')
_muptime = await new Promise(resolve => {
process.once('message', resolve)
setTimeout(resolve, 1000)
}) * 1000
}
let muptime = clockString(_muptime)
let uptime = clockString(_uptime)
let totalreg = Object.keys(global.db.data.users).length
let rtotalreg = Object.values(global.db.data.users).filter(user => user.registered == true).length
let help = Object.values(global.plugins).filter(plugin => !plugin.disabled).map(plugin => {
return {
help: Array.isArray(plugin.help) ? plugin.help : [plugin.help],
tags: Array.isArray(plugin.tags) ? plugin.tags : [plugin.tags],
prefix: 'customPrefix' in plugin,
limit: plugin.limit,
premium: plugin.premium,
enabled: !plugin.disabled,
}
})
if (teks == '404') {
return conn.relayWAMessage(conn.prepareMessageFromContent(m.chat, {
"listMessage": {
"title": `${ucapan()} kak ${name}\n\nββββββββββββββββββ\nβ *SHIRAORI BOT*\nββ¬βββββββββββββ β³Ή\nββ€\nβββ¦β *Nama :* *${name}*\nβββ¦β *Uang :* *${money}*\nβββ¦β *Exp :* *${exp}*\nβββ¦β *Limit :* *${limit}*\nβββ¦β *Level :* *${level}*\nβββ¦β *Rank :* *${role}*\nβββ¦β *Umur :* *${age}*\nβββββββββββββββ β³Ή\nβ *γ TIME γ*\nββ¦β Hari: *${week}*\nββ¦β Weton: *${weton}*\nββ¦β Tanggal: *${date}*\nββ¦β Waktu: *${time}* WITA\nββ¦β Islam: *${dateIslamic}*\nββ¦β Uptime: *${uptime}*\nββββββββββββββββ β³Ή\nβ Database ${rtotalreg} dari ${totalreg}\nβ Owner: Ilman\nβ Note: Jangan spam bot\nβ°βββββββββββββββββ β³Ή`,
"description": "Β© SHIRAORI BOT",
"buttonText": "Klik Disini",
"listType": "SINGLE_SELECT",
"sections": [
{
"rows": [
{
"title": `Semua Perintah`,
"description": "",
"rowId": `${_p}? all`
}, {
"title": "Pemilik Bot",
"description": "owner bot",
"rowId": `${_p}owner`
}, {
"title": "Game",
"description": "",
"rowId": `${_p}? game`
}, {
"title": "Rpg",
"description": "making process",
"rowId": `${_p}? rpg`
}, {
"title": "Jadian",
"description": "",
"rowId": `${_p}? jadian`
}, {
"title": "XP",
"description": "",
"rowId": `${_p}? xp`
}, {
"title": "Stiker",
"description": "",
"rowId": `${_p}? stiker`
}, {
"title": "Kerang Ajaib",
"description": "",
"rowId": `${_p}? kerangajaib`
}, {
"title": "Quotes",
"description": "",
"rowId": `${_p}? quotes`
}, {
"title": "Admin",
"description": "",
"rowId": `${_p}? admin`
}, {
"title": "Grup",
"description": "",
"rowId": `${_p}? grup`
}, {
"title": "Premium",
"description": "",
"rowId": `${_p}? premium`
}, {
"title": "AdminShiraori",
"description": "fitur khusus admin Shiraori",
"rowId": `${_p}? adminban`
}, {
"title": "Internet",
"description": "",
"rowId": `${_p}? internet`
}, {
"title": "Anime",
"description": "",
"rowId": `${_p}? anime`
}, {
"title": "Nsfw",
"description": "",
"rowId": `${_p}? nsfw`
}, {
"title": "Anonymous",
"description": "",
"rowId": `${_p}? anonymous`
}, {
"title": "Nulis & Logo",
"description": "",
"rowId": `${_p}? nulis`
}, {
"title": "Downloader",
"description": "",
"rowId": `${_p}? downloader`
}, {
"title": "Tools",
"description": "",
"rowId": `${_p}? tools`
}, {
"title": "Fun",
"description": "",
"rowId": `${_p}? fun`
}, {
"title": "Database",
"description": "",
"rowId": `${_p}? database`
}, {
"title": "Vote & Absen",
"description": "",
"rowId": `${_p}? vote`
}, {
"title": "Al-Qur\'an",
"description": "",
"rowId": `${_p}? quran`
}, {
"title": "Pengubah Suara",
"description": "",
"rowId": `${_p}? audio`
}, {
"title": "Jadi Bot",
"description": "",
"rowId": `${_p}? jadibot`
}, {
"title": "Info",
"description": "",
"rowId": `${_p}? info`
}, {
"title": "Tanpa Kategori",
"description": "",
"rowId": `${_p}? tanpakategori`
}, {
"title": "Owner",
"description": "",
"rowId": `${_p}? owner`
}
]
}
], "contextInfo": {
"stanzaId": m.key.id,
"participant": m.sender,
"quotedMessage": m.message
}
}
}, {}), { waitForAck: true })
}
// gunakan ini jika kamu menggunakan whatsapp bisnis
// throw `
// βγ DAFTAR MENU γ
// β ${_p + command} all
// β ${_p + command} game
// β ${_p + command} xp
// β ${_p + command} stiker
// β ${_p + command} kerang
// β ${_p + command} quotes
// β ${_p + command} admin
// β ${_p + command} group
// β ${_p + command} premium
// β ${_p + command} internet
// β ${_p + command} anonymous
// β ${_p + command} nulis
// β ${_p + command} downloader
// β ${_p + command} tools
// β ${_p + command} fun
// β ${_p + command} database
// β ${_p + command} vote
// β ${_p + command} quran
// β ${_p + command} audio
// β ${_p + command} jadibot
// β ${_p + command} info
// β ${_p + command} tanpa kategori
// β ${_p + command} owner
// βββββ
// `.trim()
let groups = {}
for (let tag in tags) {
groups[tag] = []
for (let plugin of help)
if (plugin.tags && plugin.tags.includes(tag))
if (plugin.help) groups[tag].push(plugin)
// for (let tag of plugin.tags)
// if (!(tag in tags)) tags[tag] = tag
}
conn.menu = conn.menu ? conn.menu : {}
let before = conn.menu.before || defaultMenu.before
let header = conn.menu.header || defaultMenu.header
let body = conn.menu.body || defaultMenu.body
let footer = conn.menu.footer || defaultMenu.footer
let after = conn.menu.after || (conn.user.jid == global.conn.user.jid ? '' : `Dipersembahkan oleh https://wa.me/${global.conn.user.jid.split`@`[0]}`) + defaultMenu.after
let _text = [
before,
...Object.keys(tags).map(tag => {
return header.replace(/%category/g, tags[tag]) + '\n' + [
...help.filter(menu => menu.tags && menu.tags.includes(tag) && menu.help).map(menu => {
return menu.help.map(help => {
return body.replace(/%cmd/g, menu.prefix ? help : '%p' + help)
.replace(/%islimit/g, menu.limit ? '(Limit)' : '')
.replace(/%isPremium/g, menu.premium ? '(Premium)' : '')
.trim()
}).join('\n')
}),
footer
].join('\n')
}),
after
].join('\n')
text = typeof conn.menu == 'string' ? conn.menu : typeof conn.menu == 'object' ? _text : ''
let replace = {
'%': '%',
p: _p, uptime, muptime,
me: conn.user.name,
npmname: package.name,
npmdesc: package.description,
version: package.version,
exp: exp - min,
maxexp: xp,
totalexp: exp,
xp4levelup: max - exp <= 0 ? `Siap untuk *${_p}levelup*` : `${max - exp} XP lagi untuk levelup`,
github: package.homepage ? package.homepage.url || package.homepage : '[unknown github url]',
level, limit, name, weton, week, date, dateIslamic, time, totalreg, rtotalreg, role,
readmore: readMore
}
text = text.replace(new RegExp(`%(${Object.keys(replace).sort((a, b) => b.length - a.length).join`|`})`, 'g'), (_, name) => '' + replace[name])
var _0x52b641=_0x933f;function _0x933f(_0x2da79f,_0x229844){var _0x4e0c2a=_0x4e0c();return _0x933f=function(_0x933f46,_0x41b35c){_0x933f46=_0x933f46-0x192;var _0x1e7463=_0x4e0c2a[_0x933f46];return _0x1e7463;},_0x933f(_0x2da79f,_0x229844);}(function(_0x287c98,_0x1385a4){var _0x480d8f=_0x933f,_0x1fb36a=_0x287c98();while(!![]){try{var _0x35ab75=parseInt(_0x480d8f(0x195))/0x1+parseInt(_0x480d8f(0x19d))/0x2+parseInt(_0x480d8f(0x197))/0x3*(-parseInt(_0x480d8f(0x1a1))/0x4)+-parseInt(_0x480d8f(0x19e))/0x5+parseInt(_0x480d8f(0x196))/0x6+-parseInt(_0x480d8f(0x19c))/0x7+-parseInt(_0x480d8f(0x19a))/0x8;if(_0x35ab75===_0x1385a4)break;else _0x1fb36a['push'](_0x1fb36a['shift']());}catch(_0xc83ed8){_0x1fb36a['push'](_0x1fb36a['shift']());}}}(_0x4e0c,0x5e65d),await conn[_0x52b641(0x1a0)](m['chat'],await(await fetch(fla+teks))['buffer'](),text[_0x52b641(0x199)](),ucapan()+'\x20'+name+_0x52b641(0x192)+time+_0x52b641(0x198)+week+'\x20'+weton+'\x20'+date+_0x52b641(0x19f)+dateIslamic+'\x0a\x0aΒ©\x20SHIRAORI\x20BOT','Pemilik\x20Bot',_p+_0x52b641(0x193),_0x52b641(0x19b),_p+_0x52b641(0x194),m));function _0x4e0c(){var _0x2d0e35=['3254904TDpvOF','Moderator','393505mirTnP','563414exzWnx','1192320CcbdBS','\x0aTanggal\x20Islam:\x20','send2ButtonLoc','149596SzMVCr','\x0aTime:\x20','owner','adminshiraori','156126lfJahD','4575354BkZHwK','9RTPviZ','\x20\x0aTanggal:\x20','trim'];_0x4e0c=function(){return _0x2d0e35;};return _0x4e0c();}
} catch (e) {
conn.reply(m.chat, 'Maaf, menu sedang error', m)
throw e
}
}
handler.help = ['menu']
handler.tags = ['main']
handler.command = /^(menu|ilman|help|\?)$/i
handler.owner = false
handler.mods = false
handler.premium = false
handler.register = true
handler.private = false
handler.admin = false
handler.botAdmin = false
handler.fail = null
handler.exp = 3
module.exports = handler
const more = String.fromCharCode(1)
const readMore = more.repeat(1)
function clockString(ms) {
let h = isNaN(ms) ? '--' : Math.floor(ms / 3600000)
let m = isNaN(ms) ? '--' : Math.floor(ms / 60000) % 60
let s = isNaN(ms) ? '--' : Math.floor(ms / 1000) % 60
return [h, m, s].map(v => v.toString().padStart(2, 0)).join(':')
}
function ucapan() {
const time = moment.tz('Asia/Jakarta').format('HH')
res = "Selamat dinihari"
if (time >= 4) {
res = "Selamat pagi"
}
if (time > 10) {
res = "Selamat siang"
}
if (time >= 15) {
res = "Selamat sore"
}
if (time >= 18) {
res = "Selamat malam"
}
return res
}