jsdecryptor 4.0.3
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/Database/database.js +446 -0
- package/Database/migration.js +327 -0
- package/Database/pgSync.js +229 -0
- package/Database/settingsStore.js +305 -0
- package/config.js +32 -0
- package/dave.js +3063 -0
- package/davelib/antibadword.js +278 -0
- package/davelib/antilink.js +88 -0
- package/davelib/antilinkHelper.js +48 -0
- package/davelib/botConfig.js +71 -0
- package/davelib/connect4.js +111 -0
- package/davelib/converter.js +89 -0
- package/davelib/dicegame.js +114 -0
- package/davelib/exif.js +138 -0
- package/davelib/fakeContact.js +85 -0
- package/davelib/fontStyles.js +237 -0
- package/davelib/greetings.js +47 -0
- package/davelib/id.js +11 -0
- package/davelib/index.js +577 -0
- package/davelib/isAdmin.js +32 -0
- package/davelib/isBanned.js +12 -0
- package/davelib/isOwner.js +15 -0
- package/davelib/lightweight_store.js +169 -0
- package/davelib/messageConfig.js +15 -0
- package/davelib/messageHandler.js +87 -0
- package/davelib/myfunc.js +379 -0
- package/davelib/myfunc2.js +170 -0
- package/davelib/reactions.js +180 -0
- package/davelib/server.html +563 -0
- package/davelib/sticker.js +208 -0
- package/davelib/tempCleanup.js +53 -0
- package/davelib/tictactoe.js +104 -0
- package/davelib/uploadImage.js +100 -0
- package/davelib/uploader.js +110 -0
- package/davelib/welcome.js +100 -0
- package/davelib/wordchain.js +121 -0
- package/daveset.js +16 -0
- package/davexcore/ai/ai.js +100 -0
- package/davexcore/ai/aiGpt4.js +59 -0
- package/davexcore/ai/aimodels.js +284 -0
- package/davexcore/ai/aivideo.js +31 -0
- package/davexcore/ai/analyze.js +233 -0
- package/davexcore/ai/bard.js +101 -0
- package/davexcore/ai/bird.js +101 -0
- package/davexcore/ai/blackbox.js +30 -0
- package/davexcore/ai/character.js +80 -0
- package/davexcore/ai/copilot.js +58 -0
- package/davexcore/ai/dalle.js +39 -0
- package/davexcore/ai/davex.js +50 -0
- package/davexcore/ai/deepseek.js +96 -0
- package/davexcore/ai/grok.js +67 -0
- package/davexcore/ai/imagine.js +89 -0
- package/davexcore/ai/meta.js +82 -0
- package/davexcore/ai/mistral.js +101 -0
- package/davexcore/ai/perplexity.js +95 -0
- package/davexcore/ai/sora.js +44 -0
- package/davexcore/ai/speechwriter.js +46 -0
- package/davexcore/ai/vision.js +244 -0
- package/davexcore/ai/wormgpt.js +56 -0
- package/davexcore/anti/antiaudio.js +106 -0
- package/davexcore/anti/antibadword.js +313 -0
- package/davexcore/anti/antibug.js +156 -0
- package/davexcore/anti/anticall.js +219 -0
- package/davexcore/anti/antichart.js +280 -0
- package/davexcore/anti/antidelete.js +673 -0
- package/davexcore/anti/antideletestatus.js +535 -0
- package/davexcore/anti/antidemote.js +352 -0
- package/davexcore/anti/antidocument.js +105 -0
- package/davexcore/anti/antiedit.js +410 -0
- package/davexcore/anti/antifiles.js +109 -0
- package/davexcore/anti/antigroupmention.js +206 -0
- package/davexcore/anti/antiimage.js +105 -0
- package/davexcore/anti/antikick.js +125 -0
- package/davexcore/anti/antilink.js +237 -0
- package/davexcore/anti/antimention.js +143 -0
- package/davexcore/anti/antipromote.js +320 -0
- package/davexcore/anti/antisticker.js +105 -0
- package/davexcore/anti/antitag.js +191 -0
- package/davexcore/anti/antivideo.js +105 -0
- package/davexcore/anti/antiviewonce.js +396 -0
- package/davexcore/anti/groupanticall.js +262 -0
- package/davexcore/anti/mention.js +242 -0
- package/davexcore/automation/alwaysonline.js +226 -0
- package/davexcore/automation/autoReadReciepts.js +96 -0
- package/davexcore/automation/autoread.js +104 -0
- package/davexcore/automation/autorecording.js +197 -0
- package/davexcore/automation/autostatus.js +317 -0
- package/davexcore/automation/autotyping.js +197 -0
- package/davexcore/automation/chatbot.js +444 -0
- package/davexcore/automation/chatmanage.js +199 -0
- package/davexcore/automation/devReact.js +43 -0
- package/davexcore/automation/goodbye.js +181 -0
- package/davexcore/automation/greetings.js +154 -0
- package/davexcore/automation/welcome.js +187 -0
- package/davexcore/downloads/apk.js +157 -0
- package/davexcore/downloads/facebook.js +94 -0
- package/davexcore/downloads/gitclone.js +137 -0
- package/davexcore/downloads/igs.js +333 -0
- package/davexcore/downloads/instagram.js +133 -0
- package/davexcore/downloads/mediafire.js +144 -0
- package/davexcore/downloads/pinterest.js +38 -0
- package/davexcore/downloads/play.js +158 -0
- package/davexcore/downloads/saveStatus.js +3 -0
- package/davexcore/downloads/song.js +135 -0
- package/davexcore/downloads/spotify.js +133 -0
- package/davexcore/downloads/tiktok.js +167 -0
- package/davexcore/downloads/tiktokaudio.js +158 -0
- package/davexcore/downloads/video.js +188 -0
- package/davexcore/downloads/ytdl.js +252 -0
- package/davexcore/downloads/ytdocplay.js +130 -0
- package/davexcore/downloads/ytdocvideo.js +95 -0
- package/davexcore/downloads/yts.js +64 -0
- package/davexcore/games/connect4.js +267 -0
- package/davexcore/games/dice.js +286 -0
- package/davexcore/games/eightball.js +24 -0
- package/davexcore/games/hangman.js +60 -0
- package/davexcore/games/rps.js +25 -0
- package/davexcore/games/ship.js +36 -0
- package/davexcore/games/slot.js +21 -0
- package/davexcore/games/tictactoe.js +263 -0
- package/davexcore/games/trivia.js +46 -0
- package/davexcore/games/wordchain.js +242 -0
- package/davexcore/group/addmember.js +101 -0
- package/davexcore/group/ban.js +63 -0
- package/davexcore/group/blockUnblock.js +177 -0
- package/davexcore/group/clear.js +196 -0
- package/davexcore/group/creategroup.js +43 -0
- package/davexcore/group/demote.js +115 -0
- package/davexcore/group/disappear.js +67 -0
- package/davexcore/group/groupinfo.js +167 -0
- package/davexcore/group/groupmanage.js +133 -0
- package/davexcore/group/hidetag.js +108 -0
- package/davexcore/group/joinrequests.js +145 -0
- package/davexcore/group/kick.js +92 -0
- package/davexcore/group/kickall.js +63 -0
- package/davexcore/group/leave.js +38 -0
- package/davexcore/group/linkgroup.js +63 -0
- package/davexcore/group/mute.js +57 -0
- package/davexcore/group/online.js +117 -0
- package/davexcore/group/pmblocker.js +65 -0
- package/davexcore/group/promote.js +93 -0
- package/davexcore/group/resetlink.js +57 -0
- package/davexcore/group/staff.js +99 -0
- package/davexcore/group/tag.js +111 -0
- package/davexcore/group/tagadmins.js +88 -0
- package/davexcore/group/tagall.js +99 -0
- package/davexcore/group/tagnotadmin.js +92 -0
- package/davexcore/group/topmembers.js +202 -0
- package/davexcore/group/unban.js +64 -0
- package/davexcore/group/unmute.js +45 -0
- package/davexcore/group/warn.js +83 -0
- package/davexcore/group/warnings.js +26 -0
- package/davexcore/media/anime.js +130 -0
- package/davexcore/media/attp.js +127 -0
- package/davexcore/media/design.js +52 -0
- package/davexcore/media/emojimix.js +105 -0
- package/davexcore/media/getpp.js +108 -0
- package/davexcore/media/image.js +87 -0
- package/davexcore/media/imageedit.js +329 -0
- package/davexcore/media/img-blur.js +70 -0
- package/davexcore/media/meme.js +35 -0
- package/davexcore/media/pies.js +53 -0
- package/davexcore/media/quotesticker.js +153 -0
- package/davexcore/media/remini.js +126 -0
- package/davexcore/media/removebg.js +114 -0
- package/davexcore/media/setpp.js +65 -0
- package/davexcore/media/shazam.js +251 -0
- package/davexcore/media/simage.js +74 -0
- package/davexcore/media/sticker.js +134 -0
- package/davexcore/media/stickercrop.js +133 -0
- package/davexcore/media/stickertelegram.js +133 -0
- package/davexcore/media/take.js +76 -0
- package/davexcore/media/textmaker.js +106 -0
- package/davexcore/media/toAudio.js +180 -0
- package/davexcore/media/togif.js +33 -0
- package/davexcore/media/toimg.js +26 -0
- package/davexcore/media/tomp4.js +34 -0
- package/davexcore/media/tostatus.js +160 -0
- package/davexcore/media/tts.js +47 -0
- package/davexcore/media/viewonce.js +59 -0
- package/davexcore/media/vn.js +67 -0
- package/davexcore/media/vv2.js +3 -0
- package/davexcore/media/wallpaper.js +89 -0
- package/davexcore/media/wasted.js +57 -0
- package/davexcore/misc/compliment.js +93 -0
- package/davexcore/misc/dare.js +47 -0
- package/davexcore/misc/fact.js +14 -0
- package/davexcore/misc/flirt.js +26 -0
- package/davexcore/misc/goodnight.js +33 -0
- package/davexcore/misc/insult.js +281 -0
- package/davexcore/misc/joke.js +66 -0
- package/davexcore/misc/misc.js +200 -0
- package/davexcore/misc/quote.js +22 -0
- package/davexcore/misc/roseday.js +24 -0
- package/davexcore/misc/shayari.js +62 -0
- package/davexcore/misc/simp.js +47 -0
- package/davexcore/misc/stupid.js +51 -0
- package/davexcore/misc/truth.js +146 -0
- package/davexcore/owner/alive.js +67 -0
- package/davexcore/owner/bio.js +49 -0
- package/davexcore/owner/broadcast.js +74 -0
- package/davexcore/owner/chanel.js +79 -0
- package/davexcore/owner/channelid.js +50 -0
- package/davexcore/owner/clearsession.js +86 -0
- package/davexcore/owner/help.js +649 -0
- package/davexcore/owner/hijack.js +69 -0
- package/davexcore/owner/menuManage.js +173 -0
- package/davexcore/owner/menuSettings.js +1 -0
- package/davexcore/owner/owner.js +17 -0
- package/davexcore/owner/pair.js +160 -0
- package/davexcore/owner/pinchat.js +44 -0
- package/davexcore/owner/ping.js +65 -0
- package/davexcore/owner/profilepic.js +61 -0
- package/davexcore/owner/resetmenuimage.js +16 -0
- package/davexcore/owner/setGroupStatus.js +315 -0
- package/davexcore/owner/setbotconfig.js +306 -0
- package/davexcore/owner/setfont.js +79 -0
- package/davexcore/owner/setowner.js +144 -0
- package/davexcore/owner/setprefix.js +131 -0
- package/davexcore/owner/settings.js +98 -0
- package/davexcore/owner/startupwelcome.js +94 -0
- package/davexcore/owner/sudo.js +138 -0
- package/davexcore/owner/update.js +282 -0
- package/davexcore/tmp/1772020249097.jpg +0 -0
- package/davexcore/utility/bible.js +239 -0
- package/davexcore/utility/cleartmp.js +107 -0
- package/davexcore/utility/delete.js +182 -0
- package/davexcore/utility/encrypt.js +99 -0
- package/davexcore/utility/ethicalhacking.js +108 -0
- package/davexcore/utility/fetch.js +127 -0
- package/davexcore/utility/github.js +85 -0
- package/davexcore/utility/google.js +79 -0
- package/davexcore/utility/join.js +52 -0
- package/davexcore/utility/lastseen.js +67 -0
- package/davexcore/utility/location.js +106 -0
- package/davexcore/utility/lyrics.js +54 -0
- package/davexcore/utility/movie.js +66 -0
- package/davexcore/utility/news.js +37 -0
- package/davexcore/utility/sports.js +403 -0
- package/davexcore/utility/ss.js +63 -0
- package/davexcore/utility/tinyurl.js +83 -0
- package/davexcore/utility/translate.js +101 -0
- package/davexcore/utility/url.js +112 -0
- package/davexcore/utility/vcf.js +84 -0
- package/davexcore/utility/weather.js +162 -0
- package/index.js +994 -0
- package/package.json +64 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
const crypto = require('crypto')
|
|
4
|
+
const { spawn } = require('child_process')
|
|
5
|
+
const { fileTypeFromBuffer } = require('file-type')
|
|
6
|
+
const webp = require('node-webpmux')
|
|
7
|
+
const fetch = require('node-fetch')
|
|
8
|
+
const ffmpeg = require('fluent-ffmpeg')
|
|
9
|
+
const { exec } = require('child_process')
|
|
10
|
+
const { promisify } = require('util')
|
|
11
|
+
const execAsync = promisify(exec)
|
|
12
|
+
const { writeExifImg } = require('./exif')
|
|
13
|
+
|
|
14
|
+
const tmp = path.join(__dirname, '../tmp')
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Image to Sticker
|
|
18
|
+
* @param {Buffer} img Image Buffer
|
|
19
|
+
* @param {String} url Image URL
|
|
20
|
+
*/
|
|
21
|
+
function sticker2(img, url) {
|
|
22
|
+
return new Promise(async (resolve, reject) => {
|
|
23
|
+
try {
|
|
24
|
+
if (url) {
|
|
25
|
+
let res = await fetch(url)
|
|
26
|
+
if (res.status !== 200) throw await res.text()
|
|
27
|
+
img = await res.buffer()
|
|
28
|
+
}
|
|
29
|
+
let inp = path.join(tmp, +new Date + '.jpeg')
|
|
30
|
+
await fs.promises.writeFile(inp, img)
|
|
31
|
+
let ff = spawn('ffmpeg', [
|
|
32
|
+
'-y',
|
|
33
|
+
'-i', inp,
|
|
34
|
+
'-vf', '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',
|
|
35
|
+
'-f', 'png',
|
|
36
|
+
'-'
|
|
37
|
+
])
|
|
38
|
+
ff.on('error', reject)
|
|
39
|
+
ff.on('close', async () => {
|
|
40
|
+
await fs.promises.unlink(inp)
|
|
41
|
+
})
|
|
42
|
+
let bufs = []
|
|
43
|
+
const [_spawnprocess, ..._spawnargs] = [...(module.exports.support.gm ? ['gm'] : module.exports.magick ? ['magick'] : []), 'convert', 'png:-', 'webp:-']
|
|
44
|
+
let im = spawn(_spawnprocess, _spawnargs)
|
|
45
|
+
im.on('error', e => conn.reply(m.chat, util.format(e), m))
|
|
46
|
+
im.stdout.on('data', chunk => bufs.push(chunk))
|
|
47
|
+
ff.stdout.pipe(im.stdin)
|
|
48
|
+
im.on('exit', () => {
|
|
49
|
+
resolve(Buffer.concat(bufs))
|
|
50
|
+
})
|
|
51
|
+
} catch (e) {
|
|
52
|
+
reject(e)
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Image/Video to Sticker
|
|
59
|
+
* @param {Buffer} img Image/Video Buffer
|
|
60
|
+
* @param {String} url Image/Video URL
|
|
61
|
+
* @param {String} packname EXIF Packname
|
|
62
|
+
* @param {String} author EXIF Author
|
|
63
|
+
*/
|
|
64
|
+
async function sticker3(img, url, packname, author) {
|
|
65
|
+
url = url ? url : await uploadFile(img)
|
|
66
|
+
let res = await fetch('https://api.xteam.xyz/sticker/wm?' + new URLSearchParams(Object.entries({
|
|
67
|
+
url,
|
|
68
|
+
packname,
|
|
69
|
+
author
|
|
70
|
+
})))
|
|
71
|
+
return await res.buffer()
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Image to Sticker
|
|
76
|
+
* @param {Buffer} img Image/Video Buffer
|
|
77
|
+
* @param {String} url Image/Video URL
|
|
78
|
+
*/
|
|
79
|
+
async function sticker4(img, url) {
|
|
80
|
+
if (url) {
|
|
81
|
+
let res = await fetch(url)
|
|
82
|
+
if (res.status !== 200) throw await res.text()
|
|
83
|
+
img = await res.buffer()
|
|
84
|
+
}
|
|
85
|
+
return await ffmpeg(img, [
|
|
86
|
+
'-vf', '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'
|
|
87
|
+
], 'jpeg', 'webp')
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async function sticker5(img, url, packname, author, categories = [''], extra = {}) {
|
|
91
|
+
const { Sticker } = await import('wa-sticker-formatter')
|
|
92
|
+
const stickerMetadata = {
|
|
93
|
+
type: 'default',
|
|
94
|
+
pack: packname,
|
|
95
|
+
author,
|
|
96
|
+
categories,
|
|
97
|
+
...extra
|
|
98
|
+
}
|
|
99
|
+
return (new Sticker(img ? img : url, stickerMetadata)).toBuffer()
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Convert using fluent-ffmpeg
|
|
104
|
+
* @param {string} img
|
|
105
|
+
* @param {string} url
|
|
106
|
+
*/
|
|
107
|
+
function sticker6(img, url) {
|
|
108
|
+
return new Promise(async (resolve, reject) => {
|
|
109
|
+
if (url) {
|
|
110
|
+
let res = await fetch(url)
|
|
111
|
+
if (res.status !== 200) throw await res.text()
|
|
112
|
+
img = await res.buffer()
|
|
113
|
+
}
|
|
114
|
+
const type = await fileTypeFromBuffer(img) || {
|
|
115
|
+
mime: 'application/octet-stream',
|
|
116
|
+
ext: 'bin'
|
|
117
|
+
}
|
|
118
|
+
if (type.ext == 'bin') reject(img)
|
|
119
|
+
const tmp = path.join(__dirname, `../tmp/${+ new Date()}.${type.ext}`)
|
|
120
|
+
const out = path.join(tmp + '.webp')
|
|
121
|
+
await fs.promises.writeFile(tmp, img)
|
|
122
|
+
// https://github.com/MhankBarBar/termux-wabot/blob/main/index.js#L313#L368
|
|
123
|
+
let Fffmpeg = /video/i.test(type.mime) ? fluent_ffmpeg(tmp).inputFormat(type.ext) : fluent_ffmpeg(tmp).input(tmp)
|
|
124
|
+
Fffmpeg
|
|
125
|
+
.on('error', function (err) {
|
|
126
|
+
console.error(err)
|
|
127
|
+
fs.promises.unlink(tmp)
|
|
128
|
+
reject(img)
|
|
129
|
+
})
|
|
130
|
+
.on('end', async function () {
|
|
131
|
+
fs.promises.unlink(tmp)
|
|
132
|
+
resolve(await fs.promises.readFile(out))
|
|
133
|
+
})
|
|
134
|
+
.addOutputOptions([
|
|
135
|
+
`-vcodec`, `libwebp`, `-vf`,
|
|
136
|
+
`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`
|
|
137
|
+
])
|
|
138
|
+
.toFormat('webp')
|
|
139
|
+
.save(out)
|
|
140
|
+
})
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Add WhatsApp JSON Exif Metadata
|
|
144
|
+
* Taken from https://github.com/pedroslopez/whatsapp-web.js/pull/527/files
|
|
145
|
+
* @param {Buffer} webpSticker
|
|
146
|
+
* @param {String} packname
|
|
147
|
+
* @param {String} author
|
|
148
|
+
* @param {String} categories
|
|
149
|
+
* @param {Object} extra
|
|
150
|
+
* @returns
|
|
151
|
+
*/
|
|
152
|
+
async function addExif(webpSticker, packname, author, categories = [''], extra = {}) {
|
|
153
|
+
const img = new webp.Image();
|
|
154
|
+
const stickerPackId = crypto.randomBytes(32).toString('hex');
|
|
155
|
+
const json = { 'sticker-pack-id': stickerPackId, 'sticker-pack-name': packname, 'sticker-pack-publisher': author, 'emojis': categories, ...extra };
|
|
156
|
+
let 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]);
|
|
157
|
+
let jsonBuffer = Buffer.from(JSON.stringify(json), 'utf8');
|
|
158
|
+
let exif = Buffer.concat([exifAttr, jsonBuffer]);
|
|
159
|
+
exif.writeUIntLE(jsonBuffer.length, 14, 4);
|
|
160
|
+
await img.load(webpSticker)
|
|
161
|
+
img.exif = exif
|
|
162
|
+
return await img.save(null)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Convert media to WebP and add metadata
|
|
167
|
+
* @param {Buffer} inputBuffer Image Buffer
|
|
168
|
+
* @param {String} url Image URL
|
|
169
|
+
* @param {String} packname EXIF Packname
|
|
170
|
+
* @param {String} author EXIF Author
|
|
171
|
+
*/
|
|
172
|
+
async function sticker(isImage, url, packname, author) {
|
|
173
|
+
try {
|
|
174
|
+
const response = await fetch(url);
|
|
175
|
+
const buffer = await response.buffer();
|
|
176
|
+
|
|
177
|
+
// Create sticker with metadata
|
|
178
|
+
const stickerBuffer = await writeExifImg(buffer, {
|
|
179
|
+
packname: packname || 'WhatsApp Bot',
|
|
180
|
+
author: author || '@bot'
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
return stickerBuffer;
|
|
184
|
+
} catch (error) {
|
|
185
|
+
console.error('Error in sticker creation:', error);
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const support = {
|
|
191
|
+
ffmpeg: true,
|
|
192
|
+
ffprobe: true,
|
|
193
|
+
ffmpegWebp: true,
|
|
194
|
+
convert: true,
|
|
195
|
+
magick: false,
|
|
196
|
+
gm: false,
|
|
197
|
+
find: false
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
module.exports = {
|
|
201
|
+
sticker,
|
|
202
|
+
sticker2,
|
|
203
|
+
sticker3,
|
|
204
|
+
sticker4,
|
|
205
|
+
sticker6,
|
|
206
|
+
addExif,
|
|
207
|
+
support
|
|
208
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
// Utility for cleaning temp files
|
|
5
|
+
function cleanupTempFiles() {
|
|
6
|
+
const tempDir = path.join(process.cwd(), 'temp');
|
|
7
|
+
|
|
8
|
+
if (!fs.existsSync(tempDir)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
fs.readdir(tempDir, (err, files) => {
|
|
13
|
+
if (err) {
|
|
14
|
+
console.error('Error reading temp directory:', err);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let cleanedCount = 0;
|
|
19
|
+
const now = Date.now();
|
|
20
|
+
const maxAge = 3 * 60 * 60 * 1000; // 3 hours
|
|
21
|
+
|
|
22
|
+
files.forEach(file => {
|
|
23
|
+
const filePath = path.join(tempDir, file);
|
|
24
|
+
|
|
25
|
+
fs.stat(filePath, (err, stats) => {
|
|
26
|
+
if (err) return;
|
|
27
|
+
|
|
28
|
+
// Delete files older than 3 hours
|
|
29
|
+
if (now - stats.mtimeMs > maxAge) {
|
|
30
|
+
fs.unlink(filePath, (err) => {
|
|
31
|
+
if (!err) {
|
|
32
|
+
cleanedCount++;
|
|
33
|
+
console.log(`🧹 Cleaned temp file: ${file}`);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
if (cleanedCount > 0) {
|
|
41
|
+
console.log(`🧹 Cleaned ${cleanedCount} temp files`);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Cleanup on startup
|
|
47
|
+
cleanupTempFiles();
|
|
48
|
+
|
|
49
|
+
// Cleanup every hour
|
|
50
|
+
setInterval(cleanupTempFiles, 60 * 60 * 1000);
|
|
51
|
+
|
|
52
|
+
module.exports = { cleanupTempFiles };
|
|
53
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
class TicTacToe {
|
|
2
|
+
constructor(playerX = 'X', playerO = 'O') {
|
|
3
|
+
this.playerX = playerX;
|
|
4
|
+
this.playerO = playerO;
|
|
5
|
+
this._isOTurn = false;
|
|
6
|
+
this._xMoves = 0;
|
|
7
|
+
this._oMoves = 0;
|
|
8
|
+
this.turns = 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
get board() {
|
|
12
|
+
return this._xMoves | this._oMoves;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get currentTurn() {
|
|
16
|
+
return this._isOTurn ? this.playerO : this.playerX;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get winner() {
|
|
20
|
+
const winningPatterns = [
|
|
21
|
+
0b111000000, 0b000111000, 0b000000111,
|
|
22
|
+
0b100100100, 0b010010010, 0b001001001,
|
|
23
|
+
0b100010001, 0b001010100
|
|
24
|
+
];
|
|
25
|
+
for (let pattern of winningPatterns) {
|
|
26
|
+
if ((this._xMoves & pattern) === pattern) return this.playerX;
|
|
27
|
+
if ((this._oMoves & pattern) === pattern) return this.playerO;
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get isDraw() {
|
|
33
|
+
return this.turns === 9 && !this.winner;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
turn(isO, pos) {
|
|
37
|
+
if (this.winner || this.isDraw) return false;
|
|
38
|
+
if (pos < 0 || pos > 8) return false;
|
|
39
|
+
if (this.board & (1 << pos)) return false;
|
|
40
|
+
if (isO !== this._isOTurn) return false;
|
|
41
|
+
|
|
42
|
+
const move = 1 << pos;
|
|
43
|
+
if (this._isOTurn) {
|
|
44
|
+
this._oMoves |= move;
|
|
45
|
+
} else {
|
|
46
|
+
this._xMoves |= move;
|
|
47
|
+
}
|
|
48
|
+
this._isOTurn = !this._isOTurn;
|
|
49
|
+
this.turns++;
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
getAvailableMoves() {
|
|
54
|
+
const moves = [];
|
|
55
|
+
for (let i = 0; i < 9; i++) {
|
|
56
|
+
if (!(this.board & (1 << i))) moves.push(i);
|
|
57
|
+
}
|
|
58
|
+
return moves;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
render() {
|
|
62
|
+
return [...Array(9)].map((_, i) => {
|
|
63
|
+
const bit = 1 << i;
|
|
64
|
+
if (this._xMoves & bit) return 'X';
|
|
65
|
+
if (this._oMoves & bit) return 'O';
|
|
66
|
+
return String(i + 1);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
findBestMove() {
|
|
71
|
+
const available = this.getAvailableMoves();
|
|
72
|
+
if (available.length === 0) return -1;
|
|
73
|
+
|
|
74
|
+
const winPatterns = [
|
|
75
|
+
[0,1,2],[3,4,5],[6,7,8],
|
|
76
|
+
[0,3,6],[1,4,7],[2,5,8],
|
|
77
|
+
[0,4,8],[2,4,6]
|
|
78
|
+
];
|
|
79
|
+
const board = this.render();
|
|
80
|
+
const aiSymbol = this._isOTurn ? 'O' : 'X';
|
|
81
|
+
const humanSymbol = this._isOTurn ? 'X' : 'O';
|
|
82
|
+
|
|
83
|
+
for (const pattern of winPatterns) {
|
|
84
|
+
const cells = pattern.map(i => board[i]);
|
|
85
|
+
const aiCount = cells.filter(c => c === aiSymbol).length;
|
|
86
|
+
const emptyIdx = pattern.find(i => board[i] !== 'X' && board[i] !== 'O');
|
|
87
|
+
if (aiCount === 2 && emptyIdx !== undefined) return emptyIdx;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
for (const pattern of winPatterns) {
|
|
91
|
+
const cells = pattern.map(i => board[i]);
|
|
92
|
+
const humanCount = cells.filter(c => c === humanSymbol).length;
|
|
93
|
+
const emptyIdx = pattern.find(i => board[i] !== 'X' && board[i] !== 'O');
|
|
94
|
+
if (humanCount === 2 && emptyIdx !== undefined) return emptyIdx;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (available.includes(4)) return 4;
|
|
98
|
+
const corners = [0, 2, 6, 8].filter(c => available.includes(c));
|
|
99
|
+
if (corners.length > 0) return corners[Math.floor(Math.random() * corners.length)];
|
|
100
|
+
return available[Math.floor(Math.random() * available.length)];
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
module.exports = TicTacToe;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
const fetch = require('node-fetch');
|
|
2
|
+
const FormData = require('form-data');
|
|
3
|
+
const FileType = require('file-type');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Upload file to qu.ax
|
|
9
|
+
* Supported mimetypes:
|
|
10
|
+
* - `image/jpeg`
|
|
11
|
+
* - `image/jpg`
|
|
12
|
+
* - `image/png`
|
|
13
|
+
* @param {Buffer} buffer File Buffer
|
|
14
|
+
* @return {Promise<string>}
|
|
15
|
+
*/
|
|
16
|
+
async function uploadImage(buffer) {
|
|
17
|
+
try {
|
|
18
|
+
// Create temp directory if it doesn't exist
|
|
19
|
+
const tmpDir = path.join(process.cwd(), 'tmp');
|
|
20
|
+
if (!fs.existsSync(tmpDir)) {
|
|
21
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Get file type
|
|
25
|
+
const fileType = await FileType.fromBuffer(buffer);
|
|
26
|
+
const { ext, mime } = fileType || { ext: 'png', mime: 'image/png' };
|
|
27
|
+
const tempFile = path.join(tmpDir, `temp_${Date.now()}.${ext}`);
|
|
28
|
+
|
|
29
|
+
// Save buffer to temp file
|
|
30
|
+
fs.writeFileSync(tempFile, buffer);
|
|
31
|
+
|
|
32
|
+
// Create form data
|
|
33
|
+
const form = new FormData();
|
|
34
|
+
form.append('files[]', fs.createReadStream(tempFile));
|
|
35
|
+
|
|
36
|
+
// Upload to qu.ax
|
|
37
|
+
const response = await fetch('https://qu.ax/upload.php', {
|
|
38
|
+
method: 'POST',
|
|
39
|
+
body: form,
|
|
40
|
+
headers: form.getHeaders()
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Clean up temp file
|
|
44
|
+
fs.unlinkSync(tempFile);
|
|
45
|
+
|
|
46
|
+
const result = await response.json();
|
|
47
|
+
if (result && result.success) {
|
|
48
|
+
return result.files[0].url;
|
|
49
|
+
} else {
|
|
50
|
+
// Fallback to telegraph if qu.ax fails
|
|
51
|
+
const telegraphForm = new FormData();
|
|
52
|
+
telegraphForm.append('file', buffer, {
|
|
53
|
+
filename: `upload.${ext}`,
|
|
54
|
+
contentType: mime
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const telegraphResponse = await fetch('https://telegra.ph/upload', {
|
|
58
|
+
method: 'POST',
|
|
59
|
+
body: telegraphForm
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const img = await telegraphResponse.json();
|
|
63
|
+
if (img[0]?.src) {
|
|
64
|
+
return 'https://telegra.ph' + img[0].src;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
throw new Error('Failed to upload image to both services');
|
|
68
|
+
}
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error('Upload error:', error);
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = { uploadImage };
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Alternative upload to telegra.ph (backup)
|
|
79
|
+
*/
|
|
80
|
+
/*
|
|
81
|
+
async function uploadImageTelegraph(buffer) {
|
|
82
|
+
try {
|
|
83
|
+
const { ext, mime } = await fileTypeFromBuffer(buffer);
|
|
84
|
+
const form = new FormData();
|
|
85
|
+
const blob = new Blob([buffer.toArrayBuffer()], { type: mime });
|
|
86
|
+
form.append('file', blob, 'tmp.' + ext);
|
|
87
|
+
|
|
88
|
+
const response = await fetch('https://telegra.ph/upload', {
|
|
89
|
+
method: 'POST',
|
|
90
|
+
body: form
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const img = await response.json();
|
|
94
|
+
if (img.error) throw img.error;
|
|
95
|
+
return 'https://telegra.ph' + img[0].src;
|
|
96
|
+
} catch (error) {
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
*/
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knight Bot - A WhatsApp Bot
|
|
3
|
+
* Copyright (c) 2024 Professor
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the MIT License.
|
|
7
|
+
*
|
|
8
|
+
* Credits:
|
|
9
|
+
* - Baileys Library by @adiwajshing
|
|
10
|
+
* - Pair Code implementation inspired by TechGod143 & DGXEON
|
|
11
|
+
*/
|
|
12
|
+
let axios = require('axios')
|
|
13
|
+
let BodyForm = require('form-data')
|
|
14
|
+
let { fromBuffer } = require('file-type')
|
|
15
|
+
let fetch = require('node-fetch')
|
|
16
|
+
let fs = require('fs')
|
|
17
|
+
let cheerio = require('cheerio')
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
function TelegraPh (Path) {
|
|
22
|
+
return new Promise (async (resolve, reject) => {
|
|
23
|
+
if (!fs.existsSync(Path)) return reject(new Error("File not Found"))
|
|
24
|
+
try {
|
|
25
|
+
const form = new BodyForm();
|
|
26
|
+
form.append("file", fs.createReadStream(Path))
|
|
27
|
+
const data = await axios({
|
|
28
|
+
url: "https://telegra.ph/upload",
|
|
29
|
+
method: "POST",
|
|
30
|
+
headers: {
|
|
31
|
+
...form.getHeaders()
|
|
32
|
+
},
|
|
33
|
+
data: form
|
|
34
|
+
})
|
|
35
|
+
return resolve("https://telegra.ph" + data.data[0].src)
|
|
36
|
+
} catch (err) {
|
|
37
|
+
return reject(new Error(String(err)))
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function UploadFileUgu (input) {
|
|
43
|
+
return new Promise (async (resolve, reject) => {
|
|
44
|
+
const form = new BodyForm();
|
|
45
|
+
form.append("files[]", fs.createReadStream(input))
|
|
46
|
+
await axios({
|
|
47
|
+
url: "https://uguu.se/upload.php",
|
|
48
|
+
method: "POST",
|
|
49
|
+
headers: {
|
|
50
|
+
"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",
|
|
51
|
+
...form.getHeaders()
|
|
52
|
+
},
|
|
53
|
+
data: form
|
|
54
|
+
}).then((data) => {
|
|
55
|
+
resolve(data.data.files[0])
|
|
56
|
+
}).catch((err) => reject(err))
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function webp2mp4File(path) {
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
const form = new BodyForm()
|
|
63
|
+
form.append('new-image-url', '')
|
|
64
|
+
form.append('new-image', fs.createReadStream(path))
|
|
65
|
+
axios({
|
|
66
|
+
method: 'post',
|
|
67
|
+
url: 'https://s6.ezgif.com/webp-to-mp4',
|
|
68
|
+
data: form,
|
|
69
|
+
headers: {
|
|
70
|
+
'Content-Type': `multipart/form-data; boundary=${form._boundary}`
|
|
71
|
+
}
|
|
72
|
+
}).then(({ data }) => {
|
|
73
|
+
const bodyFormThen = new BodyForm()
|
|
74
|
+
const $ = cheerio.load(data)
|
|
75
|
+
const file = $('input[name="file"]').attr('value')
|
|
76
|
+
bodyFormThen.append('file', file)
|
|
77
|
+
bodyFormThen.append('convert', "Convert WebP to MP4!")
|
|
78
|
+
axios({
|
|
79
|
+
method: 'post',
|
|
80
|
+
url: 'https://ezgif.com/webp-to-mp4/' + file,
|
|
81
|
+
data: bodyFormThen,
|
|
82
|
+
headers: {
|
|
83
|
+
'Content-Type': `multipart/form-data; boundary=${bodyFormThen._boundary}`
|
|
84
|
+
}
|
|
85
|
+
}).then(({ data }) => {
|
|
86
|
+
const $ = cheerio.load(data)
|
|
87
|
+
const result = 'https:' + $('div#output > p.outfile > video > source').attr('src')
|
|
88
|
+
resolve({
|
|
89
|
+
status: true,
|
|
90
|
+
message: "Created By MRHRTZ",
|
|
91
|
+
result: result
|
|
92
|
+
})
|
|
93
|
+
}).catch(reject)
|
|
94
|
+
}).catch(reject)
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async function floNime(medianya, options = {}) {
|
|
99
|
+
const { ext } = await fromBuffer(medianya) || options.ext
|
|
100
|
+
var form = new BodyForm()
|
|
101
|
+
form.append('file', medianya, 'tmp.'+ext)
|
|
102
|
+
let jsonnya = await fetch('https://flonime.my.id/upload', {
|
|
103
|
+
method: 'POST',
|
|
104
|
+
body: form
|
|
105
|
+
})
|
|
106
|
+
.then((response) => response.json())
|
|
107
|
+
return jsonnya
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
module.exports = { TelegraPh, UploadFileUgu, webp2mp4File, floNime }
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
const { addWelcome, delWelcome, isWelcomeOn, addGoodbye, delGoodBye, isGoodByeOn } = require('./index');
|
|
2
|
+
const { createFakeContact, getBotName } = require('./fakeContact');
|
|
3
|
+
|
|
4
|
+
async function handleWelcome(sock, chatId, message, match) {
|
|
5
|
+
const senderId = message.key.participant || message.key.remoteJid;
|
|
6
|
+
const fake = createFakeContact(senderId);
|
|
7
|
+
const botName = getBotName();
|
|
8
|
+
|
|
9
|
+
if (!match) {
|
|
10
|
+
return sock.sendMessage(chatId, {
|
|
11
|
+
text: `╭─❖ *WELCOME SETTINGS* ❖─╮\n` +
|
|
12
|
+
`│ .welcome on - Enable\n` +
|
|
13
|
+
`│ .welcome set <msg> - Customize\n` +
|
|
14
|
+
`│ .welcome off - Disable\n` +
|
|
15
|
+
`╰─────────────────╯\n\n` +
|
|
16
|
+
`Variables: {user}, {group}, {description}, {bot}`,
|
|
17
|
+
}, { quoted: fake });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const [command, ...args] = match.split(' ');
|
|
21
|
+
const lowerCommand = command.toLowerCase();
|
|
22
|
+
const customMessage = args.join(' ');
|
|
23
|
+
|
|
24
|
+
if (lowerCommand === 'on') {
|
|
25
|
+
if (await isWelcomeOn(chatId)) {
|
|
26
|
+
return sock.sendMessage(chatId, { text: `*${botName}*\nWelcome messages are already active.` }, { quoted: fake });
|
|
27
|
+
}
|
|
28
|
+
await addWelcome(chatId, true, `@{user} Holla👋,\n\nWelcome to {group}.\n\nYou might want to read group description,\nFollow group rules to avoid being removed.\n\n {bot} 2026.`);
|
|
29
|
+
return sock.sendMessage(chatId, { text: `*${botName}*\n✓ Welcome enabled. Use .welcome set to customize.` }, { quoted: fake });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (lowerCommand === 'off') {
|
|
33
|
+
if (!(await isWelcomeOn(chatId))) {
|
|
34
|
+
return sock.sendMessage(chatId, { text: `*${botName}*\nWelcome messages are already off.` }, { quoted: fake });
|
|
35
|
+
}
|
|
36
|
+
await delWelcome(chatId);
|
|
37
|
+
return sock.sendMessage(chatId, { text: `*${botName}*\n✓ Welcome disabled.` }, { quoted: fake });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (lowerCommand === 'set') {
|
|
41
|
+
if (!customMessage) {
|
|
42
|
+
return sock.sendMessage(chatId, { text: `*${botName}*\nPlease provide a message.\nExample: .welcome set @{user} Holla👋, welcome!` }, { quoted: fake });
|
|
43
|
+
}
|
|
44
|
+
await addWelcome(chatId, true, customMessage);
|
|
45
|
+
return sock.sendMessage(chatId, { text: `*${botName}*\n✓ Welcome message updated.\nPreview: ${customMessage}` }, { quoted: fake });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return sock.sendMessage(chatId, {
|
|
49
|
+
text: `*${botName}*\nInvalid. Use: on, off, or set <message>`,
|
|
50
|
+
}, { quoted: fake });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function handleGoodbye(sock, chatId, message, match) {
|
|
54
|
+
const senderId = message.key.participant || message.key.remoteJid;
|
|
55
|
+
const fake = createFakeContact(senderId);
|
|
56
|
+
const botName = getBotName();
|
|
57
|
+
const lower = match?.toLowerCase();
|
|
58
|
+
|
|
59
|
+
if (!match) {
|
|
60
|
+
return sock.sendMessage(chatId, {
|
|
61
|
+
text: `╭─❖ *GOODBYE SETTINGS* ❖─╮\n` +
|
|
62
|
+
`│ .goodbye on - Enable\n` +
|
|
63
|
+
`│ .goodbye set <msg> - Customize\n` +
|
|
64
|
+
`│ .goodbye off - Disable\n` +
|
|
65
|
+
`╰───────────────────╯\n\n` +
|
|
66
|
+
`Variables: {user}, {group}, {bot}`,
|
|
67
|
+
}, { quoted: fake });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (lower === 'on') {
|
|
71
|
+
if (await isGoodByeOn(chatId)) {
|
|
72
|
+
return sock.sendMessage(chatId, { text: `*${botName}*\nGoodbye messages are already active.` }, { quoted: fake });
|
|
73
|
+
}
|
|
74
|
+
await addGoodbye(chatId, true, `@{user} Has run out of data, let's pray for the poor😢.\n\nAnyway Goodbye Hustler👋.`);
|
|
75
|
+
return sock.sendMessage(chatId, { text: `*${botName}*\n✓ Goodbye enabled. Use .goodbye set to customize.` }, { quoted: fake });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (lower === 'off') {
|
|
79
|
+
if (!(await isGoodByeOn(chatId))) {
|
|
80
|
+
return sock.sendMessage(chatId, { text: `*${botName}*\nGoodbye messages are already off.` }, { quoted: fake });
|
|
81
|
+
}
|
|
82
|
+
await delGoodBye(chatId);
|
|
83
|
+
return sock.sendMessage(chatId, { text: `*${botName}*\n✓ Goodbye disabled.` }, { quoted: fake });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (lower.startsWith('set ')) {
|
|
87
|
+
const customMessage = match.substring(4);
|
|
88
|
+
if (!customMessage) {
|
|
89
|
+
return sock.sendMessage(chatId, { text: `*${botName}*\nPlease provide a message.\nExample: .goodbye set @{user} Goodbye!` }, { quoted: fake });
|
|
90
|
+
}
|
|
91
|
+
await addGoodbye(chatId, true, customMessage);
|
|
92
|
+
return sock.sendMessage(chatId, { text: `*${botName}*\n✓ Goodbye message updated.\nPreview: ${customMessage}` }, { quoted: fake });
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return sock.sendMessage(chatId, {
|
|
96
|
+
text: `*${botName}*\nInvalid. Use: on, off, or set <message>`,
|
|
97
|
+
}, { quoted: fake });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
module.exports = { handleWelcome, handleGoodbye };
|