Safe Haskell | None |
---|---|
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 {}
- newtype DiscordId a = DiscordId {}
- data ChannelIdType
- type ChannelId = DiscordId ChannelIdType
- data StageIdType
- type StageId = DiscordId StageIdType
- data GuildIdType
- type GuildId = DiscordId GuildIdType
- data MessageIdType
- type MessageId = DiscordId MessageIdType
- data AttachmentIdType
- type AttachmentId = DiscordId AttachmentIdType
- data EmojiIdType
- type EmojiId = DiscordId EmojiIdType
- data StickerIdType
- type StickerId = DiscordId StickerIdType
- data UserIdType
- type UserId = DiscordId UserIdType
- data RoleIdType
- type RoleId = DiscordId RoleIdType
- data IntegrationIdType
- type IntegrationId = DiscordId IntegrationIdType
- data WebhookIdType
- type WebhookId = DiscordId WebhookIdType
- data ParentIdType
- type ParentId = DiscordId ParentIdType
- data ApplicationIdType
- type ApplicationId = DiscordId ApplicationIdType
- data ApplicationCommandIdType
- type ApplicationCommandId = DiscordId ApplicationCommandIdType
- data InteractionIdType
- type InteractionId = DiscordId InteractionIdType
- data ScheduledEventIdType
- type ScheduledEventId = DiscordId ScheduledEventIdType
- data ScheduledEventEntityIdType
- type ScheduledEventEntityId = DiscordId ScheduledEventEntityIdType
- newtype DiscordToken a = DiscordToken {}
- type InteractionToken = DiscordToken InteractionIdType
- type WebhookToken = DiscordToken WebhookIdType
- type Shard = (Int, Int)
- snowflakeCreationDate :: Snowflake -> UTCTime
- epochTime :: UTCTime
- class Data a => InternalDiscordEnum a where
- discordTypeStartValue :: a
- fromDiscordType :: a -> Int
- discordTypeTable :: [(Int, a)]
- discordTypeParseJSON :: String -> Value -> Parser a
- toMaybeJSON :: ToJSON a => a -> Maybe Value
- data Base64Image a = Base64Image Text Text
- getMimeType :: ByteString -> Maybe Text
Documentation
Authorization token for the Discord API
A unique integer identifier. Can be used to calculate the creation date of an entity.
Instances
Instances
data ChannelIdType Source #
type ChannelId = DiscordId ChannelIdType Source #
data StageIdType Source #
type StageId = DiscordId StageIdType Source #
data GuildIdType Source #
type GuildId = DiscordId GuildIdType Source #
data MessageIdType Source #
type MessageId = DiscordId MessageIdType Source #
data AttachmentIdType Source #
type AttachmentId = DiscordId AttachmentIdType Source #
data EmojiIdType Source #
type EmojiId = DiscordId EmojiIdType Source #
data StickerIdType Source #
type StickerId = DiscordId StickerIdType Source #
data UserIdType Source #
type UserId = DiscordId UserIdType Source #
data RoleIdType Source #
type RoleId = DiscordId RoleIdType Source #
data IntegrationIdType Source #
data WebhookIdType Source #
type WebhookId = DiscordId WebhookIdType Source #
data ParentIdType Source #
type ParentId = DiscordId ParentIdType Source #
data ApplicationIdType Source #
data InteractionIdType Source #
data ScheduledEventIdType Source #
newtype DiscordToken a Source #
Instances
type WebhookToken = DiscordToken WebhookIdType Source #
snowflakeCreationDate :: Snowflake -> UTCTime Source #
Gets a creation date from a snowflake.
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.