Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

Latest commit

 

History

History
72 lines (47 loc) · 2.1 KB

README.md

File metadata and controls

72 lines (47 loc) · 2.1 KB

Moonstone NPM version

A simple, standalone, dogehouse.tv API wrapper

Installing

You will need NodeJS and NPM. To install moonstone on your local project, run:

npm install --no-optional --production moonstone-wrapper

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

Usage

You can use the example from below to see how you can use moonstone.

Ping Pong Example

const Moonstone = require("moonstone-wrapper");

var bot = Moonstone("TOKEN"); // Replace TOKEN with your bot account's token

bot.on("ready", async () => {
  // When the bot is ready
  console.log(`Ready! Logged in as ${bot.user.username}`); // Log "Ready!"
  const topRooms = await bot.getTopRooms(); // Grab the top rooms
  bot.joinRoom(topRooms[0]); // Join the top room
});

bot.on("newChatMsg", (msg) => {
  // When a message is created
  if (msg.content === "!ping") {
    // If the message content is "!ping"
    msg.room.sendChatMessage("Pong!"); // Send a message in the same channel with "Pong!"
  } else if (msg.content === "!pong") {
    // Otherwise, if the message is "!pong"
    msg.user.sendWhisper("Ping!"); // Whisper to the user with "Ping!"
  }
});

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

More examples can be found in the examples folder.

Support

You can find help on the official support server.

License

Distributed under the MIT License. See LICENSE for more information.

Contributors