pub struct UpdateRole<'a> { /* private fields */ }
Expand description
Update a role by guild id and its id.
Implementations§
Source§impl<'a> UpdateRole<'a>
impl<'a> UpdateRole<'a>
Sourcepub const fn color(self, color: Option<u32>) -> Self
pub const fn color(self, color: Option<u32>) -> Self
Set the role color.
This must be a valid hexadecimal RGB value. 0x000000
is ignored and
doesn’t count towards the final computed color in the user list. Refer
to COLOR_MAXIMUM
for the maximum acceptable value.
Sourcepub const fn icon(self, icon: Option<&'a str>) -> Self
pub const fn icon(self, icon: Option<&'a str>) -> Self
Set the icon of the role.
Only works if the guild has the ROLE_ICONS
feature.
§Editing
Pass None
to clear the existing icon.
Warning: If the existing unicode emoji isn’t cleared when setting the icon, it might cause incorrect behavior.
§Examples
Sets a role icon. The unicode emoji should always be cleared to ensure the icon can be set correctly.
use twilight_http::Client;
use twilight_model::id::Id;
let client = Client::new("token".to_owned());
let guild_id = Id::new(1);
let role_id = Id::new(1);
let icon = "data:image/png;base64,BASE64_ENCODED_PNG_IMAGE_DATA";
client
.update_role(guild_id, role_id)
.icon(Some(icon))
.unicode_emoji(None)
.await?;
Sourcepub const fn mentionable(self, mentionable: bool) -> Self
pub const fn mentionable(self, mentionable: bool) -> Self
If true, the role can be @mentioned (pinged) in chat.
Sourcepub const fn permissions(self, permissions: Permissions) -> Self
pub const fn permissions(self, permissions: Permissions) -> Self
Set the allowed permissions of this role.
Sourcepub const fn unicode_emoji(self, unicode_emoji: Option<&'a str>) -> Self
pub const fn unicode_emoji(self, unicode_emoji: Option<&'a str>) -> Self
Set the unicode emoji of a role.
Only works if the guild has the ROLE_ICONS
feature.
§Editing
Pass None
to clear the existing unicode emoji.
Warning: If the existing icon isn’t cleared when setting the unicode emoji, it might cause incorrect behavior.
§Examples
Sets a role unicode emoji. The icon should always be cleared to ensure the unicode emoji can be set correctly.
use twilight_http::Client;
use twilight_model::id::Id;
let client = Client::new("token".to_owned());
let guild_id = Id::new(1);
let role_id = Id::new(1);
client
.update_role(guild_id, role_id)
.icon(None)
.unicode_emoji(Some("🦀"))
.await?;