Skip to content
Marco Cusano edited this page May 11, 2019 · 2 revisions

ban external-link

Create a guild ban, and optionally delete previous messages sent by the banned user. Requires the BAN_MEMBERS permission. Returns a 204 empty response on success.

$params = array(
    "delete-message-days" => 7, // Default = 0 (0-7)
    "reason" => "Unwanted behaviour" // Default = null
);
$discord->guilds->ban("GUILD_ID", "USER_ID", $params);

bans external-link

Returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the BAN_MEMBERS permission.

// Example 1 (Get list of banned Users)
$discord->guilds->bans("GUILD_ID");
// Example 2 (Get a banned User)
$discord->guilds->bans("GUILD_ID", "USER_ID");

channels external-link

Returns a list of guild channel objects.

$discord->guilds->channels("GUILD_ID");

create external-link

Create a new guild. Returns a guild object on success. This endpoint can be used only by bots in less than 10 guilds. Creating channel categories from this endpoint is not supported.

$params = array(
    "name" => "Server Name",
    "region" => "region.id",
    "verification_level" => 1, // Low
    "default_message_notifications" => 0 // All messages
    "explicit_content_filter" => 1, // Member without roles
);
$discord->guilds->create($params);

createChannel external-link

Create a new channel object for the guild. Requires the MANAGE_CHANNELS permission. Returns the new channel object on success. All parameters for this endpoint are optional excluding name

$params = array(
   "name" => "channel-name",
   "type" => "0", // Text Channel
   "topic" => "Here is the **channel description**",
   "rate_limit_per_user" => 10, // In seconds
   "parent_id" => "CATEGORY_ID",
   "nsfw" => false // 18+ Filter
);
$discord->guilds->createChannel("GUILD_ID", $params);

createRole external-link

Create a new role for the guild. Requires the MANAGE_ROLES permission. Returns the new role object on success. All JSON params are optional.

var_dump($discord->keys["permissions"]) // All available permission snowflakes
$params = array(
    "name" => "Role Name",
    "permissions" => {
        "ADMINISTRATOR" => true
    },
    "color" => 10913450, // Pink
    "hoist" => true, // Whether the role should be displayed separately in the sidebar
    "mentionable" => true
);
$discord->guilds->createRole("GUILD_ID", $params);

delete external-link

Delete a guild permanently. User must be owner. Returns 204 No Content on success.

$discord->guilds->delete("GUILD_ID");

deleteChannel external-link

Delete a channel, or close a private message. Requires the MANAGE_CHANNELS permission for the guild. Deleting a category does not delete its child channels; they will have their parent_id removed and a Channel Update Gateway event will fire for each of them. Returns a channel object on success.

$discord->guilds->deleteChannel("CHANNEL_ID");

deleteEmoji external-link

Delete the given emoji. Requires the MANAGE_EMOJIS permission. Returns 204 No Content on success.

$discord->guilds->deleteEmoji("GUILD_ID", "EMOJI");

Where EMOJI parameter must be sent in the following format: name:emoji_id


deleteRole external-link

Delete a guild role. Requires the MANAGE_ROLES permission. Returns a 204 empty response on success.

$discord->guilds->deleteEmoji("GUILD_ID", "ROLE_ID");

edit external-link

Modify a guild's settings. Requires the MANAGE_GUILD permission. Returns the updated guild object on success.

$params = array(
    "name" => "New Server Name",
    "region" => "REGION_ID",
    "verification_level" => 1, // Low
    "default_message_notifications" => 1 // All messages
    "explicit_content_filter" => 0 // No filters
    "afk_channel_id" => "CHANNEL_ID",
    "afk_timeout" => 120, // In seconds
    "system_channel_id" => "CHANNEL_ID" // The id of the channel to which system messages are sent
);
$discord->guilds->edit("GUILD_ID", $params);

editChannel external-link

Update a channels settings. Requires the MANAGE_CHANNELS permission for the guild. Returns a channel on success, and a 400 BAD REQUEST on invalid parameters.

$discord->channels->edit


editEmoji external-link

Modify the given emoji. Requires the MANAGE_EMOJIS permission. Returns the updated emoji object on success.

$params = array( "name" => "new_emoji_name" );
$discord->guilds->editEmoji("GUILD_ID", "EMOJI_ID", $params);

editRole external-link

Modify a guild role. Requires the MANAGE_ROLES permission. Returns the updated role on success. All parameters to this endpoint are optional.

var_dump($discord->keys["permissions"]) // All available permission snowflakes
$params = array(
    "name" => "New Role Name",
    "permissions" => {
        "ADMINISTRATOR" => true
    },
    "color" => 10913450, // Pink
    "hoist" => true, // Whether the role should be displayed separately in the sidebar
    "mentionable" => false
);
$discord->guilds->editRole("GUILD_ID", "ROLE_ID", $params);

emoji external-link

Returns an emoji object for the given guild and emoji IDs.

$discord->guilds->emoji("GUILD_ID", "EMOJI_ID");

emojis external-link

Returns a list of emoji objects for the given guild.

$discord->guilds->emojis("GUILD_ID");

get external-link

Returns the guild object for the given id.

$discord->guilds->get("GUILD_ID");

integrations external-link

Returns the guild object for the given id.

$discord->guilds->integrations("GUILD_ID");

invites external-link

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

$discord->guilds->invites("GUILD_ID");

kick external-link

Remove a member from a guild. Requires KICK_MEMBERS permission. Returns a 204 empty response on success.

$discord->guilds->kick("GUILD_ID", "USER_ID");

member external-link

Returns a guild member object for the specified user.

$discord->guilds->member("GUILD_ID", "USER_ID");

memberRole external-link

Adds a role to a guild member. Requires the MANAGE_ROLES permission. Returns a 204 empty response on success.

// Example 1
$discord->guilds->memberRole("GUILD_ID", "USER_ID", "ROLE_ID");
// Example 2
$discord->guilds->addMemberRole("GUILD_ID", "USER_ID", "ROLE_ID");

members external-link

Returns a list of guild member objects that are members of the guild.

$discord->guilds->members("GUILD_ID");

regions external-link

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.

$discord->guilds->regions("GUILD_ID");

removeMemberRole external-link

Removes a role from a guild member. Requires the MANAGE_ROLES permission. Returns a 204 empty response on success.

$discord->guilds->removeMemberRole("GUILD_ID", "USER_ID", "ROLE_ID");

roles external-link

Returns a list of role objects for the guild.

$discord->guilds->roles("GUILD_ID");

unban external-link

Remove the ban for a user. Requires the BAN_MEMBERS permissions. Returns a 204 empty response on success.

// Example 1
$discord->guilds->unban("GUILD_ID", "USER_ID");
// Example 2
$discord->guilds->removeBan("GUILD_ID", "USER_ID");
// Example 3
$discord->guilds->revokeBan("GUILD_ID", "USER_ID");
// Example 4
$discord->guilds->deleteBan("GUILD_ID", "USER_ID");

vanity external-link

Returns a partial invite object for guilds with that feature enabled. Requires the MANAGE_GUILD permission. code will be null if a vanity url for the guild is not set.

$discord->guilds->vanity("GUILD_ID");