From 1fadad01de9bbf70b75a4ab3b5f4dc935d65458f Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Tue, 23 Jun 2015 01:10:36 +0200 Subject: [PATCH] Use variables defined by the adapter --- scripts/telegram.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/telegram.coffee b/scripts/telegram.coffee index f59e92c..78ea317 100644 --- a/scripts/telegram.coffee +++ b/scripts/telegram.coffee @@ -16,15 +16,15 @@ net = require 'net' -port = process.env['HUBOT_TG_PORT'] || 1123 -host = process.env['HUBOT_TG_HOST'] || 'localhost' - module.exports = (robot) -> + + console.log robot.host # directly run a command in telegram-cli and return its output # (a list of strings) run_command = (command, callback) -> - client = net.connect port, host, -> client.write command+'\n' + client = net.connect robot.adapter.port, robot.adapter.host, -> + client.write command+'\n' client.setEncoding 'utf8' client.on 'data', (reply) -> if callback?