From 6b036545bc16a58604459f10c85eb448f306c7f2 Mon Sep 17 00:00:00 2001 From: Josh Snyder Date: Thu, 14 Feb 2013 23:10:53 -0500 Subject: [PATCH] Handle PMs once, rather than twice. Currently new PMs are handled first by the 'message' handler and then by the 'pm' handler. This change makes the 'message' handler take a back seat to the 'pm' handler. --- src/irc.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/irc.coffee b/src/irc.coffee index e6d7e5e..277e313 100644 --- a/src/irc.coffee +++ b/src/irc.coffee @@ -165,6 +165,10 @@ class IrcBot extends Adapter self.createUser channel, nick bot.addListener 'message', (from, to, message) -> + if options.nick.toLowerCase() == to.toLowerCase() + # this is a private message, let the 'pm' listener handle it + return + console.log "From #{from} to #{to}: #{message}" user = self.createUser to, from