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

io.github.freya022.botcommands.api.commands.application.CommandUpdateResult.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.api.commands.application

import net.dv8tion.jda.api.entities.Guild

/**
 * Result of a scheduled command update.
 *
 * More details in debug/trace logs.
 */
class CommandUpdateResult internal constructor(
    /**
     * The guild the commands were updated in, `null` for global commands
     */
    val guild: Guild?,
    /**
     * `true` if the commands were updated
     */
    val updatedCommands: Boolean,
    /**
     * The list of failed command declaration functions alongside their exceptions
     */
    val updateExceptions: List
) {
    override fun toString(): String = buildString {
        if (updatedCommands) {
            append("Updated")
        } else {
            append("Skipped")
        }

        if (guild == null) {
            append(" global")
        } else {
            append(" guild (${guild.id})")
        }
        append(" commands")

        if (updateExceptions.isNotEmpty()) {
            append(", with ${updateExceptions.size} exceptions")
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy