Discord Elixir v1.1.18 DiscordEx.RestClient.Resources.Guild View Source
Convience helper for guild resource
Link to this section Summary
Functions
Ban guild member
List banned users
Batch modify roles
Begin guild prune
Get guild channels
Create guild
Create guild channel
Create guild role
Create guild integration
Delete guild
Delete guild integration
Remove guild role
Get guild embed
Get guild object
Get integrations
Get invites
Remove guild member (KICK)
Get guild member
Get guild members
Modify guild
Modify guild embed
Modify guild integration
Modify guild member
Modify role
Get prune count
List guild roles
Sync guild integration
Remove or Lift Ban
Get voice regions
Link to this section Functions
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})
List banned users
Parameters
- conn: User connection for REST holding auth info
- guild_id: Guild id
Examples
Guild.bans(conn, 9999999923792)
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}
])
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})
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"})
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"})
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)
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"})
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)
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)
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)
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)
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)
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)
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)
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)
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)
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})
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})
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})
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})
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})
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})
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})
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)
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)
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)
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)