discord-haskell-1.14.0: Write bots for Discord in Haskell
Safe HaskellNone
LanguageHaskell2010

Discord.Internal.Types.Prelude

Description

Provides base types and utility functions needed for modules in Discord.Internal.Types

Synopsis

Documentation

newtype Auth Source #

Authorization token for the Discord API

Constructors

Auth Text 

Instances

Instances details
Eq Auth Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Methods

(==) :: Auth -> Auth -> Bool #

(/=) :: Auth -> Auth -> Bool #

Ord Auth Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Methods

compare :: Auth -> Auth -> Ordering #

(<) :: Auth -> Auth -> Bool #

(<=) :: Auth -> Auth -> Bool #

(>) :: Auth -> Auth -> Bool #

(>=) :: Auth -> Auth -> Bool #

max :: Auth -> Auth -> Auth #

min :: Auth -> Auth -> Auth #

Read Auth Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Show Auth Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Methods

showsPrec :: Int -> Auth -> ShowS #

show :: Auth -> String #

showList :: [Auth] -> ShowS #

authToken :: Auth -> Text Source #

Get the raw token formatted for use with the websocket gateway

newtype Snowflake Source #

A unique integer identifier. Can be used to calculate the creation date of an entity.

Constructors

Snowflake 

Fields

Instances

Instances details
Enum Snowflake Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Eq Snowflake Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Integral Snowflake Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Num Snowflake Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Ord Snowflake Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Read Snowflake Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Real Snowflake Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Show Snowflake Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

ToJSON Snowflake Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

FromJSON Snowflake Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Bits Snowflake Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

ToHttpApiData Snowflake Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

newtype DiscordId a Source #

Constructors

DiscordId 

Fields

Instances

Instances details
Enum (DiscordId a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Eq (DiscordId a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Methods

(==) :: DiscordId a -> DiscordId a -> Bool #

(/=) :: DiscordId a -> DiscordId a -> Bool #

Integral (DiscordId a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Num (DiscordId a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Ord (DiscordId a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Read (DiscordId a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Real (DiscordId a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Show (DiscordId a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

ToJSON (DiscordId a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

FromJSON (DiscordId a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Bits (DiscordId a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

ToHttpApiData (DiscordId a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

newtype DiscordToken a Source #

Constructors

DiscordToken 

Fields

Instances

Instances details
Eq (DiscordToken a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Ord (DiscordToken a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Read (DiscordToken a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Show (DiscordToken a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

ToJSON (DiscordToken a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

FromJSON (DiscordToken a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

ToHttpApiData (DiscordToken a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

type Shard = (Int, Int) Source #

snowflakeCreationDate :: Snowflake -> UTCTime Source #

Gets a creation date from a snowflake.

epochTime :: UTCTime Source #

Default timestamp

class Data a => InternalDiscordEnum a where Source #

Minimal complete definition

discordTypeStartValue, fromDiscordType

Instances

Instances details
InternalDiscordEnum DiscordColor Source # 
Instance details

Defined in Discord.Internal.Types.Color

InternalDiscordEnum ApplicationCommandChannelType Source # 
Instance details

Defined in Discord.Internal.Types.ApplicationCommands

InternalDiscordEnum ScheduledEventType Source # 
Instance details

Defined in Discord.Internal.Types.ScheduledEvents

InternalDiscordEnum ScheduledEventStatus Source # 
Instance details

Defined in Discord.Internal.Types.ScheduledEvents

InternalDiscordEnum ScheduledEventPrivacyLevel Source # 
Instance details

Defined in Discord.Internal.Types.ScheduledEvents

InternalDiscordEnum StickerFormatType Source # 
Instance details

Defined in Discord.Internal.Types.Emoji

InternalDiscordEnum MessageFlag Source # 
Instance details

Defined in Discord.Internal.Types.Channel

InternalDiscordEnum MessageActivityType Source # 
Instance details

Defined in Discord.Internal.Types.Channel

InternalDiscordEnum MessageType Source # 
Instance details

Defined in Discord.Internal.Types.Channel

InternalDiscordEnum ActivityType Source # 
Instance details

Defined in Discord.Internal.Types.Guild

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.

Constructors

Base64Image Text Text 

Instances

Instances details
Eq (Base64Image a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Ord (Base64Image a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Read (Base64Image a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

Show (Base64Image a) Source # 
Instance details

Defined in Discord.Internal.Types.Prelude

ToJSON (Base64Image a) Source #

The ToJSON instance for Base64Image creates a string representation of the image's base-64 data, suited for using as JSON values.

The format is: data:%MIME%;base64,%DATA%.

Instance details

Defined in Discord.Internal.Types.Prelude

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.