quintilesims / slackbot

Slack bot for IQVIA
MIT License
2 stars 0 forks source link

Add 'DadJoke' behavior #24

Open zpatrick opened 6 years ago

zpatrick commented 6 years ago
person: I'm tired 
Dadbot: Hi tired! I'm Dad
diemonster commented 6 years ago

it is my destiny to do this feature 💯

zpatrick commented 6 years ago

FWIW: This would be a behavior, not a command. This is a decent reference: https://github.com/quintilesims/slackbot/blob/master/bot/karma_tracking_behavior.go

diemonster commented 6 years ago

Behavior, sure. But let's also add a command !dadmode that does the following:

Then we can disable dadmode at will.

zpatrick commented 6 years ago

so !dadmode start and !dadmode stop?

diemonster commented 6 years ago

Sure, and/or !dadmode just flips it on or off depending on current state.

diemonster commented 6 years ago

Also include "I don't know, can I?" behavior:

person: Can you get me a thing? slackbot: I don't know, person. Can I?

zpatrick commented 6 years ago

@diemonster I realize this particular issue isn't the best example, but I was thinking it would be best for the !dadmode command and others like it (e.g. any command that just turns something on/off) to be explicit rather than switch whatever mode it is in. Reason is for something like aliases you'd need to have the explicit command:

!alias add !thing !dadmode stop
diemonster commented 6 years ago

@zpatrick what if !dadmode just displays whether it's on or off, then?

zpatrick commented 6 years ago

I'm not sure how that would help the !alias problem - there isn't any way for aliases to perform that sort of logic you'd need to parse the output and determine what to do next. You could have all three though:

!dadmode -> displays if it is on or off
!dadmode start -> starts dadmode (idempotent) 
!dadmode stop -> stops dadmode (idempotent)
diemonster commented 6 years ago

what about blacklisting certain commands from !alias?

explicitness is usually a good thing, but for a chat bot it seems like laziness prevails. Having to do something like !dadmode status just to see if it's 'on' seems like a bit much.

zpatrick commented 6 years ago

That's why I'm advocating for start and stop to be idempotent; I don't think !dadmode by itself is really necessary, just seemed like you wanted it there 🤷‍♂️

diemonster commented 6 years ago

I've run into a lot of edge cases with dadmode, and I'm curious how extreme we want to go with this.

Simplest implementation would be to match exact phrases such as:

I'm tired
I'm thirsty
I'm hungry
etc...

Otherwise, simply matching "I'm ____" elsewhere in a string of text will provide far too much nonsense:

Who knows, but I'm sure the dog is old
The car went fast, but I'm still late
They fired me, but I'm not sorry 

There appears to be some pretty complicated library support for text tagging so that you could split nouns and verbs and such from a sentence and match via that, but seems awfully overkill for just this command. If other commands and behaviors could benefit from such analysis, then maybe it'd be worth it.

Thoughts @zpatrick ?