eris-hummus
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

Eris for Hummus NPM version

A Node.js wrapper for interfacing with Hummus.

Installing

You will need NodeJS 10.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 eris-hummus

If you need voice support, remove the --no-optional.

Ping Pong Example

const Eris = require("eris-hummus");

// Replace TOKEN with your bot account's token
const bot = new Eris("Bot TOKEN");

bot.on("ready", () => { // When the bot is ready
    console.log("Ready!"); // Log "Ready!"
    bot.editStatus("online", {name: "Game", type: 1}) // You can change online to stuff like dnd, and the game to anything you want.
});

bot.on("error", (err) => {
  console.error(err); // or your preferred logger
});

bot.on("messageCreate", (msg) => { // When a message is created
    if(msg.content === "!ping") { // If the message content is "!ping"
        bot.createMessage(msg.channel.id, "Pong!");
        // Send a message in the same channel with "Pong!"
    } else if(msg.content === "!pong") { // Otherwise, if the message is "!pong"
        bot.createMessage(msg.channel.id, "Ping!");
        // Respond with "Ping!"
    }
});

bot.connect(); // Get the bot to connect to Discord

More examples can be found in the examples folder.

License

Refer to the LICENSE file.

Package Sidebar

Install

npm i eris-hummus

Weekly Downloads

1

Version

0.0.5

License

MIT

Unpacked Size

1.08 MB

Total Files

85

Last publish

Collaborators

  • nilenta