0.1.2 • Published 6 years ago
lext v0.1.2
Lext
A NodeJS Wikia chat client
Requirements
Installation
Create a directory for your bot and change to that directory in your command line. Use NPM to install Lext:
npm install lext
Optional libraries
eventemitter3
- Alternate EventEmitter library (faster)
Example: Ping Pong
const { Client } = require("lext");
const bot = new Client("some_username", "some_password");
bot.on("ready", () => {
console.log("Ready!"); // logs ready
});
bot.on("messageCreate", (msg) => {
if (msg.content === "!ping") { // If the message content is "!ping"
bot.createMessage(msg.room.id, "Pong!");
// Send a message in the same room with "Pong!"
} else if (msg.content === "!pong") { // Otherwise, if the message is "!pong"
bot.createMessage(msg.room.id, "Ping!");
// Respond with "Ping!"
}
});
bot.connect("ur.wiki", "ur.other-wiki"); // if u want more sites to connect, pass them as parameters
The examples can be found in the examples folder.