Don't respond if message is older than 5 mins
This commit is contained in:
parent
380b9bb7dd
commit
3e63694be3
@ -167,6 +167,11 @@ func (client *Client) eventHandler(evt interface{}) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if time.Now().Sub(v.Info.Timestamp).Minutes() >= 5 {
|
||||||
|
fmt.Printf("Message from %s older than 5 minutes, skipping\n", chatUserId)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
time.Sleep(2 * time.Duration(rand.IntN(3)) * time.Second)
|
time.Sleep(2 * time.Duration(rand.IntN(3)) * time.Second)
|
||||||
|
|
||||||
client.WAClient.SendChatPresence(v.Info.Chat, types.ChatPresenceComposing, types.ChatPresenceMediaText)
|
client.WAClient.SendChatPresence(v.Info.Chat, types.ChatPresenceComposing, types.ChatPresenceMediaText)
|
||||||
|
Loading…
Reference in New Issue
Block a user