All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.freya022.botcommands.internal.components.EntitySelectMenuImpl.kt Maven / Gradle / Ivy

Go to download

A Kotlin-first (and Java) framework that makes creating Discord bots a piece of cake, using the JDA library.

There is a newer version: 3.0.0-alpha.18
Show newest version
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()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy