18 lines
603 B
Kotlin
18 lines
603 B
Kotlin
package nl.voidcorp.discord.command
|
|
|
|
import net.dv8tion.jda.api.entities.Guild
|
|
import nl.voidcorp.discord.storage.GuildRepo
|
|
import nl.voidcorp.discord.storage.GuildStore
|
|
import org.springframework.beans.factory.annotation.Autowired
|
|
import org.springframework.stereotype.Service
|
|
|
|
@Service
|
|
class CommandSettingsImpl(override val prefix: String = "?") : CommandSettings(prefix) {
|
|
@Autowired
|
|
lateinit var guildRepo: GuildRepo
|
|
|
|
override fun getPrefix(guild: Guild): String {
|
|
val store = guildRepo.findByGuildId(guild.idLong) ?: GuildStore(guild.idLong)
|
|
return store.prefix
|
|
}
|
|
} |