Added the quote quick command.
This commit is contained in:
parent
8bbe88a078
commit
d33ab441f8
3 changed files with 14 additions and 4 deletions
|
@ -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
|
||||
|
|
Reference in a new issue