ADOX
About
adox is an easy-to-use Node.js library for interacting with the Discord API's.
Installation
npm install adox
yarn add adox
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 } = require('adox');
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.commandType === 'ChatInput' && interaction.commandName === 'ping') {
await interaction.reply({
content: `Pong! **${client.ws.ping}**ms`,
flags: 'Ephemeral',
});
}
});
client.ws.connect('Your super secret token');
Useful Links
Contributing
If you want to contribute to adox, you can do so by forking the repository and submitting a pull request.
License
adox is licensed under the GPL 3.0