@@ -6,7 +6,6 @@ const spinnies = new(require('spinnies'))(),
6
6
fs = require ( 'fs' ) ,
7
7
path = require ( 'path' ) ,
8
8
colors = require ( '@colors/colors' ) ,
9
- stable = require ( 'json-stable-stringify' ) ,
10
9
env = require ( './config.json' ) ,
11
10
{ platform } = require ( 'os' )
12
11
const cache = new ( require ( 'node-cache' ) ) ( {
@@ -65,29 +64,6 @@ client.on('ready', async () => {
65
64
if ( tmpFiles . length > 0 ) {
66
65
tmpFiles . filter ( v => ! v . endsWith ( '.file' ) ) . map ( v => fs . unlinkSync ( './temp/' + v ) )
67
66
}
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
- } ) )
91
67
} catch { }
92
68
} , 60 * 1000 * 10 )
93
69
@@ -120,6 +96,7 @@ client.on('message.delete', ctx => {
120
96
if ( ! ctx || ctx . origin . fromMe || ctx . origin . isBot || ! ctx . origin . sender ) return
121
97
if ( cache . has ( ctx . origin . sender ) && cache . get ( ctx . origin . sender ) === 1 ) return
122
98
cache . set ( ctx . origin . sender , 1 )
99
+ if ( Object . keys ( ctx . delete . message ) < 1 ) return
123
100
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 )
124
101
} )
125
102
@@ -147,10 +124,12 @@ client.on('group.add', async ctx => {
147
124
const groupSet = global . db . groups . find ( v => v . jid == ctx . jid )
148
125
if ( ! global . db || ! global . db . groups ) return
149
126
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
+ }
152
131
} catch {
153
- var pic = await Func . fetchBuffer ( './media/image/default .jpg')
132
+ var pic = 'https://qu.ax/uPqo .jpg'
154
133
}
155
134
156
135
/* localonly to remove new member when the number not from indonesia */
@@ -176,10 +155,12 @@ client.on('group.remove', async ctx => {
176
155
if ( ! global . db || ! global . db . groups ) return
177
156
const groupSet = global . db . groups . find ( v => v . jid == ctx . jid )
178
157
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
+ }
181
162
} catch {
182
- var pic = await Func . fetchBuffer ( './media/image/default .jpg')
163
+ var pic = 'https://qu.ax/uPqo .jpg'
183
164
}
184
165
const txt = ( groupSet && groupSet . text_left ? groupSet . text_left : text ) . replace ( '+tag' , `@${ ctx . member . split `@` [ 0 ] } ` ) . replace ( '+grup' , `${ ctx . subject } ` )
185
166
if ( groupSet && groupSet . left ) sock . sendMessageModify ( ctx . jid , txt , null , {
0 commit comments