Sapphire Framework Documentation

website·Indexed 33 days ago

https://www.sapphirejs.dev/

API documentation for the Sapphire framework, including core pieces, framework resolvers, and various plugins such as @sapphire/plugin-scheduled-tasks, @sapphire/plugin-pattern-commands, @sapphire/plugin-api, and @sapphire/plugin-subcommands.

Tokens
670.8K
Snippets
4.8K
Records
7K
Agent score
65%

What's inside Sapphire

  1. Overview of @sapphire/lexure

    @sapphire/lexure is a fast parser and utility set for non-technical user input. It is written in TypeScript and supports NodeJS and browsers (CommonJS, ESM, and UMD). Key features include parsing quoted input with multiple quote styles, a customizable strategy system for flags and options, preservation of leading whitespace, and custom argument delimiters.
  2. Overview of the Sapphire Discord Bot Framework

    Sapphire is a modular and extendable Discord bot framework built on top of discord.js. It is written in TypeScript and provides full support for both TypeScript and JavaScript. Key features include a Command Handler, Arguments, Pre-conditions, a Listeners Store, and advanced plugin support.
  3. Overview of Result and Option types

    The @sapphire/result library provides a TypeScript port of Nightly Rust's Result<T, E> and Option<T> structs.

    • Result: A type union used to express computations that can fail. It consists of two variants: Ok(T) (representing success and containing a value) and Err(E) (representing error and containing an error value).
    • Option: A type used to represent a value that may or may not be present.
  4. Overview of @sapphire/lexure

    @sapphire/lexure is a fast parser and utility library designed for non-technical user input. It is written in TypeScript and supports NodeJS and browsers (via CommonJS, ESM, and UMD bundles). Key features include support for multiple quote styles, customizable flag/option parsing strategies, preservation of leading whitespace, and custom argument delimiters.
  5. Overview of the Sapphire API plugin

    The @sapphire/plugin-api provides an API endpoint for a bot that can be called from external services. This is particularly useful for creating a web dashboard where end-users can modify bot configuration settings via a website that interfaces with the bot.
  6. Overview of @sapphire/result

    The @sapphire/result package is a TypeScript port of Nightly Rust's Result<T, E> and Option<T> structs. It is designed to alleviate the chaos of nested or sequential try-catch blocks by providing a functional way to express computations that can fail, propagate errors, and handle optional values.
  7. Overview of @sapphire/plugin-utilities-store

    The @sapphire/plugin-utilities-store plugin for the Sapphire framework provides an automatically imported utilities store. This allows developers to centralize external utility functions and access them through the Sapphire container.

    Important Constraint: Utility functions are only available on the container after the bot has logged in. Any functions required during the pre-login phase must be exported using standard module loading (e.g., export / require).