19 lines
816 B
Kotlin
19 lines
816 B
Kotlin
package nl.voidcorp.discord.commands
|
|
|
|
import nl.voidcorp.discord.command.Command
|
|
import nl.voidcorp.discord.command.CommandMessage
|
|
import nl.voidcorp.discord.command.CommandResult
|
|
import nl.voidcorp.discord.storage.GuildRepo
|
|
import nl.voidcorp.discord.storage.GuildStore
|
|
import org.springframework.stereotype.Service
|
|
|
|
class ListRolesCommand : Command("listroles", aliases = listOf("roles")) {
|
|
override fun handle(event: CommandMessage): CommandResult {
|
|
val guild = repo.findByGuildId(event.guild.idLong) ?: GuildStore(event.guild.idLong)
|
|
if (guild.roleMap.isNotEmpty())
|
|
event.reply(guild.roleMap.keys.joinToString(prefix = "The available roles are: ") { "`$it`" })
|
|
else
|
|
event.reply("There are no roles to pick here...")
|
|
return CommandResult.SUCCESS
|
|
}
|
|
} |