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

Convience helper for channel

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

Functions

bulk_delete_messages(conn, channel_id, message_ids)

Specs

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])
create_invite(conn, channel_id, options)

Specs

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})
delete(conn, channel_id)

Specs

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)
delete_message(conn, channel_id, message_id)

Specs

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)
delete_permissions(conn, channel_id, overwrite_id)

Specs

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)
edit_permissions(conn, channel_id, overwrite_id, options)

Specs

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})
get(conn, channel_id)

Specs

get(pid, number) :: map

Get channel

Parameters

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

Examples

Channel.get(conn, 99999999993832)
get_invites(conn, channel_id)

Specs

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)
messages(conn, channel_id)

Specs

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)
modify(conn, channel_id, options)

Specs

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"})
send_file(conn, channel_id, file_data)

Specs

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"})
send_message(conn, channel_id, message_data)

Specs

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!"})
trigger_typing(conn, channel_id)

Specs

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)
update_message(conn, channel_id, message_id, message)

Specs

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!")