Added a function to get the sender of an irc message.
This commit is contained in:
parent
a6ac073a6c
commit
81fb522dd4
1 changed files with 5 additions and 0 deletions
|
@ -2,6 +2,7 @@ module Hsbot.Message
|
|||
( answerMsg
|
||||
, getCommand
|
||||
, getDestination
|
||||
, getSender
|
||||
, readMsg
|
||||
, writeMsg
|
||||
) where
|
||||
|
@ -37,6 +38,10 @@ getCommand (IRC.Message _ _ (_:msg:[])) = do
|
|||
else return []
|
||||
getCommand _ = return []
|
||||
|
||||
getSender :: IRC.Message -> String
|
||||
getSender (IRC.Message (Just (IRC.NickName nick _ _)) _ _) = nick
|
||||
getSender _ = ""
|
||||
|
||||
-- | Get the destination of a message
|
||||
getDestination :: IRC.Message -> String
|
||||
getDestination (IRC.Message _ _ (dest:_:[])) = dest
|
||||
|
|
Reference in a new issue