3.0.0 • Published 5 months ago
discord.odf v3.0.0
A comprehensive wrapper package for discord.js that provides seamless support for both ESM and CommonJS modules with complete TypeScript type definitions.
Features
- 🔄 Dual module support (ESM and CommonJS)
- 📝 Complete TypeScript type definitions
- 🛠 Utility functions for common Discord.js operations
- 📊 Enhanced embed creation and management
- 🎮 Message component utilities (buttons, select menus)
- 🔐 Permission handling utilities
- 🎯 Event handling with type safety
- ✨ Zero additional runtime dependencies
Installation
npm install discord.odf@latest
Usage
ESM Import
import { Client } from 'discord.odf';
const client = new Client({
intents: ['GuildMessages', 'MessageContent']
});
CommonJS Require
const { Client } = require('discord.odf');
const client = new Client({
intents: ['GuildMessages', 'MessageContent']
});
Features
Enhanced Embeds
Create beautiful embeds with our utility functions:
import { EmbedBuild } from 'discord.odf';
// Basic embed
const embed = EmbedBuild({
title: 'Welcome',
description: 'Welcome to our server!',
type: 'success' // Predefined color scheme
});
Message Components
Create interactive message components with type-safe builders:
import {
ButtonBuild,
StringSelectMenuBuild,
ActionRowBuild,
ButtonStyles
} from 'discord.odf';
// Create a button
const button = ButtonBuild({
label: 'Click Me',
style: ButtonStyles.PRIMARY,
customId: 'my-button'
});
// Create a select menu
const menu = StringSelectMenuBuild({
customId: 'select-option',
placeholder: 'Choose an option',
options: [
{ label: 'Option 1', value: '1' },
{ label: 'Option 2', value: '2' }
]
});
// Create an action row with components
const row = ActionRowBuild([button]);
API Documentation
Component Utilities
ButtonBuild(options)
: Create a button with predefined stylesStringSelectMenuBuild(options)
: Create a string select menuUserSelectMenuBuild(options)
: Create a user select menuRoleSelectMenuBuild(options)
: Create a role select menuChannelSelectMenuBuild(options)
: Create a channel select menuActionRowBuild(components)
: Create an action row with components
Embed Utilities
EmbedBuild(options)
: Create a basic embed with specified optionsEmbedColors
: Predefined color schemes for embeds
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Discord.js - The awesome library we're wrapping
- All the contributors who helped make this package better