add rollcall support
parent
b27ba949e7
commit
728c255e9b
13
Anna.hs
13
Anna.hs
|
@ -67,8 +67,11 @@ tokenDispatch (Just userName) (Just chn) ts = if elem "PRIVMSG" ts
|
||||||
| elem "o/" tokens = updateRightGreets
|
| elem "o/" tokens = updateRightGreets
|
||||||
| elem "\\o" tokens = updateLeftGreets
|
| elem "\\o" tokens = updateLeftGreets
|
||||||
| otherwise = case head tokens of
|
| otherwise = case head tokens of
|
||||||
"!greets" -> greets chn
|
-- TODO: make reader monad for this? passing chn is a little tedious
|
||||||
_ -> return ()
|
"!greets" -> greets chn
|
||||||
|
"!rollcall" -> rollcall chn
|
||||||
|
"!anna" -> anna chn
|
||||||
|
_ -> return ()
|
||||||
tokens = case length msgTokens of
|
tokens = case length msgTokens of
|
||||||
1 -> [rstrip $ tail $ head msgTokens]
|
1 -> [rstrip $ tail $ head msgTokens]
|
||||||
_ -> (tail $ head msgTokens) : ((init $ tail msgTokens) ++ [(rstrip $ last msgTokens)])
|
_ -> (tail $ head msgTokens) : ((init $ tail msgTokens) ++ [(rstrip $ last msgTokens)])
|
||||||
|
@ -103,9 +106,15 @@ greets chn = do
|
||||||
displayLine = "o/ - " ++ (head contentLines) ++ " vs \\o - " ++ (head $ tail contentLines)
|
displayLine = "o/ - " ++ (head contentLines) ++ " vs \\o - " ++ (head $ tail contentLines)
|
||||||
sendMessage chn displayLine
|
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
|
||||||
|
|
||||||
timezone :: String -> String -> Net ()
|
timezone :: String -> String -> Net ()
|
||||||
timezone chn username = undefined
|
timezone chn username = undefined
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Basic commands
|
-- Basic commands
|
||||||
write :: String -> String -> Net ()
|
write :: String -> String -> Net ()
|
||||||
write cmd args = do
|
write cmd args = do
|
||||||
|
|
Loading…
Reference in New Issue