ADDOX
About
addox is an easy-to-use Node.js library for interacting with the Discord API's.
Installation
npm install addox
yarn add addox
Warn
Node.js v16.6.0 or higher is required.
Features
- Easy to use
- Object-oriented
- Lightweight
- Fast
- TypeScript support
Optional Dependencies
- zlib-sync for WebSocket data compression and decompression
- erlpack for WebSocket data serialization and deserialization
Example ping-pong
const {
Client,
ApplicationCommandBuilder,
EmbedBuilder,
ButtonBuilder,
ActionRowBuilder,
} = require('addox');
const client = new Client({
ws: {
intents: ['Guilds'],
},
});
client.ws.on('ready', () => {
const commands = [
new ApplicationCommandBuilder().setName('ping').setDescription('Replies with pong!')
];
client.caches.commands
.set(commands)
.then(() => console.log('Application commands (/) registered!'))
.catch(console.error);
console.log(`Logged in as ${client.user.tag}!`);
});
client.ws.on('interactionCreate', async (interaction) => {
if (interaction.type === 'ApplicationCommand' && interaction.commandType === 'ChatInput') {
switch (interaction.commandName) {
case 'ping':
await interaction.reply({
content: `Pong! **${client.ws.ping}**ms`,
});
break;
}
}
});
client.ws.connect('your-super-secret-token');
Useful Links
Contributing
If you want to contribute to addox, you can do so by forking the repository and submitting a pull request.