 	# Send a WOL package
 	# 
 	robot.respond /kick (.*)/i, (msg) ->
-		wakeup msg.match[1], msg
+		wakeup msg.match[1], (message) ->
+			msg.reply message
 		
 
 	#
 	# Listen to GET http requests
 	# 
 	robot.router.get '/wakeup/kick/:mac', (req, res) ->
-		enabled = process.env.HUBOT_WAKEUP_HTTP_ENABLED
+		enabled = process.env.HUBOT_WAKEUP_HTTP_ENABLED	 
 
 		if enabled == "true" or enabled == "1"
 			mac = req.params.mac
-			res.reply = res.end
-			wakeup mac, res
+			channel = process.env.HUBOT_WAKEUP_CHANNEL or "#general"
+
+			wakeup mac, (message) ->
+				robot.send {room: channel}, message
+				res.end message
+				return
 		else
 			res.end "http disabled"
 

#
# Configuration:
#   HUBOT_WAKEUP_HTTP_ENABLED - trigger wakeup with a http request? ( 1|0 )
#
# Commands:
#   hubot kick <machine> - Send a WOL package to `<machine>`

			# This is the magical line, that sends the packages
			wol.wake mac, (error) ->
				if error
					callback "shoot! #{error}"
				else
					callback "kicked #{mac} his shiny metal ass"
		else
			callback "'#{mac}' is not a mac adres, nor a machine I know"
			return

			
