Use variables defined by the adapter

This commit is contained in:
rnhmjoj 2015-06-23 01:10:36 +02:00
parent d66080f531
commit 1fadad01de

View File

@ -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?