@ovencord/builders
v1.13.2
Published
A set of builders that you can use when creating your bot
Maintainers
Readme
@ovencord/builders
High-performance payload builders, standardized for Zod 3 and Bun.
@ovencord/builders is a modernized utility package for building Discord API payloads. Rebuilt for Bun, it eliminates legacy Zod v2 constraints and fixes long-standing multi-inheritance issues in TypeScript.
🥟 Why Ovencord-Builders?
| Feature | @ovencord/builders | @ovencord/builders | |---------|---------------------|--------------------| | Validation | Zod v2 (Legacy) | Zod v3+ Standard | | Inheritance | Fragmented Mixins | Fixed Interface Merging | | Performance | Standard | Memory-optimized schemas | | TypeScript | Basic | Strict & Highly Inferential | | Build Step | Required | Zero (Source-only) |
✨ Technical Optimizations
- Zod 3 Native: All schemas have been refactored to use native Zod 3 features like
z.nativeEnum(),z.string().url(), andsuperRefine, resulting in faster validation cycles and better error messages. - Mixin Clarity: Resolved
ts-mixervisibility issues. Methods like.toJSON()are now properly exposed through interface merging, ensuring a seamless developer experience. - Uint8Array Support: Native support for Web Standard
Uint8Arrayin attachments, reducingBufferoverhead.
📦 Installation
Bun 1.0.0 or newer is required.
bun add @ovencord/builders🚀 Examples
Build a Chat Input Command
import { SlashCommandBuilder } from '@ovencord/builders';
const command = new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with Pong!')
.addStringOption(option =>
option.setName('message')
.setDescription('Optional message to echo')
.setMaxLength(2000)
);
console.log(command.toJSON());Create an Action Row with Buttons
import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from '@ovencord/builders';
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('primary')
.setLabel('Click Me')
.setStyle(ButtonStyle.Primary),
new ButtonBuilder()
.setLabel('GitHub')
.setURL('https://github.com/ovencord')
.setStyle(ButtonStyle.Link)
);🛠️ Performance Features
- Standardized Assertions: Refactored assertions for maximum performance during serialization.
- Source-Only Distribution: No more
distfolders. Bun loads the TypeScript source directly, making the package extremely lightweight (~1.5MB total vs ~15MB for discord.js).
🤝 Contributing
See the contribution guide if you'd like to submit a PR.
📜 License
Apache-2.0 © Ovencord Contributors
Original discord.js code © Discord.js Contributors
