user

package
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resource

type Resource struct {
	// contains filtered or unexported fields
}

Resource is a resource that allows to perform various actions on a Discord user. Create one with Client.User.

func NewResource

func NewResource(c resource.RestClient, id string) *Resource

func (*Resource) Connections

func (r *Resource) Connections(ctx context.Context) ([]discord.UserConnection, error)

Connections returns a list of connections for the connected user.

func (*Resource) DMs

func (r *Resource) DMs(ctx context.Context) ([]discord.Channel, error)

DMs returns the list of direct message channels the current user is in. This endpoint does not seem to be available for Bot users, always returning an empty list of channels.

func (*Resource) Get

func (r *Resource) Get(ctx context.Context) (*discord.User, error)

Get returns the current user.

func (*Resource) Guilds

func (r *Resource) Guilds(ctx context.Context) ([]discord.PartialGuild, error)

Guilds returns a list of partial guilds the current user is a member of. This endpoint returns at most 100 guilds by default, which is the maximum number of guilds a non-bot user can join. Therefore, pagination is not needed for integrations that need to get a list of users' guilds.

func (*Resource) LeaveGuild

func (r *Resource) LeaveGuild(ctx context.Context, id string) error

LeaveGuild make the current user leave a guild given its ID.

func (*Resource) Modify

func (r *Resource) Modify(ctx context.Context, username, avatar string) (*discord.User, error)

Modify modifies the current user account settings. Avatar is a Data URI scheme that supports JPG, GIF, and PNG formats. An example Data URI format is:

data:image/jpeg;base64,BASE64_ENCODED_JPEG_IMAGE_DATA

Ensure you use the proper header type (image/jpeg, image/png, image/gif) that matches the image data being provided.

func (*Resource) NewDM

func (r *Resource) NewDM(ctx context.Context, recipientID string) (*discord.Channel, error)

NewDM creates a new DM channel with a user. Returns the created channel. If a DM channel already exist with this recipient, it does not create a new one and returns the existing one instead.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL