Discord Elixir v1.1.4 DiscordEx.RestClient.Resources.User

Convience helper for user resource

Summary

Functions

Get all user connections

Create direct message channel for user

Get currrent user

Get user direct message channels

Get user data for a specific user id

Current user guilds

User login that returns connection

User logout which kills the connection process

Modify the current user

Query users with results from mutual guilds

Functions

connections(conn)

Specs

connections(pid) :: list

Get all user connections

Parameters

  • conn: User connection for REST holding auth info

Examples

User.connections(conn)
create_dm_channel(conn, recipient_id)

Specs

create_dm_channel(pid, number) :: map

Create direct message channel for user

Parameters

  • conn: User connection for REST holding auth info
  • recipient_id: The user id in which a direct message channel should be open

Examples

User.create_dm_channel(conn, 9999991384736571)
current(conn)

Specs

current(pid) :: map

Get currrent user

Parameters

  • conn: User connection for REST holding auth info

Examples

User.current(conn)
dm_channels(conn)

Specs

dm_channels(pid) :: map

Get user direct message channels

Parameters

  • conn: User connection for REST holding auth info

Examples

User.dm_channels(conn)
get(conn, user_id)

Specs

get(pid, number) :: map

Get user data for a specific user id

Parameters

  • conn: User connection for REST holding auth info
  • user_id: User ID

Examples

User.get(conn, 329230923902390)
guilds(conn)

Specs

guilds(pid) :: list

Current user guilds

Parameters

  • conn: User connection for REST holding auth info

Examples

User.guilds(conn)
leave_guild(conn, guild_id)

Specs

leave_guild(pid, number) :: nil

Leave guild

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: The identifier for the guild in which the user wishes to leave

Examples

User.guilds(conn, 81323847812384)
login(email, password)

Specs

login(String.t, String.t) :: map

User login that returns connection

Parameters

  • email: User’s email
  • password: User’s password

Examples

User.login("user39023@discordapp.com","password")
#=> {:ok, #PID<0.200.0>}
logout(conn)

Specs

logout(pid) :: atom

User logout which kills the connection process

Parameters

  • conn: User connection for REST holding auth info

Examples

User.logout(conn)
#=> :ok
modify(conn, options)

Specs

modify(pid, map) :: map

Modify the current user

Parameters

  • conn: User connection for REST holding auth info
  • options: Updateable options which include (username, avatar) and email, password.

Examples

User.modify(conn, %{username: "SuperUserKato", email: "superuserkato@discordapp.com", password: "password"})
query(conn, username, limit \\ 25)

Specs

query(pid, String.t, number) :: list

Query users with results from mutual guilds

Parameters

  • conn: User connection for REST holding auth info
  • username: Nick of user who you are looking up
  • limit: How many results to return. (default: 25)

Examples

User.query(conn, "tontoXL3902", 10)