Debian Codegraph @

src/Lambdabot/Plugin/Novelty/Slap.hs

raw
1 -- | Support for quotes
2 module Lambdabot.Plugin.Novelty.Slap (slapPlugin) where
3
4 import Lambdabot.Plugin
5 import Lambdabot.Util
6
7 type Slap = ModuleT () LB
8
9 slapPlugin :: Module ()
10 slapPlugin = newModule
11 { moduleCmds = return
12 [ (command "slap")
13 { aliases = ["smack"]
14 , help = say "slap <nick>. Slap someone amusingly."
15 , process = slap
16 }
17 ]
18 }
19
20 ------------------------------------------------------------------------
21
22 slap :: String -> Cmd Slap ()
23 slap "me" = do
24 target <- showNick =<< getSender
25 slapRandom target
26 slap "yourself" = do
27 target <- showNick =<< getLambdabotName
28 slapRandom target
29 slap target =
30 slapRandom target
31
32 slapRandom :: String -> Cmd Slap ()
33 slapRandom tgt = say . ($ tgt) =<< random slapList
34
35 slapList :: [String -> String]
36 slapList =
37 [(\x -> "/me slaps " ++ x)
38 ,(\x -> "/me smacks " ++ x ++ " about with a large trout")
39 ,(\x -> "/me beats up " ++ x)
40 ,(\x -> "/me pokes " ++ x ++ " in the eye")
41 ,(\x -> "why on earth would I slap " ++ x ++ "?")
42 ,(\x -> "*SMACK*, *SLAM*, take that " ++ x ++ "!")
43 ,(\_ -> "/me activates her slap-o-matic...")
44 ,(\x -> "/me orders her trained monkeys to punch " ++ x)
45 ,(\x -> "/me smashes a lamp on " ++ possesiveForm x ++ " head")
46 ,(\x -> "/me hits " ++ x ++ " with a hammer, so they breaks into a thousand pieces")
47 ,(\x -> "/me throws some pointy lambdas at " ++ x)
48 ,(\x -> "/me loves " ++ x ++ ", so no slapping")
49 ,(\x -> "/me would never hurt " ++ x ++ "!")
50 ,(\x -> "go slap " ++ x ++ " yourself")
51 ,(\_ -> "I won't; I want to go get some cookies instead.")
52 ,(\x -> "I'd rather not; " ++ x ++ " looks rather dangerous.")
53 ,(\_ -> "I don't perform such side effects on command!")
54 ,(\_ -> "stop telling me what to do")
55 ,(\x -> "/me clobbers " ++ x ++ " with an untyped language")
56 ,(\x -> "/me pulls " ++ x ++ " through the Evil Mangler")
57 ,(\x -> "/me secretly deletes " ++ possesiveForm x ++ " source code")
58 ,(\x -> "/me places her fist firmly on " ++ possesiveForm x ++ " jaw")
59 ,(\x -> "/me locks up " ++ x ++ " in a Monad")
60 ,(\x -> "/me submits " ++ possesiveForm x ++ " email address to a dozen spam lists")
61 ,(\x -> "/me moulds " ++ x ++ " into a delicous cookie, and places it in her oven")
62 ,(\_ -> "/me will count to five...")
63 ,(\x -> "/me jabs " ++ x ++ " with a C pointer")
64 ,(\x -> "/me is overcome by a sudden desire to hurt " ++ x)
65 ,(\x -> "/me karate-chops " ++ x ++ " into two equally sized halves")
66 ,(\x -> "Come on, let's all slap " ++ x)
67 ,(\x -> "/me pushes " ++ x ++ " from his chair")
68 ,(\x -> "/me hits " ++ x ++ " with an assortment of kitchen utensils")
69 ,(\x -> "/me slaps " ++ x ++ " with a slab of concrete")
70 ,(\x -> "/me puts on her slapping gloves, and slaps " ++ x)
71 ,(\x -> "/me decomposes " ++ x ++ " into several parts using the Banach-Tarski theorem and reassembles them to get two copies of " ++ x ++ "!")
72 ]
73
74 -- | The possesive form of a name, "x's"
75 possesiveForm :: String -> String
76 possesiveForm [] = []
77 possesiveForm x
78 | last x == 's' = x ++ "'"
79 | otherwise = x ++ "'s"