summaryrefslogtreecommitdiffstats
path: root/src/Reaktor/Plugins/Ping.hs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-01-23 00:02:42 +0100
committertv <tv@krebsco.de>2019-01-23 00:57:36 +0100
commitd40815fd56bf1895af89b72b1171675a2e0ae5f7 (patch)
tree83b96a701f16b13915836c3a6c94463732a9f6d8 /src/Reaktor/Plugins/Ping.hs
parenta00da57346c195b1b15d1c6aca2891483901aae6 (diff)
src: use more simple functions
Diffstat (limited to 'src/Reaktor/Plugins/Ping.hs')
-rw-r--r--src/Reaktor/Plugins/Ping.hs28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/Reaktor/Plugins/Ping.hs b/src/Reaktor/Plugins/Ping.hs
index de3fe53..436ebe2 100644
--- a/src/Reaktor/Plugins/Ping.hs
+++ b/src/Reaktor/Plugins/Ping.hs
@@ -1,15 +1,15 @@
+{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
-module Reaktor.Plugins.Ping (plugin) where
-
-import Control.Monad (when)
-import Data.Aeson (Value(Null))
-import Reaktor.Internal
-
-
-plugin :: Value -> IO Plugin
-plugin = simplePlugin (\Null -> run)
-
-run :: PluginFunc
-run (Message _ ircCommand args) =
- when (ircCommand == "PING") $
- sendMsg (Message Nothing "PONG" args)
+{-# LANGUAGE RecordWildCards #-}
+module Reaktor.Plugins.Ping where
+
+import Prelude.Extended
+import Reaktor
+
+new :: Actions -> IO (Message -> IO ())
+new Actions{..} =
+ return $ \case
+ Message _ cmd args ->
+ when (cmd == "PING") $
+ aSend (Message Nothing "PONG" args)
+ _ -> pure ()