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

io.github.freya022.botcommands.api.localization.DefaultMessagesFactory.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.

The newest version!
package io.github.freya022.botcommands.api.localization

import io.github.freya022.botcommands.api.core.service.annotations.BService
import io.github.freya022.botcommands.api.core.service.annotations.InterfacedService
import io.github.freya022.botcommands.api.localization.interaction.UserLocaleProvider
import io.github.freya022.botcommands.api.localization.text.TextCommandLocaleProvider
import net.dv8tion.jda.api.events.message.MessageReceivedEvent
import net.dv8tion.jda.api.interactions.Interaction
import java.util.*

/**
 * Factory for [DefaultMessages] instances, using locales from various sources.
 *
 * **Usage:** Register your instance as a service with [@BService][BService].
 *
 * @see InterfacedService @InterfacedService
 */
@InterfacedService(acceptMultiple = false)
interface DefaultMessagesFactory {
    /**
     * Retrieves a [DefaultMessages] instance for the given locale.
     */
    fun get(locale: Locale): DefaultMessages

    /**
     * Retrieves a [DefaultMessages] instance, with the locale derived from this event.
     *
     * By default, this uses [TextCommandLocaleProvider] to get the locale.
     */
    fun get(event: MessageReceivedEvent): DefaultMessages

    /**
     * Retrieves a [DefaultMessages] instance, with the locale derived from this interaction.
     *
     * By default, this uses [UserLocaleProvider] to get the locale.
     */
    fun get(event: Interaction): DefaultMessages
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy