From ce276eee82ec0b8c4106beb4c51d6f9eb77335c4 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 13 Jan 2019 23:52:05 +0100 Subject: src: init --- src/Reaktor/Plugins/Ping.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/Reaktor/Plugins/Ping.hs (limited to 'src/Reaktor/Plugins/Ping.hs') diff --git a/src/Reaktor/Plugins/Ping.hs b/src/Reaktor/Plugins/Ping.hs new file mode 100644 index 0000000..83b3ac4 --- /dev/null +++ b/src/Reaktor/Plugins/Ping.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE OverloadedStrings #-} +module Reaktor.Plugins.Ping (plugin) where + +import Control.Monad (when) +import Data.Aeson (Value(Null)) +import Reaktor.Types + + +plugin :: Value -> IO Plugin +plugin = simplePlugin (\Null -> run) + +run :: PluginFunc +run (Message _ ircCommand args) = + when (ircCommand == "PING") $ + sendMsg (Message Nothing "PONG" args) -- cgit v1.2.3