REST API endpoints for Discord users.
All functions return {:ok, result} or {:error, reason}.
Summary
Functions
Creates a DM channel with a user.
Gets a user by ID.
Lists the guilds the bot is in, as partial guild objects.
Leaves a guild. Discord then sends GUILD_DELETE for it.
Gets the current bot user.
Modifies the current bot user — its account-wide identity.
Streams every guild the bot is in, 200 per request, lazily.
Functions
Creates a DM channel with a user.
Gets a user by ID.
Lists the guilds the bot is in, as partial guild objects.
GET /users/@me/guilds. Returns at most 200 per call; stream_guilds/1 pages through them
all.
Options
:before,:after— guild id cursors:limit— 1–200, default 200:with_counts— includeapproximate_member_countandapproximate_presence_count:shard— only the guilds of this shard,0tomax_concurrency - 1. Required for a bot using large bot sharding: Discord answers400without it since September 2026
Leaves a guild. Discord then sends GUILD_DELETE for it.
DELETE /users/@me/guilds/{guild_id}. The bot cannot leave a guild it owns.
Gets the current bot user.
Modifies the current bot user — its account-wide identity.
PATCH /users/@me, taking username, avatar and banner. A per-guild profile is set
with EDA.API.Member.modify_me/2 instead, and overrides this one in that guild.
avatar and banner are image data: a path or raw bytes is converted to a data URI
for you, and nil clears the field. See EDA.ImageData.
EDA.API.User.modify_me(%{username: "EDA", avatar: "priv/avatar.png"})Changing the username may randomise the discriminator, and Discord rate-limits it heavily — this is not a call to make on a schedule.
@spec stream_guilds(keyword()) :: Enumerable.t()
Streams every guild the bot is in, 200 per request, lazily.
Takes the options of guilds/1 except :before, :after and :limit.
EDA.API.User.stream_guilds(with_counts: true) |> Enum.count()