io.github.freya022.botcommands.internal.components.EntitySelectMenuImpl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of BotCommands Show documentation
Show all versions of BotCommands Show documentation
A Kotlin-first (and Java) framework that makes creating Discord bots a piece of cake, using the JDA library.
package io.github.freya022.botcommands.internal.components
import io.github.freya022.botcommands.api.components.EntitySelectMenu
import io.github.freya022.botcommands.api.components.event.EntitySelectEvent
import io.github.freya022.botcommands.internal.components.controller.ComponentController
import io.github.freya022.botcommands.internal.utils.throwInternal
import net.dv8tion.jda.api.interactions.components.selections.EntitySelectMenu as JDAEntitySelectMenu
internal class EntitySelectMenuImpl internal constructor(
componentController: ComponentController,
override val internalId: Int,
private val selectMenu: JDAEntitySelectMenu
) : AbstractAwaitableComponentImpl(componentController),
EntitySelectMenu,
JDAEntitySelectMenu by selectMenu {
override fun withDisabled(disabled: Boolean): EntitySelectMenuImpl {
return EntitySelectMenuImpl(componentController, internalId, super.withDisabled(disabled))
}
override fun getId(): String = selectMenu.id ?: throwInternal("BC components cannot have null IDs")
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as EntitySelectMenuImpl
return selectMenu == other.selectMenu
}
override fun hashCode(): Int {
return selectMenu.hashCode()
}
override fun toString(): String {
return selectMenu.toString()
}
}