private fun filterMentions(selectedMentions: Set<User>, message: String): MutableList<String> {val text = message.lowercase()val remainingMentions =selectedMentions.filter {text.contains("@${it.name.lowercase()}")}.map { it.id }this.selectedMentions.clear()return remainingMentions.toMutableList()}
Filters the current input and the mentions the user selected from the suggestion list. Removes any mentions which are selected but no longer present in the input.