Created
September 8, 2015 21:16
-
-
Save coleww/a9f82ba7f37504bae368 to your computer and use it in GitHub Desktop.
log urls posted to yr irc channel to a delicious account
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isUrl = require('is-url') | |
var exec = require('child_process').exec | |
var irc = require("irc"); | |
var config = { | |
channels: ["#SOMECHANNEl"], | |
server: "irc.freenode.net", | |
botName: "SOME_USERNAME_YOOOOO" | |
}; | |
// Create the bot name | |
var bot = new irc.Client(config.server, config.botName, { | |
channels: config.channels | |
}); | |
bot.addListener("message", function(from, to, text, message) { | |
console.log("WHATSAT", text) | |
var words = text.split(" ") | |
console.log(words) | |
words.forEach(function(str){ | |
console.log("WHO?", str) | |
if (isUrl(str)){ | |
//can add stuff like `--tags=tag1,tag2,tagn --description="Page Title"` after `--sahred=yes`!!!! YOU CAN! yes you can! | |
exec('delicious add "'+ str +'" --shared=yes', function (error, stdout, stderr) { | |
console.log(str, "YEAH!") | |
}) | |
} | |
}) | |
}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
you gotta set DELICIOUS env variables as per what it says in: https://www.npmjs.com/package/npm-delicious | |
### DEPS: | |
npm install --save irc is-url | |
npm install -g npm-delicious | |
this script will post any URLs it sees in the given irc channel(s) to the specified delicious account. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment