hubot

Hubot with slack adapter - cannot perform rtm.start

梦想与她 提交于 2019-12-11 12:15:14
问题 I'm trying to have hubot + slack on my local machine. installed hubot and slack client. running: bin\hubot -a slack and got error (after adding log messages to the script) INFO Connecting... INFO { ok: false, error: { [Error: socket hang up] code: 'ECONNRESET' } } from reading code in node_modules\slack-client\src\client.js found the problem occurs in a POST request: Client.prototype.login = function() { this.logger.info('Connecting...'); return this._apiCall('rtm.start', { agent: 'node-slack

Hubot/Express: disable basic auth in a specific route

痴心易碎 提交于 2019-12-11 03:11:57
问题 I am using Hubot and I've defined the environment variables EXPRESS_USER and EXPRESS_PASSWORD to enable basic authentication. Hubot uses express and basically it's setupExpress: -> user = process.env.EXPRESS_USER pass = process.env.EXPRESS_PASSWORD stat = process.env.EXPRESS_STATIC express = require 'express' app = express() app.use (req, res, next) => res.setHeader "X-Powered-By", "hubot/#{@name}" next() app.use express.basicAuth user, pass if user and pass app.use express.query() app.use

Hubot - load environmental variables from a file

倾然丶 夕夏残阳落幕 提交于 2019-12-10 10:52:56
问题 setting environmental variables for a Hubot is pretty easy on the production server. However when I want to test the bot locally, I need the env vars inside a file. I already have the file .env for env vars that heroku is using for running locally. But I can't seem to find a way to load env vars inside the Hubot scripts from a file. Merry Christmas :-) 回答1: okay it's possible with hubot-env. https://www.npmjs.com/package/hubot-env The following command will load the file from a relative path:

Node.js hubot execute commands on the server

天大地大妈咪最大 提交于 2019-12-07 17:11:56
问题 I am trying to execute a command on the server using hubot. This example works for me: robot.respond /(cmd)/i, (msg) -> doing = spawn 'ls', ['-la'] doing.stdout.on 'data', (data) -> msg.send data.toString() However, I need to change the folder before I execute the command I want to execute. What I want hubot to run is: cd /var/folder && some-command but changing the folder from the hubot script doesn't work. The executed command has a lot of files loaded based on the folder it resides in so

Node.js hubot execute commands on the server

元气小坏坏 提交于 2019-12-05 23:04:20
I am trying to execute a command on the server using hubot. This example works for me: robot.respond /(cmd)/i, (msg) -> doing = spawn 'ls', ['-la'] doing.stdout.on 'data', (data) -> msg.send data.toString() However, I need to change the folder before I execute the command I want to execute. What I want hubot to run is: cd /var/folder && some-command but changing the folder from the hubot script doesn't work. The executed command has a lot of files loaded based on the folder it resides in so it seems I have to go to this folder. How can I make hubot execute a command from a specific path?

Hubot Unit Testing Not Receiving Response

杀马特。学长 韩版系。学妹 提交于 2019-12-05 19:18:03
I'm trying to set up a simple unit test for my hubot code and I am not receiving responses back. I have simplified this down to: test.coffee: Helper = require('hubot-test-helper') chai = require 'chai' expect = chai.expect helper = new Helper('../hubot-scripts/something.coffee') describe 'PING', -> beforeEach -> @room = helper.createRoom() afterEach -> @room.destroy it 'should PONG', -> @room.user.say 'alice', '@hubot PING' expect(@room.messages).to.eql [ ['alice', '@hubot PING'], ['hubot', 'PONG'] ] and something.coffee: module.exports = (robot) -> robot.response /PING$/i, (msg) -> msg.send

How do I combine multiple queries in ElasticSearch

让人想犯罪 __ 提交于 2019-12-04 17:25:39
问题 For reference here is the code. I am trying to make a hubot plugin that logs to elasticsearch and then uses hubot commands to search those logs. https://gist.github.com/4050748 I am trying to retrieve records that match two queries. { query: { match: { user: "SomeUsername" }, range: { date: { from: (Date.now() - 3600) } } }, size: 50 } I was expecting: Up to 50 records records that had the given user records in the last hour I got: up to 10 records records that had the given user from any

Debugging/printing in a Hubot script

拟墨画扇 提交于 2019-12-04 10:23:31
问题 I'm trying to debug an existing Hubot script and in the future write my own, and I need an easy way to debug it or at least print values somewhere (but not to the channel). How can I do so? Bonus points if this can be done with just using Node in some interactive local mode. I'm really not sure where to start. All scripts Hubot uses are written in Coffeescript. P.S. I'm using Hubot with Hipchat. 回答1: I don't know if this helps but I found a way to inspect objects. Util = require "util" module

Unable to install hubot - npm dependency not met

女生的网名这么多〃 提交于 2019-12-03 11:08:41
问题 While trying to deploy hubot, npm keeps complaining about unmet dependencies. The documentation does not explain how to get around this. yum install npm --enablerepo=epel yum install nodejs --enablerepo=epel cd /opt git clone https://github.com/github/hubot.git cd hubot/ ./bin/hubot --create acebot npm install -g hubot coffee-script ... npm http 200 https://registry.npmjs.org/formidable/-/formidable-1.0.14.tgz npm http 200 https://registry.npmjs.org/uid2/-/uid2-0.0.2.tgz /usr/bin/hubot ->

How do I combine multiple queries in ElasticSearch

时光毁灭记忆、已成空白 提交于 2019-12-03 11:05:44
For reference here is the code. I am trying to make a hubot plugin that logs to elasticsearch and then uses hubot commands to search those logs. https://gist.github.com/4050748 I am trying to retrieve records that match two queries. { query: { match: { user: "SomeUsername" }, range: { date: { from: (Date.now() - 3600) } } }, size: 50 } I was expecting: Up to 50 records records that had the given user records in the last hour I got: up to 10 records records that had the given user from any time How do I get all the records with some username in the last hour? Do I need to use match_all with