0.0.1 • Published 10 years ago
sails-userhooks-ircbot v0.0.1
sails-hooks-irc
Description
An IRC Bot user hook for the Sails.js framework (~v0.10).
Installation
via npm
npm install sails-userhooks-ircbot
Setting Up A Bot
Create The Hook
Create the file myApp/hooks/ircbot/index.js
module.exports = require('sails-userhooks-ircbot');
Add A Config File
Create the file myApp/config/irc.js
module.exports.irc = {
"sailsTroll": {
events:{
error:console.log,
join:console.log,
part:console.log,
message:console.log,
say:console.log,
registered:console.log
}
}
};
Generate a 'bot' api
dude@littleDude:~/node/myApp$ sails generate api bot
debug: Generated a new controller `file` at api/controllers/BotController.js!
debug: Generated a new model `File` at api/models/Bot.js!
info: REST API generated @ http://localhost:1337/Bot
info: and will be available the next time you run `sails lift`.
dude@littleDude:~/node/myApp$
Add a bot
model instance
Either lift your app in console or use blueprints to create a record like this in it that looks like this.
{
"name" : "sailsTroll"
"host" : "chat.freenode.net",
"autoconnect" : true,
"autorejoin" : true
}
Lift Your App
Your Bot should connect after the hook registers.
Events
TODO
- Create a generator to automatically create config/hook files
- Allow bots to be defined in
irc.js
as well as in a waterline collection
0.0.1
10 years ago