Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Provides base types and utility functions needed for modules in Discord.Internal.Types
Synopsis
- newtype Auth = Auth Text
- authToken :: Auth -> Text
- newtype Snowflake = Snowflake {}
- snowflakeCreationDate :: Snowflake -> UTCTime
- newtype RolePermissions = RolePermissions {}
- newtype DiscordId a = DiscordId {}
- type ChannelId = DiscordId ChannelIdType
- type StageId = DiscordId StageIdType
- type GuildId = DiscordId GuildIdType
- type MessageId = DiscordId MessageIdType
- type AttachmentId = DiscordId AttachmentIdType
- type EmojiId = DiscordId EmojiIdType
- type StickerId = DiscordId StickerIdType
- type UserId = DiscordId UserIdType
- type RoleId = DiscordId RoleIdType
- type IntegrationId = DiscordId IntegrationIdType
- type WebhookId = DiscordId WebhookIdType
- type ParentId = DiscordId ParentIdType
- type ApplicationId = DiscordId ApplicationIdType
- type ApplicationCommandId = DiscordId ApplicationCommandIdType
- type InteractionId = DiscordId InteractionIdType
- type ScheduledEventId = DiscordId ScheduledEventIdType
- type ScheduledEventEntityId = DiscordId ScheduledEventEntityIdType
- newtype DiscordToken a = DiscordToken {}
- type InteractionToken = DiscordToken InteractionIdType
- type WebhookToken = DiscordToken WebhookIdType
- type Shard = (Int, Int)
- epochTime :: UTCTime
- class Data a => InternalDiscordEnum a where
- discordTypeStartValue :: a
- fromDiscordType :: a -> Int
- discordTypeTable :: [(Int, a)]
- discordTypeParseJSON :: String -> Value -> Parser a
- data Base64Image a = Base64Image {
- mimeType :: Text
- base64Data :: ByteString
- getMimeType :: ByteString -> Maybe Text
- (.==) :: ToJSON a => Key -> a -> Maybe Pair
- (.=?) :: ToJSON a => Key -> Maybe a -> Maybe Pair
- objectFromMaybes :: [Maybe Pair] -> Value
- data ChannelTypeOption
- = ChannelTypeOptionGuildText
- | ChannelTypeOptionDM
- | ChannelTypeOptionGuildVoice
- | ChannelTypeOptionGroupDM
- | ChannelTypeOptionGuildCategory
- | ChannelTypeOptionGuildNews
- | ChannelTypeOptionGuildStore
- | ChannelTypeOptionGuildNewsThread
- | ChannelTypeOptionGuildPublicThread
- | ChannelTypeOptionGuildPrivateThread
- | ChannelTypeOptionGuildStageVoice
Documentation
Authorization token for the Discord API
A unique integer identifier. Can be used to calculate the creation date of an entity.
Instances
FromJSON Snowflake Source # | |
Defined in Discord.Internal.Types.Prelude | |
ToJSON Snowflake Source # | |
Read Snowflake Source # | |
Show Snowflake Source # | |
Eq Snowflake Source # | |
Ord Snowflake Source # | |
Defined in Discord.Internal.Types.Prelude | |
ToHttpApiData Snowflake Source # | |
Defined in Discord.Internal.Types.Prelude toUrlPiece :: Snowflake -> Text # toEncodedUrlPiece :: Snowflake -> Builder # toHeader :: Snowflake -> ByteString # toQueryParam :: Snowflake -> Text # toEncodedQueryParam :: Snowflake -> Builder # |
snowflakeCreationDate :: Snowflake -> UTCTime Source #
Gets a creation date from a snowflake.
newtype RolePermissions Source #
Instances
Instances
FromJSON (DiscordId a) Source # | |
Defined in Discord.Internal.Types.Prelude | |
ToJSON (DiscordId a) Source # | |
Read (DiscordId a) Source # | |
Show (DiscordId a) Source # | |
Eq (DiscordId a) Source # | |
Ord (DiscordId a) Source # | |
Defined in Discord.Internal.Types.Prelude | |
ToHttpApiData (DiscordId a) Source # | |
Defined in Discord.Internal.Types.Prelude toUrlPiece :: DiscordId a -> Text # toEncodedUrlPiece :: DiscordId a -> Builder # toHeader :: DiscordId a -> ByteString # toQueryParam :: DiscordId a -> Text # toEncodedQueryParam :: DiscordId a -> Builder # |
type AttachmentId = DiscordId AttachmentIdType Source #
type IntegrationId = DiscordId IntegrationIdType Source #
type ApplicationId = DiscordId ApplicationIdType Source #
type ApplicationCommandId = DiscordId ApplicationCommandIdType Source #
type InteractionId = DiscordId InteractionIdType Source #
type ScheduledEventId = DiscordId ScheduledEventIdType Source #
type ScheduledEventEntityId = DiscordId ScheduledEventEntityIdType Source #
newtype DiscordToken a Source #
Instances
type InteractionToken = DiscordToken InteractionIdType Source #
type WebhookToken = DiscordToken WebhookIdType Source #
class Data a => InternalDiscordEnum a where Source #
discordTypeStartValue :: a Source #
fromDiscordType :: a -> Int Source #
discordTypeTable :: [(Int, a)] Source #
discordTypeParseJSON :: String -> Value -> Parser a Source #
Instances
data Base64Image a Source #
Base64Image mime data
represents the base64 encoding of an image (as
data
), together with a tag of its mime type (mime
). The constructor is
only for Internal use, and its public export is hidden in Discord.Types.
Public creation of this datatype should be done using the relevant smart constructors for Emoji, Sticker, or Avatar.
Instances
getMimeType :: ByteString -> Maybe Text Source #
getMimeType bs
returns a possible mimetype for the given bytestring,
based on the first few magic bytes. It may return any of PNGJPEGGIF or WEBP
mimetypes, or Nothing if none are matched.
Reference: https://en.wikipedia.org/wiki/List_of_file_signatures
Although Discord's official documentation does not state WEBP as a supported format, it has been accepted for both emojis and user avatars no problem when tested manually.
Inspired by discord.py's implementation.
data ChannelTypeOption Source #
The different channel types. Used for application commands and components.
https://discord.com/developers/docs/resources/channel#channel-object-channel-types
ChannelTypeOptionGuildText | A text channel in a server. |
ChannelTypeOptionDM | A direct message between users. |
ChannelTypeOptionGuildVoice | A voice channel in a server. |
ChannelTypeOptionGroupDM | A direct message between multiple users. |
ChannelTypeOptionGuildCategory | An organizational category that contains up to 50 channels. |
ChannelTypeOptionGuildNews | A channel that users can follow and crosspost into their own server. |
ChannelTypeOptionGuildStore | A channel in which game developers can sell their game on discord. |
ChannelTypeOptionGuildNewsThread | A temporary sub-channel within a guild_news channel. |
ChannelTypeOptionGuildPublicThread | A temporary sub-channel within a guild_text channel. |
ChannelTypeOptionGuildPrivateThread | A temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission |
ChannelTypeOptionGuildStageVoice | A voice channel for hosting events with an audience. |