-- | Support for quotes
module Lambdabot.Plugin.Novelty.Slap (slapPlugin) where

import Lambdabot.Plugin
import Lambdabot.Util

type Slap = ModuleT () LB

slapPlugin :: Module ()
slapPlugin :: Module ()
slapPlugin = Module ()
forall st. Module st
newModule
    { moduleCmds :: ModuleT () LB [Command (ModuleT () LB)]
moduleCmds = [Command (ModuleT () LB)]
-> ModuleT () LB [Command (ModuleT () LB)]
forall (m :: * -> *) a. Monad m => a -> m a
return
        [ (String -> Command Identity
command String
"slap")
            { aliases :: [String]
aliases = [String
"smack"]
            , help :: Cmd (ModuleT () LB) ()
help = String -> Cmd (ModuleT () LB) ()
forall (m :: * -> *). Monad m => String -> Cmd m ()
say String
"slap <nick>. Slap someone amusingly."
            , process :: String -> Cmd (ModuleT () LB) ()
process = String -> Cmd (ModuleT () LB) ()
slap
            }
        ]
    }

------------------------------------------------------------------------

slap :: String -> Cmd Slap ()
slap :: String -> Cmd (ModuleT () LB) ()
slap String
"me" = do
    String
target <- Nick -> Cmd (ModuleT () LB) String
forall (m :: * -> *). Monad m => Nick -> Cmd m String
showNick (Nick -> Cmd (ModuleT () LB) String)
-> Cmd (ModuleT () LB) Nick -> Cmd (ModuleT () LB) String
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cmd (ModuleT () LB) Nick
forall (m :: * -> *). Monad m => Cmd m Nick
getSender
    String -> Cmd (ModuleT () LB) ()
slapRandom String
target
slap String
"yourself" = do
    String
target <- Nick -> Cmd (ModuleT () LB) String
forall (m :: * -> *). Monad m => Nick -> Cmd m String
showNick (Nick -> Cmd (ModuleT () LB) String)
-> Cmd (ModuleT () LB) Nick -> Cmd (ModuleT () LB) String
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Cmd (ModuleT () LB) Nick
forall (m :: * -> *). Monad m => Cmd m Nick
getLambdabotName
    String -> Cmd (ModuleT () LB) ()
slapRandom String
target
slap String
target =
    String -> Cmd (ModuleT () LB) ()
slapRandom String
target

slapRandom :: String -> Cmd Slap ()
slapRandom :: String -> Cmd (ModuleT () LB) ()
slapRandom String
tgt = String -> Cmd (ModuleT () LB) ()
forall (m :: * -> *). Monad m => String -> Cmd m ()
say (String -> Cmd (ModuleT () LB) ())
-> ((String -> String) -> String)
-> (String -> String)
-> Cmd (ModuleT () LB) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$ String
tgt) ((String -> String) -> Cmd (ModuleT () LB) ())
-> Cmd (ModuleT () LB) (String -> String) -> Cmd (ModuleT () LB) ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< [String -> String] -> Cmd (ModuleT () LB) (String -> String)
forall (m :: * -> *) a. MonadIO m => [a] -> m a
random [String -> String]
slapList

slapList :: [String -> String]
slapList :: [String -> String]
slapList =
    [(\String
x -> String
"/me slaps " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x)
    ,(\String
x -> String
"/me smacks " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" about with a large trout")
    ,(\String
x -> String
"/me beats up " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x)
    ,(\String
x -> String
"/me pokes " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" in the eye")
    ,(\String
x -> String
"why on earth would I slap " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"?")
    ,(\String
x -> String
"*SMACK*, *SLAM*, take that " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"!")
    ,(\String
_ -> String
"/me activates her slap-o-matic...")
    ,(\String
x -> String
"/me orders her trained monkeys to punch " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x)
    ,(\String
x -> String
"/me smashes a lamp on " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> String
possesiveForm String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" head")
    ,(\String
x -> String
"/me hits " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" with a hammer, so they breaks into a thousand pieces")
    ,(\String
x -> String
"/me throws some pointy lambdas at " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x)
    ,(\String
x -> String
"/me loves " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", so no slapping")
    ,(\String
x -> String
"/me would never hurt " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"!")
    ,(\String
x -> String
"go slap " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" yourself")
    ,(\String
_ -> String
"I won't; I want to go get some cookies instead.")
    ,(\String
x -> String
"I'd rather not; " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" looks rather dangerous.")
    ,(\String
_ -> String
"I don't perform such side effects on command!")
    ,(\String
_ -> String
"stop telling me what to do")
    ,(\String
x -> String
"/me clobbers " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" with an untyped language")
    ,(\String
x -> String
"/me pulls " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" through the Evil Mangler")
    ,(\String
x -> String
"/me secretly deletes " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> String
possesiveForm String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" source code")
    ,(\String
x -> String
"/me places her fist firmly on " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> String
possesiveForm String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" jaw")
    ,(\String
x -> String
"/me locks up " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" in a Monad")
    ,(\String
x -> String
"/me submits " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> String
possesiveForm String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" email address to a dozen spam lists")
    ,(\String
x -> String
"/me moulds " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" into a delicous cookie, and places it in her oven")
    ,(\String
_ -> String
"/me will count to five...")
    ,(\String
x -> String
"/me jabs " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" with a C pointer")
    ,(\String
x -> String
"/me is overcome by a sudden desire to hurt " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x)
    ,(\String
x -> String
"/me karate-chops " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" into two equally sized halves")
    ,(\String
x -> String
"Come on, let's all slap " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x)
    ,(\String
x -> String
"/me pushes " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" from his chair")
    ,(\String
x -> String
"/me hits " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" with an assortment of kitchen utensils")
    ,(\String
x -> String
"/me slaps " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" with a slab of concrete")
    ,(\String
x -> String
"/me puts on her slapping gloves, and slaps " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x)
    ,(\String
x -> String
"/me decomposes " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" into several parts using the Banach-Tarski theorem and reassembles them to get two copies of " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"!")
    ]

-- | The possesive form of a name, "x's"
possesiveForm :: String -> String
possesiveForm :: String -> String
possesiveForm [] = []
possesiveForm String
x
 | String -> Char
forall a. [a] -> a
last String
x Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
's' = String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"'"
 | Bool
otherwise     = String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"'s"