Struct serenity::model::id::GuildId [] [src]

pub struct GuildId(pub u64);

An identifier for a Guild

Methods

impl GuildId
[src]

[src]

Deprecated

: The concept of default channels is no more, use Guild::default_channel{_guaranteed} to simulate the concept.

Converts the guild Id into the default channel's Id.

[src]

Ban a User from the guild. All messages by the user within the last given number of days given will be deleted.

Refer to the documentation for Guild::ban for more information.

Note: Requires the Ban Members permission.

Examples

Ban a member and remove all messages they've sent in the last 4 days:

This example is not tested
use serenity::model::GuildId;

// assuming a `user` has already been bound
let _ = GuildId(81384788765712384).ban(user, 4);

Errors

Returns a ModelError::DeleteMessageDaysAmount if the number of days' worth of messages to delete is over the maximum.

[src]

Gets a list of the guild's bans.

Requires the Ban Members permission.

[src]

Gets a list of the guild's audit log entries

[src]

Gets all of the guild's channels over the REST API.

[src]

Creates a GuildChannel in the the guild.

Refer to http::create_channel for more information.

Requires the Manage Channels permission.

Examples

Create a voice channel in a guild with the name test:

This example is not tested
use serenity::model::{ChannelType, GuildId};

let _channel = GuildId(7).create_channel("test", ChannelType::Voice, None);

[src]

Creates an emoji in the guild with a name and base64-encoded image.

Refer to the documentation for Guild::create_emoji for more information.

Requires the Manage Emojis permission.

Examples

See the EditProfile::avatar example for an in-depth example as to how to read an image from the filesystem and encode it as base64. Most of the example can be applied similarly for this method.

[src]

Creates an integration for the guild.

Requires the Manage Guild permission.

[src]

Creates a new role in the guild with the data set, if any.

See the documentation for Guild::create_role on how to use this.

Note: Requires the Manage Roles permission.

[src]

Deletes the current guild if the current account is the owner of the guild.

Refer to Guild::delete for more information.

Note: Requires the current user to be the owner of the guild.

[src]

Deletes an Emoji from the guild.

Requires the Manage Emojis permission.

[src]

Deletes an integration by Id from the guild.

Requires the Manage Guild permission.

[src]

Deletes a Role by Id from the guild.

Also see Role::delete if you have the cache and methods features enabled.

Requires the Manage Roles permission.

[src]

Edits the current guild with new data where specified.

Refer to Guild::edit for more information.

Note: Requires the current user to have the Manage Guild permission.

[src]

Edits an Emoji's name in the guild.

Also see Emoji::edit if you have the cache and methods features enabled.

Requires the Manage Emojis permission.

[src]

Edits the properties of member of the guild, such as muting or nicknaming them.

Refer to EditMember's documentation for a full list of methods and permission restrictions.

Examples

Mute a member and set their roles to just one role with a predefined Id:

This example is not tested
guild.edit_member(user_id, |m| m.mute(true).roles(&vec![role_id]));

[src]

Edits the current user's nickname for the guild.

Pass None to reset the nickname.

Requires the Change Nickname permission.

[src]

Edits a Role, optionally setting its new fields.

Requires the Manage Roles permission.

Examples

Make a role hoisted:

This example is not tested
use serenity::model::{GuildId, RoleId};

GuildId(7).edit_role(RoleId(8), |r| r.hoist(true));

[src]

Edits the order of Roles Requires the Manage Roles permission.

Examples

Change the order of a role:

This example is not tested
use serenity::model::{GuildId, RoleId};
GuildId(7).edit_role_position(RoleId(8), 2);

[src]

Search the cache for the guild.

[src]

Requests the guild over REST.

Note that this will not be a complete guild, as REST does not send all data with a guild retrieval.

[src]

Gets all integration of the guild.

This performs a request over the REST API.

[src]

Gets all of the guild's invites.

Requires the Manage Guild permission.

[src]

Kicks a Member from the guild.

Requires the Kick Members permission.

[src]

Leaves the guild.

[src]

Gets a user's Member for the guild by Id.

[src]

Gets a list of the guild's members.

Optionally pass in the limit to limit the number of results. Maximum value is 1000. Optionally pass in after to offset the results by a User's Id.

[src]

Moves a member to a specific voice channel.

Requires the Move Members permission.

[src]

Gets the number of Members that would be pruned with the given number of days.

Requires the Kick Members permission.

[src]

Re-orders the channels of the guild.

Accepts an iterator of a tuple of the channel ID to modify and its new position.

Although not required, you should specify all channels' positions, regardless of whether they were updated. Otherwise, positioning can sometimes get weird.

[src]

Returns the Id of the shard associated with the guild.

When the cache is enabled this will automatically retrieve the total number of shards.

Note: When the cache is enabled, this function unlocks the cache to retrieve the total number of shards in use. If you already have the total, consider using utils::shard_id.

[src]

Starts an integration sync for the given integration Id.

Requires the Manage Guild permission.

[src]

Starts a prune of Members.

See the documentation on GuildPrune for more information.

Note: Requires the Kick Members permission.

[src]

Unbans a User from the guild.

Requires the Ban Members permission.

[src]

Retrieve's the guild's vanity URL.

Note: Requires the Manage Guild permission.

[src]

Retrieves the guild's webhooks.

Note: Requires the Manage Webhooks permission.

impl GuildId
[src]

[src]

Retrieves the time that the Id was created at.

Trait Implementations

impl From<PartialGuild> for GuildId
[src]

[src]

Gets the Id of a partial guild.

impl<'a> From<&'a PartialGuild> for GuildId
[src]

[src]

Gets the Id of a partial guild.

impl From<GuildInfo> for GuildId
[src]

[src]

Gets the Id of Guild information struct.

impl<'a> From<&'a GuildInfo> for GuildId
[src]

[src]

Gets the Id of Guild information struct.

impl From<InviteGuild> for GuildId
[src]

[src]

Gets the Id of Invite Guild struct.

impl<'a> From<&'a InviteGuild> for GuildId
[src]

[src]

Gets the Id of Invite Guild struct.

impl From<Guild> for GuildId
[src]

[src]

Gets the Id of Guild.

impl<'a> From<&'a Guild> for GuildId
[src]

[src]

Gets the Id of Guild.

impl From<GuildId> for GuildContainer
[src]

[src]

Performs the conversion.

impl Copy for GuildId
[src]

impl Clone for GuildId
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for GuildId
[src]

[src]

Returns the "default value" for a type. Read more

impl Debug for GuildId
[src]

[src]

Formats the value using the given formatter. Read more

impl Eq for GuildId
[src]

impl Hash for GuildId
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl PartialOrd for GuildId
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for GuildId
[src]

[src]

This method returns an Ordering between self and other. Read more

1.21.0
[src]

Compares and returns the maximum of two values. Read more

1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl AsRef<GuildId> for GuildId
[src]

Important traits for &'a mut W
[src]

Performs the conversion.

impl From<u64> for GuildId
[src]

[src]

Performs the conversion.

impl PartialEq for GuildId
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl PartialEq<u64> for GuildId
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl Display for GuildId
[src]

[src]

Formats the value using the given formatter. Read more

impl<'de> Deserialize<'de> for GuildId
[src]

[src]

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations

impl Send for GuildId

impl Sync for GuildId