Struct serenity::model::guild::PartialGuild [−][src]
#[non_exhaustive]pub struct PartialGuild {}Show fields
pub application_id: Option<ApplicationId>, pub id: GuildId, pub afk_channel_id: Option<ChannelId>, pub afk_timeout: u64, pub default_message_notifications: DefaultMessageNotificationLevel, pub widget_enabled: Option<bool>, pub widget_channel_id: Option<ChannelId>, pub emojis: HashMap<EmojiId, Emoji>, pub features: Vec<String>, pub icon: Option<String>, pub mfa_level: MfaLevel, pub name: String, pub owner_id: UserId, pub owner: bool, pub region: String, pub roles: HashMap<RoleId, Role>, pub splash: Option<String>, pub discovery_splash: Option<String>, pub system_channel_id: Option<ChannelId>, pub system_channel_flags: SystemChannelFlags, pub rules_channel_id: Option<ChannelId>, pub public_updates_channel_id: Option<ChannelId>, pub verification_level: VerificationLevel, pub description: Option<String>, pub premium_tier: PremiumTier, pub premium_subscription_count: u64, pub banner: Option<String>, pub vanity_url_code: Option<String>, pub welcome_screen: Option<GuildWelcomeScreen>, pub approximate_member_count: Option<u64>, pub approximate_presence_count: Option<u64>, pub nsfw: bool, pub max_video_channel_users: Option<u64>, pub max_presences: Option<u64>, pub max_members: Option<u64>, pub permissions: Option<String>,
Expand description
Partial information about a Guild
. This does not include information
like member data.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct {{ .. }}
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.application_id: Option<ApplicationId>
Expand description
Application ID of the guild creator if it is bot-created.
id: GuildId
Expand description
The unique Id identifying the guild.
This is equivilant to the Id of the default role (@everyone
) and also
that of the default channel (typically #general
).
afk_channel_id: Option<ChannelId>
Expand description
Id of a voice channel that’s considered the AFK channel.
afk_timeout: u64
Expand description
The amount of seconds a user can not show any activity in a voice channel before being moved to an AFK channel – if one exists.
default_message_notifications: DefaultMessageNotificationLevel
Expand description
Indicator of whether notifications for all messages are enabled by default in the guild.
widget_enabled: Option<bool>
Expand description
Whether or not the guild widget is enabled.
widget_channel_id: Option<ChannelId>
Expand description
The channel id that the widget will generate an invite to, or null if set to no invite
emojis: HashMap<EmojiId, Emoji>
Expand description
All of the guild’s custom emojis.
features: Vec<String>
Expand description
Features enabled for the guild.
Refer to Guild::features
for more information.
icon: Option<String>
Expand description
The hash of the icon used by the guild.
In the client, this appears on the guild list on the left-hand side.
mfa_level: MfaLevel
Expand description
name: String
Expand description
The name of the guild.
owner_id: UserId
Expand description
The Id of the User
who owns the guild.
owner: bool
Expand description
Whether or not the user is the owner of the guild.
region: String
Regions are now set per voice channel instead of globally.
Expand description
The region that the voice servers that the guild uses are located in.
roles: HashMap<RoleId, Role>
Expand description
A mapping of the guild’s roles.
splash: Option<String>
Expand description
An identifying hash of the guild’s splash icon.
If the InviteSplash
feature is enabled, this can be used to generate
a URL to a splash image.
discovery_splash: Option<String>
Expand description
An identifying hash of the guild discovery’s splash icon.
Note: Only present for guilds with the DISCOVERABLE
feature.
system_channel_id: Option<ChannelId>
Expand description
The ID of the channel to which system messages are sent.
system_channel_flags: SystemChannelFlags
Expand description
System channel flags.
rules_channel_id: Option<ChannelId>
Expand description
The id of the channel where rules and/or guidelines are displayed.
Note: Only available on COMMUNITY
guild, see Self::features
.
public_updates_channel_id: Option<ChannelId>
Expand description
The id of the channel where admins and moderators of Community guilds receive notices from Discord.
Note: Only available on COMMUNITY
guild, see Self::features
.
verification_level: VerificationLevel
Expand description
Indicator of the current verification level of the guild.
description: Option<String>
Expand description
The guild’s description, if it has one.
Expand description
The server’s premium boosting level.
Expand description
The total number of users currently boosting this server.
Expand description
The guild’s banner, if it has one.
vanity_url_code: Option<String>
Expand description
The vanity url code for the guild, if it has one.
welcome_screen: Option<GuildWelcomeScreen>
Expand description
The welcome screen of the guild.
Note: Only available on COMMUNITY
guild, see Self::features
.
approximate_member_count: Option<u64>
Expand description
Approximate number of members in this guild.
approximate_presence_count: Option<u64>
Expand description
Approximate number of non-offline members in this guild.
nsfw: bool
Expand description
Whether or not this guild is designated as NSFW. See discord support article
.
max_video_channel_users: Option<u64>
Expand description
The maximum amount of users in a video channel.
max_presences: Option<u64>
Expand description
The maximum number of presences for the guild. The default value is currently 25000.
Note: It is in effect when it is None
.
max_members: Option<u64>
Expand description
The maximum number of members for the guild.
permissions: Option<String>
Expand description
The user permissions in the guild.
Implementations
impl PartialGuild
[src]
impl PartialGuild
[src]pub async fn ban(
&self,
http: impl AsRef<Http>,
user: impl Into<UserId>,
dmd: u8
) -> Result<()>
[src]
pub async fn ban(
&self,
http: impl AsRef<Http>,
user: impl Into<UserId>,
dmd: u8
) -> Result<()>
[src]Ban a User
from the guild, deleting a number of
days’ worth of messages (dmd
) between the range 0 and 7.
Note: Requires the Ban Members permission.
Examples
Ban a member and remove all messages they’ve sent in the last 4 days:
// assumes a `user` and `guild` have already been bound let _ = guild.ban(user, 4);
Errors
Returns a ModelError::DeleteMessageDaysAmount
if the number of
days’ worth of messages to delete is over the maximum.
Also may return Error::Http
if the current user lacks permission.
pub async fn ban_with_reason(
&self,
http: impl AsRef<Http>,
user: impl Into<UserId>,
dmd: u8,
reason: impl AsRef<str>
) -> Result<()>
[src]
pub async fn ban_with_reason(
&self,
http: impl AsRef<Http>,
user: impl Into<UserId>,
dmd: u8,
reason: impl AsRef<str>
) -> Result<()>
[src]pub async fn bans(&self, http: impl AsRef<Http>) -> Result<Vec<Ban>>
[src]
pub async fn bans(&self, http: impl AsRef<Http>) -> Result<Vec<Ban>>
[src]Gets a list of the guild’s bans.
Requires the Ban Members permission.
Errors
Returns Error::Http
if the current user lacks permission.
pub async fn channels(
&self,
http: impl AsRef<Http>
) -> Result<HashMap<ChannelId, GuildChannel>>
[src]
pub async fn channels(
&self,
http: impl AsRef<Http>
) -> Result<HashMap<ChannelId, GuildChannel>>
[src]Gets all of the guild’s channels over the REST API.
Errors
Returns Error::Http
if the current user is not in
the guild or if the guild is otherwise unavailable.
pub async fn create_channel(
&self,
http: impl AsRef<Http>,
f: impl FnOnce(&mut CreateChannel) -> &mut CreateChannel
) -> Result<GuildChannel>
[src]
pub async fn create_channel(
&self,
http: impl AsRef<Http>,
f: impl FnOnce(&mut CreateChannel) -> &mut CreateChannel
) -> Result<GuildChannel>
[src]Creates a GuildChannel
in 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; guild.create_channel(|c| c.name("test").kind(ChannelType::Voice));
Errors
Returns Error::Http
if the current user lacks permission,
or if invalid data was given, such as the channel name being
too long.
pub async fn create_emoji(
&self,
http: impl AsRef<Http>,
name: &str,
image: &str
) -> Result<Emoji>
[src]
pub async fn create_emoji(
&self,
http: impl AsRef<Http>,
name: &str,
image: &str
) -> Result<Emoji>
[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.
Errors
Returns Error::Http
if the current user lacks permission,
if the emoji name is too long, or if the image is too large.
pub async fn create_integration(
&self,
http: impl AsRef<Http>,
integration_id: impl Into<IntegrationId>,
kind: &str
) -> Result<()>
[src]
pub async fn create_integration(
&self,
http: impl AsRef<Http>,
integration_id: impl Into<IntegrationId>,
kind: &str
) -> Result<()>
[src]Creates an integration for the guild.
Requires the Manage Guild permission.
Errors
Returns Error::Http
if the current user lacks permission.
pub async fn create_application_command<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<ApplicationCommand> where
F: FnOnce(&mut CreateApplicationCommand) -> &mut CreateApplicationCommand,
[src]
This is supported on crate feature unstable_discord_api
only.
pub async fn create_application_command<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<ApplicationCommand> where
F: FnOnce(&mut CreateApplicationCommand) -> &mut CreateApplicationCommand,
[src]unstable_discord_api
only.Creates a guild specific ApplicationCommand
Note: Unlike global ApplicationCommand
s, guild commands will update instantly.
Errors
Returns the same possible errors as create_global_application_command
.
pub async fn create_application_commands<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<Vec<ApplicationCommand>> where
F: FnOnce(&mut CreateApplicationCommands) -> &mut CreateApplicationCommands,
[src]
This is supported on crate feature unstable_discord_api
only.
pub async fn create_application_commands<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<Vec<ApplicationCommand>> where
F: FnOnce(&mut CreateApplicationCommands) -> &mut CreateApplicationCommands,
[src]unstable_discord_api
only.Same as create_application_command
, but allows to create more
than one command per call.
pub async fn create_application_command_permission<F>(
&self,
http: impl AsRef<Http>,
command_id: CommandId,
f: F
) -> Result<ApplicationCommandPermission> where
F: FnOnce(&mut CreateApplicationCommandPermissionsData) -> &mut CreateApplicationCommandPermissionsData,
[src]
This is supported on crate feature unstable_discord_api
only.
pub async fn create_application_command_permission<F>(
&self,
http: impl AsRef<Http>,
command_id: CommandId,
f: F
) -> Result<ApplicationCommandPermission> where
F: FnOnce(&mut CreateApplicationCommandPermissionsData) -> &mut CreateApplicationCommandPermissionsData,
[src]unstable_discord_api
only.Creates a guild specific ApplicationCommandPermission
.
Note: It will update instantly.
pub async fn create_application_commands_permissions<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<Vec<ApplicationCommandPermission>> where
F: FnOnce(&mut CreateApplicationCommandsPermissions) -> &mut CreateApplicationCommandsPermissions,
[src]
This is supported on crate feature unstable_discord_api
only.
pub async fn create_application_commands_permissions<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<Vec<ApplicationCommandPermission>> where
F: FnOnce(&mut CreateApplicationCommandsPermissions) -> &mut CreateApplicationCommandsPermissions,
[src]unstable_discord_api
only.Same as create_application_command_permission
but allows to create
more than one permission per call.
pub async fn get_application_commands(
&self,
http: impl AsRef<Http>
) -> Result<Vec<ApplicationCommand>>
[src]
This is supported on crate feature unstable_discord_api
only.
pub async fn get_application_commands(
&self,
http: impl AsRef<Http>
) -> Result<Vec<ApplicationCommand>>
[src]unstable_discord_api
only.Get all guild application commands.
pub async fn get_application_command(
&self,
http: impl AsRef<Http>,
command_id: CommandId
) -> Result<ApplicationCommand>
[src]
This is supported on crate feature unstable_discord_api
only.
pub async fn get_application_command(
&self,
http: impl AsRef<Http>,
command_id: CommandId
) -> Result<ApplicationCommand>
[src]unstable_discord_api
only.Get a specific guild application command by its Id.
pub async fn edit_application_command<F>(
&self,
http: impl AsRef<Http>,
command_id: CommandId,
f: F
) -> Result<ApplicationCommand> where
F: FnOnce(&mut CreateApplicationCommand) -> &mut CreateApplicationCommand,
[src]
This is supported on crate feature unstable_discord_api
only.
pub async fn edit_application_command<F>(
&self,
http: impl AsRef<Http>,
command_id: CommandId,
f: F
) -> Result<ApplicationCommand> where
F: FnOnce(&mut CreateApplicationCommand) -> &mut CreateApplicationCommand,
[src]unstable_discord_api
only.Edit guild application command by its Id.
pub async fn delete_application_command(
&self,
http: impl AsRef<Http>,
command_id: CommandId
) -> Result<()>
[src]
This is supported on crate feature unstable_discord_api
only.
pub async fn delete_application_command(
&self,
http: impl AsRef<Http>,
command_id: CommandId
) -> Result<()>
[src]unstable_discord_api
only.Delete guild application command by its Id.
pub async fn get_application_commands_permissions(
&self,
http: impl AsRef<Http>
) -> Result<Vec<ApplicationCommandPermission>>
[src]
This is supported on crate feature unstable_discord_api
only.
pub async fn get_application_commands_permissions(
&self,
http: impl AsRef<Http>
) -> Result<Vec<ApplicationCommandPermission>>
[src]unstable_discord_api
only.Get all guild application commands permissions only.
pub async fn get_application_command_permissions(
&self,
http: impl AsRef<Http>,
command_id: CommandId
) -> Result<ApplicationCommandPermission>
[src]
This is supported on crate feature unstable_discord_api
only.
pub async fn get_application_command_permissions(
&self,
http: impl AsRef<Http>,
command_id: CommandId
) -> Result<ApplicationCommandPermission>
[src]unstable_discord_api
only.Get permissions for specific guild application command by its Id.
pub async fn create_role<F>(&self, http: impl AsRef<Http>, f: F) -> Result<Role> where
F: FnOnce(&mut EditRole) -> &mut EditRole,
[src]
pub async fn create_role<F>(&self, http: impl AsRef<Http>, f: F) -> Result<Role> where
F: FnOnce(&mut EditRole) -> &mut EditRole,
[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.
Errors
Returns Error::Http
if the current user lacks permission,
or if an invalid value was set.
pub async fn delete(&self, http: impl AsRef<Http>) -> Result<PartialGuild>
[src]
pub async fn delete(&self, http: impl AsRef<Http>) -> Result<PartialGuild>
[src]Deletes the current guild if the current user is the owner of the guild.
Note: Requires the current user to be the owner of the guild.
Errors
Returns Error::Http
if the current user is not the owner of
the guild.
pub async fn delete_emoji(
&self,
http: impl AsRef<Http>,
emoji_id: impl Into<EmojiId>
) -> Result<()>
[src]
pub async fn delete_emoji(
&self,
http: impl AsRef<Http>,
emoji_id: impl Into<EmojiId>
) -> Result<()>
[src]Deletes an Emoji
from the guild.
Requires the Manage Emojis permission.
Errors
Returns Error::Http
if the current user lacks permission,
or if an emoji with that Id does not exist in the guild.
pub async fn delete_integration(
&self,
http: impl AsRef<Http>,
integration_id: impl Into<IntegrationId>
) -> Result<()>
[src]
pub async fn delete_integration(
&self,
http: impl AsRef<Http>,
integration_id: impl Into<IntegrationId>
) -> Result<()>
[src]Deletes an integration by Id from the guild.
Requires the Manage Guild permission.
Errors
Returns Error::Http
if the current user lacks permission,
or if an integration with that Id does not exist in the guild.
pub async fn delete_role(
&self,
http: impl AsRef<Http>,
role_id: impl Into<RoleId>
) -> Result<()>
[src]
pub async fn delete_role(
&self,
http: impl AsRef<Http>,
role_id: impl Into<RoleId>
) -> Result<()>
[src]Deletes a Role
by Id from the guild.
Also see Role::delete
if you have the cache
and model
features
enabled.
Requires the Manage Roles permission.
Errors
Returns Error::Http
if the current user lacks permission,
or if a Role with that Id does not exist in the Guild.
pub async fn edit<F>(&mut self, http: impl AsRef<Http>, f: F) -> Result<()> where
F: FnOnce(&mut EditGuild) -> &mut EditGuild,
[src]
pub async fn edit<F>(&mut self, http: impl AsRef<Http>, f: F) -> Result<()> where
F: FnOnce(&mut EditGuild) -> &mut EditGuild,
[src]Edits the current guild with new data where specified.
Note: Requires the current user to have the Manage Guild permission.
Errors
Returns Error::Http
if an invalid value is set, or if the current user
lacks permission to edit the guild.
pub async fn edit_emoji(
&self,
http: impl AsRef<Http>,
emoji_id: impl Into<EmojiId>,
name: &str
) -> Result<Emoji>
[src]
pub async fn edit_emoji(
&self,
http: impl AsRef<Http>,
emoji_id: impl Into<EmojiId>,
name: &str
) -> Result<Emoji>
[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.
Errors
Returns Error::Http
if the current user lacks permission,
or if an emoji with that Id does not exist in the guild.
pub async fn edit_member<F>(
&self,
http: impl AsRef<Http>,
user_id: impl Into<UserId>,
f: F
) -> Result<Member> where
F: FnOnce(&mut EditMember) -> &mut EditMember,
[src]
pub async fn edit_member<F>(
&self,
http: impl AsRef<Http>,
user_id: impl Into<UserId>,
f: F
) -> Result<Member> where
F: FnOnce(&mut EditMember) -> &mut EditMember,
[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:
use serenity::model::GuildId; GuildId(7).edit_member(user_id, |m| m.mute(true).roles(&vec![role_id])).await;
Errors
Returns Error::Http
if the current user lacks the necessary permissions.
pub async fn edit_nickname(
&self,
http: impl AsRef<Http>,
new_nickname: Option<&str>
) -> Result<()>
[src]
pub async fn edit_nickname(
&self,
http: impl AsRef<Http>,
new_nickname: Option<&str>
) -> Result<()>
[src]Edits the current user’s nickname for the guild.
Pass None
to reset the nickname.
Note: Requires the Change Nickname permission.
Errors
Returns Error::Http
if the current user lacks permission
to change their nickname.
pub async fn edit_welcome_screen<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<GuildWelcomeScreen> where
F: FnOnce(&mut EditGuildWelcomeScreen) -> &mut EditGuildWelcomeScreen,
[src]
pub async fn edit_welcome_screen<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<GuildWelcomeScreen> where
F: FnOnce(&mut EditGuildWelcomeScreen) -> &mut EditGuildWelcomeScreen,
[src]Edits the GuildWelcomeScreen
.
Errors
Returns an Error::Http
if some mandatory fields are not provided.
pub async fn edit_widget<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<GuildWidget> where
F: FnOnce(&mut EditGuildWidget) -> &mut EditGuildWidget,
[src]
pub async fn edit_widget<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<GuildWidget> where
F: FnOnce(&mut EditGuildWidget) -> &mut EditGuildWidget,
[src]Edits the GuildWidget
.
Errors
Returns an Error::Http
if the bot does not have the MANAGE_GUILD
permission.
pub async fn get(
http: impl AsRef<Http>,
guild_id: impl Into<GuildId>
) -> Result<PartialGuild>
[src]
pub async fn get(
http: impl AsRef<Http>,
guild_id: impl Into<GuildId>
) -> Result<PartialGuild>
[src]Gets a partial amount of guild data by its Id.
Errors
Returns Error::Http
if the current user is not
in the guild.
pub async fn kick(
&self,
http: impl AsRef<Http>,
user_id: impl Into<UserId>
) -> Result<()>
[src]
pub async fn kick(
&self,
http: impl AsRef<Http>,
user_id: impl Into<UserId>
) -> Result<()>
[src]Kicks a Member
from the guild.
Requires the Kick Members permission.
Errors
Returns Error::Http
if the member cannot be kicked
by the current user.
pub async fn kick_with_reason(
&self,
http: impl AsRef<Http>,
user_id: impl Into<UserId>,
reason: &str
) -> Result<()>
[src]
pub async fn kick_with_reason(
&self,
http: impl AsRef<Http>,
user_id: impl Into<UserId>,
reason: &str
) -> Result<()>
[src]Errors
In addition to the reasons Self::kick
may return an error,
can also return an error if the reason is too long.
pub fn icon_url(&self) -> Option<String>
[src]
pub fn icon_url(&self) -> Option<String>
[src]Returns a formatted URL of the guild’s icon, if the guild has an icon.
pub async fn emoji(
&self,
http: impl AsRef<Http>,
emoji_id: EmojiId
) -> Result<Emoji>
[src]
pub async fn emoji(
&self,
http: impl AsRef<Http>,
emoji_id: EmojiId
) -> Result<Emoji>
[src]Gets an Emoji
of this guild by its ID via HTTP.
Errors
Returns Error::Http
if an Emoji
with the given Id does
not exist for the guild.
pub async fn integrations(
&self,
http: impl AsRef<Http>
) -> Result<Vec<Integration>>
[src]
pub async fn integrations(
&self,
http: impl AsRef<Http>
) -> Result<Vec<Integration>>
[src]Gets all integration of the guild.
Requires the Manage Guild permission.
Errors
Returns Error::Http
if the current user lacks permission.
pub async fn invites(&self, http: impl AsRef<Http>) -> Result<Vec<RichInvite>>
[src]
pub async fn invites(&self, http: impl AsRef<Http>) -> Result<Vec<RichInvite>>
[src]Gets all of the guild’s invites.
Requires the Manage Guild permission.
Errors
Returns Error::Http
if the current user lacks permission.
pub async fn leave(&self, http: impl AsRef<Http>) -> Result<()>
[src]
pub async fn leave(&self, http: impl AsRef<Http>) -> Result<()>
[src]Leaves the guild.
Errors
Returns Error::Http
if the current user is unable to
leave the Guild, or currently is not in the guild.
pub async fn member(
&self,
cache_http: impl CacheHttp,
user_id: impl Into<UserId>
) -> Result<Member>
[src]
pub async fn member(
&self,
cache_http: impl CacheHttp,
user_id: impl Into<UserId>
) -> Result<Member>
[src]Gets a user’s Member
for the guild by Id.
Errors
Returns Error::Http
if the member is not in the Guild,
or if the Guild is otherwise unavailable.
pub async fn members(
&self,
http: impl AsRef<Http>,
limit: Option<u64>,
after: impl Into<Option<UserId>>
) -> Result<Vec<Member>>
[src]
pub async fn members(
&self,
http: impl AsRef<Http>,
limit: Option<u64>,
after: impl Into<Option<UserId>>
) -> Result<Vec<Member>>
[src]Gets a list of the guild’s members.
Optionally pass in the limit
to limit the number of results.
Minimum value is 1, maximum and default value is 1000.
Optionally pass in after
to offset the results by a User
’s Id.
Errors
Returns an Error::Http
if the API returns an error,
may also return Error::NotInRange
if the input is
not within range.
pub async fn move_member(
&self,
http: impl AsRef<Http>,
user_id: impl Into<UserId>,
channel_id: impl Into<ChannelId>
) -> Result<Member>
[src]
pub async fn move_member(
&self,
http: impl AsRef<Http>,
user_id: impl Into<UserId>,
channel_id: impl Into<ChannelId>
) -> Result<Member>
[src]Moves a member to a specific voice channel.
Requires the Move Members permission.
Errors
Returns an Error::Http
if the current user lacks permission,
or if the member is not currently in a voice channel for this Guild.
pub fn user_permissions_in(
&self,
channel: &GuildChannel,
member: &Member
) -> Result<Permissions>
[src]
pub fn user_permissions_in(
&self,
channel: &GuildChannel,
member: &Member
) -> Result<Permissions>
[src]Calculate a Member
’s permissions in a given channel in the guild.
Errors
Returns Error::Model
if the Member has a non-existent Role
for some reason.
pub fn role_permissions_in(
&self,
channel: &GuildChannel,
role: &Role
) -> Result<Permissions>
[src]
pub fn role_permissions_in(
&self,
channel: &GuildChannel,
role: &Role
) -> Result<Permissions>
[src]pub async fn prune_count(
&self,
http: impl AsRef<Http>,
days: u16
) -> Result<GuildPrune>
[src]
pub async fn prune_count(
&self,
http: impl AsRef<Http>,
days: u16
) -> Result<GuildPrune>
[src]Gets the number of Member
s that would be pruned with the given
number of days.
Requires the Kick Members permission.
See Guild::prune_count
.
Errors
Returns Error::Http
if the current user lacks permission.
pub async fn shard_id(&self, cache: impl AsRef<Cache>) -> u64
[src]
pub async fn shard_id(&self, cache: impl AsRef<Cache>) -> u64
[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
.
pub fn splash_url(&self) -> Option<String>
[src]
pub fn splash_url(&self) -> Option<String>
[src]Returns the formatted URL of the guild’s splash image, if one exists.
pub async fn start_integration_sync(
&self,
http: impl AsRef<Http>,
integration_id: impl Into<IntegrationId>
) -> Result<()>
[src]
pub async fn start_integration_sync(
&self,
http: impl AsRef<Http>,
integration_id: impl Into<IntegrationId>
) -> Result<()>
[src]Starts an integration sync for the given integration Id.
Requires the Manage Guild permission.
Errors
pub async fn vanity_url(&self, http: impl AsRef<Http>) -> Result<String>
[src]
pub async fn vanity_url(&self, http: impl AsRef<Http>) -> Result<String>
[src]Retrieve’s the guild’s vanity URL.
Note: Requires the Manage Guild permission.
Errors
See Guild::vanity_url
.
pub async fn webhooks(&self, http: impl AsRef<Http>) -> Result<Vec<Webhook>>
[src]
pub async fn webhooks(&self, http: impl AsRef<Http>) -> Result<Vec<Webhook>>
[src]Retrieves the guild’s webhooks.
Note: Requires the Manage Webhooks permission.
Errors
See Guild::webhooks
.
pub fn role_by_name(&self, role_name: &str) -> Option<&Role>
[src]
pub fn role_by_name(&self, role_name: &str) -> Option<&Role>
[src]Obtain a reference to a role by its name.
Note: If two or more roles have the same name, obtained reference will be one of them.
Examples
Obtain a reference to a Role
by its name.
use serenity::model::prelude::*; use serenity::prelude::*; struct Handler; #[serenity::async_trait] impl EventHandler for Handler { async fn message(&self, context: Context, msg: Message) { if let Some(guild_id) = msg.guild_id { if let Some(guild) = guild_id.to_guild_cached(&context).await { if let Some(role) = guild.role_by_name("role_name") { println!("Obtained role's reference: {:?}", role); } } } } } let mut client =Client::builder("token").event_handler(Handler).await?; client.start().await?;
pub fn await_reply<'a>(
&self,
shard_messenger: &'a impl AsRef<ShardMessenger>
) -> CollectReply<'a>ⓘNotable traits for CollectReply<'a>
impl<'a> Future for CollectReply<'a> type Output = Option<Arc<Message>>;
[src]
This is supported on crate feature collector
only.
pub fn await_reply<'a>(
&self,
shard_messenger: &'a impl AsRef<ShardMessenger>
) -> CollectReply<'a>ⓘNotable traits for CollectReply<'a>
impl<'a> Future for CollectReply<'a> type Output = Option<Arc<Message>>;
[src]collector
only.Returns a future that will await one message sent in this guild.
pub fn await_replies<'a>(
&self,
shard_messenger: &'a impl AsRef<ShardMessenger>
) -> MessageCollectorBuilder<'a>ⓘNotable traits for MessageCollectorBuilder<'a>
impl<'a> Future for MessageCollectorBuilder<'a> type Output = MessageCollector;
[src]
This is supported on crate feature collector
only.
pub fn await_replies<'a>(
&self,
shard_messenger: &'a impl AsRef<ShardMessenger>
) -> MessageCollectorBuilder<'a>ⓘNotable traits for MessageCollectorBuilder<'a>
impl<'a> Future for MessageCollectorBuilder<'a> type Output = MessageCollector;
[src]collector
only.Returns a stream builder which can be awaited to obtain a stream of messages in this guild.
pub fn await_reaction<'a>(
&self,
shard_messenger: &'a impl AsRef<ShardMessenger>
) -> CollectReaction<'a>ⓘNotable traits for CollectReaction<'a>
impl<'a> Future for CollectReaction<'a> type Output = Option<Arc<ReactionAction>>;
[src]
This is supported on crate feature collector
only.
pub fn await_reaction<'a>(
&self,
shard_messenger: &'a impl AsRef<ShardMessenger>
) -> CollectReaction<'a>ⓘNotable traits for CollectReaction<'a>
impl<'a> Future for CollectReaction<'a> type Output = Option<Arc<ReactionAction>>;
[src]collector
only.Await a single reaction in this guild.
pub fn await_reactions<'a>(
&self,
shard_messenger: &'a impl AsRef<ShardMessenger>
) -> ReactionCollectorBuilder<'a>ⓘNotable traits for ReactionCollectorBuilder<'a>
impl<'a> Future for ReactionCollectorBuilder<'a> type Output = ReactionCollector;
[src]
This is supported on crate feature collector
only.
pub fn await_reactions<'a>(
&self,
shard_messenger: &'a impl AsRef<ShardMessenger>
) -> ReactionCollectorBuilder<'a>ⓘNotable traits for ReactionCollectorBuilder<'a>
impl<'a> Future for ReactionCollectorBuilder<'a> type Output = ReactionCollector;
[src]collector
only.Returns a stream builder which can be awaited to obtain a stream of reactions sent in this guild.
Trait Implementations
impl Clone for PartialGuild
[src]
impl Clone for PartialGuild
[src]fn clone(&self) -> PartialGuild
[src]
fn clone(&self) -> PartialGuild
[src]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)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for PartialGuild
[src]
impl Debug for PartialGuild
[src]impl<'de> Deserialize<'de> for PartialGuild
[src]
impl<'de> Deserialize<'de> for PartialGuild
[src]fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
[src]
fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
[src]Deserialize this value from the given Serde deserializer. Read more
impl<'a> From<&'a PartialGuild> for GuildId
[src]
impl<'a> From<&'a PartialGuild> for GuildId
[src]fn from(guild: &PartialGuild) -> GuildId
[src]
fn from(guild: &PartialGuild) -> GuildId
[src]Gets the Id of a partial guild.
impl From<PartialGuild> for GuildId
[src]
impl From<PartialGuild> for GuildId
[src]fn from(guild: PartialGuild) -> GuildId
[src]
fn from(guild: PartialGuild) -> GuildId
[src]Gets the Id of a partial guild.
impl From<PartialGuild> for GuildContainer
[src]
impl From<PartialGuild> for GuildContainer
[src]fn from(guild: PartialGuild) -> GuildContainer
[src]
fn from(guild: PartialGuild) -> GuildContainer
[src]Performs the conversion.
impl Serialize for PartialGuild
[src]
impl Serialize for PartialGuild
[src]Auto Trait Implementations
impl RefUnwindSafe for PartialGuild
impl Send for PartialGuild
impl Sync for PartialGuild
impl Unpin for PartialGuild
impl UnwindSafe for PartialGuild
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,