Channel, message, thread, typing and pin endpoints.
Message params (create_message/4, edit_message/5) are passed through as JSON:
content, embeds, components, message_reference, allowed_mentions, flags,
… Build embeds with Noizu.Discord.Embeds and convert/split long markdown with
Noizu.Discord.Markdown.
Summary
Functions
POST /channels/{channel.id}/messages — send a message.
DELETE /channels/{channel.id}/messages/{message.id} — delete a message ({:ok, nil}).
PATCH /channels/{channel.id}/messages/{message.id} — edit a message.
GET /channels/{channel.id} — a channel (or thread) by id.
GET /channels/{channel.id}/messages/{message.id} — one message.
GET /guilds/{guild.id}/threads/active — all active threads in a guild
(%{"threads" => [...], "members" => [...]}). Note the argument is a guild id:
API v10 has no per-channel active-threads endpoint.
GET /channels/{channel.id}/messages — one page of messages (newest first).
Query opts: :before, :after, :around (mutually exclusive), :limit (1–100).
GET /channels/{channel.id}/messages — lazy stream over history.
PUT /channels/{channel.id}/messages/pins/{message.id} — pin a message ({:ok, nil}).
Accepts :reason (audit log).
POST /channels/{channel.id}/threads — start a thread without a message.
params: %{name, type, auto_archive_duration, invitable, rate_limit_per_user}
(forum/media channels also take message).
POST /channels/{channel.id}/messages/{message.id}/threads — start a thread from a
message. params: %{name, auto_archive_duration, rate_limit_per_user}.
POST /channels/{channel.id}/typing — trigger the typing indicator ({:ok, nil}).
Functions
@spec create_message(Noizu.Discord.Client.t(), String.t(), map(), keyword()) :: Noizu.Discord.Request.result()
POST /channels/{channel.id}/messages — send a message.
params: %{content, embeds, components, message_reference, allowed_mentions, …}
(atom or string keys). Content is limited to 2000 characters — see
Noizu.Discord.Markdown.chunk/2.
@spec delete_message(Noizu.Discord.Client.t(), String.t(), String.t(), keyword()) :: Noizu.Discord.Request.result()
DELETE /channels/{channel.id}/messages/{message.id} — delete a message ({:ok, nil}).
@spec edit_message(Noizu.Discord.Client.t(), String.t(), String.t(), map(), keyword()) :: Noizu.Discord.Request.result()
PATCH /channels/{channel.id}/messages/{message.id} — edit a message.
@spec get(Noizu.Discord.Client.t(), String.t(), keyword()) :: Noizu.Discord.Request.result()
GET /channels/{channel.id} — a channel (or thread) by id.
@spec get_message(Noizu.Discord.Client.t(), String.t(), String.t(), keyword()) :: Noizu.Discord.Request.result()
GET /channels/{channel.id}/messages/{message.id} — one message.
@spec list_active_threads(Noizu.Discord.Client.t(), String.t(), keyword()) :: Noizu.Discord.Request.result()
GET /guilds/{guild.id}/threads/active — all active threads in a guild
(%{"threads" => [...], "members" => [...]}). Note the argument is a guild id:
API v10 has no per-channel active-threads endpoint.
@spec messages(Noizu.Discord.Client.t(), String.t(), keyword()) :: Noizu.Discord.Request.result()
GET /channels/{channel.id}/messages — one page of messages (newest first).
Query opts: :before, :after, :around (mutually exclusive), :limit (1–100).
@spec messages_stream(Noizu.Discord.Client.t(), String.t(), keyword()) :: Enumerable.t()
GET /channels/{channel.id}/messages — lazy stream over history.
Default walks backwards from the newest message (before paging; pass :before
to start below a given id). Pass :after to walk forwards from that id instead.
:limit is the page size (default 100). :around is not supported for streams.
@spec pin_message(Noizu.Discord.Client.t(), String.t(), String.t(), keyword()) :: Noizu.Discord.Request.result()
PUT /channels/{channel.id}/messages/pins/{message.id} — pin a message ({:ok, nil}).
Accepts :reason (audit log).
@spec start_thread(Noizu.Discord.Client.t(), String.t(), map(), keyword()) :: Noizu.Discord.Request.result()
POST /channels/{channel.id}/threads — start a thread without a message.
params: %{name, type, auto_archive_duration, invitable, rate_limit_per_user}
(forum/media channels also take message).
@spec start_thread_from_message( Noizu.Discord.Client.t(), String.t(), String.t(), map(), keyword() ) :: Noizu.Discord.Request.result()
POST /channels/{channel.id}/messages/{message.id}/threads — start a thread from a
message. params: %{name, auto_archive_duration, rate_limit_per_user}.
@spec typing(Noizu.Discord.Client.t(), String.t(), keyword()) :: Noizu.Discord.Request.result()
POST /channels/{channel.id}/typing — trigger the typing indicator ({:ok, nil}).