aeracord v0.7.4
Aeracord
Aeracord is a lightweight library for the Discord API. Aeracord's main purpose is to give you control over how objects are cached.
Installation
Aeracord can be installed from NPM. You can install it with the NPM CLI tool or with Yarn. Aeracord has TypeScript support built in.
NPM:
npm install aeracord
Yarn:
yarn add aeracord
Once installed, you can import it into your project as usual:
// CommonJS
const aeracord = require("aeracord");
// or ES6 imports
import aeracord from "aeracord";
Or if you'd prefer, you can destruct the imports:
// CommonJS
const { Client, Guild, User, ... } = require("aeracord");
// or ES6 imports
import { Client, Guild, User, ... } from "aeracord";
Connecting to the Gateway
To connect to the gateway, you need to construct a new Client:
import { ActivityTypes, Client } from "aeracord";
// Create client
const client = new Client({
token: process.env.TOKEN,
presence: {
activities: [{
name: "say /help",
type: ActivityTypes.PLAYING
}]
},
membersIntent: true,
presencesIntent: true
});
// Event listeners
...
// Connect to the gateway
client.connect();
Before interacting with the API, you need to wait for the ready
event. This event is fired when the client has connected to the gateway:
// Ready
client.on("ready", (data) => {
// Log
console.log("Bot online");
});
You can also listen for various other events, such as the interactionCreate
event for when an interaction is created:
// Interaction create
client.on("interactionCreate", (interaction) => {
// Ping
if (interaction.data.name === "ping") {
// Respond
interaction.respond("Pong!");
}
});
Issue Tracker
You can report bugs and suggest features by opening an issue. Please check to make sure that an issue for the bug or feature you're reporting doesn't already exist.
Contributing
Contributing guidelines will be available soon.