Giter Site home page Giter Site logo

hubot-gitter2's Introduction

hubot-gitter2

Improved Hubot adapter for Gitter


There was already one adapter hubot-gitter but after trying to fix many missing things from it, I decided to write one from scratch.

Gitter chat

At the time this is written, here is the advantages of this one:

  • namespaced environment variables for the configuration
  • handling robot.send room: 'room id or uri', 'my message'
  • gathering information from users in all rooms correctly
  • not handling messages that the bot itself is sending

Installation

  • install Hubot and CoffeeScript: npm install -g hubot coffee-script
  • create your bot and install its dependencies:
npm install -g yo generator-hubot
mkdir -p my-bot
yo hubot
  • save hubot-gitter2 as dependency: npm install --save hubot-gitter2
  • start the bot using the right adapter: HUBOT_GITTER2_TOKEN=<your token> ./bin/hubot -a gitter2 --name <your bot name>
    • HUBOT_GITTER2_TOKEN: get your personal token there after sign-in
    • the bot will automatically listen on the rooms it has joined.

Troubleshooting

  • If your bot is not responding to mentions, make sure hubot was started with the same --name parameter as its GitHub username.

hubot-gitter2's People

Contributors

aleksueir avatar bobbyrne01 avatar davidchambers avatar fiws avatar huafu avatar jzaefferer avatar koron avatar nemani avatar raine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hubot-gitter2's Issues

Error: 401 {"error":"Unauthorized"}

[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] overriding {client#get}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] overriding {client#post}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] overriding {client#put}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] overriding {client#patch}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] overriding {client#delete}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] overriding {client#request}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] overriding {client#stream}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] creating promise users.current
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] {client#get} [/user]
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] {client#request} [GET, /user, ]
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] created
[hubot-gitter2.error][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] error while loading session user: Error: 401 {"error":"Unauthorized"}
[hubot-gitter2.error][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] Error: 401 {"error":"Unauthorized"}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] destroying promise users.current

move release notes from readme to /releases

We will soon merge #27, at which point I'll release a new version of this package. With this in mind, I propose moving the release notes from the readme to their respective releases. This would reduce the release process to just two steps:

  1. Run npm run release [major|minor|patch].
  2. Create a GitHub release for the tag created in the previous step.

If this change is okay with you, @huafu, I will update the three releases in question then open a pull request to remove the release notes from the readme.

Mention NPX in README

Following steps are mentioned in README:

  • install Hubot and CoffeeScript: npm install -g hubot coffee-script

  • create your bot and install its dependencies:

    npm install -g yo generator-hubot
    mkdir -p my-bot
    yo hubot
    

However they can be simplified into

npx -p yo -p generator-hubot -- yo hubot

with latest Node.js.

Error: 401 {"error":"Unauthorized"}

[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] overriding {client#get}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] overriding {client#post}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] overriding {client#put}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] overriding {client#patch}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] overriding {client#delete}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] overriding {client#request}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] overriding {client#stream}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] creating promise users.current
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] {client#get} [/user]
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] {client#request} [GET, /user, ]
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] created
[hubot-gitter2.error][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] error while loading session user: Error: 401 {"error":"Unauthorized"}
[hubot-gitter2.error][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] Error: 401 {"error":"Unauthorized"}
[hubot-gitter2.debug][object GitterClient<5e546bb4a87df413ca50296752b9de8b522dc0 c1>] destroying promise users.current

Document supported env vars

The changelog mentions two newly added env vars, but their usage doesn't seem to be documented anywhere.

PS: As far as I can tell, the docs folder is rather useless; not hosted anywhere to view it properly, and the content is primarily the content of the readme?

Can you help?

Hello,

I have been trying to get hubot running, using your extension, for my Gitter Room over at chocolatey/choco. I have been able to successfully deploy hubot onto Azure by using the instructions listed here:

https://github.com/scrumdod/hubot-vsonline/blob/master/docs/HOWTO-HubotForVisualStudioOnlineTeamRoomsOnAzureWebSite.md

And you can see it is alive here:

image

However, it doesn't seem to be responding to any commands, i.e. hubot ping comes back with nothing. Are you able to suggest anything that I can try to get this working? Thanks in advance!

Gary

Users are registered with "wrong" name

Hi there,

when using gitter2 + hubot-auth, it's pretty inconvenient to assign roles to users. Since gitter is tightly coupled to github, I'd assume I can assign roles to github names, just like I highlight them by @name

Unfortunately you have to assign roles to the full name like "Daniel Freudenberger (dfreudenberger)" which feels wrong. I think it could be easily fixed by storing the user's login name instead of his fullname somewhere here https://github.com/huafu/hubot-gitter2/blob/develop/src/HubotGitter2Adapter.coffee#L229

Looking forward to your feedback

Are you planning a new release?

@huafu I was just wondering if you were planning on generating a new release soon?

There is at least one fix on the develop branch that we would like to see pushed as a new release, as it allows us to run this Hubot Gitter on Azure. Thanks in advance!

Bot doesn't respond

I've installed and started the bot using the README instructions, so far so good. When starting it logs a bunch of stuff about rooms it found/joined(?) as well as users. When trying to interact with the bot, for example typing "[nameofbot] help", it outputs something like this:

[hubot-gitter2.debug][object GitterClient<[sha]>] found user with id `[other-sha]`: [object GitterUser<jzaefferer>]

Otherwise nothing happens. Googling around didn't yield any results, so I'm hoping for some guidance here.

Authentication

Is there any way to only allow certain users e.g. in a certain channel to do something?

simplify branching strategy

@huafu, currently we have develop and master branches. I do not think this is necessary. I suggest merging the branches, deleting develop, and merging all future pull requests into master directly. Do you support this? Say the word and I will take care of it. :)

Fails to create GitterClient with coffee-script > 1.8

Reference Error on startup with CoffeeScript >=1.9
Fails even with CoffeeScript v1.12.6 (latest)

With CoffeeScript 1.9.0:

ReferenceError: no id given to create an object: null, [object Object<token,id>]
  at GitterClient.GitterObject [as constructor] (./node_modules/hubot-gitter2/src/GitterObject.coffee:107:15)
  at new GitterClient (./node_modules/hubot-gitter2/src/GitterClient.coffee:34:5)
  at Function.GitterObject.factory (./node_modules/hubot-gitter2/src/GitterObject.coffee:67:49)
  at Function.GitterClient.factory (./node_modules/hubot-gitter2/src/GitterClient.coffee:24:26)
  at HubotGitter2Adapter.gitterClient (./node_modules/hubot-gitter2/src/HubotGitter2Adapter.coffee:120:31)
  at HubotGitter2Adapter.run (./node_modules/hubot-gitter2/src/HubotGitter2Adapter.coffee:82:11)
  at Robot.run (./node_modules/hubot/src/robot.coffee:587:14)

With CoffeeScript 1.8.0:

[hubot-gitter2.debug][object GitterClient<f21a0ae5e899ffc2669cc1215efcf1b5aa19227a>] overriding {client#get}
[hubot-gitter2.debug][object GitterClient<f21a0ae5e899ffc2669cc1215efcf1b5aa19227a>] overriding {client#post}
[hubot-gitter2.debug][object GitterClient<f21a0ae5e899ffc2669cc1215efcf1b5aa19227a>] overriding {client#put}
[hubot-gitter2.debug][object GitterClient<f21a0ae5e899ffc2669cc1215efcf1b5aa19227a>] overriding {client#patch}
[hubot-gitter2.debug][object GitterClient<f21a0ae5e899ffc2669cc1215efcf1b5aa19227a>] overriding {client#delete}
[hubot-gitter2.debug][object GitterClient<f21a0ae5e899ffc2669cc1215efcf1b5aa19227a>] overriding {client#request}
[hubot-gitter2.debug][object GitterClient<f21a0ae5e899ffc2669cc1215efcf1b5aa19227a>] overriding {client#stream}
[hubot-gitter2.debug][object GitterClient<f21a0ae5e899ffc2669cc1215efcf1b5aa19227a>] creating promise `users.current`
[hubot-gitter2.debug][object GitterClient<f21a0ae5e899ffc2669cc1215efcf1b5aa19227a>] {client#get} [/user]
[hubot-gitter2.debug][object GitterClient<f21a0ae5e899ffc2669cc1215efcf1b5aa19227a>] {client#request} [GET, /user, ]
[hubot-gitter2.debug][object GitterClient<f21a0ae5e899ffc2669cc1215efcf1b5aa19227a>] created

User can't operate the bot

We have a user on gitter who can't operate the bot - it seems that there's some kind of user limit somewhere which is 100 users? Channels go easily beyond that :/

organizing previous releases

The current state of this project confuses me: some releases available via npm are not tagged on GitHub, some GitHub version tags do not correspond to npm releases, and there's at least one untagged commit which updates the version field of package.json.

$ npm view hubot-gitter2 versions --json
[
  "0.0.1",
  "0.0.2",
  "0.0.3",
  "0.1.0",
  "0.1.2",
  "0.1.3"
]
$ git ls-remote --tags [email protected]:huafu/hubot-gitter2.git
70b6211845ebf020a809baa9279d6d8b468f1946	refs/tags/0.1.0
4dbb3827fbdcbbdd63b43d133b792930e837913a	refs/tags/0.1.0^{}
feba856a76fa3f2e17646bc53e5dc3cc53b5df9b	refs/tags/0.1.1
66c6c5726e26aadb1f8b8a0ec6ba8ab3dbe73d60	refs/tags/0.1.1^{}
3a429a9b3e7dab06272e541614506c135ea89cda	refs/tags/0.1.2
beef873224a8d5677420d50ca7783656eab3d5fc	refs/tags/0.1.2^{}
8ca526698e098cf608f9456bf3ad4390f5c81652	refs/tags/0.1.3
18d5d0da398d3a69941e5c28e094d5debbf0d27a	refs/tags/0.1.3^{}

I'd like to reconcile these differences before publishing a new release.

@huafu, I have two questions for you:

  1. Are you happy for me to create annotated tags for untagged commits which correspond to npm releases?
  2. Are you happy for me to ignore the release/0.2.0 branch, since the “release” commit was not tagged and the version was not published to the npm registry?

Doesn't work with rooms with a lot of users

I have some trouble getting the bot register messages from users in a big room and I think the issue is that if the user doesn't happen to be in the list of 30 users that are registered upon joining a room, their messages won't be listened to.

Any idea @huafu?

[hubot-gitter2.debug][object GitterClient<189b95ef8bec5187da92dde95b92af41a2e8ce0d>] {client#get} [/rooms/56be141fe610378809c12471/users, [object Object]]
[hubot-gitter2.debug][object GitterClient<189b95ef8bec5187da92dde95b92af41a2e8ce0d>] {client#request} [GET, /rooms/56be141fe610378809c12471/users, [object Object]]
[hubot-gitter2.debug][object GitterRoom<56be141fe610378809c12471>] listening events on resource `chatMessages`
[hubot-gitter2.debug][object GitterRoom<56be141fe610378809c12471>] listening events on resource `events`
[hubot-gitter2.debug][object GitterRoom<56be141fe610378809c12471>] listening events on resource `users`
[hubot-gitter2.debug][object GitterUser<ram-bot>] destroying promise `rooms.all`
[hubot-gitter2.debug][object GitterRoom<ram-bot/test>] {event::status:join}
[hubot-gitter2.debug][object GitterRoom<ramda/ramda>] {event::status:join}
[hubot-gitter2.debug][object GitterRoom<56be141fe610378809c12471>] {event::status:join}
[hubot-gitter2.debug][object GitterRoom<56be141fe610378809c12471>] loaded 2 member users
[hubot-gitter2.debug][object GitterUser<raine>] created
[hubot-gitter2.debug][object GitterRoom<56be141fe610378809c12471>] destroying promise `users.all`
[hubot-gitter2.debug][object GitterRoom<ram-bot/test>] loaded 3 member users
[hubot-gitter2.debug][object GitterUser<rai-bot>] created
[hubot-gitter2.debug][object GitterRoom<ram-bot/test>] destroying promise `users.all`
[hubot-gitter2.debug][object GitterRoom<ramda/ramda>] loaded 30 member users
[hubot-gitter2.debug][object GitterUser<c089>] created
[hubot-gitter2.debug][object GitterUser<mrtnbroder>] created
[hubot-gitter2.debug][object GitterUser<brandonweis>] created
[hubot-gitter2.debug][object GitterUser<cinaglia>] created
[hubot-gitter2.debug][object GitterUser<raine>] {event::update} [object Array<1><role>]
[hubot-gitter2.debug][object GitterUser<horte>] created
[hubot-gitter2.debug][object GitterUser<gurdasnijor>] created
[hubot-gitter2.debug][object GitterUser<onemanstartup>] created
[hubot-gitter2.debug][object GitterUser<linhmtran168>] created
[hubot-gitter2.debug][object GitterUser<rShetty>] created
[hubot-gitter2.debug][object GitterUser<nateabele>] created
[hubot-gitter2.debug][object GitterUser<errorsmith>] created
[hubot-gitter2.debug][object GitterUser<sirinath>] created
[hubot-gitter2.debug][object GitterUser<mpj>] created
[hubot-gitter2.debug][object GitterUser<jeffpamer>] created
[hubot-gitter2.debug][object GitterUser<neersighted>] created
[hubot-gitter2.debug][object GitterUser<hemanth>] created
[hubot-gitter2.debug][object GitterUser<TheLudd>] created
[hubot-gitter2.debug][object GitterUser<eliperelman>] created
[hubot-gitter2.debug][object GitterUser<aychtang>] created
[hubot-gitter2.debug][object GitterUser<adwayish>] created
[hubot-gitter2.debug][object GitterUser<kasperlewau>] created
[hubot-gitter2.debug][object GitterUser<TheUnknownOne>] created
[hubot-gitter2.debug][object GitterUser<iofjuupasli>] created
[hubot-gitter2.debug][object GitterUser<declandewet>] created
[hubot-gitter2.debug][object GitterUser<Gouigouix>] created
[hubot-gitter2.debug][object GitterUser<safareli>] created
[hubot-gitter2.debug][object GitterUser<megawac>] created
[hubot-gitter2.debug][object GitterUser<codyhatch>] created
[hubot-gitter2.debug][object GitterUser<ChetHarrison>] created
[hubot-gitter2.debug][object GitterRoom<ramda/ramda>] destroying promise `users.all`

Does not mention user when replying

I noticed that both the hubot shell and Flowdock adapter prepend the user's name to the message when using res.reply. I'm pretty sure this adapter should do the same.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.