satanic-release 0.0.0-stage → 2.4.0
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/RUN NODE 20 - 21 +0 -0
- package/assets/fishing/LICENSE.txt +1 -0
- package/assets/fishing/SOURCES.md +8 -0
- package/assets/fishing/angler.svg +16 -0
- package/assets/fishing/background.svg +1 -0
- package/assets/fishing/bait.svg +1 -0
- package/assets/fishing/birds.svg +1 -0
- package/assets/fishing/boat.svg +1 -0
- package/assets/fishing/bobber.svg +1 -0
- package/assets/fishing/cloud.svg +1 -0
- package/assets/fishing/coin.svg +1 -0
- package/assets/fishing/coral.svg +1 -0
- package/assets/fishing/crate.svg +1 -0
- package/assets/fishing/fish-bass.svg +1 -0
- package/assets/fishing/fish-catfish.svg +1 -0
- package/assets/fishing/fish-koi.svg +1 -0
- package/assets/fishing/fish-perch.svg +1 -0
- package/assets/fishing/fish-trout.svg +1 -0
- package/assets/fishing/hook.svg +1 -0
- package/assets/fishing/lilypad.svg +1 -0
- package/assets/fishing/manifest.json +48 -0
- package/assets/fishing/net.svg +1 -0
- package/assets/fishing/reeds.svg +1 -0
- package/assets/fishing/rod.svg +1 -0
- package/assets/fishing/spark.svg +1 -0
- package/assets/fishing/splash.svg +5 -0
- package/assets/fishing/watergrass.svg +1 -0
- package/assets/fonts/qiro-nulis.ttf +0 -0
- package/assets/rpg/CC0_SOURCES.txt +23 -0
- package/assets/rpg/cc0/SOURCES.md +18 -0
- package/assets/rpg/items/antidote.svg +1 -0
- package/assets/rpg/items/armor.svg +1 -0
- package/assets/rpg/items/axe.svg +1 -0
- package/assets/rpg/items/bag.svg +1 -0
- package/assets/rpg/items/bear.svg +1 -0
- package/assets/rpg/items/boar.svg +1 -0
- package/assets/rpg/items/book.svg +1 -0
- package/assets/rpg/items/bow.svg +1 -0
- package/assets/rpg/items/car.svg +1 -0
- package/assets/rpg/items/cherry.svg +1 -0
- package/assets/rpg/items/chest.svg +1 -0
- package/assets/rpg/items/coal.svg +1 -0
- package/assets/rpg/items/coin.svg +1 -0
- package/assets/rpg/items/compass.svg +1 -0
- package/assets/rpg/items/crate.svg +1 -0
- package/assets/rpg/items/deer.svg +1 -0
- package/assets/rpg/items/demon.svg +1 -0
- package/assets/rpg/items/diamond.svg +5 -0
- package/assets/rpg/items/diamondchest.svg +1 -0
- package/assets/rpg/items/dice.svg +1 -0
- package/assets/rpg/items/dice1.svg +1 -0
- package/assets/rpg/items/dice2.svg +1 -0
- package/assets/rpg/items/dice3.svg +1 -0
- package/assets/rpg/items/dice4.svg +1 -0
- package/assets/rpg/items/dice5.svg +1 -0
- package/assets/rpg/items/dice6.svg +1 -0
- package/assets/rpg/items/dragon.svg +1 -0
- package/assets/rpg/items/dumbbell.svg +1 -0
- package/assets/rpg/items/egg.svg +1 -0
- package/assets/rpg/items/elixir.svg +1 -0
- package/assets/rpg/items/emerald.svg +1 -0
- package/assets/rpg/items/fish.svg +1 -0
- package/assets/rpg/items/fishingrod.svg +1 -0
- package/assets/rpg/items/flower.svg +1 -0
- package/assets/rpg/items/food.svg +1 -0
- package/assets/rpg/items/fox.svg +1 -0
- package/assets/rpg/items/frost.svg +1 -0
- package/assets/rpg/items/gold.svg +1 -0
- package/assets/rpg/items/goldchest.svg +1 -0
- package/assets/rpg/items/grape.svg +1 -0
- package/assets/rpg/items/hammer.svg +1 -0
- package/assets/rpg/items/helmet.svg +1 -0
- package/assets/rpg/items/herb.svg +1 -0
- package/assets/rpg/items/house.svg +1 -0
- package/assets/rpg/items/iron.svg +1 -0
- package/assets/rpg/items/key.svg +1 -0
- package/assets/rpg/items/kraken.svg +1 -0
- package/assets/rpg/items/kunai.svg +1 -0
- package/assets/rpg/items/leather.svg +1 -0
- package/assets/rpg/items/lemon.svg +1 -0
- package/assets/rpg/items/lion.svg +1 -0
- package/assets/rpg/items/map.svg +1 -0
- package/assets/rpg/items/meat.svg +1 -0
- package/assets/rpg/items/mpotion.svg +1 -0
- package/assets/rpg/items/octopus.svg +1 -0
- package/assets/rpg/items/orange.svg +1 -0
- package/assets/rpg/items/ore.svg +1 -0
- package/assets/rpg/items/parking.svg +1 -0
- package/assets/rpg/items/pearl.svg +1 -0
- package/assets/rpg/items/pet.svg +1 -0
- package/assets/rpg/items/pickaxe.svg +1 -0
- package/assets/rpg/items/potion.svg +1 -0
- package/assets/rpg/items/prawn.svg +1 -0
- package/assets/rpg/items/rabbit.svg +1 -0
- package/assets/rpg/items/ramen.svg +1 -0
- package/assets/rpg/items/rice.svg +1 -0
- package/assets/rpg/items/rock.svg +1 -0
- package/assets/rpg/items/scroll.svg +1 -0
- package/assets/rpg/items/seven.svg +1 -0
- package/assets/rpg/items/shark.svg +1 -0
- package/assets/rpg/items/shield.svg +1 -0
- package/assets/rpg/items/shuriken.svg +1 -0
- package/assets/rpg/items/slot.svg +1 -0
- package/assets/rpg/items/staminapotion.svg +1 -0
- package/assets/rpg/items/sword.svg +1 -0
- package/assets/rpg/items/tent.svg +1 -0
- package/assets/rpg/items/thunder.svg +1 -0
- package/assets/rpg/items/titan.svg +1 -0
- package/assets/rpg/items/trash.svg +1 -0
- package/assets/rpg/items/undead.svg +1 -0
- package/assets/rpg/items/whale.svg +1 -0
- package/assets/rpg/items/wheat.svg +1 -0
- package/assets/rpg/items/wood.svg +1 -0
- package/assets/rpg/ui/SOURCES.md +12 -0
- package/assets/rpg/ui/compass.svg +1 -0
- package/assets/rpg/ui/diamond.svg +1 -0
- package/assets/rpg/ui/soft-frame.svg +6 -0
- package/buypanel.js +37 -0
- package/cara ambil apikey.js +26 -0
- package/data/assets/Caveat-Bold.ttf +0 -0
- package/data/assets/FontsFree-Net-SFProDisplay-Bold.ttf +0 -0
- package/data/assets/FontsFree-Net-SFProDisplay-Regular.ttf +0 -0
- package/data/assets/Indie-Flower.ttf +0 -0
- package/database/absen.json +1 -0
- package/database/absen_status.json +1 -0
- package/database/admin.json +1 -0
- package/database/adminvip.json +1 -0
- package/database/afk.json +1 -0
- package/database/antiaudio.json +1 -0
- package/database/antibadword.json +1 -0
- package/database/antibot-settings.json +1 -0
- package/database/antibot.json +1 -0
- package/database/antidelete.json +3 -0
- package/database/antiig.json +1 -0
- package/database/antiimage.json +1 -0
- package/database/antilink.json +1 -0
- package/database/antilinkall.json +1 -0
- package/database/antilinkkick.json +1 -0
- package/database/antirvo.json +1 -0
- package/database/antispam-counter.json +1 -0
- package/database/antispam-groups.json +1 -0
- package/database/antispam-warn.json +1 -0
- package/database/antisticker.json +1 -0
- package/database/antiswgc.json +1 -0
- package/database/antitagsw.json +1 -0
- package/database/antitoxic.json +1 -0
- package/database/antitt.json +1 -0
- package/database/antivideo.json +1 -0
- package/database/antiyt.json +1 -0
- package/database/autojoingc.json +1 -0
- package/database/autosholat.json +3 -0
- package/database/bad.json +73 -0
- package/database/badword.json +7 -0
- package/database/banchat.json +1 -0
- package/database/bannedfitur.json +1 -0
- package/database/banuser.json +1 -0
- package/database/blacklist.json +1 -0
- package/database/blacklistgroup.json +1 -0
- package/database/broadcast.json +3 -0
- package/database/chatsNotif.json +1 -0
- package/database/config.json +1 -0
- package/database/database.json +1 -0
- package/database/expiredpanel.json +1 -0
- package/database/expiredpanel2.json +1 -0
- package/database/fiturmember.json +1 -0
- package/database/groupadd.json +1 -0
- package/database/groups.json +6 -0
- package/database/gruplist.json +5 -0
- package/database/idgrup.json +1 -0
- package/database/jpmgroup.json +1 -0
- package/database/kata-kata.json +28309 -0
- package/database/left.json +1 -0
- package/database/list-message.json +51 -0
- package/database/maintenance.json +4 -0
- package/database/mutegc.json +1 -0
- package/database/nilai.json +3 -0
- package/database/onlyadmin.json +1 -0
- package/database/onlygc.json +6 -0
- package/database/onlyprivate.json +3 -0
- package/database/openaigc.json +3 -0
- package/database/owner.json +1 -0
- package/database/panelexpired2.json +1 -0
- package/database/payment.json +1 -0
- package/database/pending.json +1 -0
- package/database/pendingSewa.json +1 -0
- package/database/prefix.json +4 -0
- package/database/premium.json +1 -0
- package/database/qris.json +3 -0
- package/database/registered.json +2 -0
- package/database/schedule.json +1 -0
- package/database/set_done.json +1 -0
- package/database/set_left.json +1 -0
- package/database/set_proses.json +1 -0
- package/database/set_welcome.json +1 -0
- package/database/setting.json +1 -0
- package/database/sewa.json +1 -0
- package/database/sewabot.json +3 -0
- package/database/transaksi.json +1 -0
- package/database/uservip.json +1 -0
- package/database/warning.json +2 -0
- package/database/welcome.json +1 -0
- package/helper.js +461 -0
- package/index.js +19 -0
- package/lib/AGENCYB.TTF +0 -0
- package/lib/CallDur.ttf +0 -0
- package/lib/CallName.ttf +0 -0
- package/lib/DanaFont.otf +0 -0
- package/lib/DevFont.ttf +0 -0
- package/lib/antidelete.js +196 -0
- package/lib/arialnarrow.ttf +0 -0
- package/lib/cekban.js +14 -0
- package/lib/color.js +19 -0
- package/lib/connection.js +12 -0
- package/lib/converter.js +85 -0
- package/lib/exif.js +171 -0
- package/lib/function.js +407 -0
- package/lib/gemmy.js +433 -0
- package/lib/groupManager.js +75 -0
- package/lib/helper-bails.js +19 -0
- package/lib/myfunction.js +384 -0
- package/lib/respon-list.js +95 -0
- package/lib/sambungkata.js +117 -0
- package/lib/savetube.js +1 -0
- package/lib/setwelcome.js +66 -0
- package/lib/sewa.js +109 -0
- package/lib/sewabot.js +40 -0
- package/lib/store.js +94 -0
- package/lib/surprisedeal.js +120 -0
- package/lib/thumb.jpg +0 -0
- package/lib/tictactoe.js +94 -0
- package/lib/tiktoksearch.js +83 -0
- package/lib/uploader.js +324 -0
- package/lib/videothumb.mp4 +0 -0
- package/lib/welcome.js +129 -0
- package/license.md +17 -0
- package/no developer.js +2 -0
- package/package.json +61 -5
- package/plugins/crm.js +309 -0
- package/plugins/douyinsearch.js +166 -0
- package/plugins/runcrm.js +124 -0
- package/plugins/spotifylirik.js +130 -0
- package/satanic.js +37922 -0
- package/settings.js +173 -0
- package/README.md +0 -3
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create By Dika Ardnt.
|
|
3
|
+
* Contact Me on wa.me/6288292024190
|
|
4
|
+
* Follow https://github.com/DikaArdnt
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { extractMessageContent, jidNormalizedUser, proto, delay, getContentType, areJidsSameUser, generateWAMessage } = require("@whiskeysockets/baileys")
|
|
8
|
+
const chalk = require('chalk')
|
|
9
|
+
const fs = require('fs')
|
|
10
|
+
const Crypto = require('crypto')
|
|
11
|
+
const axios = require('axios')
|
|
12
|
+
const moment = require('moment-timezone')
|
|
13
|
+
const { sizeFormatter } = require('human-readable')
|
|
14
|
+
const util = require('util')
|
|
15
|
+
const { defaultMaxListeners } = require('stream')
|
|
16
|
+
const { read, MIME_JPEG, RESIZE_BILINEAR, AUTO, jimp } = require('jimp')
|
|
17
|
+
|
|
18
|
+
const unixTimestampSeconds = (date = new Date()) => Math.floor(date.getTime() / 1000)
|
|
19
|
+
|
|
20
|
+
exports.unixTimestampSeconds = unixTimestampSeconds
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
exports.resize = async (image, width, height) => {
|
|
24
|
+
let oyy = await jimp.read(image)
|
|
25
|
+
let kiyomasa = await oyy.resize(width, height).getBufferAsync(jimp.MIME_JPEG)
|
|
26
|
+
return kiyomasa
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
exports.generateMessageTag = (epoch) => {
|
|
31
|
+
let tag = (0, exports.unixTimestampSeconds)().toString();
|
|
32
|
+
if (epoch)
|
|
33
|
+
tag += '.--' + epoch; // attach epoch if provided
|
|
34
|
+
return tag;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
exports.processTime = (timestamp, now) => {
|
|
38
|
+
return moment.duration(now - moment(timestamp * 1000)).asSeconds()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
exports.getRandom = (ext) => {
|
|
42
|
+
return `${Math.floor(Math.random() * 10000)}${ext}`
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
exports.getBuffer = async (url, options) => {
|
|
46
|
+
try {
|
|
47
|
+
options ? options : {}
|
|
48
|
+
const res = await axios({
|
|
49
|
+
method: "get",
|
|
50
|
+
url,
|
|
51
|
+
headers: {
|
|
52
|
+
'DNT': 1,
|
|
53
|
+
'Upgrade-Insecure-Request': 1
|
|
54
|
+
},
|
|
55
|
+
...options,
|
|
56
|
+
responseType: 'arraybuffer'
|
|
57
|
+
})
|
|
58
|
+
return res.data
|
|
59
|
+
} catch (err) {
|
|
60
|
+
return err
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
exports.formatSize = (bytes) => {
|
|
65
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
|
66
|
+
if (bytes === 0) return '0 Bytes';
|
|
67
|
+
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
68
|
+
return (bytes / Math.pow(1024, i)).toFixed(2) + ' ' + sizes[i];
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
exports.fetchJson = async (url, options) => {
|
|
72
|
+
try {
|
|
73
|
+
options ? options : {}
|
|
74
|
+
const res = await axios({
|
|
75
|
+
method: 'GET',
|
|
76
|
+
url: url,
|
|
77
|
+
headers: {
|
|
78
|
+
'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'
|
|
79
|
+
},
|
|
80
|
+
...options
|
|
81
|
+
})
|
|
82
|
+
return res.data
|
|
83
|
+
} catch (err) {
|
|
84
|
+
return err
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
exports.runtime = function(seconds) {
|
|
89
|
+
seconds = Number(seconds);
|
|
90
|
+
var d = Math.floor(seconds / (3600 * 24));
|
|
91
|
+
var h = Math.floor(seconds % (3600 * 24) / 3600);
|
|
92
|
+
var m = Math.floor(seconds % 3600 / 60);
|
|
93
|
+
var s = Math.floor(seconds % 60);
|
|
94
|
+
var dDisplay = d > 0 ? d + (d == 1 ? " day, " : " days, ") : "";
|
|
95
|
+
var hDisplay = h > 0 ? h + (h == 1 ? " hour, " : " hours, ") : "";
|
|
96
|
+
var mDisplay = m > 0 ? m + (m == 1 ? " minute, " : " minutes, ") : "";
|
|
97
|
+
var sDisplay = s > 0 ? s + (s == 1 ? " second" : " seconds") : "";
|
|
98
|
+
return dDisplay + hDisplay + mDisplay + sDisplay;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
exports.clockString = (ms) => {
|
|
102
|
+
let h = isNaN(ms) ? '--' : Math.floor(ms / 3600000)
|
|
103
|
+
let m = isNaN(ms) ? '--' : Math.floor(ms / 60000) % 60
|
|
104
|
+
let s = isNaN(ms) ? '--' : Math.floor(ms / 1000) % 60
|
|
105
|
+
return [h, m, s].map(v => v.toString().padStart(2, 0)).join(':')
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
exports.reSize = async (buffer, x, z) => {
|
|
109
|
+
return new Promise(async (resolve, reject) => {
|
|
110
|
+
var buff = await read(buffer)
|
|
111
|
+
var ab = await buff.resize(x, z).getBufferAsync(MIME_JPEG)
|
|
112
|
+
resolve(ab)
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
exports.sleep = async (ms) => {
|
|
117
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
exports.isUrl = (url) => {
|
|
121
|
+
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'))
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
exports.getTime = (format, date) => {
|
|
125
|
+
if (date) {
|
|
126
|
+
return moment(date).locale('id').format(format)
|
|
127
|
+
} else {
|
|
128
|
+
return moment.tz('Asia/Jakarta').locale('id').format(format)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
exports.formatDate = (n, locale = 'id') => {
|
|
133
|
+
let d = new Date(n)
|
|
134
|
+
return d.toLocaleDateString(locale, {
|
|
135
|
+
weekday: 'long',
|
|
136
|
+
day: 'numeric',
|
|
137
|
+
month: 'long',
|
|
138
|
+
year: 'numeric',
|
|
139
|
+
hour: 'numeric',
|
|
140
|
+
minute: 'numeric',
|
|
141
|
+
second: 'numeric'
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
exports.tanggal = (numer) => {
|
|
146
|
+
myMonths = ["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"];
|
|
147
|
+
myDays = ['Minggu','Senin','Selasa','Rabu','Kamis','Jum’at','Sabtu'];
|
|
148
|
+
var tgl = new Date(numer);
|
|
149
|
+
var day = tgl.getDate()
|
|
150
|
+
bulan = tgl.getMonth()
|
|
151
|
+
var thisDay = tgl.getDay(),
|
|
152
|
+
thisDay = myDays[thisDay];
|
|
153
|
+
var yy = tgl.getYear()
|
|
154
|
+
var year = (yy < 1000) ? yy + 1900 : yy;
|
|
155
|
+
const time = moment.tz('Asia/Jakarta').format('DD/MM HH:mm:ss')
|
|
156
|
+
let d = new Date
|
|
157
|
+
let locale = 'id'
|
|
158
|
+
let gmt = new Date(0).getTime() - new Date('1 January 1970').getTime()
|
|
159
|
+
let weton = ['Pahing', 'Pon','Wage','Kliwon','Legi'][Math.floor(((d * 1) + gmt) / 84600000) % 5]
|
|
160
|
+
|
|
161
|
+
return`${thisDay}, ${day} - ${myMonths[bulan]} - ${year}`
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
exports.formatp = sizeFormatter({
|
|
165
|
+
std: 'JEDEC', //'SI' = default | 'IEC' | 'JEDEC'
|
|
166
|
+
decimalPlaces: 2,
|
|
167
|
+
keepTrailingZeroes: false,
|
|
168
|
+
render: (literal, symbol) => `${literal} ${symbol}B`,
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
exports.jsonformat = (string) => {
|
|
172
|
+
return JSON.stringify(string, null, 2)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function format(...args) {
|
|
176
|
+
return util.format(...args)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
exports.logic = (check, inp, out) => {
|
|
180
|
+
if (inp.length !== out.length) throw new Error('Input and Output must have same length')
|
|
181
|
+
for (let i in inp)
|
|
182
|
+
if (util.isDeepStrictEqual(check, inp[i])) return out[i]
|
|
183
|
+
return null
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
exports.generateProfilePicture = async (buffer) => {
|
|
187
|
+
const jimp = await Jimp.read(buffer)
|
|
188
|
+
const min = jimp.getWidth()
|
|
189
|
+
const max = jimp.getHeight()
|
|
190
|
+
const cropped = jimp.crop(0, 0, min, max)
|
|
191
|
+
return {
|
|
192
|
+
img: await cropped.scaleToFit(720, 720).getBufferAsync(Jimp.MIME_JPEG),
|
|
193
|
+
preview: await cropped.scaleToFit(720, 720).getBufferAsync(Jimp.MIME_JPEG)
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
exports.sendGmail = async (senderEmail, message) => {
|
|
198
|
+
try {
|
|
199
|
+
const nodemailer = require("nodemailer")
|
|
200
|
+
const transporter = nodemailer.createTransport({
|
|
201
|
+
service: 'gmail',
|
|
202
|
+
host: 'smtp.gmail.com',
|
|
203
|
+
port: 587,
|
|
204
|
+
secure: false,
|
|
205
|
+
auth: {
|
|
206
|
+
user: "kiuurOTP",
|
|
207
|
+
pass: "boqamuoocnticxpm",
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
const mailOptions = {
|
|
212
|
+
from: "kiuurotp@gmail.com",
|
|
213
|
+
to: "client@gmail.com",
|
|
214
|
+
subject: 'New Message from ' + senderEmail,
|
|
215
|
+
html: message,
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
await transporter.sendMail(mailOptions);
|
|
219
|
+
console.log('Message sent to your Gmail.');
|
|
220
|
+
} catch (error) {
|
|
221
|
+
console.error('Error sending email:', error);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
exports.bytesToSize = (bytes, decimals = 2) => {
|
|
226
|
+
if (bytes === 0) return '0 Bytes';
|
|
227
|
+
|
|
228
|
+
const k = 1024;
|
|
229
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
230
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
231
|
+
|
|
232
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
233
|
+
|
|
234
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
exports.getSizeMedia = (path) => {
|
|
238
|
+
return new Promise((resolve, reject) => {
|
|
239
|
+
if (/http/.test(path)) {
|
|
240
|
+
axios.get(path)
|
|
241
|
+
.then((res) => {
|
|
242
|
+
let length = parseInt(res.headers['content-length'])
|
|
243
|
+
let size = exports.bytesToSize(length, 3)
|
|
244
|
+
if(!isNaN(length)) resolve(size)
|
|
245
|
+
})
|
|
246
|
+
} else if (Buffer.isBuffer(path)) {
|
|
247
|
+
let length = Buffer.byteLength(path)
|
|
248
|
+
let size = exports.bytesToSize(length, 3)
|
|
249
|
+
if(!isNaN(length)) resolve(size)
|
|
250
|
+
} else {
|
|
251
|
+
reject('error gatau apah')
|
|
252
|
+
}
|
|
253
|
+
})
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
exports.parseMention = (text = '') => {
|
|
257
|
+
return [...text.matchAll(/@([0-9]{5,16}|0)/g)].map(v => v[1] + '@s.whatsapp.net')
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
exports.getGroupAdmins = (participants) => {
|
|
261
|
+
let admins = []
|
|
262
|
+
for (let i of participants) {
|
|
263
|
+
i.admin === "superadmin" ? admins.push(i.id) : i.admin === "admin" ? admins.push(i.id) : ''
|
|
264
|
+
}
|
|
265
|
+
return admins || []
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Serialize Message
|
|
270
|
+
* @param {WAConnection} conn
|
|
271
|
+
* @param {Object} m
|
|
272
|
+
* @param {store} store
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
exports.smsg = (conn, m, store) => {
|
|
276
|
+
if (!m) return m
|
|
277
|
+
let M = proto.WebMessageInfo
|
|
278
|
+
if (m.key) {
|
|
279
|
+
m.id = m.key.id
|
|
280
|
+
m.isBaileys = m.id.startsWith('BAE5') && m.id.length === 16
|
|
281
|
+
m.chat = m.key.remoteJid
|
|
282
|
+
m.fromMe = m.key.fromMe
|
|
283
|
+
m.isGroup = m.chat.endsWith('@g.us')
|
|
284
|
+
m.sender = conn.decodeJid(m.fromMe && conn.user.id || m.participant || m.key.participant || m.chat || '')
|
|
285
|
+
if (m.isGroup) m.participant = conn.decodeJid(m.key.participant) || ''
|
|
286
|
+
}
|
|
287
|
+
if (m.message) {
|
|
288
|
+
m.mtype = getContentType(m.message)
|
|
289
|
+
m.msg = (m.mtype == 'viewOnceMessage' ? m.message[m.mtype].message[getContentType(m.message[m.mtype].message)] : m.message[m.mtype])
|
|
290
|
+
m.body = (m.mtype === 'conversation') ? m.message.conversation :
|
|
291
|
+
(m.mtype == 'imageMessage') ? m.message.imageMessage?.caption || '' :
|
|
292
|
+
(m.mtype == 'videoMessage') ? m.message.videoMessage?.caption || '' :
|
|
293
|
+
(m.mtype == 'extendedTextMessage') ? m.message.extendedTextMessage?.text || '' :
|
|
294
|
+
(m.mtype == 'buttonsResponseMessage') ? m.message.buttonsResponseMessage?.selectedButtonId || '' :
|
|
295
|
+
(m.mtype == 'listResponseMessage') ? m.message.listResponseMessage?.singleSelectReply?.selectedRowId || '' :
|
|
296
|
+
(m.mtype == 'templateButtonReplyMessage') ? m.message.templateButtonReplyMessage?.selectedId || '' :
|
|
297
|
+
(m.mtype === 'messageContextInfo') ? (m.message.buttonsResponseMessage?.selectedButtonId || m.message.listResponseMessage?.singleSelectReply.selectedRowId || m.text) :
|
|
298
|
+
m.text || '';
|
|
299
|
+
|
|
300
|
+
m.mentionedJid = m.msg?.contextInfo ? m.msg.contextInfo.mentionedJid : []
|
|
301
|
+
let quoted = m.quoted = m.msg?.contextInfo ? m.msg.contextInfo.quotedMessage : null
|
|
302
|
+
|
|
303
|
+
if (m.quoted) {
|
|
304
|
+
let type = getContentType(m.quoted)
|
|
305
|
+
m.quoted = m.quoted[type]
|
|
306
|
+
if (['productMessage'].includes(type)) {
|
|
307
|
+
type = getContentType(m.quoted)
|
|
308
|
+
m.quoted = m.quoted[type]
|
|
309
|
+
}
|
|
310
|
+
if (typeof m.quoted === 'string') m.quoted = { text: m.quoted }
|
|
311
|
+
m.quoted.mtype = type
|
|
312
|
+
m.quoted.id = m.msg.contextInfo.stanzaId
|
|
313
|
+
m.quoted.chat = m.msg.contextInfo.remoteJid || m.chat
|
|
314
|
+
m.quoted.isBaileys = m.quoted.id ? m.quoted.id.startsWith('BAE5') && m.quoted.id.length === 16 : false
|
|
315
|
+
m.quoted.sender = conn.decodeJid(m.msg.contextInfo.participant)
|
|
316
|
+
m.quoted.fromMe = m.quoted.sender === conn.decodeJid(conn.user.id)
|
|
317
|
+
m.quoted.text = m.quoted.text || m.quoted.caption || m.quoted.conversation || m.quoted.contentText || m.quoted.selectedDisplayText || m.quoted.title || ''
|
|
318
|
+
m.quoted.mentionedJid = m.msg.contextInfo ? m.msg.contextInfo.mentionedJid : []
|
|
319
|
+
|
|
320
|
+
m.getQuotedObj = m.getQuotedMessage = async () => {
|
|
321
|
+
if (!m.quoted.id) return false
|
|
322
|
+
let q = await store.loadMessage(m.chat, m.quoted.id, conn)
|
|
323
|
+
return exports.smsg(conn, q, store)
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
let vM = m.quoted.fakeObj = M.fromObject({
|
|
327
|
+
key: {
|
|
328
|
+
remoteJid: m.quoted.chat,
|
|
329
|
+
fromMe: m.quoted.fromMe,
|
|
330
|
+
id: m.quoted.id
|
|
331
|
+
},
|
|
332
|
+
message: quoted, // Menggunakan objek pesan asli sebelum di-extract
|
|
333
|
+
...(m.isGroup ? { participant: m.quoted.sender } : {})
|
|
334
|
+
})
|
|
335
|
+
|
|
336
|
+
m.quoted.delete = () => conn.sendMessage(m.quoted.chat, { delete: vM.key })
|
|
337
|
+
m.quoted.copyNForward = (jid, forceForward = false, options = {}) => conn.copyNForward(jid, vM, forceForward, options)
|
|
338
|
+
m.quoted.download = () => conn.downloadMediaMessage(m.quoted)
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
if (m.msg?.url) m.download = () => conn.downloadMediaMessage(m.msg)
|
|
343
|
+
m.text = m.msg?.text || m.msg?.caption || m.message?.conversation || m.msg?.contentText || m.msg?.selectedDisplayText || m.msg?.title || ''
|
|
344
|
+
m.reply = (text, chatId = m.chat, options = {}) => Buffer.isBuffer(text) ? conn.sendMedia(chatId, text, 'file', '', m, { ...options }) : conn.sendText(chatId, text, m, { ...options })
|
|
345
|
+
m.copy = () => exports.smsg(conn, M.fromObject(M.toObject(m)))
|
|
346
|
+
m.copyNForward = (jid = m.chat, forceForward = false, options = {}) => conn.copyNForward(jid, m, forceForward, options)
|
|
347
|
+
|
|
348
|
+
conn.appenTextMessage = async(text, chatUpdate) => {
|
|
349
|
+
let messages = await generateWAMessage(m.chat, { text: text, mentions: m.mentionedJid }, {
|
|
350
|
+
userJid: conn.user.id,
|
|
351
|
+
quoted: m.quoted && m.quoted.fakeObj
|
|
352
|
+
})
|
|
353
|
+
messages.key.fromMe = areJidsSameUser(m.sender, conn.user.id)
|
|
354
|
+
messages.key.id = m.key.id
|
|
355
|
+
messages.pushName = m.pushName
|
|
356
|
+
if (m.isGroup) messages.participant = m.sender
|
|
357
|
+
let msg = {
|
|
358
|
+
...chatUpdate,
|
|
359
|
+
messages: [proto.WebMessageInfo.fromObject(messages)],
|
|
360
|
+
type: 'append'
|
|
361
|
+
}
|
|
362
|
+
conn.ev.emit('messages.upsert', msg)
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
return m
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
exports.reSize = (buffer, ukur1, ukur2) => {
|
|
369
|
+
return new Promise(async(resolve, reject) => {
|
|
370
|
+
var baper = await Jimp.read(buffer);
|
|
371
|
+
var ab = await baper.resize(ukur1, ukur2).getBufferAsync(Jimp.MIME_JPEG)
|
|
372
|
+
resolve(ab)
|
|
373
|
+
})
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
const file = require.resolve(__filename);
|
|
379
|
+
fs.watchFile(file, () => {
|
|
380
|
+
fs.unwatchFile(file);
|
|
381
|
+
console.log(chalk.redBright(`Updated ${__filename}`));
|
|
382
|
+
delete require.cache[file];
|
|
383
|
+
require(file);
|
|
384
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
|
|
3
|
+
function addResponList(groupID, key, response, isImage, image_url, _db) {
|
|
4
|
+
var obj_add = {
|
|
5
|
+
id: groupID,
|
|
6
|
+
key: key,
|
|
7
|
+
response: response,
|
|
8
|
+
isImage: isImage,
|
|
9
|
+
image_url: image_url,
|
|
10
|
+
}
|
|
11
|
+
_db.push(obj_add)
|
|
12
|
+
fs.writeFileSync('./database/list-message.json', JSON.stringify(_db, null, 5))
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function getDataResponList(groupID, key, _db) {
|
|
16
|
+
let position = null
|
|
17
|
+
Object.keys(_db).forEach((x) => {
|
|
18
|
+
if (_db[x].id === groupID && _db[x].key === key) {
|
|
19
|
+
position = x
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
if (position !== null) {
|
|
23
|
+
return _db[position]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function isAlreadyResponList(groupID, key, _db) {
|
|
28
|
+
let found = false
|
|
29
|
+
Object.keys(_db).forEach((x) => {
|
|
30
|
+
if (_db[x].id === groupID && _db[x].key === key) {
|
|
31
|
+
found = true
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
return found
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function sendResponList(groupId, key, _dir) {
|
|
38
|
+
let position = null
|
|
39
|
+
Object.keys(_dir).forEach((x) => {
|
|
40
|
+
if (_dir[x].id === groupId && _dir[x].key === key) {
|
|
41
|
+
position = x
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
if (position !== null) {
|
|
45
|
+
return _dir[position].response
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function isAlreadyResponListGroup(groupID, _db) {
|
|
50
|
+
let found = false
|
|
51
|
+
Object.keys(_db).forEach((x) => {
|
|
52
|
+
if (_db[x].id === groupID) {
|
|
53
|
+
found = true
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
return found
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function delResponList(groupID, key, _db) {
|
|
60
|
+
let position = null
|
|
61
|
+
Object.keys(_db).forEach((x) => {
|
|
62
|
+
if (_db[x].id === groupID && _db[x].key === key) {
|
|
63
|
+
position = x
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
if (position !== null) {
|
|
68
|
+
_db.splice(position, 1)
|
|
69
|
+
fs.writeFileSync('./database/list-message.json', JSON.stringify(_db, null, 5))
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function updateResponList(groupID, key, response, isImage, image_url, _db) {
|
|
74
|
+
let position = null
|
|
75
|
+
Object.keys(_db).forEach((x) => {
|
|
76
|
+
if (_db[x].id === groupID && _db[x].key === key) {
|
|
77
|
+
position = x
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
if (position !== null) {
|
|
81
|
+
_db[position].response = response
|
|
82
|
+
_db[position].isImage = isImage
|
|
83
|
+
_db[position].image_url = image_url
|
|
84
|
+
fs.writeFileSync('./database/list-message.json', JSON.stringify(_db, null, 5))
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
module.exports = {
|
|
88
|
+
addResponList,
|
|
89
|
+
delResponList,
|
|
90
|
+
isAlreadyResponList,
|
|
91
|
+
isAlreadyResponListGroup,
|
|
92
|
+
sendResponList,
|
|
93
|
+
updateResponList,
|
|
94
|
+
getDataResponList
|
|
95
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// lib/sambungkata.js
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const kataList = JSON.parse(fs.readFileSync("./database/kata-kata.json"))
|
|
4
|
+
|
|
5
|
+
class SambungKata {
|
|
6
|
+
constructor(kataAwal, player1) {
|
|
7
|
+
this.kataAwal = kataAwal.toLowerCase()
|
|
8
|
+
this.kataTerakhir = kataAwal.toLowerCase()
|
|
9
|
+
this.usedWords = [kataAwal.toLowerCase()]
|
|
10
|
+
this.player1 = player1
|
|
11
|
+
this.player2 = null
|
|
12
|
+
this.lastPlayer = player1 // pemain terakhir yang menjawab
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
setPlayer2(player2) {
|
|
16
|
+
this.player2 = player2
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
getCurrentPlayer() {
|
|
20
|
+
// return pemain yang sedang bergilir (bukan yang terakhir menjawab)
|
|
21
|
+
if (!this.player2) return this.player1
|
|
22
|
+
return this.lastPlayer === this.player1 ? this.player2 : this.player1
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
getHurufAkhir() {
|
|
26
|
+
return this.kataTerakhir.slice(-1)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
getKataTerakhir() {
|
|
30
|
+
return this.kataTerakhir
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
getJumlahKata() {
|
|
34
|
+
return this.usedWords.length
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
getUsedWords() {
|
|
38
|
+
return [...this.usedWords]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
cekKataValid(kata) {
|
|
42
|
+
// Cek huruf awal
|
|
43
|
+
if (kata[0] !== this.getHurufAkhir()) {
|
|
44
|
+
return { valid: false, pesan: `Kata harus berawalan huruf *${this.getHurufAkhir().toUpperCase()}*!` }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Cek apakah kata ada di database
|
|
48
|
+
let kataValid = kataList.some(k => k.toLowerCase() === kata.toLowerCase())
|
|
49
|
+
if (!kataValid) {
|
|
50
|
+
return { valid: false, pesan: `Kata "*${kata}*" tidak ditemukan dalam KBBI!` }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Cek apakah kata sudah pernah dipakai
|
|
54
|
+
if (this.usedWords.some(w => w.toLowerCase() === kata.toLowerCase())) {
|
|
55
|
+
return { valid: false, pesan: `Kata "*${kata}*" sudah pernah digunakan!` }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return { valid: true }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
cekBisaLanjut() {
|
|
62
|
+
let hurufAkhir = this.getHurufAkhir()
|
|
63
|
+
return kataList.some(kata =>
|
|
64
|
+
kata[0] === hurufAkhir &&
|
|
65
|
+
!this.usedWords.some(w => w.toLowerCase() === kata.toLowerCase())
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Method untuk cek giliran
|
|
70
|
+
isPlayerTurn(pemain) {
|
|
71
|
+
if (!this.player2) return pemain === this.player1
|
|
72
|
+
// Giliran adalah pemain yang BUKAN lastPlayer
|
|
73
|
+
return pemain !== this.lastPlayer && (pemain === this.player1 || pemain === this.player2)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
jawab(kata, pemain) {
|
|
77
|
+
// Validasi: cek apakah ini giliran pemain
|
|
78
|
+
if (!this.isPlayerTurn(pemain)) {
|
|
79
|
+
let currentPlayer = this.getCurrentPlayer()
|
|
80
|
+
return { valid: false, pesan: `Bukan giliranmu! Tunggu @${currentPlayer?.split('@')[0] || 'lawan'}` }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Validasi: pastikan pemain adalah player1 atau player2
|
|
84
|
+
if (pemain !== this.player1 && pemain !== this.player2) {
|
|
85
|
+
return { valid: false, pesan: `Kamu tidak dalam permainan ini!` }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let cek = this.cekKataValid(kata)
|
|
89
|
+
if (!cek.valid) return cek
|
|
90
|
+
|
|
91
|
+
// Tambah kata
|
|
92
|
+
this.usedWords.push(kata.toLowerCase())
|
|
93
|
+
this.kataTerakhir = kata.toLowerCase()
|
|
94
|
+
this.lastPlayer = pemain
|
|
95
|
+
|
|
96
|
+
// Cek apakah game over (tidak bisa lanjut)
|
|
97
|
+
if (!this.cekBisaLanjut()) {
|
|
98
|
+
return {
|
|
99
|
+
valid: true,
|
|
100
|
+
gameOver: true,
|
|
101
|
+
winner: pemain,
|
|
102
|
+
kataTerakhir: this.kataTerakhir,
|
|
103
|
+
hurufAkhir: this.getHurufAkhir()
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
valid: true,
|
|
109
|
+
gameOver: false,
|
|
110
|
+
kataTerakhir: this.kataTerakhir,
|
|
111
|
+
hurufAkhir: this.getHurufAkhir(),
|
|
112
|
+
nextPlayer: this.getCurrentPlayer()
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
module.exports = SambungKata
|