Skip to content

Nexus.R

Miu edited this page Oct 17, 2023 · 20 revisions

React Native + Svelte for Discord Bots. Nexus.R (React) is a Kotlin-only feature that enables developers to respond to slash commands more intuitively akin to web development. In addition, Nexus.R supports a simple and minimal state system (writable) that enables you to update the Discord message by simply changing a writable's value.

Features

  • Write-once, Use Everywhere
    • Nexus.R allows you to easily reuse responses whether it was written for slash commands or for messages with hardly any changes.
  • States in Discord Bot
    • Nexus.R introduces the infamous states of the JavaScript world into Discord bots, allowing you to create messages that will re-render itself upon different state changes, just like a reactive website!
  • Webdev-like Feel
    • In order to make Discord bot development more accessible to even web developers, we've made the feature feels like writing web code (JSX) but simpler!

Learn by Code

Nexus.R is simple enough for most developers that you can simply read the code and you'll understand it. If you prefer to learn by reading examples, we recommend reading the examples.

Learn by Wiki

In this wiki page, we'll try to go in-depth into Nexus.R and how we can use it effectively to build a beautiful and reactive Discord bot. Nexus.R is easier to understand for web developers who are familiar with JSX or Svelte as this essentially is the same but for Kotlin Discord bots and that's what makes it beautiful, but before we begin with our guide, we have to understand one thing and that is: Nexus.R will never be as performant and memory efficient as manually doing things yourself, but it will be more easier on the developer experience.

To expand upon the above statement, it's important to acknowledge that Nexus.R breaks the traditional philosophy of Nexus in which abstractions are kept at a minimal. Nexus.R builds many abstractions upon the Javacord way in order to optimize the most for developer experience, which in turn, means it creates a lot of objects, which allocates a bit more memory and uses more time.

According to our testing though, Nexus.R doesn't impact a lot as the code is designed enough that it doesn't create enough objects that it slows down things, in fact, most rendering completes in about 1-10 milliseconds and that's very tiny.

To get started with Nexus, we recommend reading the following in chronological:

  1. Installation & Preparing Nexus
  2. Designing Commands
  3. Command Interceptors
  4. Additional Features (Subcommand Router, Option Validation)
  5. Context Menus
  6. Command Synchronization

You may want to read a specific part of handling command and middleware responses:

You can also read about additional features of Nexus:

You can read about synchronizing commands to Discord:

For more additional performance:

Additional configurations:

Clone this wiki locally