aboutsummaryrefslogtreecommitdiffstats
path: root/src/Reaktor/Plugins/Ping.hs
blob: de3fe539a01a50db0bb95775974d679fc59bb1d4 (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.Internal


plugin :: Value -> IO Plugin
plugin = simplePlugin (\Null -> run)

run :: PluginFunc
run (Message _ ircCommand args) =
    when (ircCommand == "PING") $
      sendMsg (Message Nothing "PONG" args)