Blad3Mak3r/Slash

Add ``extra`` object to SlashCommandContext

Closed this issue · 1 comments

Add an object that can be **Any and overwrited.

SlashCommandContext#setExtra(obj: Any)
SlashCommandContext#getExtra(): Any

This will permit:

fun SlashCommandContext.setConfig(config: GuildConfig) {
  this.setExtra(config)
}

fun SlashCommandContext.getConfig(): GuildConfig {
  val obj = this.getExtra() ?: error("GuildConfig has not been defined")
  return obj as GuildConfig
}

Resolved on 253f8da