simple-dcjs
v1.0.1
Published
A simple wrapper for discord.js to simplify bot creation and management
Maintainers
Readme
Simple Discord Js
Simple Discord Js brings WhatsApp Baileys syntax to Discord.js, letting you create rich messages, buttons, modals, and selects with familiar, intuitive APIs. Simplify Discord bot development with Baileys-like message structures.
📦 Installation
npm install simple-dcjs🚀 Quick Start
const { SatzzBot } = require('simple-dcjs');
const bot = new SatzzBot({
prefix: '!',
intents: [
'Guilds',
'GuildMessages',
'MessageContent',
'GuildMessageReactions'
]
});
// Add a simple command
bot.addCommand('ping', async (message) => {
await bot.sendMessage(message.channel.id, { text: 'Pong! 🏓' });
});
// Handle button interactions
bot.onButton('my_button', async (interaction) => {
await interaction.reply({ content: 'Button clicked!', ephemeral: true });
});
// Login with your Discord token
bot.login('YOUR_DISCORD_TOKEN');🚀 Features
- Baileys-Like Syntax: Send images/videos with
image: { url }, buttons as arrays, lists with sections/rows - Discord Native Components: Select menus (user/role/channel), modals, action rows
- Media Support: Images, videos, audio with captions
- Interactions: Button handlers, select menus, modal submits with ephemeral replies
- Message Components v2: Advanced message structuring with containers, sections, and more
Embed
await bot.sendMessage(message.channel.id, {
title: 'Test Embed',
description: 'This is a test embed created with Baileys-like syntax',
color: 0x0099ff,
fields: [
{ name: 'Field 1', value: 'Value 1', inline: true },
{ name: 'Field 2', value: 'Value 2', inline: true },
],
footer: { text: 'Footer text' },
timestamp: new Date(),
});Embed With Image
await bot.sendMessage(message.channel.id, {
title: 'Image Embed',
description: 'Embed with thumbnail and image',
color: 0x00ff00,
thumbnail: 'https://picsum.photos/seed/thumbnail/150/150',
image: 'https://picsum.photos/seed/image/400/300',
});Image
await bot.sendMessage(message.channel.id, {
image: { url: 'https://picsum.photos/seed/random/500/400' },
caption: 'This is an image sent with Baileys-style syntax! 📸'
});Video
await bot.sendMessage(message.channel.id, {
video: { url: 'https://www.w3schools.com/html/mov_bbb.mp4' },
caption: 'Sample video 🎥'
});
Audio
await bot.sendMessage(message.channel.id, {
audio: { url: 'https://cdn.discordapp.com/attachments/1420854986148941848/1436954304354189392/life_force.mp3?ex=692d2afb&is=692bd97b&hm=ae0595d28b55d81f1fc3aac6e063663b8c26e89c11681227e590b05aa20a4027&' }
});Buttons
await bot.sendMessage(message.channel.id, {
text: 'Choose an option:',
buttons: [
{ id: 'btn_primary', label: 'Primary', style: 'primary' },
{ id: 'btn_success', label: 'Success ✅', style: 'success' },
{ id: 'btn_danger', label: 'Danger ❌', style: 'danger' }
]
});Select
const selectMenu = bot.createSelectMenu({
customId: 'string_select',
placeholder: 'Choose an option',
options: [
{ label: 'Option 1', value: 'opt1', description: 'First option', emoji: '1️⃣' },
{ label: 'Option 2', value: 'opt2', description: 'Second option', emoji: '2️⃣' },
{ label: 'Option 3', value: 'opt3', description: 'Third option', emoji: '3️⃣' },
],
});
const row = bot.createActionRow(selectMenu);
await bot.sendMessage(message.channel.id, {
text: 'Select an option:',
components: [row]
});Select User
const userSelect = bot.createUserSelectMenu({
customId: 'user_select',
placeholder: 'Select a user',
minValues: 1,
maxValues: 3,
});
const row = bot.createActionRow(userSelect);
await bot.sendMessage(message.channel.id, {
text: 'Select up to 3 users:',
components: [row]
});Select Role
const roleSelect = bot.createRoleSelectMenu({
customId: 'role_select',
placeholder: 'Select a role',
});
const row = bot.createActionRow(roleSelect);
await bot.sendMessage(message.channel.id, {
text: 'Select a role:',
components: [row]
});Select Channel
const channelSelect = bot.createChannelSelectMenu({
customId: 'channel_select',
placeholder: 'Select a channel',
});
const row = bot.createActionRow(channelSelect);
await bot.sendMessage(message.channel.id, {
text: 'Select a channel:',
components: [row]
});ComponentV2
bot.addCommand('componentv2', async (message) => {
await bot.sendMessage(message.channel.id, {
container: [
{
type: 'text',
content: 'Testing Message Components v2:'
},
{
type: 'section',
texts: ['Welcome to Message Components v2!', 'This is a new way to structure messages.'],
button: {
id: 'section_btn',
label: 'Click Me',
style: 'primary',
emoji: '👋'
},
thumbnail: 'https://picsum.photos/seed/picsum/200/300'
},
{
type: 'section',
texts: ['Welcome to Message Components v2!', 'This is a new way to structure messages.'],
button: {
id: 'section_btn',
label: 'Click Me',
style: 'primary',
emoji: '👋'
},
},
{
type: 'buttons',
buttons: [
{ id: 'btn1', label: 'Button 1', style: 'primary' },
{ id: 'btn2', label: 'Button 2', style: 'secondary', emoji: '⭐' },
{ label: 'Link', style: 'link', url: 'https://discord.js.org' }
]
},
{
type: 'select',
customId: 'container_select',
placeholder: 'Choose from container',
options: [
{ label: 'Option A', value: 'a', emoji: '🔴' },
{ label: 'Option B', value: 'b', emoji: '🔵' }
]
},
{
type: 'image',
url: 'https://picsum.photos/seed/picsum/200/300'
}
]
});
});🎛 API Reference
Sending Messages
// Text
{ text: 'Hello!' }
// Embed
{ title: 'Embed', description: 'Content', color: 0x0099ff }
// Baileys Buttons
{ text: 'Click', buttons: [{ buttonId: 'id', buttonText: { displayText: 'Label' }, type: 1 }] }
// List/Sections
{ sections: [{ title: 'Food', rows: [{ title: 'Pizza', rowId: 'pizza' }] }] }
Components
bot.createButton({ customId, label, style })bot.createSelectMenu({ customId, options })bot.createActionRow(components)
🤝 Contributing
Fork, add features/tests, submit PRs. Focus on new Baileys features or Discord interactions.
📄 License
MIT - Free to use/modify. No warranty.
