aboutsummaryrefslogtreecommitdiffstats
path: root/src/Reaktor/Internal.hs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-01-27 03:23:17 +0100
committertv <tv@krebsco.de>2019-01-27 03:27:29 +0100
commite9ca12a945b1d1c068e9c31050e264cb20690db4 (patch)
tree6f12a1ede100424ebbd24f97f46bf9c31243d672 /src/Reaktor/Internal.hs
parentaaddda85c74540d1dab452dcdddf425927983ea9 (diff)
Reaktor: add data Commandv0.2.0
Diffstat (limited to 'src/Reaktor/Internal.hs')
-rw-r--r--src/Reaktor/Internal.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Reaktor/Internal.hs b/src/Reaktor/Internal.hs
index e52a347..09dd723 100644
--- a/src/Reaktor/Internal.hs
+++ b/src/Reaktor/Internal.hs
@@ -6,8 +6,10 @@ module Reaktor.Internal where
import Prelude.Extended
import Blessings
import Data.Aeson
+import Data.String.Conversions (convertString)
import qualified Data.Text as T
import Network.Socket as Exports (HostName,ServiceName)
+import Reaktor.IRC
import System.IO
@@ -50,15 +52,14 @@ instance FromJSON Config where
tlsPort :: ServiceName
tlsPort = "6697"
-
-data Message = Message (Maybe Text) Text [Text] | Start
+data Message = Message (Maybe Text) Command [Text] | Start
deriving Show
formatMessage :: Message -> Text
formatMessage = \case
Message mb_prefix cmd params ->
maybe "" ((":"<>) . (<>" ")) mb_prefix
- <> cmd
+ <> convertString cmd
<> T.concat (map (" "<>) (init params))
<> if null params then "" else " :" <> last params
<> "\r\n"