Skip to content

Commit

Permalink
Merge pull request #241 from Pan-nav/master
Browse files Browse the repository at this point in the history
Filter non-contributors from contributor list
  • Loading branch information
stephendotgg authored Mar 28, 2024
2 parents 4842787 + 6d0c4cd commit 8901d1e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/kotlin/com/learnspigot/bot/help/CloseCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ class CloseCommand {
}

val contributors: List<Member> =
channel.retrieveThreadMembers().complete().filter { member: ThreadMember -> member.id != channel.ownerId }
.filter { member: ThreadMember -> !member.user.isBot }.take(25).map { it.member }
channel.retrieveThreadMembers().complete().asSequence().filter { member: ThreadMember -> member.id != channel.ownerId }
.filter { member: ThreadMember -> !member.user.isBot }
.filter{ member: ThreadMember ->
val messageHistory = channel.iterableHistory.complete()
messageHistory.any { it.author.id == member.id }}
.take(25).map { it.member }.toList()

if (contributors.isEmpty()) {
event.replyEmbeds(
Expand Down

0 comments on commit 8901d1e

Please sign in to comment.