summaryrefslogtreecommitdiffstats
path: root/src/Reaktor/Plugins/Ping.hs
blob: 83b3ac4b5d486115ed8d1742585ca5974d973f51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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)