REST API endpoints for Discord guild bans.
All functions return {:ok, result} or {:error, reason}.
Summary
Functions
@spec bulk(String.t() | integer(), [String.t() | integer()], keyword()) :: {:ok, map()} | {:error, term()}
Bans up to 200 users from a guild in a single request.
Options
:delete_message_seconds- Seconds of messages to delete (0-604800)
Returns {:ok, %{"banned_users" => [...], "failed_users" => [...]}}.
Bans a user from a guild.
Options
:delete_message_seconds— seconds of message history to delete (0-604800):reason— audit log reason (sent asX-Audit-Log-Reasonheader)
Gets a specific ban for a guild.
Gets bans for a guild.
Unbans a user from a guild.
@spec stream( String.t() | integer(), keyword() ) :: Enumerable.t()
Returns a lazy Stream that paginates through all bans in a guild.
Options
:direction—:beforeor:after(default:before):per_page— bans per request (1-1000, default 1000):before— start before this user ID:after— start after this user ID
Examples
EDA.API.Ban.stream(guild_id) |> Enum.to_list()
EDA.API.Ban.stream(guild_id, per_page: 100) |> Stream.take(50) |> Enum.to_list()