Created
March 16, 2012 08:46
-
-
Save devyn/2049194 to your computer and use it in GitHub Desktop.
An example of a pink petal
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
module.exports = function (hub, name) { | |
// We register ourself as darkf_dix and are returned a handle that | |
// allows us to subscribe to or unsubscribe from events. | |
hub.register (name || "darkf_dix", function (handle) { | |
// The first argument specifies what item to subscribe to events from. | |
// If null or undefined, the default is "*". The second argument | |
// specifies what kind of events to accept. If left null or undefined, | |
// it defaults to the special event kind "*", which matches any kind of | |
// event. | |
handle.subscribe ("irc/*", "message", function (e) { | |
if (e.data.from.match (/^darkf/)) { | |
if (e.data.body.match (/\bdicks\b/i)) { | |
// Don't propagate the message if it contains the whole word 'dicks'. | |
} else { | |
e.data.body = "dicks dicks dicks dicks dicks"; | |
e.next (); | |
} | |
} else { | |
e.next (); | |
} | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment