Nostrum.Api.User (nostrum v0.11.0-dev)
View SourceFunctions for interacting with the Discord API's user endpoints.
Summary
Functions
Create a new DM channel with a user.
Creates a new group DM channel.
Gets a user by its Nostrum.Struct.User.id/0
.
Functions
@spec create_dm(Nostrum.Struct.User.id()) :: Nostrum.Api.error() | {:ok, Nostrum.Struct.Channel.dm_channel()}
Create a new DM channel with a user.
If successful, returns {:ok, dm_channel}
. Otherwise, returns a Nostrum.Api.error/0
.
Examples
Nostrum.Api.User.create_dm(150061853001777154)
{:ok, %Nostrum.Struct.Channel{type: 1}}
@spec create_group_dm([String.t()], %{ optional(Nostrum.Struct.User.id()) => String.t() }) :: Nostrum.Api.error() | {:ok, Nostrum.Struct.Channel.group_dm_channel()}
Creates a new group DM channel.
If successful, returns {:ok, group_dm_channel}
. Otherwise, returns a Nostrum.Api.error/0
.
access_tokens
are user oauth2 tokens. nicks
is a map that maps a user id
to a nickname.
Examples
Nostrum.Api.User.create_group_dm(["6qrZcUqja7812RVdnEKjpzOL4CvHBFG"], %{41771983423143937 => "My Nickname"})
{:ok, %Nostrum.Struct.Channel{type: 3}}
@spec get(Nostrum.Struct.User.id()) :: Nostrum.Api.error() | {:ok, Nostrum.Struct.User.t()}
Gets a user by its Nostrum.Struct.User.id/0
.
If the request is successful, this function returns {:ok, user}
, where
user
is a Nostrum.Struct.User
. Otherwise, returns {:error, reason}
.