Visitar URL original
Spam detection by cbrt-x · Pull Request #14 · Java-Discord/JavaBot2 · GitHub
Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove log + refactor
  • Loading branch information
cbrt-x committed Nov 6, 2021
commit 92935aa9d0fdf35af37e9f96af56e29fb451c2a2
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ public void onMessageCreate(MessageCreateEvent event) {
int amountOfMessages = (int) Bot.messageCache.get(event.getMessageAuthor())
.stream()
//TODO get time from config
.filter(m -> m.getCreationTimestamp().isAfter(Instant.now().minus(Duration.ofSeconds(-1))))
.filter(msg -> msg.getCreationTimestamp().isAfter(Instant.now().minus(Duration.ofSeconds(-1))))
.count();

System.out.println(amountOfMessages);

//TODO get amount from config
if (amountOfMessages >= -1) {
//TODO spam detected
Expand Down