freeCodeCamp / camper-gitter-bot

Finally, robotic beings rule the world.
BSD 3-Clause "New" or "Revised" License
96 stars 65 forks source link

Make camperbot welcome people over DM #128

Open raisedadead opened 7 years ago

raisedadead commented 7 years ago

Refers : https://github.com/freeCodeCamp/camperbot/issues/117#issuecomment-262160727 CamperBot should respond back with official chat rooms and resources.

dhcodes commented 7 years ago

@raisedadead is this possible? the gitter api doesn't seem to allow private messages and you can use /query @mention to start a message but you have to push enter first. I'm looking into using a recursive function to make it work but haven't been successful so far

t3h2mas commented 7 years ago

Confirmed the lack of private messages https://developer.gitter.im/docs/messages-resource

@dhcodes what are you using to simulate key presses, and is it allowed in gitters TOS?

dhcodes commented 7 years ago

@t3h2mas haven't gotten that far yet and I am not sure. I'll do some quick reading and some more experimenting soon. Feel free to jump in and do the same; I'm not sure how much time I'll have to work on this.

t3h2mas commented 7 years ago

@dhcodes it's my opinion that if gitter doesn't provide the API, then we shouldn't bother. Going around it could be troublesome and could change if anything on their end is updated without us knowing. Alternatively, what about contacting gitter and asking for the feature?

dhcodes commented 7 years ago

I'm of the same mindset @t3h2mas. I'll reach out to Gitter about this. I suspect their fear is that if it's a private message, it's harder for mods to know/justify banning someone for sending spam/malicious content. But worth the ask.

dhcodes commented 7 years ago

On the way to emailing them, I found this: http://blog.gitter.im/2017/03/15/gitter-gitlab-acquisition/

Looks like it will all be open-source soon. In the meantime, I'll ask about PM support via API in the GitterHQ room.

dhcodes commented 7 years ago

I stand corrected. According to a dev in the GitterHQ room, the API should work as-is for private messages. He/she directed me to: https://developer.gitter.im/docs/messages-resource#send-a-message

I'll try it soon, but anyone else is welcome to as well.

dhcodes commented 7 years ago

Update: I've got this mostly working. Will try to refactor and post it over the weekend.

dhcodes commented 7 years ago

I'm no longer sure if this is possible. I've been able to send DMs to individuals but only if they already have a one-to-one chat with my bot. I believe the room (even the DM room) must already exist in order to send messages via the API and you cannot create a room via the API based on this line in the Rooms documentation:

Create a Room

This is a private API. You need to use the Gitter ecosystem to create a room.

I have a message out to the GitterHQ chat room to confirm. So we may need to rethink how we do this.