1.1.4 • Published 6 years ago
starsjs v1.1.4
starsjs
This is mainly for myself, I might make it more public and actually work on it as an actual library, but for now it's pretty much a eris clone.
A NodeJS wrapper for interfacing with Discord.
Installing
You will need NodeJS 4+. If you need voice support you will also need Python 2.7 and a C++ compiler. Refer to the Getting Started section of the docs for more details.
npm install --no-optional starsjs
If you need voice support, remove the --no-optional
Ping Pong Example
const Stars = require("starsjs");
var client = new Stars("BOT_TOKEN");
// Replace BOT_TOKEN with your bot account's token
client.on("ready", () => { // When the bot is ready
console.log("Ready!"); // Log "Ready!"
});
client.on("messageCreate", (msg) => { // When a message is created
if(msg.content === "!ping") { // If the message content is "!ping"
msg.channel.createMessage("Pong!");
// Send a message in the same channel with "Pong!"
} else if (msg.content === "!pong") { // Otherwise, if the message is "!pong"
msg.channel.createMessage("Ping!");
// Respond with "Ping!"
}
});
client.connect(); // Get the bot to connect to Discord
Useful Links
The website includes more detailed information on getting started, as well as documentation for the different components.
The GitHub repo has the most updated code.
License
Refer to the LICENSE file.