aboutsummaryrefslogtreecommitdiffstats
path: root/src/Reaktor/Plugins/Ping.hs
diff options
context:
space:
mode:
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 ()