Skip to content

Commit

Permalink
autosort roles
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkyAI committed Oct 23, 2023
1 parent de33e9a commit 330dff6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/kotlin/moe/nikky/RoleManagementExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -812,16 +812,26 @@ class RoleManagementExtension : Extension(), Klogging {
"**${roleChooserConfig.section}** : \n" + roleMapping
.map { entry ->
val role = guild.getRole(entry.role)
entry to role
}
.sortedByDescending { (_, role) ->
role.rawPosition
}
.joinToString("\n") { (entry, role) ->
"${entry.reaction} ${role.mention}"
}
.joinToString("\n")
} else {
"**${roleChooserConfig.section}** : \n" + roleMapping
.map { entry ->
val role = guild.getRole(entry.role)
entry to role
}
.sortedByDescending { (_, role) ->
role.rawPosition
}
.joinToString("\n") { (entry, role) ->
"${entry.reaction} `${role.name}`"
}
.joinToString("\n")
}
}

Expand Down

0 comments on commit 330dff6

Please sign in to comment.