novecord
v0.1.1
Published
Build powerful discord bots with a powerful library.
Readme
NoveCord
NoveCord is a lightweight, dependency-free Discord API wrapper built entirely from scratch using only Node.js core modules. It provides essential features like WebSocket gateway, REST API handling, interactions (slash commands, buttons, modals), embed building, shard management, and more — all without external libraries.
Much closer!
This library is so close to full version, wait for 1.0.0! we gonna give so much support.
Note
This module is currently under maintenance, so some bugs may still occur. Please be patient until the full release.
Sources
Features
- WebSocket Gateway connection (no external WS libraries)
- Native HTTPS REST API requests using Node.js core modules
- Full Interaction v2 support (slash commands, buttons, select menus, modals)
- Embed builder
- Intents bitfield system
- EventEmitter-based easy event handling (
.onmethod) - Simple command handler
- Multi-process shard manager
- Minimal size and zero external dependencies (only core WebSocket module)
Installation
npm install novecord
yarn add novecordUsage Example
const { Client, Intents } = require('novecord');
const client = new Client({
token: 'Discord Bot Token',
intents: Intents.Guilds | Intents.GuildMessages | Intents.MessageContents
});
client.on('READY', () => {
console.log(`Logged in as ${client.user.username}`);
});
client.on('MESSAGE_CREATE', (message) => {
if (message.content === '!ping') {
client.sendMessage(message.channel_id, { content: 'Pong!' });
}
});
client.login();Event-Driven Typing Indicator
The setTyping(channelId) method sends a POST request directly to Discord’s /channels/{channelId}/typing endpoint using the bot token internally. On success, it emits a 'typingStarted' event with the channel ID. On failure, it emits a 'typingError' event with the error details.
client.setTyping(channelId);
client.on('typingStarted', (channelId) => {
console.log(`Typing indicator started in channel ${channelId}`);
});
client.on('typingError', ({ channelId, error }) => {
console.error(`Failed to start typing in channel ${channelId}:`, error);
});REST API Example
const { REST, Routes } = require('novecord');
const rest = new REST(TOKEN);
rest.get(Routes.User('@me'))
.then(user => console.log(user))
.catch(console.error);Embed Builder Example
const { Embed } = require('novecord');
const embed = new Embed()
.setTitle('NoveCord')
.setDescription('A simple, dependency-free Discord API wrapper.')
.setColor('#5865F2');
client.sendMessage(channelID, { embeds: [embed] });Shard Manager Example
const ShardManager = require('novecord').ShardManager;
const manager = new ShardManager(2, 'YOUR_BOT_TOKEN', Intents.All);
manager.on('shardMessage', ({ shardId, message }) => {
console.log(`Message from shard ${shardId}:`, message);
});
manager.spawnAll('path/to/shard.js');