summaryrefslogtreecommitdiff
path: root/HsbotIrcBot/Hsbot/Irc
diff options
context:
space:
mode:
authorJulien Dessaux2010-08-22 17:57:30 +0200
committerJulien Dessaux2010-08-22 18:15:14 +0200
commitd33ab441f876620171ff70762069efb378824562 (patch)
tree65ad9c9086c22592fb422ec4d15c08f2f938463c /HsbotIrcBot/Hsbot/Irc
parentImproved message dispatching in core. (diff)
downloadhsbot-d33ab441f876620171ff70762069efb378824562.tar.gz
hsbot-d33ab441f876620171ff70762069efb378824562.tar.bz2
hsbot-d33ab441f876620171ff70762069efb378824562.zip
Added the quote quick command.
Diffstat (limited to 'HsbotIrcBot/Hsbot/Irc')
-rw-r--r--HsbotIrcBot/Hsbot/Irc/Plugin/Quote.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/HsbotIrcBot/Hsbot/Irc/Plugin/Quote.hs b/HsbotIrcBot/Hsbot/Irc/Plugin/Quote.hs
index 0335d8b..81c3794 100644
--- a/HsbotIrcBot/Hsbot/Irc/Plugin/Quote.hs
+++ b/HsbotIrcBot/Hsbot/Irc/Plugin/Quote.hs
@@ -105,6 +105,16 @@ runCommand intCmd
-- | quote command dispatcher
dispatchQuoteCmd :: String -> QuoteBot ()
dispatchQuoteCmd cmd
+ | cmd == "quick" = do
+ quoteBot <- get
+ now <- liftIO $ getCurrentTime
+ let sender = takeWhile (/= '!') $ fromMaybe "ARGH" (ircMsgPrefix request)
+ newQuote = Quote sender [(quoteElt stuff)] now 0
+ quoteId = nextQuoteId quoteBot
+ quoteBotDB' = M.insert quoteId newQuote (quoteBotDB quoteBot)
+ put $ quoteBot { nextQuoteId = quoteId + 1, quoteBotDB = quoteBotDB' }
+ lift $ answerMsg request ("New quoteId : " ++ show quoteId)
+ syncQuoteBot
| cmd == "start" = do
quoteBot <- get
now <- liftIO $ getCurrentTime