From 88a44a3e76a6cd8acdb23c58bd45912834c19b56 Mon Sep 17 00:00:00 2001 From: Ian Yang Date: Mon, 19 Dec 2011 22:55:41 +0800 Subject: [PATCH] Auto add name before message which sent from query window --- src/irc.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/irc.coffee b/src/irc.coffee index 8a82054..5c19a2a 100644 --- a/src/irc.coffee +++ b/src/irc.coffee @@ -71,7 +71,7 @@ class IrcBot extends Adapter bot.addListener 'message', (from, to, message) -> console.log "From #{from} to #{to}: #{message}" - + user = self.userForName from unless user? id = (new Date().getTime() / 1000).toString().replace('.','') @@ -83,6 +83,8 @@ class IrcBot extends Adapter console.log "#{to} <#{from}> #{message}" else user.room = null + unless message.indexOf(to) == 0 + message = "#{to}: #{message}" console.log "msg <#{from}> #{message}" self.receive new Robot.TextMessage(user, message)