-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add slap responder * update readme
- Loading branch information
Showing
3 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
defmodule ExMustang.Responders.Slap do | ||
@moduledoc """ | ||
Slap user on slack around a bit with a large trout | ||
`slap <username> | me | ||
""" | ||
use Hedwig.Responder | ||
|
||
@emoticon ":fish:" | ||
# banters copied from https://github.com/spfr/slapbot/blob/master/helpers.js#L2-L19 | ||
@banters [ | ||
"Ouch! That must hurt!", | ||
"That should teach you a lesson!", | ||
"Ha ha ha ha!", | ||
"Damn milenial!", | ||
"Take that, you fool!", | ||
"Feel the pain!", | ||
"You probably still use Notepad++...", | ||
"Your pull request is horrible.", | ||
"Your JIRA ticket sucks.", | ||
"Your Trello card is lame. Do you even Markdown bro?", | ||
"Ooooh snap!", | ||
"Get slapped, son!", | ||
"Your bloody hipster!", | ||
"Now go back to work!", | ||
"Go buy us some Ice Cream!", | ||
"Why don’t you go back to your desk and tail call yourself?", | ||
"Are you a priest? Your code is running on pure faith and no logic…", | ||
"Your code, just like C, has no class!" | ||
] | ||
|
||
@usage """ | ||
slap - Slaps the user. Format: slap <username> | me | ||
""" | ||
hear ~r/^slap\s*me/i, msg do | ||
emote msg, build_msg(msg.user.id) | ||
emote msg, random(@banters) | ||
end | ||
hear ~r/^slap\s*<@(?<user>\w+)>.*$/i, msg do | ||
emote msg, build_msg(msg.matches["user"]) | ||
emote msg, random(@banters) | ||
end | ||
|
||
defp build_msg(user) do | ||
"slaps <@#{user}> around a bit with a large trout #{@emoticon}" | ||
end | ||
end |