module Calamity.Commands.Help (
helpCommand',
helpCommand,
) where
import Calamity.Client.Types (BotC)
import Calamity.Commands.Types
import Calamity.Types.Tellable
import CalamityCommands.Help qualified as CC
import Control.Monad (void)
import Polysemy qualified as P
helpCommand' :: (Tellable c, BotC r, CommandContext c) => CommandHandler c -> Maybe (Group c) -> [Check c] -> P.Sem r (Command c)
helpCommand' :: forall c (r :: EffectRow).
(Tellable c, BotC r, CommandContext c) =>
CommandHandler c
-> Maybe (Group c) -> [Check c] -> Sem r (Command c)
helpCommand' CommandHandler c
handler Maybe (Group c)
parent [Check c]
checks = CommandHandler c
-> Maybe (Group c)
-> [Check c]
-> (c -> Text -> Sem (Fail : r) ())
-> Sem r (Command IO c ())
forall (m :: * -> *) (r :: EffectRow) c a.
(Monad m, Member (Final m) r, CommandContext m c a) =>
CommandHandler m c a
-> Maybe (Group m c a)
-> [Check m c]
-> (c -> Text -> Sem (Fail : r) a)
-> Sem r (Command m c a)
CC.helpCommand' CommandHandler c
handler Maybe (Group c)
parent [Check c]
checks (\c
a Text
b -> Sem (Fail : r) (Either RestError Message) -> Sem (Fail : r) ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Sem (Fail : r) (Either RestError Message) -> Sem (Fail : r) ())
-> Sem (Fail : r) (Either RestError Message) -> Sem (Fail : r) ()
forall a b. (a -> b) -> a -> b
$ c -> Text -> Sem (Fail : r) (Either RestError Message)
forall msg (r :: EffectRow) t.
(BotC r, ToMessage msg, Tellable t) =>
t -> msg -> Sem r (Either RestError Message)
tell c
a Text
b)
helpCommand :: (Tellable c, BotC r, CommandContext c) => P.Sem (DSLState c r) (Command c)
helpCommand :: forall c (r :: EffectRow).
(Tellable c, BotC r, CommandContext c) =>
Sem (DSLState c r) (Command c)
helpCommand = (c -> Text -> Sem (Fail : r) ())
-> Sem (DSLState IO c () r) (Command IO c ())
forall c (m :: * -> *) a (r :: EffectRow).
(Monad m, Member (Final m) r, CommandContext m c a) =>
(c -> Text -> Sem (Fail : r) a)
-> Sem (DSLState m c a r) (Command m c a)
CC.helpCommand (\c
a Text
b -> Sem (Fail : r) (Either RestError Message) -> Sem (Fail : r) ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Sem (Fail : r) (Either RestError Message) -> Sem (Fail : r) ())
-> Sem (Fail : r) (Either RestError Message) -> Sem (Fail : r) ()
forall a b. (a -> b) -> a -> b
$ c -> Text -> Sem (Fail : r) (Either RestError Message)
forall msg (r :: EffectRow) t.
(BotC r, ToMessage msg, Tellable t) =>
t -> msg -> Sem r (Either RestError Message)
tell c
a Text
b)