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

Calamity.Types.Tellable

Description

Things that are messageable

Synopsis

Documentation

class ToMessage a where Source #

Things that can be used to send a message

Can be used to compose text, embeds, and files. e.g.

intoMsg Text "A message" <> intoMsg Embed (def & #description ?~ "Embed description")

Methods

intoMsg :: a -> Endo CreateMessageOptions Source #

Turn a into a CreateMessageOptions builder

Instances

Instances details
ToMessage String Source #

Message content, (<>) concatenates the content

Instance details

Defined in Calamity.Types.Tellable

ToMessage Text Source #

Message content, (<>) concatenates the content

Instance details

Defined in Calamity.Types.Tellable

ToMessage Text Source #

Message content, (<>) concatenates the content

Instance details

Defined in Calamity.Types.Tellable

ToMessage Embed Source #

Message embed, (<>) appends a new embed

Instance details

Defined in Calamity.Types.Tellable

ToMessage MessageReference Source #

Set a MessageReference as the message to reply to

Instance details

Defined in Calamity.Types.Tellable

ToMessage Component Source #

Add a singleton row containing a Component to the message

If the component is not already an actionrow, it is wrapped in a singleton row

Instance details

Defined in Calamity.Types.Tellable

ToMessage Select Source #

Add a singleton row containing a Select to the message,

Instance details

Defined in Calamity.Types.Tellable

ToMessage LinkButton Source #

Add a singleton row containing a LinkButton to the message,

Instance details

Defined in Calamity.Types.Tellable

ToMessage Button Source #

Add a singleton row containing a Button to the message,

Instance details

Defined in Calamity.Types.Tellable

ToMessage AllowedMentions Source #

Allowed mentions, (<>) combines allowed mentions

Instance details

Defined in Calamity.Types.Tellable

ToMessage CreateMessageOptions Source # 
Instance details

Defined in Calamity.Types.Tellable

ToMessage CreateMessageAttachment Source #

Message attachments, (<>) appends a new file

Instance details

Defined in Calamity.Types.Tellable

ToMessage [Component] Source #

Add many components to a message.

Each component will be wrapped in a singleton ActionRow if not already

Instance details

Defined in Calamity.Types.Tellable

ToMessage [Select] Source #

Add an row of Selects to the message

Instance details

Defined in Calamity.Types.Tellable

ToMessage [LinkButton] Source #

Add an row of LinkButtons to the message

Instance details

Defined in Calamity.Types.Tellable

ToMessage [Button] Source #

Add an row of Buttons to the message

Instance details

Defined in Calamity.Types.Tellable

ToMessage (Endo CreateMessageOptions) Source # 
Instance details

Defined in Calamity.Types.Tellable

ToMessage (TMention Member) Source #

Add a Member id to the list of allowed user mentions

Instance details

Defined in Calamity.Types.Tellable

ToMessage (TMention User) Source #

Add a User id to the list of allowed user mentions

Instance details

Defined in Calamity.Types.Tellable

ToMessage (TMention Role) Source #

Add a Role id to the list of allowed role mentions

Instance details

Defined in Calamity.Types.Tellable

ToMessage (CreateMessageOptions -> CreateMessageOptions) Source # 
Instance details

Defined in Calamity.Types.Tellable

class Tellable a where Source #

Methods

getChannel :: (BotC r, Member (Error RestError) r) => a -> Sem r (Snowflake Channel) Source #

Instances

Instances details
Tellable Channel Source # 
Instance details

Defined in Calamity.Types.Tellable

Methods

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

Tellable Message Source # 
Instance details

Defined in Calamity.Types.Tellable

Methods

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

Tellable Member Source # 
Instance details

Defined in Calamity.Types.Tellable

Methods

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

Tellable User Source # 
Instance details

Defined in Calamity.Types.Tellable

Methods

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

Tellable DMChannel Source # 
Instance details

Defined in Calamity.Types.Tellable

Methods

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

Tellable TextChannel Source # 
Instance details

Defined in Calamity.Types.Tellable

Methods

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

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 #

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 #

Tellable (Snowflake Channel) Source # 
Instance details

Defined in Calamity.Types.Tellable

Tellable (Snowflake Member) Source # 
Instance details

Defined in Calamity.Types.Tellable

Tellable (Snowflake User) Source # 
Instance details

Defined in Calamity.Types.Tellable

Methods

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

Tellable (Snowflake DMChannel) Source # 
Instance details

Defined in Calamity.Types.Tellable

Tellable (Snowflake TextChannel) Source # 
Instance details

Defined in Calamity.Types.Tellable

newtype TMention a Source #

A wrapper type for allowing mentions

Constructors

TMention (Snowflake a) 

Instances

Instances details
Show (TMention a) Source # 
Instance details

Defined in Calamity.Types.Tellable

Methods

showsPrec :: Int -> TMention a -> ShowS #

show :: TMention a -> String #

showList :: [TMention a] -> ShowS #

Generic (TMention a) Source # 
Instance details

Defined in Calamity.Types.Tellable

Associated Types

type Rep (TMention a) :: Type -> Type #

Methods

from :: TMention a -> Rep (TMention a) x #

to :: Rep (TMention a) x -> TMention a #

ToMessage (TMention Member) Source #

Add a Member id to the list of allowed user mentions

Instance details

Defined in Calamity.Types.Tellable

ToMessage (TMention User) Source #

Add a User id to the list of allowed user mentions

Instance details

Defined in Calamity.Types.Tellable

ToMessage (TMention Role) Source #

Add a Role id to the list of allowed role mentions

Instance details

Defined in Calamity.Types.Tellable

type Rep (TMention a) Source # 
Instance details

Defined in Calamity.Types.Tellable

type Rep (TMention a) = D1 ('MetaData "TMention" "Calamity.Types.Tellable" "calamity-0.3.0.0-inplace" 'True) (C1 ('MetaCons "TMention" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Snowflake a))))

tell :: forall msg r t. (BotC r, ToMessage msg, Tellable t) => t -> msg -> Sem r (Either RestError Message) Source #

Send a message to something that is messageable

To send a string literal you'll probably want to use TypeApplication to specify the type of msg

Examples

Sending a string:

void $ tell @Text m ("Somebody told me to tell you about: " <> s)

reply :: forall msg r t. (BotC r, ToMessage msg, HasID Channel t, HasID Message t) => t -> msg -> Sem r (Either RestError Message) Source #

Create a reply to an existing message in the same channel

To send a string literal you'll probably want to use TypeApplication to specify the type of msg

Examples

Sending a string:

void $ reply @Text msgToReplyTo ("Somebody told me to tell you about: " <> s)