Readd check after changing the underlying list

This commit is contained in:
Norbi Peti 2023-06-30 03:20:40 +02:00
parent 0d59dff86e
commit cde0d44b04
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56

View file

@ -20,6 +20,7 @@ import java.util.function.Supplier
import java.util.{Objects, Optional}
import javax.annotation.Nullable
import scala.jdk.Accumulator
import scala.jdk.CollectionConverters.ListHasAsScala
import scala.jdk.OptionConverters.RichOptional
import scala.jdk.StreamConverters.StreamHasToScala
@ -107,7 +108,8 @@ class ChannelconCommand(private val module: MinecraftChatModule) extends IComman
if (MCChatCustom.hasCustomChat(message.getChannelId)) {
return respond(sender, "this channel is already connected to a Minecraft channel. Use `@ChromaBot channelcon remove` to remove it.")
}
val chan: Optional[Channel] = Channel.getChannels.filter(ch => ch.getIdentifier.equalsIgnoreCase(channelID)).findAny // TODO: Removed erroring shit
val chan: Optional[Channel] = Channel.getChannels.filter(ch => ch.getIdentifier.equalsIgnoreCase(channelID)
|| ch.extraIdentifiers.get().asScala.exists(id => id.equalsIgnoreCase(channelID))).findAny
if (!chan.isPresent) { //TODO: Red embed that disappears over time (kinda like the highlight messages in OW)
DPUtils.reply(message, channel, "MC channel with ID '" + channelID + "' not found! The ID is the command for it without the /.").subscribe()
return true