calamity-0.8.0.0: A library for writing discord bots in haskell
Safe HaskellSafe-Inferred
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

CalamityCommandContext 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 #

TextShow 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

(k ~ A_Lens, a ~ Channel, b ~ Channel) => LabelOptic "channel" k FullContext FullContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

(k ~ A_Lens, a ~ Command FullContext, b ~ Command FullContext) => LabelOptic "command" k FullContext FullContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

(k ~ A_Lens, a ~ Maybe Guild, b ~ Maybe Guild) => LabelOptic "guild" k FullContext FullContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

(k ~ A_Lens, a ~ Maybe Member, b ~ Maybe Member) => LabelOptic "member" k FullContext FullContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

(k ~ A_Lens, a ~ Message, b ~ Message) => LabelOptic "message" k FullContext FullContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "prefix" k FullContext FullContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "unparsedParams" k FullContext FullContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

(k ~ A_Lens, a ~ User, b ~ User) => LabelOptic "user" k FullContext FullContext a b 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

CalamityCommandContext 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 #

TextShow 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

(k ~ A_Lens, a ~ Snowflake Channel, b ~ Snowflake Channel) => LabelOptic "channelID" k LightContext LightContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

(k ~ A_Lens, a ~ Command LightContext, b ~ Command LightContext) => LabelOptic "command" k LightContext LightContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

(k ~ A_Lens, a ~ Maybe (Snowflake Guild), b ~ Maybe (Snowflake Guild)) => LabelOptic "guildID" k LightContext LightContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

(k ~ A_Lens, a ~ Maybe Member, b ~ Maybe Member) => LabelOptic "member" k LightContext LightContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

(k ~ A_Lens, a ~ Message, b ~ Message) => LabelOptic "message" k LightContext LightContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "prefix" k LightContext LightContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "unparsedParams" k LightContext LightContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

(k ~ A_Lens, a ~ User, b ~ User) => LabelOptic "user" k LightContext LightContext a b Source # 
Instance details

Defined in Calamity.Commands.Context

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