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

Convience helper for guild resource

Link to this section Summary

Functions

List banned users

Get guild channels

Create guild

Delete guild

Get guild embed

Get guild object

Get integrations

Remove guild member (KICK)

Modify guild embed

List guild roles

Get voice regions

Link to this section Functions

Link to this function ban_member(conn, guild_id, user_id, options) View Source
ban_member(pid(), number(), number(), map()) :: atom()

Ban guild member

Create a guild ban, and optionally delete previous messages sent by the banned user. Requires the ‘BAN_MEMBERS’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • user_id: User id of guild member
  • options: Option for banning which includes (delete-message-days)

Examples

Guild.ban_member(conn, 9999999923792, 3290238023092309, %{delete-message-days: 3})
Link to this function bans(conn, guild_id) View Source
bans(pid(), number()) :: map()

List banned users

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id

Examples

Guild.bans(conn, 9999999923792)
Link to this function batch_modify_roles(conn, guild_id, role_option_array) View Source
batch_modify_roles(pid(), number(), list()) :: map()

Batch modify roles

Batch modify a set of role objects for the guild. Requires the ‘MANAGE_ROLES’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • user_id: User id of guild member
  • role_option_array: Options to update roles which include (id, name, permissions, position, color, hoist)

Examples

Guild.batch_modify_roles(conn, 9999999923792, 3290238023092309, [
  %{id: 392092390909032, position: 1},
  %{id: 392053390902324, position: 2}
])
Link to this function begin_prune(conn, guild_id, options) View Source
begin_prune(pid(), number(), map()) :: map()

Begin guild prune

Begin a prune operation. Requires the ‘KICK_MEMBERS’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • options: Options to prune guild members which include (days)

Examples

Guild.begin_prune(conn, 9999999923792, %{days: 7})
Link to this function channels(conn, guild_id) View Source
channels(pid(), number()) :: map()

Get guild channels

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id

Examples

Guild.channels(conn, 9999999923792)

Create guild

This endpoint is only available for whitelisted bots. If you believe you have a legitimate use case for automating guild creation, please contact support@discordapp.com.

Parameters

  • conn: User connection for REST holding auth info
  • options: Options for creating a guild including (name, region, icon)

Examples

Guild.create(conn, %{name: "My Guild", region: "Amsterdam", icon: "/path/to/local/icon.jpg"})
Link to this function create_channel(conn, guild_id, options) View Source
create_channel(pid(), number(), map()) :: map()

Create guild channel

Requires the ‘MANAGE_CHANNELS’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • options: Options for creating a guild channel including (name, type, bitrate)

Examples

Guild.create_channel(conn, 93209203902, %{name: "general-chat", type: "text"})
Link to this function create_empty_role(conn, guild_id) View Source
create_empty_role(pid(), number()) :: map()

Create guild role

Create a new empty role object for the guild. Requires the ‘MANAGE_ROLES’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id

Examples

Guild.create_empty_role(conn, 9999999923792)
Link to this function create_integration(conn, guild_id, options) View Source
create_integration(pid(), number(), map()) :: atom()

Create guild integration

Attach an integration object from the current user to the guild. Requires the ‘MANAGE_GUILD’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • options: Options for creating a guild integration including (type, id)

Examples

Guild.create_integration(conn, 93209203902, %{id: 3288823892398298293, type: "awesome-application"})
Link to this function delete(conn, guild_id) View Source
delete(pid(), number()) :: map()

Delete guild

BE CAREFUL - YOU CAN NOT UNDO! User must be owner.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id

Examples

Guild.delete(conn, 9999999923792)
Link to this function delete_integration(conn, guild_id, integration_id) View Source
delete_integration(pid(), number(), number()) :: atom()

Delete guild integration

Delete the attached integration object for the guild. Requires the ‘MANAGE_GUILD’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • integration_id: Integration id

Examples

Guild.delete_integration(conn, 93209203902, 3892898393)
Link to this function delete_role(conn, guild_id, role_id) View Source
delete_role(pid(), number(), number()) :: atom()

Remove guild role

Delete a guild role. Requires the ‘MANAGE_ROLES’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • role_id: Role id of guild member

Examples

Guild.delete_role(conn, 9999999923792, 3290238023092309)
Link to this function embed(conn, guild_id) View Source
embed(pid(), number()) :: map()

Get guild embed

Returns the guild embed object. Requires the ‘MANAGE_GUILD’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id

Examples

Guild.embed(conn, 9999999923792)
Link to this function get(conn, guild_id) View Source
get(pid(), map()) :: map()
get(pid(), String.t()) :: map()

Get guild object

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id

Examples

Guild.get(conn, 9999999923792)
Link to this function integrations(conn, guild_id) View Source
integrations(pid(), number()) :: map()

Get integrations

Returns a list of integration objects for the guild. Requires the ‘MANAGE_GUILD’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id

Examples

Guild.integrations(conn, 9999999923792)
Link to this function invites(conn, guild_id) View Source
invites(pid(), number()) :: map()

Get invites

Returns a list of invite objects (with invite metadata) for the guild. Requires the ‘MANAGE_GUILD’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id

Examples

Guild.invites(conn, 9999999923792)
Link to this function kick_member(conn, guild_id, user_id) View Source
kick_member(pid(), number(), number()) :: atom()

Remove guild member (KICK)

Remove a member from a guild. Requires ‘KICK_MEMBERS’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • user_id: User id of guild member

Examples

Guild.kick_member(conn, 9999999923792, 3290238023092309)
Link to this function member(conn, guild_id, user_id) View Source
member(pid(), number(), number()) :: map()

Get guild member

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • user_id: User id of guild member

Examples

Guild.member(conn, 9999999923792, 3290238023092309)
Link to this function members(conn, guild_id, options) View Source
members(pid(), number(), map()) :: map()

Get guild members

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • options: Other options which include (limit, offset)

Examples

Guild.members(conn, 9999999923792, %{limit: 4})
Link to this function modify(conn, guild_id, options) View Source
modify(pid(), number(), map()) :: map()

Modify guild

Modify a guilds settings. Returns the updated guild object on success.

Parameters

  • conn: User connection for REST holding auth info
  • options: Options for creating a guild including (name, region, verification_level, afk_channel_id, afk_timeout, icon(128x128), owner_id, splash(128x128))

Examples

Guild.modify(conn, 320923099923,
  %{name: "My Guild", region: "Amsterdam", icon: "/path/to/local/icon.jpg", owner_id: 4930928030923})
Link to this function modify_embed(conn, guild_id) View Source
modify_embed(pid(), number()) :: map()

Modify guild embed

Modify a guild embed object for the guild. Requires the ‘MANAGE_GUILD’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id

Examples

Guild.modify_embed(conn, 93209203902, %{enabled: false})
Link to this function modify_integration(conn, guild_id, integration_id, options) View Source
modify_integration(pid(), number(), number(), map()) :: atom()

Modify guild integration

Modify the behavior and settings of a integration object for the guild. Requires the ‘MANAGE_GUILD’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • integration_id: Integration id
  • options: Options for modifying a guild integration including (expire_behavior, expire_grace_period, enable_emoticons)

Examples

Guild.modify_integration(conn, 93209203902, 3892898393, %{expire_grace_period: 300, enable_emoticons: true})
Link to this function modify_member(conn, guild_id, user_id, options) View Source
modify_member(pid(), number(), number(), map()) :: atom()

Modify guild member

When moving members to channels, the API user must have permissions to both connect to the channel and have the MOVE_MEMBERS permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • user_id: User id of guild member
  • options: Options to update guild member which include (nick, roles, mute, deaf, channel_id)

Examples

Guild.modify_member(conn, 9999999923792, 3290238023092309, %{nick: "Jingo", mute: true, channel_id: 3920293092390})
Link to this function modify_role(conn, guild_id, role_id, options) View Source
modify_role(pid(), number(), number(), map()) :: map()

Modify role

Modify a guild role. Requires the ‘MANAGE_ROLES’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • role_id: Role id
  • options: Options to update roles which include (name, permissions, position, color, hoist)

Examples

Guild.modify_role(conn, 320923099923, 3290930290923, %{name: "super-administrator", color: 11830404, permissions: 66321471})
Link to this function prune_count(conn, guild_id, options) View Source
prune_count(pid(), number(), map()) :: map()

Get prune count

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • options: Options to prune guild members which include (days)

Examples

Guild.prune_count(conn, 9999999923792, %{days: 7})
Link to this function roles(conn, guild_id) View Source
roles(pid(), number()) :: map()

List guild roles

Returns a list of role objects for the guild. Requires the ‘MANAGE_ROLES’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id

Examples

Guild.roles(conn, 9999999923792)
Link to this function sync_integration(conn, guild_id, integration_id) View Source
sync_integration(pid(), number(), number()) :: atom()

Sync guild integration

Sync an integration. Requires the ‘MANAGE_GUILD’ permission.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • integration_id: Integration id

Examples

Guild.sync_integration(conn, 93209203902, 3892898393)
Link to this function unban_member(conn, guild_id, user_id) View Source
unban_member(pid(), number(), number()) :: atom()

Remove or Lift Ban

Remove the ban for a user. Requires the ‘BAN_MEMBERS’ permissions.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id
  • user_id: User id of guild member

Examples

Guild.unban_member(conn, 9999999923792, 3290238023092309)
Link to this function voice_regions(conn, guild_id) View Source
voice_regions(pid(), number()) :: map()

Get voice regions

Returns a list of voice region objects for the guild. Unlike the similar /voice route, this returns VIP servers when the guild is VIP-enabled.

Parameters

  • conn: User connection for REST holding auth info
  • guild_id: Guild id

Examples

Guild.voice_regions(conn, 9999999923792)