calamity-0.4.0.0: A library for writing discord bots in haskell
Safe HaskellNone
LanguageHaskell2010

Calamity.Commands.Context

Description

Command invokation context

Synopsis

Documentation

class CommandContext c => CalamityCommandContext c where Source #

Methods

ctxChannelID :: c -> Snowflake Channel Source #

The id of the channel that invoked this command

ctxGuildID :: c -> Maybe (Snowflake Guild) Source #

The id of the guild the command was invoked in, if in a guild

ctxUserID :: c -> Snowflake User Source #

The id of the user that invoked this command

ctxMessage :: c -> Message Source #

The message that triggered this command

data FullContext Source #

Invokation context for commands

Constructors

FullContext 

Fields

  • message :: Message

    The message that the command was invoked from

  • guild :: Maybe Guild

    If the command was sent in a guild, this will be present

  • member :: Maybe Member

    The member that invoked the command, if in a guild

    Note: If discord sent a member with the message, this is used; otherwise we try to fetch the member from the cache.

  • channel :: Channel

    The channel the command was invoked from

  • user :: User

    The user that invoked the command

  • command :: Command FullContext

    The command that was invoked

  • prefix :: Text

    The prefix that was used to invoke the command

  • unparsedParams :: Text

    The message remaining after consuming the prefix

Instances

Instances details
Show FullContext Source # 
Instance details

Defined in Calamity.Commands.Context

Generic FullContext Source # 
Instance details

Defined in Calamity.Commands.Context

Associated Types

type Rep FullContext :: Type -> Type #

TextShow FullContext Source # 
Instance details

Defined in Calamity.Commands.Context

Tellable FullContext Source # 
Instance details

Defined in Calamity.Commands.Context

Methods

getChannel :: forall (r :: EffectRow). (BotC r, Member (Error RestError) r) => FullContext -> Sem r (Snowflake Channel) Source #

CalamityCommandContext FullContext Source # 
Instance details

Defined in Calamity.Commands.Context

HasID Channel FullContext Source # 
Instance details

Defined in Calamity.Commands.Context

HasID Message FullContext Source # 
Instance details

Defined in Calamity.Commands.Context

HasID User FullContext Source # 
Instance details

Defined in Calamity.Commands.Context

CommandContext IO FullContext () Source # 
Instance details

Defined in Calamity.Commands.Context

type Rep FullContext Source # 
Instance details

Defined in Calamity.Commands.Context

useFullContext :: Member CacheEff r => Sem (ConstructContext (Message, User, Maybe Member) FullContext IO () ': r) a -> Sem r a Source #

data LightContext Source #

A lightweight context that doesn't need any cache information

Constructors

LightContext 

Fields

Instances

Instances details
Show LightContext Source # 
Instance details

Defined in Calamity.Commands.Context

Generic LightContext Source # 
Instance details

Defined in Calamity.Commands.Context

Associated Types

type Rep LightContext :: Type -> Type #

TextShow LightContext Source # 
Instance details

Defined in Calamity.Commands.Context

Tellable LightContext Source # 
Instance details

Defined in Calamity.Commands.Context

Methods

getChannel :: forall (r :: EffectRow). (BotC r, Member (Error RestError) r) => LightContext -> Sem r (Snowflake Channel) Source #

CalamityCommandContext LightContext Source # 
Instance details

Defined in Calamity.Commands.Context

HasID Channel LightContext Source # 
Instance details

Defined in Calamity.Commands.Context

HasID Message LightContext Source # 
Instance details

Defined in Calamity.Commands.Context

HasID User LightContext Source # 
Instance details

Defined in Calamity.Commands.Context

CommandContext IO LightContext () Source # 
Instance details

Defined in Calamity.Commands.Context

type Rep LightContext Source # 
Instance details

Defined in Calamity.Commands.Context

useLightContext :: Sem (ConstructContext (Message, User, Maybe Member) LightContext IO () ': r) a -> Sem r a Source #