ChatExchangeJS
This project is still in the beta stage, and may be unstable. Use with caution.
A Node.js wrapper for the Stack Exchange chat system, allowing the ability to interact with the chat.
This library is still missing some major features, especially when it comes to error reporting. You may run into situations where the library simply doesn't work, and the errors outputted aren't that useful. These should be fixed in the upcoming weeks.
Features:
- Message API, allowing to send and receive messages
- Chat event listener, so you can listen for any event from the chat room
Installation
Install from NPM:
npm install chatexchangejs
Usage:
var Client = ; //Enter the bot users creds herevar user = email:"myemail" password: "mypassword"; //Function called when joining a room { console //Add event listener to this room room; //Send welcome message when user enters room room; //Send goodbye message when user leaves room;} //This is the user session. All actions that require the user to be logged in should be done in here. { console //Join room, then run room function me;} //Create new client for sitevar me = "stackoverflow.com"; //Login to site with username and passwordme;
A demo can be seen in demo.js
.
To run the demo, create a user.json
file in the project dir, and add the bot username and password to it.
Then, just run node demo
.
Your chat bot is now running in the ChatExchangeJS Beta room on stackoverflow.
Don't leave the demo file running! It's for demo purposes only, and gives anyone the ability to edit or delete your bot's messages!