@@ -134,50 +134,7 @@ export default async function (msg: Message, type: string): Promise<void> {
134134 )
135135 return ;
136136
137- < < < << << HEAD
138137 reactQueue . add ( ( ) => autoReaction ( msg ) ) ;
139- === = ===
140- react . react = async ( reaction : string ) : Promise < void > => {
141- // add delay for more
142- // humanly like interaction
143- const min = 2000 ;
144- const max = 6000 ;
145- const randomMs = Math . floor ( Math . random ( ) * ( max - min + 1 ) ) + min ;
146-
147- await sleep ( randomMs ) ;
148- const isEmoji = / .* [ A - Z a - z 0 - 9 ] .* / . test ( reaction ) ;
149- log . info ( "AutoReact" , lid , reaction ) ;
150- await redis . set ( `react:${ msg . id . id } ` , "1" , {
151- expiration : {
152- type : "EX" ,
153- value : 3600 , // 1 hour
154- } ,
155- } ) ;
156-
157- if ( Math . random ( ) < 0.1 && ! isEmoji )
158- if ( Math . random ( ) < 0.2 )
159- ( await client ( ) ) . sendMessage ( react . id . remote , reaction ) ;
160- else await msg . reply ( reaction ) ;
161- else await msg . react ( reaction ) ;
162- } ;
163-
164- const emojis = [
165- ...new Set ( [ ...react . body . matchAll ( regex ) ] . map ( ( m ) => m [ 0 ] ) ) ,
166- ] ;
167- if ( emojis . length > 0 ) {
168- await react . react (
169- emojis [ Math . floor ( Math . random ( ) * emojis . length ) ] ,
170- ) ;
171- } else if ( containsAny ( react . body , funD ) ) {
172- await react . react ( "🤣" ) ;
173- } else if ( containsAny ( react . body , happyEE ) ) {
174- await msg . reply ( funD [ Math . floor ( Math . random ( ) * funD . length ) ] ) ;
175- } else if ( containsAny ( react . body , sadEE ) ) {
176- await react . react ( "😭" ) ;
177- } else if ( containsAny ( react . body , loveEE ) ) {
178- await react . react ( "❤️" ) ;
179- }
180- >>> > >>> de917599a0c2a5b0589a34461a0512e42cbffea6
181138 } ) ( ) ,
182139 ( async ( ) => {
183140 const botId = ( await client ( ) ) . info . wid . _serialized ;
0 commit comments