| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Calamity.Client.Types
Description
Types for the client
Synopsis
- data Client = Client {
- shards :: TVar [(InChan ControlMessage, Async (Maybe ()))]
- numShards :: MVar Int
- token :: Token
- rlState :: RateLimitState
- eventsIn :: InChan CalamityEvent
- eventsOut :: OutChan CalamityEvent
- ehidCounter :: IORef Integer
- newtype StartupError = StartupError String
- data EventType
- = ReadyEvt
- | ChannelCreateEvt
- | ChannelUpdateEvt
- | ChannelDeleteEvt
- | ChannelpinsUpdateEvt
- | GuildCreateEvt
- | GuildUpdateEvt
- | GuildDeleteEvt
- | GuildBanAddEvt
- | GuildBanRemoveEvt
- | GuildEmojisUpdateEvt
- | GuildIntegrationsUpdateEvt
- | GuildMemberAddEvt
- | GuildMemberRemoveEvt
- | GuildMemberUpdateEvt
- | GuildMembersChunkEvt
- | GuildRoleCreateEvt
- | GuildRoleUpdateEvt
- | GuildRoleDeleteEvt
- | InviteCreateEvt
- | InviteDeleteEvt
- | MessageCreateEvt
- | MessageUpdateEvt
- | MessageDeleteEvt
- | MessageDeleteBulkEvt
- | MessageReactionAddEvt
- | MessageReactionRemoveEvt
- | MessageReactionRemoveAllEvt
- | TypingStartEvt
- | UserUpdateEvt
- | forall s a. CustomEvt s a
- data GuildCreateStatus
- data GuildDeleteStatus
- type family EHType (d :: EventType) m r where ...
- type BotC r = (Members '[LogEff, MetricEff, CacheEff, Reader Client, AtomicState EventHandlers, Embed IO, Final IO, Async] r, Typeable r)
- type SetupEff r = LogEff ': (Reader Client ': (AtomicState EventHandlers ': (Async ': r)))
- type ReactConstraints r s eh ehIO t = (InsertEventHandler s, RemoveEventHandler s, eh ~ EHType s (Sem r) (), ehIO ~ EHType s IO (), Uncurry eh, Uncurried eh ~ (t -> Sem r ()), Curry (t -> IO ()), ehIO ~ Curried (t -> IO ()))
- type WaitUntilConstraints r s eh check t = (InsertEventHandler s, RemoveEventHandler s, Uncurry eh, eh ~ EHType s (Sem r) (), eh ~ Curried (t -> Sem r ()), Uncurry check, Uncurried check ~ (t -> Bool), Curry (t -> IO ()), Curried (t -> IO ()) ~ EHType s IO ())
- type WaitUntilMConstraints r s eh ehB t = (InsertEventHandler s, RemoveEventHandler s, Uncurry eh, eh ~ EHType s (Sem r) (), eh ~ Curried (t -> Sem r ()), Uncurry ehB, Uncurried ehB ~ (t -> Sem r Bool), Curry (t -> IO ()), Curried (t -> IO ()) ~ EHType s IO ())
- newtype EventHandlers = EventHandlers (TypeRepMap EventHandler)
- class InsertEventHandler a where
- makeEventHandlers :: Proxy a -> Integer -> StoredEHType a -> EventHandlers
- class RemoveEventHandler a where
- removeEventHandler :: Proxy a -> Integer -> EventHandlers -> EventHandlers
- getEventHandlers :: GetEventHandlers a => EventHandlers -> [StoredEHType a]
- getCustomEventHandlers :: TypeRep -> TypeRep -> EventHandlers -> [Dynamic -> IO ()]
Documentation
Constructors
| Client | |
Fields
| |
Instances
newtype StartupError Source #
Constructors
| StartupError String |
Instances
| Show StartupError Source # | |
Defined in Calamity.Client.Types Methods showsPrec :: Int -> StartupError -> ShowS # show :: StartupError -> String # showList :: [StartupError] -> ShowS # | |
A Data Kind used to fire custom events
Constructors
Instances
| (EHInstanceSelector a ~ flag, RemoveEventHandler' flag a) => RemoveEventHandler (a :: EventType) Source # | |
Defined in Calamity.Client.Types Methods removeEventHandler :: Proxy a -> Integer -> EventHandlers -> EventHandlers Source # | |
data GuildCreateStatus Source #
Constructors
| GuildCreateNew | The guild was just joined |
| GuildCreateAvailable | The guild is becoming available |
Instances
| Show GuildCreateStatus Source # | |
Defined in Calamity.Client.Types Methods showsPrec :: Int -> GuildCreateStatus -> ShowS # show :: GuildCreateStatus -> String # showList :: [GuildCreateStatus] -> ShowS # | |
| Generic GuildCreateStatus Source # | |
Defined in Calamity.Client.Types Associated Types type Rep GuildCreateStatus :: Type -> Type # Methods from :: GuildCreateStatus -> Rep GuildCreateStatus x # to :: Rep GuildCreateStatus x -> GuildCreateStatus # | |
| TextShow GuildCreateStatus Source # | |
Defined in Calamity.Client.Types Methods showbPrec :: Int -> GuildCreateStatus -> Builder showb :: GuildCreateStatus -> Builder showbList :: [GuildCreateStatus] -> Builder showtPrec :: Int -> GuildCreateStatus -> Text showt :: GuildCreateStatus -> Text showtList :: [GuildCreateStatus] -> Text showtlPrec :: Int -> GuildCreateStatus -> Text showtl :: GuildCreateStatus -> Text showtlList :: [GuildCreateStatus] -> Text | |
| type Rep GuildCreateStatus Source # | |
Defined in Calamity.Client.Types | |
data GuildDeleteStatus Source #
Constructors
| GuildDeleteUnavailable | The guild became unavailable |
| GuildDeleteRemoved | The bot was removed from the guild |
Instances
| Show GuildDeleteStatus Source # | |
Defined in Calamity.Client.Types Methods showsPrec :: Int -> GuildDeleteStatus -> ShowS # show :: GuildDeleteStatus -> String # showList :: [GuildDeleteStatus] -> ShowS # | |
| Generic GuildDeleteStatus Source # | |
Defined in Calamity.Client.Types Associated Types type Rep GuildDeleteStatus :: Type -> Type # Methods from :: GuildDeleteStatus -> Rep GuildDeleteStatus x # to :: Rep GuildDeleteStatus x -> GuildDeleteStatus # | |
| TextShow GuildDeleteStatus Source # | |
Defined in Calamity.Client.Types Methods showbPrec :: Int -> GuildDeleteStatus -> Builder showb :: GuildDeleteStatus -> Builder showbList :: [GuildDeleteStatus] -> Builder showtPrec :: Int -> GuildDeleteStatus -> Text showt :: GuildDeleteStatus -> Text showtList :: [GuildDeleteStatus] -> Text showtlPrec :: Int -> GuildDeleteStatus -> Text showtl :: GuildDeleteStatus -> Text showtlList :: [GuildDeleteStatus] -> Text | |
| type Rep GuildDeleteStatus Source # | |
Defined in Calamity.Client.Types | |
type family EHType (d :: EventType) m r where ... Source #
A type family to decide what the parameters for an event handler should be determined by the type of event it is handling.
Equations
type BotC r = (Members '[LogEff, MetricEff, CacheEff, Reader Client, AtomicState EventHandlers, Embed IO, Final IO, Async] r, Typeable r) Source #
type SetupEff r = LogEff ': (Reader Client ': (AtomicState EventHandlers ': (Async ': r))) Source #
A concrete effect stack used inside the bot
type ReactConstraints r s eh ehIO t = (InsertEventHandler s, RemoveEventHandler s, eh ~ EHType s (Sem r) (), ehIO ~ EHType s IO (), Uncurry eh, Uncurried eh ~ (t -> Sem r ()), Curry (t -> IO ()), ehIO ~ Curried (t -> IO ())) Source #
Some constraints that react needs to work. Don't
worry about these since they are satisfied for any type s can be
type WaitUntilConstraints r s eh check t = (InsertEventHandler s, RemoveEventHandler s, Uncurry eh, eh ~ EHType s (Sem r) (), eh ~ Curried (t -> Sem r ()), Uncurry check, Uncurried check ~ (t -> Bool), Curry (t -> IO ()), Curried (t -> IO ()) ~ EHType s IO ()) Source #
Some constraints that waitUntil needs to work. Don't
worry about these since they are satisfied for any type s can be
type WaitUntilMConstraints r s eh ehB t = (InsertEventHandler s, RemoveEventHandler s, Uncurry eh, eh ~ EHType s (Sem r) (), eh ~ Curried (t -> Sem r ()), Uncurry ehB, Uncurried ehB ~ (t -> Sem r Bool), Curry (t -> IO ()), Curried (t -> IO ()) ~ EHType s IO ()) Source #
Some constraints that waitUntilM needs to work. Don't
worry about these since they are satisfied for any type s can be
newtype EventHandlers Source #
Constructors
| EventHandlers (TypeRepMap EventHandler) |
Instances
| Semigroup EventHandlers Source # | |
Defined in Calamity.Client.Types Methods (<>) :: EventHandlers -> EventHandlers -> EventHandlers # sconcat :: NonEmpty EventHandlers -> EventHandlers # stimes :: Integral b => b -> EventHandlers -> EventHandlers # | |
| Monoid EventHandlers Source # | |
Defined in Calamity.Client.Types Methods mempty :: EventHandlers # mappend :: EventHandlers -> EventHandlers -> EventHandlers # mconcat :: [EventHandlers] -> EventHandlers # | |
| Default EventHandlers Source # | |
Defined in Calamity.Client.Types Methods def :: EventHandlers | |
class InsertEventHandler a where Source #
A helper typeclass that is used to decide how to register regular events, and custom events which require storing in a map at runtime.
Methods
makeEventHandlers :: Proxy a -> Integer -> StoredEHType a -> EventHandlers Source #
Instances
| (EHInstanceSelector a ~ flag, InsertEventHandler' flag a) => InsertEventHandler a Source # | |
Defined in Calamity.Client.Types Methods makeEventHandlers :: Proxy a -> Integer -> StoredEHType a -> EventHandlers Source # | |
class RemoveEventHandler a where Source #
Methods
removeEventHandler :: Proxy a -> Integer -> EventHandlers -> EventHandlers Source #
Instances
| (EHInstanceSelector a ~ flag, RemoveEventHandler' flag a) => RemoveEventHandler (a :: EventType) Source # | |
Defined in Calamity.Client.Types Methods removeEventHandler :: Proxy a -> Integer -> EventHandlers -> EventHandlers Source # | |
getEventHandlers :: GetEventHandlers a => EventHandlers -> [StoredEHType a] Source #
getCustomEventHandlers :: TypeRep -> TypeRep -> EventHandlers -> [Dynamic -> IO ()] Source #