Struct serenity::model::id::GuildId [−][src]
pub struct GuildId(pub u64);
An identifier for a Guild
Methods
impl GuildId
[src]
impl GuildId
pub fn as_channel_id(&self) -> ChannelId
[src]
pub fn as_channel_id(&self) -> ChannelId
: 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.
pub fn ban<U, BO>(&self, user: U, ban_options: &BO) -> Result<()> where
U: Into<UserId>,
BO: BanOptions,
[src]
pub fn ban<U, BO>(&self, user: U, ban_options: &BO) -> Result<()> where
U: Into<UserId>,
BO: BanOptions,
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:
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.
pub fn bans(&self) -> Result<Vec<Ban>>
[src]
pub fn bans(&self) -> Result<Vec<Ban>>
Gets a list of the guild's bans.
Requires the Ban Members permission.
pub fn audit_logs(
&self,
action_type: Option<u8>,
user_id: Option<UserId>,
before: Option<AuditLogEntryId>,
limit: Option<u8>
) -> Result<AuditLogs>
[src]
pub fn audit_logs(
&self,
action_type: Option<u8>,
user_id: Option<UserId>,
before: Option<AuditLogEntryId>,
limit: Option<u8>
) -> Result<AuditLogs>
Gets a list of the guild's audit log entries
pub fn channels(&self) -> Result<HashMap<ChannelId, GuildChannel>>
[src]
pub fn channels(&self) -> Result<HashMap<ChannelId, GuildChannel>>
Gets all of the guild's channels over the REST API.
pub fn create_channel<C>(
&self,
name: &str,
kind: ChannelType,
category: C
) -> Result<GuildChannel> where
C: Into<Option<ChannelId>>,
[src]
pub fn create_channel<C>(
&self,
name: &str,
kind: ChannelType,
category: C
) -> Result<GuildChannel> where
C: Into<Option<ChannelId>>,
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
:
use serenity::model::{ChannelType, GuildId}; let _channel = GuildId(7).create_channel("test", ChannelType::Voice, None);
pub fn create_emoji(&self, name: &str, image: &str) -> Result<Emoji>
[src]
pub fn create_emoji(&self, name: &str, image: &str) -> Result<Emoji>
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.
pub fn create_integration<I>(&self, integration_id: I, kind: &str) -> Result<()> where
I: Into<IntegrationId>,
[src]
pub fn create_integration<I>(&self, integration_id: I, kind: &str) -> Result<()> where
I: Into<IntegrationId>,
Creates an integration for the guild.
Requires the Manage Guild permission.
pub fn create_role<F: FnOnce(EditRole) -> EditRole>(&self, f: F) -> Result<Role>
[src]
pub fn create_role<F: FnOnce(EditRole) -> EditRole>(&self, f: F) -> Result<Role>
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.
pub fn delete(&self) -> Result<PartialGuild>
[src]
pub fn delete(&self) -> Result<PartialGuild>
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.
pub fn delete_emoji<E: Into<EmojiId>>(&self, emoji_id: E) -> Result<()>
[src]
pub fn delete_emoji<E: Into<EmojiId>>(&self, emoji_id: E) -> Result<()>
Deletes an Emoji
from the guild.
Requires the Manage Emojis permission.
pub fn delete_integration<I: Into<IntegrationId>>(
&self,
integration_id: I
) -> Result<()>
[src]
pub fn delete_integration<I: Into<IntegrationId>>(
&self,
integration_id: I
) -> Result<()>
Deletes an integration by Id from the guild.
Requires the Manage Guild permission.
pub fn delete_role<R: Into<RoleId>>(&self, role_id: R) -> Result<()>
[src]
pub fn delete_role<R: Into<RoleId>>(&self, role_id: R) -> Result<()>
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.
pub fn edit<F: FnOnce(EditGuild) -> EditGuild>(
&mut self,
f: F
) -> Result<PartialGuild>
[src]
pub fn edit<F: FnOnce(EditGuild) -> EditGuild>(
&mut self,
f: F
) -> Result<PartialGuild>
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.
pub fn edit_emoji<E: Into<EmojiId>>(
&self,
emoji_id: E,
name: &str
) -> Result<Emoji>
[src]
pub fn edit_emoji<E: Into<EmojiId>>(
&self,
emoji_id: E,
name: &str
) -> Result<Emoji>
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.
pub fn edit_member<F, U>(&self, user_id: U, f: F) -> Result<()> where
F: FnOnce(EditMember) -> EditMember,
U: Into<UserId>,
[src]
pub fn edit_member<F, U>(&self, user_id: U, f: F) -> Result<()> where
F: FnOnce(EditMember) -> EditMember,
U: Into<UserId>,
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:
guild.edit_member(user_id, |m| m.mute(true).roles(&vec![role_id]));
pub fn edit_nickname(&self, new_nickname: Option<&str>) -> Result<()>
[src]
pub fn edit_nickname(&self, new_nickname: Option<&str>) -> Result<()>
Edits the current user's nickname for the guild.
Pass None
to reset the nickname.
Requires the Change Nickname permission.
pub fn edit_role<F, R>(&self, role_id: R, f: F) -> Result<Role> where
F: FnOnce(EditRole) -> EditRole,
R: Into<RoleId>,
[src]
pub fn edit_role<F, R>(&self, role_id: R, f: F) -> Result<Role> where
F: FnOnce(EditRole) -> EditRole,
R: Into<RoleId>,
Edits a Role
, optionally setting its new fields.
Requires the Manage Roles permission.
Examples
Make a role hoisted:
use serenity::model::{GuildId, RoleId}; GuildId(7).edit_role(RoleId(8), |r| r.hoist(true));
pub fn edit_role_position<R>(
&self,
role_id: R,
position: u64
) -> Result<Vec<Role>> where
R: Into<RoleId>,
[src]
pub fn edit_role_position<R>(
&self,
role_id: R,
position: u64
) -> Result<Vec<Role>> where
R: Into<RoleId>,
Edits the order of Role
s
Requires the Manage Roles permission.
Examples
Change the order of a role:
use serenity::model::{GuildId, RoleId}; GuildId(7).edit_role_position(RoleId(8), 2);
pub fn find(&self) -> Option<Arc<RwLock<Guild>>>
[src]
pub fn find(&self) -> Option<Arc<RwLock<Guild>>>
: Use the to_guild_cached
-method instead.
Search the cache for the guild.
pub fn to_guild_cached(self) -> Option<Arc<RwLock<Guild>>>
[src]
pub fn to_guild_cached(self) -> Option<Arc<RwLock<Guild>>>
Tries to find the Guild
by its Id in the cache.
pub fn get(&self) -> Result<PartialGuild>
[src]
pub fn get(&self) -> Result<PartialGuild>
: Use the to_partial_guild
-method instead.
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.
pub fn to_partial_guild(self) -> Result<PartialGuild>
[src]
pub fn to_partial_guild(self) -> Result<PartialGuild>
Requests PartialGuild
over REST API.
Note: This will not be a Guild
, as the REST API does not send
all data with a guild retrieval.
pub fn integrations(&self) -> Result<Vec<Integration>>
[src]
pub fn integrations(&self) -> Result<Vec<Integration>>
Gets all integration of the guild.
This performs a request over the REST API.
pub fn invites(&self) -> Result<Vec<RichInvite>>
[src]
pub fn invites(&self) -> Result<Vec<RichInvite>>
Gets all of the guild's invites.
Requires the Manage Guild permission.
pub fn kick<U: Into<UserId>>(&self, user_id: U) -> Result<()>
[src]
pub fn kick<U: Into<UserId>>(&self, user_id: U) -> Result<()>
Kicks a Member
from the guild.
Requires the Kick Members permission.
pub fn leave(&self) -> Result<()>
[src]
pub fn leave(&self) -> Result<()>
Leaves the guild.
pub fn member<U: Into<UserId>>(&self, user_id: U) -> Result<Member>
[src]
pub fn member<U: Into<UserId>>(&self, user_id: U) -> Result<Member>
Gets a user's Member
for the guild by Id.
If the cache feature is enabled the cache will be checked first. If not found it will resort to an http request.
pub fn members<U>(
&self,
limit: Option<u64>,
after: Option<U>
) -> Result<Vec<Member>> where
U: Into<UserId>,
[src]
pub fn members<U>(
&self,
limit: Option<u64>,
after: Option<U>
) -> Result<Vec<Member>> where
U: Into<UserId>,
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.
pub fn move_member<C, U>(&self, user_id: U, channel_id: C) -> Result<()> where
C: Into<ChannelId>,
U: Into<UserId>,
[src]
pub fn move_member<C, U>(&self, user_id: U, channel_id: C) -> Result<()> where
C: Into<ChannelId>,
U: Into<UserId>,
Moves a member to a specific voice channel.
Requires the Move Members permission.
pub fn prune_count(&self, days: u16) -> Result<GuildPrune>
[src]
pub fn prune_count(&self, days: u16) -> Result<GuildPrune>
Gets the number of Member
s that would be pruned with the given
number of days.
Requires the Kick Members permission.
pub fn reorder_channels<It>(&self, channels: It) -> Result<()> where
It: IntoIterator<Item = (ChannelId, u64)>,
[src]
pub fn reorder_channels<It>(&self, channels: It) -> Result<()> where
It: IntoIterator<Item = (ChannelId, u64)>,
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.
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
.
pub fn start_integration_sync<I: Into<IntegrationId>>(
&self,
integration_id: I
) -> Result<()>
[src]
pub fn start_integration_sync<I: Into<IntegrationId>>(
&self,
integration_id: I
) -> Result<()>
Starts an integration sync for the given integration Id.
Requires the Manage Guild permission.
pub fn start_prune(&self, days: u16) -> Result<GuildPrune>
[src]
pub fn start_prune(&self, days: u16) -> Result<GuildPrune>
Starts a prune of Member
s.
See the documentation on GuildPrune
for more information.
Note: Requires the Kick Members permission.
pub fn unban<U: Into<UserId>>(&self, user_id: U) -> Result<()>
[src]
pub fn unban<U: Into<UserId>>(&self, user_id: U) -> Result<()>
Unbans a User
from the guild.
Requires the Ban Members permission.
pub fn vanity_url(&self) -> Result<String>
[src]
pub fn vanity_url(&self) -> Result<String>
Retrieve's the guild's vanity URL.
Note: Requires the Manage Guild permission.
pub fn webhooks(&self) -> Result<Vec<Webhook>>
[src]
pub fn webhooks(&self) -> Result<Vec<Webhook>>
Retrieves the guild's webhooks.
Note: Requires the Manage Webhooks permission.
impl GuildId
[src]
impl GuildId
pub fn created_at(&self) -> NaiveDateTime
[src]
pub fn created_at(&self) -> NaiveDateTime
Retrieves the time that the Id was created at.
pub fn as_u64(&self) -> &u64
[src]
pub fn as_u64(&self) -> &u64
Immutably borrow inner Id.
pub fn as_mut_u64(&mut self) -> &mut u64
[src]
pub fn as_mut_u64(&mut self) -> &mut u64
Mutably borrow inner Id.
Trait Implementations
impl From<PartialGuild> for GuildId
[src]
impl From<PartialGuild> for GuildId
fn from(guild: PartialGuild) -> GuildId
[src]
fn from(guild: PartialGuild) -> GuildId
Gets the Id of a partial guild.
impl<'a> From<&'a PartialGuild> for GuildId
[src]
impl<'a> From<&'a PartialGuild> for GuildId
fn from(guild: &PartialGuild) -> GuildId
[src]
fn from(guild: &PartialGuild) -> GuildId
Gets the Id of a partial guild.
impl From<GuildInfo> for GuildId
[src]
impl From<GuildInfo> for GuildId
impl<'a> From<&'a GuildInfo> for GuildId
[src]
impl<'a> From<&'a GuildInfo> for GuildId
impl From<InviteGuild> for GuildId
[src]
impl From<InviteGuild> for GuildId
fn from(invite_guild: InviteGuild) -> GuildId
[src]
fn from(invite_guild: InviteGuild) -> GuildId
Gets the Id of Invite Guild struct.
impl<'a> From<&'a InviteGuild> for GuildId
[src]
impl<'a> From<&'a InviteGuild> for GuildId
fn from(invite_guild: &InviteGuild) -> GuildId
[src]
fn from(invite_guild: &InviteGuild) -> GuildId
Gets the Id of Invite Guild struct.
impl From<Guild> for GuildId
[src]
impl From<Guild> for GuildId
impl<'a> From<&'a Guild> for GuildId
[src]
impl<'a> From<&'a Guild> for GuildId
impl From<GuildId> for GuildContainer
[src]
impl From<GuildId> for GuildContainer
fn from(guild_id: GuildId) -> GuildContainer
[src]
fn from(guild_id: GuildId) -> GuildContainer
Performs the conversion.
impl Copy for GuildId
[src]
impl Copy for GuildId
impl Clone for GuildId
[src]
impl Clone for GuildId
fn clone(&self) -> GuildId
[src]
fn clone(&self) -> GuildId
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for GuildId
[src]
impl Default for GuildId
impl Debug for GuildId
[src]
impl Debug for GuildId
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Eq for GuildId
[src]
impl Eq for GuildId
impl Hash for GuildId
[src]
impl Hash for GuildId
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialOrd for GuildId
[src]
impl PartialOrd for GuildId
fn partial_cmp(&self, other: &GuildId) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &GuildId) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &GuildId) -> bool
[src]
fn lt(&self, other: &GuildId) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &GuildId) -> bool
[src]
fn le(&self, other: &GuildId) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &GuildId) -> bool
[src]
fn gt(&self, other: &GuildId) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &GuildId) -> bool
[src]
fn ge(&self, other: &GuildId) -> bool
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]
impl Ord for GuildId
fn cmp(&self, other: &GuildId) -> Ordering
[src]
fn cmp(&self, other: &GuildId) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl AsRef<GuildId> for GuildId
[src]
impl AsRef<GuildId> for GuildId
impl<'a> From<&'a GuildId> for GuildId
[src]
impl<'a> From<&'a GuildId> for GuildId
impl From<u64> for GuildId
[src]
impl From<u64> for GuildId
impl PartialEq for GuildId
[src]
impl PartialEq for GuildId
fn eq(&self, other: &Self) -> bool
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialEq<u64> for GuildId
[src]
impl PartialEq<u64> for GuildId
fn eq(&self, u: &u64) -> bool
[src]
fn eq(&self, u: &u64) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Display for GuildId
[src]
impl Display for GuildId
fn fmt(&self, f: &mut Formatter) -> FmtResult
[src]
fn fmt(&self, f: &mut Formatter) -> FmtResult
Formats the value using the given formatter. Read more
impl<'de> Deserialize<'de> for GuildId
[src]
impl<'de> Deserialize<'de> for GuildId
fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
[src]
fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more