@@ -140,50 +140,7 @@ export default async function (msg: Message, type: string): Promise<void> {
140140 )
141141 return ;
142142
143- < < < << << HEAD
144- react . react = async ( reaction : string ) : Promise < void > => {
145- // add delay for more
146- // humanly like interaction
147- const min = 2000 ;
148- const max = 6000 ;
149- const randomMs = Math . floor ( Math . random ( ) * ( max - min + 1 ) ) + min ;
150-
151- await sleep ( randomMs ) ;
152- const isEmoji = / .* [ A - Z a - z 0 - 9 ] .* / . test ( reaction ) ;
153- log . info ( "AutoReact" , lid , reaction ) ;
154- await redis . set ( `react:${ msg . id . id } ` , "1" , {
155- expiration : {
156- type : "EX" ,
157- value : 3600 , // 1 hour
158- } ,
159- } ) ;
160-
161- if ( Math . random ( ) < 0.1 && ! isEmoji )
162- if ( Math . random ( ) < 0.2 )
163- ( await client ( ) ) . sendMessage ( react . id . remote , reaction ) ;
164- else await msg . reply ( reaction ) ;
165- else await msg . react ( reaction ) ;
166- } ;
167-
168- const emojis = [
169- ...new Set ( [ ...react . body . matchAll ( regex ) ] . map ( ( m ) => m [ 0 ] ) ) ,
170- ] ;
171- if ( emojis . length > 0 ) {
172- await react . react (
173- emojis [ Math . floor ( Math . random ( ) * emojis . length ) ] ,
174- ) ;
175- } else if ( containsAny ( react . body , funD ) ) {
176- await react . react ( "🤣" ) ;
177- } else if ( containsAny ( react . body , happyEE ) ) {
178- await msg . reply ( funD [ Math . floor ( Math . random ( ) * funD . length ) ] ) ;
179- } else if ( containsAny ( react . body , sadEE ) ) {
180- await react . react ( "😭" ) ;
181- } else if ( containsAny ( react . body , loveEE ) ) {
182- await react . react ( "❤️" ) ;
183- }
184- === = ===
185143 reactQueue . add ( ( ) => autoReaction ( msg ) ) ;
186- >>> > >>> upstream / master
187144 } ) ( ) ,
188145 ( async ( ) => {
189146 const botId = ( await client ( ) ) . info . wid . _serialized ;
@@ -232,17 +189,13 @@ export default async function (msg: Message, type: string): Promise<void> {
232189 }
233190
234191 log . info ( "Message" , lid , key ) ;
235- << < < < << HEAD
236- msg . body = newMessageBody ;
237- === = ===
238192
239193 if ( newMessageBody . split ( " " ) . length === 1 && msg . hasQuotedMsg ) {
240194 const qoutedMessage = await msg . getQuotedMessage ( ) ;
241195 msg . body = ( newMessageBody + " " + qoutedMessage . body ) . trim ( ) ;
242196 } else {
243197 msg . body = newMessageBody ;
244198 }
245- >>> > >>> upstream / master
246199
247200 /*
248201 *
@@ -258,13 +211,9 @@ export default async function (msg: Message, type: string): Promise<void> {
258211 options ?: MessageSendOptions ,
259212 ) : Promise < Message > => {
260213 let messageBody = typeof content === "string" ? Font ( content ) : content ;
261- < < < << << HEAD
262- log . info ( "Reply" , lid , key ) ;
263- === === =
264214 const latency = Date . now ( ) - receivedAt ;
265215 const latencySec = ( latency / 1000 ) . toFixed ( 2 ) ;
266216 log . info ( "Reply" , lid , `${ key } ${ latencySec } s` ) ;
267- > >>> >>> upstream / master
268217
269218 if ( ! msg . fromMe ) {
270219 const chat = await msg . getChat ( ) ;
0 commit comments