Safe Haskell | None |
---|---|
Language | Haskell2010 |
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) 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 s = (InsertEventHandler s, RemoveEventHandler s)
- 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
Client | |
|
Instances
newtype StartupError Source #
Instances
Show StartupError Source # | |
Defined in Calamity.Client.Types showsPrec :: Int -> StartupError -> ShowS # show :: StartupError -> String # showList :: [StartupError] -> ShowS # |
A Data Kind used to fire custom events
Instances
(EHInstanceSelector a ~ flag, RemoveEventHandler' flag a) => RemoveEventHandler (a :: EventType) Source # | |
Defined in Calamity.Client.Types removeEventHandler :: Proxy a -> Integer -> EventHandlers -> EventHandlers Source # |
data GuildCreateStatus Source #
GuildCreateNew | The guild was just joined |
GuildCreateAvailable | The guild is becoming available |
Instances
Show GuildCreateStatus Source # | |
Defined in Calamity.Client.Types showsPrec :: Int -> GuildCreateStatus -> ShowS # show :: GuildCreateStatus -> String # showList :: [GuildCreateStatus] -> ShowS # | |
Generic GuildCreateStatus Source # | |
Defined in Calamity.Client.Types type Rep GuildCreateStatus :: Type -> Type # from :: GuildCreateStatus -> Rep GuildCreateStatus x # to :: Rep GuildCreateStatus x -> GuildCreateStatus # | |
TextShow GuildCreateStatus Source # | |
Defined in Calamity.Client.Types 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 #
GuildDeleteUnavailable | The guild became unavailable |
GuildDeleteRemoved | The bot was removed from the guild |
Instances
Show GuildDeleteStatus Source # | |
Defined in Calamity.Client.Types showsPrec :: Int -> GuildDeleteStatus -> ShowS # show :: GuildDeleteStatus -> String # showList :: [GuildDeleteStatus] -> ShowS # | |
Generic GuildDeleteStatus Source # | |
Defined in Calamity.Client.Types type Rep GuildDeleteStatus :: Type -> Type # from :: GuildDeleteStatus -> Rep GuildDeleteStatus x # to :: Rep GuildDeleteStatus x -> GuildDeleteStatus # | |
TextShow GuildDeleteStatus Source # | |
Defined in Calamity.Client.Types 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) 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.
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 s = (InsertEventHandler s, RemoveEventHandler s) Source #
Some constraints that react
needs to work. Don't
worry about these since they are satisfied for any type s
can be
newtype EventHandlers Source #
EventHandlers (TypeRepMap EventHandler) |
Instances
Semigroup EventHandlers Source # | |
Defined in Calamity.Client.Types (<>) :: EventHandlers -> EventHandlers -> EventHandlers # sconcat :: NonEmpty EventHandlers -> EventHandlers # stimes :: Integral b => b -> EventHandlers -> EventHandlers # | |
Monoid EventHandlers Source # | |
Defined in Calamity.Client.Types mempty :: EventHandlers # mappend :: EventHandlers -> EventHandlers -> EventHandlers # mconcat :: [EventHandlers] -> EventHandlers # | |
Default EventHandlers Source # | |
Defined in Calamity.Client.Types 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.
makeEventHandlers :: Proxy a -> Integer -> StoredEHType a -> EventHandlers Source #
Instances
(EHInstanceSelector a ~ flag, InsertEventHandler' flag a) => InsertEventHandler a Source # | |
Defined in Calamity.Client.Types makeEventHandlers :: Proxy a -> Integer -> StoredEHType a -> EventHandlers Source # |
class RemoveEventHandler a where Source #
removeEventHandler :: Proxy a -> Integer -> EventHandlers -> EventHandlers Source #
Instances
(EHInstanceSelector a ~ flag, RemoveEventHandler' flag a) => RemoveEventHandler (a :: EventType) Source # | |
Defined in Calamity.Client.Types removeEventHandler :: Proxy a -> Integer -> EventHandlers -> EventHandlers Source # |
getEventHandlers :: GetEventHandlers a => EventHandlers -> [StoredEHType a] Source #
getCustomEventHandlers :: TypeRep -> TypeRep -> EventHandlers -> [Dynamic -> IO ()] Source #