From 728c255e9b5d6b3766c59a0dc48e5e36108b29ac Mon Sep 17 00:00:00 2001 From: opfez Date: Fri, 8 Oct 2021 16:23:33 +0200 Subject: [PATCH] add rollcall support --- Anna.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Anna.hs b/Anna.hs index 2599b32..4a040fa 100644 --- a/Anna.hs +++ b/Anna.hs @@ -67,8 +67,11 @@ tokenDispatch (Just userName) (Just chn) ts = if elem "PRIVMSG" ts | elem "o/" tokens = updateRightGreets | elem "\\o" tokens = updateLeftGreets | otherwise = case head tokens of - "!greets" -> greets chn - _ -> return () + -- TODO: make reader monad for this? passing chn is a little tedious + "!greets" -> greets chn + "!rollcall" -> rollcall chn + "!anna" -> anna chn + _ -> return () tokens = case length msgTokens of 1 -> [rstrip $ tail $ head 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) 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 chn username = undefined + + -- Basic commands write :: String -> String -> Net () write cmd args = do