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 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 Text Text
- getMimeType :: ByteString -> Maybe Text
- (.==) :: ToJSON a => AesonKey -> a -> Maybe Pair
- (.=?) :: ToJSON a => AesonKey -> Maybe a -> Maybe Pair
- type AesonKey = Key
- objectFromMaybes :: [Maybe Pair] -> Value
Documentation
Authorization token for the Discord API
A unique integer identifier. Can be used to calculate the creation date of an entity.
Instances
snowflakeCreationDate :: Snowflake -> UTCTime Source #
Gets a creation date from a snowflake.
Instances
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.