Add command submodules

This commit is contained in:
Joscha 2020-04-08 12:03:57 +00:00
parent 3e2120f970
commit c485404528
5 changed files with 65 additions and 2 deletions

View file

@ -0,0 +1,15 @@
module Haboli.Euphoria.Command.Megaparsec
( cmdMega
) where
import qualified Data.Text as T
import Text.Megaparsec
import Haboli.Euphoria.Api
import Haboli.Euphoria.Client
import Haboli.Euphoria.Command
cmdMega :: Parsec e' T.Text a -> (Message -> a -> Client e ()) -> Command e
cmdMega parser f msg = case parse parser "" $ msgContent msg of
Left _ -> pure False
Right a -> True <$ f msg a