Skip to Content
nyx logonyx guide

Introduction

Reading time:3 min read

nyx

GitHubnyx-discord/nyx

Hello there 👋! Welcome to official guide for using nyx, a TypeScript bot framework for Discord.

Here, you'll discover what nyx is, how to create your own bot and how to customize it.

What is nyx?

Nyx is a framework to build Discord bots in TypeScript, with adapters for discord.js, @discordjs/core and HTTP-only bots with @nyx-discord/http, built on top of @discordjs/core.

The main ideas behind the framework are:

Fully extendable

Every single internal component is documented and can be easily swapped by your own. We want you to know how your bot fully works.

Bare-bones

As little runtime dependencies as possible, which you can also replace.

Architecture freedom

Nyx doesn't enforce any specific way to do things. Choose your own folder structure, way to load commands/events, databases, naming conventions, etc.

Easy to understand and setup

Hacky code is avoided, like changing Discord.js typings or internals. Type safety, error handling and extensibility are prioritized over convenience and magic.

discord.js

Native objects

Use the objects you already know from your Discord library without needing to learn new wrappers.

A presentation layer, not the whole system

Nyx doesn't own your bot's logic, build step or runtime. It's the layer that connects Discord to your design, so your core logic stays independent and testable.

Warnings

  • We assume you have some level of understanding of TypeScript.
  • The framework doesn't come with any commands, events or filters (like cooldowns). To avoid being too opinionated, we only ship the things required for you to be able to build such features. Our optional packages provide some utilities, but you can also build your own.

Key Features

  1. Commands, for Discord application commands. Includes support for context menu commands, subcommands, and more.
  2. Events, for subscribing to events, either from Discord.js or your own.
  3. Schedules, for timed tasks.
  4. Plugins, for pieces that extend nyx.

All of these features are documented in detail in their respective sections, which we'll cover next.

Through optional packages, it also supports:

  1. Sessions, for stateful interaction conversations, similar to collectors.
  2. Loaders, for scanning directories to load commands, events, and schedules.
  3. Type-safe Options, for creating commands with type-safe options.

Codeblocks

The codeblocks in this guide are powered by Twoslash, meaning:

  • You can hover over variables, functions, etc. to see their documentation.
  • Every example (only often skipping trivial or already mentioned declarations) will work, otherwise this guide wouldn't compile!

Community and Contribution

Click on each card to go to its page.
Edit on GitHub

Last updated on

On this page