help + ignore self

This commit is contained in:
Chris Wanstrath
2010-12-14 03:08:44 -08:00
parent 3a0a4e13a9
commit 0aeb62cd7d
+4 -1
View File
@@ -79,7 +79,7 @@ hear = (pattern, callback) ->
dispatch = (message) ->
for pair in handlers
[ pattern, handler ] = pair
if match = message.message.match(pattern)
if message.user.username isnt username and match = message.message.match(pattern)
message.match = match
message.say = (thing) -> say(message.topic.id, thing)
handler(message)
@@ -122,6 +122,9 @@ hear /feeling/, (message) ->
hear /about/, (message) ->
message.say "I am learning to love."
hear /help/, (message) ->
message.say "I listen for '@#{username} image me PHRASE' and '@#{username} wiki me PHRASE'"
hear /wiki me (.*)/i, (message) ->
term = escape(message.match[1])
url = "http://en.wikipedia.org/w/api.php?action=opensearch&search=#{term}&format=json"