A comprehensive Discord Luau Library for Bleumoon.
  • Luau 99.2%
  • Nix 0.5%
  • Shell 0.3%
Find a file
2026-03-22 16:34:18 -05:00
.forgejo/workflows Initial commit 2026-02-12 21:19:10 -06:00
.github release 0.2.2 2026-03-19 11:53:35 -05:00
.vscode sync repository with template 2026-03-06 16:03:39 -06:00
docs release 0.2.3 2026-03-22 16:34:18 -05:00
scripts sync repository with template 2026-03-06 16:03:39 -06:00
src release 0.2.3 2026-03-22 16:34:18 -05:00
tests release 0.2.2 2026-03-19 11:53:35 -05:00
.editorconfig Initial commit 2026-02-12 21:19:10 -06:00
.gitignore sync repository with template 2026-03-06 16:03:39 -06:00
.luaurc release 0.2.2 2026-03-19 11:53:35 -05:00
bleumoon.lock release 0.2.2 2026-03-19 11:53:35 -05:00
bleumoon.toml release 0.2.3 2026-03-22 16:34:18 -05:00
CHANGELOG.md release 0.2.3 2026-03-22 16:34:18 -05:00
flake.lock release 0.2.3 2026-03-22 16:34:18 -05:00
flake.nix release 0.2.2 2026-03-19 11:53:35 -05:00
init.luau include types 2026-03-19 18:13:53 -05:00
LICENSE Initial commit 2026-02-12 21:19:10 -06:00
README.md release 0.1.0 2026-02-15 20:28:35 -06:00
stylua.toml Initial commit 2026-02-12 21:19:10 -06:00

Bleucord

A comprehensive Discord API v10 library for the BleuMoon Luau runtime.

Features

  • Full Discord API v10 coverage — REST endpoints, Gateway WebSocket, OAuth2
  • High-level Client — event-driven bot framework with automatic caching
  • Low-level access — direct REST client and Gateway shard control
  • Builder pattern — fluent APIs for embeds, components, slash commands, modals
  • Auto-sharding — concurrency-aware shard spawning via /gateway/bot
  • Rate limiting — per-route bucket management with automatic retry
  • Typed--!strict mode throughout with full type annotations
  • Voice support — voice gateway protocol (audio transport is a placeholder — BleuMoon has no UDP API)
  • OAuth2 — Discord OAuth2 flows via BleuAuth

Quick Start

local bleucord = require("@pkg/bleucord/src")
local Client = bleucord.Client
local Intents = bleucord.Intents

local client = Client.new({
	intents = Intents.DEFAULT,
})

client:on("READY", function(data)
	print(`Logged in as {data.user.username}!`)
end)

client:on("MESSAGE_CREATE", function(message)
	if message.content == "!ping" then
		client.rest:post(`/channels/{message.channel_id}/messages`, {
			body = { content = "Pong!" },
		})
	end
end)

client:login("YOUR_BOT_TOKEN")

Installation

Add bleucord as a dependency in your bleumoon.toml:

[dependencies]
bleucord = "*"

Then install:

bleumoon pkg install

Prerequisites

Tip: If you have Nix with flakes enabled, both tools are provided automatically via nix develop.

Documentation

Development

Setup

git clone https://git.ds.reinitialized.net/bleupigs.club/bleucord.git
cd bleucord
nix develop          # or install BleuMoon + StyLua manually
bleumoon pkg install

Running Tests

bleumoon run tests/init

437 unit tests covering utilities, structures, builders, gateway, cache, and OAuth modules.

Formatting

stylua --check .   # check
stylua .           # apply

Project Structure

├── bleumoon.toml          # Project manifest & dependencies
├── src/
│   ├── init.luau          # Library entry point (exports)
│   ├── main.luau          # Example application entry point
│   ├── client/            # High-level Client class
│   ├── rest/              # REST client & endpoint modules
│   │   └── endpoints/     # 18 endpoint modules (guild, channel, message, etc.)
│   ├── gateway/           # WebSocket gateway, sharding, heartbeat, intents
│   ├── structures/        # Builders: embed, component, command, permission, snowflake
│   ├── cache/             # CacheManager & 9 typed store modules
│   │   └── stores/        # guild, channel, member, role, user, message, etc.
│   ├── events/            # EventEmitter, event name constants
│   ├── voice/             # Voice gateway, connection, audio player
│   ├── oauth/             # Discord OAuth2 via BleuAuth
│   └── utils/             # Bitfield, Collection, CDN, errors, constants
├── tests/
│   ├── init.luau          # BleuTest-based test runner
│   └── unit/              # 17 unit test files
├── types/
│   └── discord.luau       # Comprehensive Discord API type definitions
├── docs/
│   ├── api/               # API reference documentation
│   ├── guides/            # Usage guides
│   ├── architecture/      # Architecture Decision Records
│   └── investigations/    # Bug investigation write-ups
└── packages/              # Installed dependencies (auto-managed, gitignored)

Known Limitations

  • Voice audio transport is a placeholder — BleuMoon does not currently expose a UDP API. The voice gateway handshake works, but sending/receiving audio frames requires UDP.
  • Interaction signature verification uses a placeholder — BleuMoon's crypto module doesn't support Ed25519 signing.
  • Large snowflake shard calculation uses string-based modular arithmetic to avoid double-precision overflow.

License

This project is licensed under the MIT License.