hubot-archive / hubot-tell

Hubot plugin to send a user a message the next time they are present in the room
MIT License
26 stars 15 forks source link

Deliver tell when the user say something in the channel for the first time after the tell #8

Open rodrigoaguilera opened 8 years ago

rodrigoaguilera commented 8 years ago

I'm migrating to hubot from a drupal bot that had the tell functionality.

There is people in my chat room who never enter the IRC room they just change the to bob_away or similar.

Can the bot react on nick changes to?

lorenzhs commented 8 years ago

First you should punch those people because that's bad practice ;)

Second thing would be to figure out if hubot sends us an event when someone changes their nick and react to that as well. I can't see one in https://github.com/github/hubot/blob/master/src/robot.coffee at the moment so this might be a bit difficult — specifically, hubot seems to classify messages into "Enter", "Leave", "Text", "Topic" and a catch-all type.

rodrigoaguilera commented 8 years ago

To not ever leave a channel is one of the main features of irssi IRC client. They are the NSA of IRC.

As an example of what youcommented I found this: https://github.com/bobsilverberg/hubot-welcome/blob/master/src/welcome.coffee That reacts on nick change.

But I have been thinking about when this plugin should tell the message. Why not on the first time the user says something after the tell command happenend?

This covers my use case and problems with users leaving their irc open and not paying attention, users entering the channel and leaving because a quick restart of the IRC client, other hubot adapters where users never actually leave like telegram. Also, this plugin will deliver the message when they are paying attention to the channel.

We just have to listen to the username of every message.

lorenzhs commented 8 years ago

I'm familiar with IRC, my WeeChat runs in a tmux and I never quit.

The problem with detecting nick changes is just that the matching is done on a prefix basis because some people use different suffixes to their nick depending on the machine they're using and whatnot, so it's not always possible to know the exact nickname they will be using (like "foo", "foo2", and "foo_work"). This obviously doesn't work with "foo" and "foo_away".

I thought someone had already built what you suggested, sending the messages when the recipient speaks again, it's definitely a very good idea. We should probably go this route instead of trying to detect nick changes.

rodrigoaguilera commented 8 years ago

Changed issue title to reflect what we talked about.

I think we should decide on replacing the old behavior of delivering the tell when the user enters or maintain both.

I'm more inclined to replace but I'm aware that will break what current users expect of this plugin.

What do you think?

lorenzhs commented 8 years ago

Definitely both, breaking existing use cases for such a limited script sounds like a bad idea.

Code-wise it's not hard, we factor the retrieval of stored messages and sending thereof into a method and call it in both scenarios. Should be easy.

miklb commented 8 years ago

any thoughts on adding this?

rodrigoaguilera commented 8 years ago

This repo doesn't see a commit for a long time. Maybe it needs new maintainers before this can be implemented.

lorenzhs commented 8 years ago

I'd be happy to merge a pull request that does this as outlined here. However, I'm not using Hubot any more myself, so I probably won't implement it myself.