add qotd support
parent
00c8f6d5d9
commit
6ee089a1a2
15
Anna.hs
15
Anna.hs
|
@ -69,6 +69,7 @@ tokenDispatch (Just userName) (Just chn) ts = if elem "PRIVMSG" ts
|
|||
| otherwise = case head tokens of
|
||||
-- TODO: make reader monad for this? passing chn is a little tedious
|
||||
"!greets" -> greets chn
|
||||
"!qotd" -> qotd chn
|
||||
"!rollcall" -> rollcall chn
|
||||
"!anna" -> anna chn
|
||||
_ -> return ()
|
||||
|
@ -106,14 +107,20 @@ greets chn = do
|
|||
displayLine = "o/ - " ++ (head contentLines) ++ " vs \\o - " ++ (head $ tail contentLines)
|
||||
sendMessage chn displayLine
|
||||
|
||||
rollcall :: String -> Net ()
|
||||
rollcall chn = sendMessage chn "Hello! I respond to !anna and !greets. My source code is available at https://git.tilde.town/opfez/anna"
|
||||
anna = rollcall
|
||||
qotd :: String -> Net ()
|
||||
qotd chn = do
|
||||
handle <- liftIO $ connectTo "127.0.0.1" 1717
|
||||
text <- liftIO $ hGetContents handle
|
||||
sendMessage chn text
|
||||
return ()
|
||||
|
||||
-- TODO
|
||||
timezone :: String -> String -> Net ()
|
||||
timezone chn username = undefined
|
||||
|
||||
|
||||
rollcall :: String -> Net ()
|
||||
rollcall chn = sendMessage chn "Hello! I respond to !anna and !greets. My source code is available at https://git.tilde.town/opfez/anna"
|
||||
anna = rollcall
|
||||
|
||||
-- Basic commands
|
||||
write :: String -> String -> Net ()
|
||||
|
|
Loading…
Reference in New Issue