Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gitterbot to remaining FCC rooms #148

Closed
dcsan opened this issue Aug 19, 2015 · 11 comments
Closed

Add gitterbot to remaining FCC rooms #148

dcsan opened this issue Aug 19, 2015 · 11 comments

Comments

@dcsan
Copy link
Owner

dcsan commented Aug 19, 2015

Gitterbot is awesome. Campers are using it like crazy. Have you been monitoring the statistics?
He does a few key things remarkably well
I was wondering whether you could roll him out in the rest of our rooms
There are about 400 of these - is there a good way to do these in batch? They’re listed here: https://github.com/FreeCodeCamp/freecodecamp/wiki/Official-Free-Code-Camp-Chat-Rooms and https://github.com/FreeCodeCamp/freecodecamp/wiki/List-of-Free-Code-Camp-city-based-Campsites

@dcsan
Copy link
Owner Author

dcsan commented Aug 19, 2015

this should be as simple as adding to list of rooms here:
https://github.com/dcsan/gitterbot/blob/master/nap/data/RoomData.js#L205

those lists of rooms could be refactored from a list of hashes to just one-line roomname array
although thats not needed at this point

@abhisekp abhisekp changed the title add gitterbot to remaining rooms Add gitterbot to remaining FCC rooms Aug 19, 2015
@dcsan
Copy link
Owner Author

dcsan commented Aug 19, 2015

@abhisekp let me know if you can do this @QuincyLarson was keen to get the bot live in more rooms and so your help would be appreciated. this is mostly a text edit so it should be OK to just try it and see if we have problems with the rate limit and need a planB.

@abhisekp
Copy link
Collaborator

@dcsan I guess this will only be an addition of objects similar to as follows. Right?

{
    name: "FreeCodeCamp/Bhubaneswar"
}

I can do that. First I need to filter out all the chat rooms from the chat room wiki page and make it look like object with name property.
Some cleanup work required. I need some time.

@oab00
Copy link
Collaborator

oab00 commented Aug 19, 2015

@abhisekp you could make a one-line roomname array and then add a one-line map function at the end to turn them into objects 😄

var rooms = ['Help', 'Help2'].map(function(room) { return { name: room }; });

as can be seen here -> http://repl.it/BC6M

@abhisekp
Copy link
Collaborator

@oab00 sure. Nice. That would be really great for later when the rooms will be read from a flattened array.

@dcsan
Copy link
Owner Author

dcsan commented Aug 19, 2015

i think most of the main rooms are added, its just the city rooms need to all be added

https://github.com/FreeCodeCamp/freecodecamp/wiki/List-of-Free-Code-Camp-city-based-Campsites

so copy that list and remove any punctuation.

@dcsan
Copy link
Owner Author

dcsan commented Aug 19, 2015

i guess you didn't manage to test this?

we'll have to see what happens when we run this. i think it may time out gitter API but we only have to join each room ONCE EVER. so we could either

  • write lots of code to join on an interval -
  • or switch the order of the rooms and run the startup code 5 times! we should get 80 or so rooms per run :)

@abhisekp
Copy link
Collaborator

You could make the bot join the rooms in chunks!

@dcsan
Copy link
Owner Author

dcsan commented Aug 19, 2015

yeah with an interval or iterator if you want to try and write some fancy ES6 code.

discussion
https://gitter.im/gitterHQ/fcc?at=55d4b3ca569fb38114106509

@abhisekp
Copy link
Collaborator

@dcsan update the above comment. The link is broken.

@dcsan
Copy link
Owner Author

dcsan commented Aug 19, 2015

oh that's a private chat.
relevant parts are on #105


@QuincyLarson Is this on startup when joining rooms or just general usage giving people browny points, etc?
dcsan 09:50
hi - I know about one situation where at startup we join a bunch of rooms. when the app starts it will fire a ton of calls immeidately, which triggers the limit.
we have a bunch of regional rooms, so want to add another 400 rooms or so
i think if i switched the whole codebase to use a different API I can get room events without actually listening to the rooms?
but haven't got around to that yet
ie your realtime API
mydigitalself 10:05
i think if i switched the whole codebase to use a different API I can get room events without actually listening to the rooms?
exactly, the way you're doing it on startup right now is probabyl what's causing that issue - does it go away a few minutes after startup and then operates just fine?
dcsan 10:05
https://gitter.im/gitterHQ/fcc?at=55ca6298569f5b53655486af
yep, if i wait a minute or so its fine
i just wanted to check - that event above
  if (msg.notification === 'user_notification') {
that gets fired from the RT client, will happen whenver a message is received in ANY of the rooms that user is joined to?
(as long as we haven't logged in as the bot and turned off notifications for certain rooms manually)
mydigitalself 10:07
exactly
dcsan 10:07
so we would still have to "join" the rooms at least once
if there are 400 rooms we want to do that programmatically but i can just write a "setInterval" script to do that once
after that, just switch to using your new RT api and using the event above
so your nwapp is using
https://github.com/gitterHQ/desktop/blob/master/nwapp/index.js#L11
var Gitter = require('gitter-realtime-client');
but i still need to use the REST api to send messages
dcsan 10:17
currently I "join" the room (even though I maybe already joined) in order to get a Room Object, that I can stream from.
     that.gitter.rooms.join(roomUrl, function(err, room) {
        ....
          var chats = room.streaming().chatMessages();
          chats.on("chatMessages", function(message) {
to avoid doing that I need to replace this code with parts from the RT api:
just checking / thinking aloud 

dcsan added a commit that referenced this issue Aug 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants