aboutsummaryrefslogtreecommitdiffstats
path: root/src/Reaktor/Plugins/Ping.hs
blob: 436ebe21d314c21c846ebf912c85be60b1cfad8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# 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 ()