Discord Elixir v1.1.18 DiscordEx.RestClient.Resources.Channel View Source

Convience helper for channel

Link to this section Summary

Functions

Bulk Delete previously sent messages

Delete a guild channel, or close a private message

Delete a previously sent message

Get channel

Get channel invites

Retrieve messages for a channel

Update a channels settings

Post a file and message to a guild text or DM channel

Post a message to a guild text or DM channel

Trigger typing indicator

Link to this section Functions

Link to this function bulk_delete_messages(conn, channel_id, message_ids) View Source
bulk_delete_messages(pid(), number(), list()) :: atom()

Bulk Delete previously sent messages

This endpoint can only be used on guild channels and requires the ‘MANAGE_MESSAGES’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • channel_id: Channel id
  • message_ids: list of msssage ids to delete

Examples

Channel.bulk_delete_messages(conn, 439093409304934, [32902930920932,3290239832023,237727828932])
Link to this function create_invite(conn, channel_id, options) View Source
create_invite(pid(), number(), map()) :: map()

Create channel invites

Requires the CREATE_INSTANT_INVITE permission.

Parameters

  • conn: User connection for REST holding auth info
  • channel_id: Channel id
  • options: Invite creation options which include (max_age [default 24 hours], max_uses, temporary, xkcdpass)

Examples

Channel.create_invite(conn, 3290293092093, %{max_age: 86400, max_uses: 1, temporary: false, xkcdpass: false})
Link to this function delete(conn, channel_id) View Source
delete(pid(), number()) :: map()

Delete a guild channel, or close a private message

Requires the ‘MANAGE_GUILD’ permission for the guild containing the channel.

Parameters

  • conn: User connection for REST holding auth info
  • channel_id: Channel id

Examples

Channel.delete(conn, 93209293090239)
Link to this function delete_message(conn, channel_id, message_id) View Source
delete_message(pid(), number(), number()) :: atom()

Delete a previously sent message

This endpoint can only be used on guild channels and requires the ‘MANAGE_MESSAGES’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • channel_id: Channel id
  • message_id: The message id that you want to edit

Examples

Channel.delete_message(conn, 439093409304934, 32892398238)
Link to this function delete_permissions(conn, channel_id, overwrite_id) View Source
delete_permissions(pid(), number(), number()) :: map()

Delete channel permissions

Delete a channel permission overwrite for a user or role in a channel. Only usable for guild channels. Requires the ‘MANAGE_ROLES’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • channel_id: Channel id
  • overwrite_id: The role or user to override permissions in channel for

Examples

Channel.delete_permissions(conn, 9999999999383, 3279283989823)
Link to this function edit_permissions(conn, channel_id, overwrite_id, options) View Source
edit_permissions(pid(), number(), number(), map()) :: map()

Edit channel permissions

Edit the channel permission overwrites for a user or role in a channel. Only usable for guild channels. Requires the ‘MANAGE_ROLES’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • channel_id: Channel id
  • overwrite_id: The role or user to override permissions in channel for
  • options: The permissions to allow or deny

Examples

Channel.edit_permissions(conn, 9999999999383, 2382830923, %{allow: 66321471})
Link to this function get(conn, channel_id) View Source
get(pid(), number()) :: map()

Get channel

Parameters

  • conn: User connection for REST holding auth info
  • channel_id: Channel id

Examples

Channel.get(conn, 99999999993832)
Link to this function get_invites(conn, channel_id) View Source
get_invites(pid(), number()) :: list()

Get channel invites

Requires the ‘MANAGE_CHANNELS’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • channel_id: Channel id

Examples

Channel.get_invites(conn, 9999999999383)
Link to this function messages(conn, channel_id) View Source
messages(pid(), number()) :: map()

Retrieve messages for a channel

Requires the ‘READ_MESSAGES’ permission for the guild containing the channel.

Parameters

  • conn: User connection for REST holding auth info
  • channel_id: Channel id

Examples

Channel.messages(conn, 439093409304934)
Link to this function modify(conn, channel_id, options) View Source
modify(pid(), number(), map()) :: map()

Update a channels settings

Requires the ‘MANAGE_GUILD’ permission for the guild containing the channel.

Parameters

  • conn: User connection for REST holding auth info
  • channel_id: Channel id
  • options: Updateable options which include (name, position, topic, bitrate)

Examples

Channel.modify(conn, 3290293092093, %{name: "my-channel", topic" "we all are friends here"})
Link to this function send_file(conn, channel_id, file_data) View Source
send_file(pid(), number(), map()) :: map()

Post a file and message to a guild text or DM channel

Requires the ‘SEND_MESSAGES’ permission to be present on the current user.

Parameters

  • conn: User connection for REST holding auth info
  • channel_id: Channel id
  • file_data: filed data which include (content, nonce, tts, file)

Examples

Channel.send_messages(conn, 439093409304934, %{content: "Check this out!", file: "/local/path/to/file.jpg"})
Link to this function send_message(conn, channel_id, message_data) View Source
send_message(pid(), number(), String.t()) :: map()

Post a message to a guild text or DM channel

Requires the ‘SEND_MESSAGES’ permission to be present on the current user.

Parameters

  • conn: User connection for REST holding auth info
  • channel_id: Channel id
  • message_data: message data which include (content, nonce, tts)

Examples

Channel.send_message(conn, 439093409304934, %{content: "Hi! Friends!"})
Link to this function trigger_typing(conn, channel_id) View Source
trigger_typing(pid(), number()) :: atom()

Trigger typing indicator

Post a typing indicator for the specified channel. Generally bots should not implement this route. However, if a bot is responding to a command and expects the computation to take a few seconds, this endpoint may be called to let the user know that the bot is processing their message.

Parameters

  • conn: User connection for REST holding auth info
  • channel_id: Channel id

Examples

Channel.trigger_typing(conn, 3290293092093)
Link to this function update_message(conn, channel_id, message_id, message) View Source
update_message(pid(), number(), number(), String.t()) :: map()

Edit a previously sent message

You can only edit messages that have been sent by the current user.

Parameters

  • conn: User connection for REST holding auth info
  • channel_id: Channel id
  • message_id: The message id that you want to edit
  • message: Message you wish to update the sent message with

Examples

Channel.update_message(conn, 439093409304934, 32892398238, "Updating this message!")