Skip to content

Commit 1c66d50

Browse files
committed
feat: update welcome+left, antidelete & profile pic
1 parent 67f76b2 commit 1c66d50

File tree

7 files changed

+14
-140
lines changed

7 files changed

+14
-140
lines changed

client.js

+11-30
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const spinnies = new(require('spinnies'))(),
66
fs = require('fs'),
77
path = require('path'),
88
colors = require('@colors/colors'),
9-
stable = require('json-stable-stringify'),
109
env = require('./config.json'),
1110
{ platform } = require('os')
1211
const cache = new(require('node-cache'))({
@@ -65,29 +64,6 @@ client.on('ready', async () => {
6564
if (tmpFiles.length > 0) {
6665
tmpFiles.filter(v => !v.endsWith('.file')).map(v => fs.unlinkSync('./temp/' + v))
6766
}
68-
69-
/* this source from @jarspay */
70-
const TIME = 1000 * 60 * 60
71-
const filename = []
72-
const files = await fs.readdirSync('./session')
73-
for (const file of files) {
74-
if (file != 'creds.json') filename.push(path.join('./session', file))
75-
}
76-
77-
await Promise.allSettled(filename.map(async (file) => {
78-
const stat = await fs.statSync(file)
79-
if (stat.isFile() && (Date.now() - stat.mtimeMs >= TIME)) {
80-
if (platform() === 'win32') {
81-
let fileHandle
82-
try {
83-
fileHandle = await fs.openSync(file, 'r+')
84-
} catch (e) {} finally {
85-
await fileHandle.close()
86-
}
87-
}
88-
await fs.unlinkSync(file)
89-
}
90-
}))
9167
} catch {}
9268
}, 60 * 1000 * 10)
9369

@@ -120,6 +96,7 @@ client.on('message.delete', ctx => {
12096
if (!ctx || ctx.origin.fromMe || ctx.origin.isBot || !ctx.origin.sender) return
12197
if (cache.has(ctx.origin.sender) && cache.get(ctx.origin.sender) === 1) return
12298
cache.set(ctx.origin.sender, 1)
99+
if (Object.keys(ctx.delete.message) < 1) return
123100
if (ctx.origin.isGroup && global.db.groups.some(v => v.jid == ctx.origin.chat) && global.db.groups.find(v => v.jid == ctx.origin.chat).antidelete) return sock.copyNForward(ctx.origin.chat, ctx.delete)
124101
})
125102

@@ -147,10 +124,12 @@ client.on('group.add', async ctx => {
147124
const groupSet = global.db.groups.find(v => v.jid == ctx.jid)
148125
if (!global.db || !global.db.groups) return
149126
try {
150-
const photo = await Func.fetchBuffer(await sock.profilePictureUrl(ctx.member, 'image'))
151-
var pic = photo ? await Func.fetchBuffer(photo) : await Func.fetchBuffer(await sock.profilePictureUrl(ctx.jid, 'image'))
127+
var pic = await sock.profilePictureUrl(ctx.member, 'image')
128+
if (!pic) {
129+
var pic = 'https://qu.ax/uPqo.jpg'
130+
}
152131
} catch {
153-
var pic = await Func.fetchBuffer('./media/image/default.jpg')
132+
var pic = 'https://qu.ax/uPqo.jpg'
154133
}
155134

156135
/* localonly to remove new member when the number not from indonesia */
@@ -176,10 +155,12 @@ client.on('group.remove', async ctx => {
176155
if (!global.db || !global.db.groups) return
177156
const groupSet = global.db.groups.find(v => v.jid == ctx.jid)
178157
try {
179-
const photo = await Func.fetchBuffer(await sock.profilePictureUrl(ctx.member, 'image'))
180-
var pic = photo ? await Func.fetchBuffer(photo) : await Func.fetchBuffer(await sock.profilePictureUrl(ctx.jid, 'image'))
158+
var pic = await sock.profilePictureUrl(ctx.member, 'image')
159+
if (!pic) {
160+
var pic = 'https://qu.ax/uPqo.jpg'
161+
}
181162
} catch {
182-
var pic = await Func.fetchBuffer('./media/image/default.jpg')
163+
var pic = 'https://qu.ax/uPqo.jpg'
183164
}
184165
const txt = (groupSet && groupSet.text_left ? groupSet.text_left : text).replace('+tag', `@${ctx.member.split`@`[0]}`).replace('+grup', `${ctx.subject}`)
185166
if (groupSet && groupSet.left) sock.sendMessageModify(ctx.jid, txt, null, {

config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"evaluate_chars": ["=>", "~>", "<", ">", "$"],
1717
"pairing": {
1818
"state": true,
19-
"number": 6285819846892
19+
"number": 62857035017449
2020
},
2121
"replit_url": ""
2222
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@adiwajshing/baileys": "npm:@neoxr/baileys",
2929
"@adiwajshing/keyed-db": "^0.2.4",
3030
"@colors/colors": "^1.6.0",
31-
"@neoxr/wb": "^2.6.3",
31+
"@neoxr/wb": "^2.6.7",
3232
"@neoxr/youtube-scraper": "^3.1.5",
3333
"audio-decode": "^2.2.0",
3434
"bytes": "^3.1.2",

plugins/group/groupinfo.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ exports.run = {
3939
caption += global.footer
4040
client.sendMessageModify(m.chat, caption, m, {
4141
largeThumb: true,
42-
thumbnail: pic,
42+
thumbnail: pic ? await Func.fetchBuffer(pic) : await Func.fetchBuffer('./media/image/default.jpg')
4343
})
4444
} catch (e) {
45-
console.log(e)
4645
client.reply(m.chat, Func.jsonFormat(e), m)
4746
}
4847
},

plugins/utilities/ai_stable.js

-29
This file was deleted.

plugins/utilities/ai_waifu.js

-28
This file was deleted.

plugins/utilities/recolor.js

-49
This file was deleted.

0 commit comments

Comments
 (0)