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

Discord.Internal.Rest.User

Description

Provides actions for Channel API interactions

Synopsis

Documentation

data UserRequest a where Source #

Data constructor for requests. See API

Constructors

GetCurrentUser :: UserRequest User

Returns the User object of the requester's account. For OAuth2, this requires the identify scope, which will return the object without an email, and optionally the email scope, which returns the object with an email.

GetUser :: UserId -> UserRequest User

Returns a User for a given user ID

ModifyCurrentUser :: Text -> Base64Image User -> UserRequest User

Modify user's username & avatar pic

GetCurrentUserGuilds :: UserRequest [PartialGuild]

Returns a list of user Guild objects the current user is a member of. Requires the guilds OAuth2 scope.

LeaveGuild :: GuildId -> UserRequest ()

Leave a guild.

GetUserDMs :: UserRequest [Channel]

Returns a list of DM Channel objects

CreateDM :: UserId -> UserRequest Channel

Create a new DM channel with a user. Returns a DM Channel object.

GetUserConnections :: UserRequest [ConnectionObject] 

Instances

Instances details
Request (UserRequest a) Source # 
Instance details

Defined in Discord.Internal.Rest.User

parseAvatarImage :: ByteString -> Either Text (Base64Image User) Source #

parseAvatarImage bs will attempt to convert the given image bytestring bs to the base64 format expected by the Discord API. It may return Left with an error reason if the image format could not be predetermined from the opening magic bytes. This function does not validate the rest of the image, and this is up to the library user to check themselves.

This function accepts all file types accepted by getMimeType.