From d33ab441f876620171ff70762069efb378824562 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 22 Aug 2010 17:57:30 +0200 Subject: Added the quote quick command. --- HsbotIrcBot/Hsbot/Irc/Plugin/Quote.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'HsbotIrcBot/Hsbot/Irc/Plugin/Quote.hs') 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 -- cgit v1.2.3