A Node.js wrapper for interfacing with Discord.
⚠️ This library is not ready for production use.
npm install helly
yarn add helly
pnpm add helly
npm install helly@dev
yarn add helly@dev
pnpm add helly@dev
bufferutil for a much faster WebSocket connection (npm install bufferutil
)
utf-8-validate in combination with bufferutil
for much faster WebSocket processing (npm install utf-8-validate
)
const { Client, Events, GatewayIntentBits } = require('helly');
const client = new Client({
intents: [GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
});
// Code inside here will run when the bot connects to the Discord API
client.on(Events.Ready /* you can also use 'Ready', but using enums are recommended */, () => {
console.log("Ready!"); // Log "Ready!"
});
// Code inside here will run when someone sends a message in a channel
client.on(Events.MessageCreate /* you can also use 'MessageCreate', but using enums are recommended */, (message) => {
if (message.content === '!ping') return message.reply(`🏓 ${client.ping}ms...`)
if (message.content === 'Hi') return message.reply(`Hello, ${message.author}! How are you?`)
})
// Replace TOKEN with your bot account's token
client.login('TOKEN')
Generated using TypeDoc version 0.22.16, the 9/16/2022 at 1:09:14 AM