Revert "hotfix 1"

This reverts commit 1f3ebc42
This commit is contained in:
Wieland Schöbl
2021-06-02 23:21:50 +02:00
parent 7ff789afd3
commit 4e2186026c

View File

@@ -123,9 +123,13 @@ object Channels {
fun refreshServiceChannelsFromDisk() =
Json.decodeFromString<List<ServiceChannel>>(SERVICE_CHANNELS_FILE.readText()).toMutableList()
fun getServerNames(server: Long? = null): List<String>? = Main.jdas.flatMap { jda ->
channels.filter { server == null || (jda.getTextChannelById(it.id)?.guild?.idLong == server) }.mapNotNull {
val channel = jda.getTextChannelById(it.id) ?: return@mapNotNull null
fun getServerNames(server: Long? = null) = Main.jdas.flatMap { jda ->
channels.filter { server == null || (jda.getTextChannelById(it.id)?.guild?.idLong == server) }.map {
val channel = jda.getTextChannelById(it.id)
if (channel == null) {
Admin.warning("Channel ${it.id} is no longer active!")
return@map "**${it.id}** *(inactive)*"
}
val role = when (it.mentionedRole) {
null -> ""