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

me.jakejmattson.kutils.api.dsl.command.CommandEvent.kt Maven / Gradle / Ivy

There is a newer version: 0.18.1
Show newest version
package me.jakejmattson.kutils.api.dsl.command

import me.jakejmattson.kutils.api.Discord
import me.jakejmattson.kutils.internal.command.RawInputs
import me.jakejmattson.kutils.internal.utils.Responder
import net.dv8tion.jda.api.entities.*

data class DiscordContext(val discord: Discord,
                          val message: Message,
                          val author: User = message.author,
                          val guild: Guild? = if (message.isFromGuild) message.guild else null,
                          override val channel: MessageChannel = message.channel) : Responder {
    val relevantPrefix: String = discord.configuration.prefix.invoke(this)
}

data class CommandEvent(val rawInputs: RawInputs,
                                              val container: CommandsContainer,
                                              private val discordContext: DiscordContext) : Responder {
    val discord = discordContext.discord
    val author = discordContext.author
    val message = discordContext.message
    override val channel = discordContext.channel
    val guild = discordContext.guild
    val command = container[rawInputs.commandName]
    val relevantPrefix = discordContext.relevantPrefix

    lateinit var args: T
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy