Skip to content

ShindouMihou/Nexus

Repository files navigation

Splashscreen

Discord Bot Framework for Javacord, simplified.

Nexus is a Javacord framework, written in Kotlin-Java, designed to enable developers to add application commands to their Discord bots with simplicity. It is the successor of the Velen framework and takes an "object-based" approach to designing application commands (slash commands, context menus, etc).

Example

object PingCommand: NexusHandler {
    val name: String = "ping"
    val description: String = "Ping, Pong!"

    override fun onEvent(event: NexusCommandEvent) {
        // Auto-deferred response (automatically handles deferring of responses when the framework
        // detects potentially late response).
        event.autoDefer(ephemeral = true) {
           return@autodefer NexusMessage.from("Hello ${event.user.name}")
        }

        // Manual response (you are in control of deferring, etc.)
        // event.respondNowWith("Hello ${event.user.name}!")
    }
}
object ReportUserContextMenu: NexusUserContextMenu() {
    val name = "test"

    override fun onEvent(event: NexusContextMenuEvent<UserContextMenuCommandEvent, UserContextMenuInteraction>) {
        val target = event.interaction.target
        event.respondNowEphemerallyWith("${target.discriminatedName} has been reported to our servers!")
    }
}

For Kotlin users looking to create interactive or highly reactive bots, you may be interested in checking our web development-inspired rendering mechanism called Reakt.Discord which has states, reactivity and many more cool things that will help you build a bot super quickly!

Getting Started

To get started with Nexus, we recommend reading the wiki in its chronological order:

You can also read the examples that we have:

If you want to install Nexus as a dependency, you can head to Jitpack, select a version and follow the instructions there:

Bots using Nexus

Nexus is used in production by Discord bots, such as:

  • Beemo: An anti-raid Discord bot that prevents raids on many large servers.
  • Amelia-chan: A simple RSS Discord bot for the novel site, ScribbleHub.
  • Threadscore: Gamifying Q&A for Discord.
  • Flyght: Adds Know-Your-Member to Discord. Powered together with Reakt.Discord.

If you want to add your bot to the list, feel free to add it by creating a pull request!

Features

Nexus was created from the ground up to power Discord bots with a simplistic yet flexible developer experience without compromising on performance, allowing developers to build their Discord bots fast and clean.

  • Object-based commands
  • Object-based context menus
  • Middlewares, Afterwares
  • Supports auto-deferring of responses
  • Flexible command synchronization system
  • Supports optional validation and subcommand routers
  • Clean, developer-oriented API
  • Supports persistent slash command indexes, and many more
  • Supports different pagination systems

We recommend reading the GitHub Wiki to learn more about the different features of Nexus.

License

Nexus is distributed under the Apache 2.0 license, the same one used by Javacord. See LICENSE for more information.