pub struct CreateRole<'a> { /* private fields */ }Expand description
Create a role in a guild.
§Examples
use twilight_http::Client;
use twilight_model::id::Id;
let client = Client::new("my token".to_owned());
let guild_id = Id::new(234);
client
.create_role(guild_id)
.color(0xd90083)
.name("Bright Pink")
.await?;Implementations§
Source§impl<'a> CreateRole<'a>
impl<'a> CreateRole<'a>
Sourcepub const fn color(self, color: u32) -> Self
pub const fn color(self, color: 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 colors(self, colors: RoleColors) -> Self
pub const fn colors(self, colors: RoleColors) -> Self
Set the role colours.
Sourcepub const fn icon(self, icon: &'a str) -> Self
pub const fn icon(self, icon: &'a str) -> Self
Set the icon of the role.
Only works if the guild has the ROLE_ICONS feature.
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 name(self, name: &'a str) -> Self
pub const fn name(self, name: &'a str) -> Self
Set the name of the role.
If none is specified, Discord sets this to New Role.
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: &'a str) -> Self
pub const fn unicode_emoji(self, unicode_emoji: &'a str) -> Self
Set the unicode emoji of a role.
Trait Implementations§
Source§impl<'a> AuditLogReason<'a> for CreateRole<'a>
impl<'a> AuditLogReason<'a> for CreateRole<'a>
Source§impl IntoFuture for CreateRole<'_>
impl IntoFuture for CreateRole<'_>
Source§type Output = Result<Response<Role>, Error>
type Output = Result<Response<Role>, Error>
The output that the future will produce on completion.
Source§type IntoFuture = ResponseFuture<Role>
type IntoFuture = ResponseFuture<Role>
Which kind of future are we turning this into?
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Creates a future from a value. Read more
Source§impl TryIntoRequest for CreateRole<'_>
impl TryIntoRequest for CreateRole<'_>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for CreateRole<'a>
impl<'a> !UnwindSafe for CreateRole<'a>
impl<'a> Forget for CreateRole<'a>
impl<'a> Freeze for CreateRole<'a>
impl<'a> Move for CreateRole<'a>
impl<'a> Send for CreateRole<'a>
impl<'a> Sync for CreateRole<'a>where
InternalBitFlags: Sync,
NonZero<u64>: Sync,
RawVecInner: Sync,
BoxRaw<[Pos]>: Sync,
Bytes: Sync,
Arc<Config>: Sync,
Arc<Resolver<GenericConnector<TokioRuntimeProvider>>>: Sync,
Arc<ClientConfig>: Sync,
Arc<dyn ResolveServerName + Send + Sync>: Sync,
Arc<dyn Executor<Pin<Box<dyn Future<Output = ()> + Send>>> + Send + Sync>: Sync,
Arc<dyn Timer + Send + Sync>: Sync,
Arc<Mutex<PoolInner<PoolClient<Full<Bytes>>, (Scheme, Authority)>>>: Sync,
BoxRaw<str>: Sync,
Arc<Chan<(Message, Option<Box<dyn FnOnce(Option<Bucket>) -> bool + Send>>), Semaphore>>: Sync,
Arc<Atomic<bool>>: Sync,
NonZero<i32>: Sync,
impl<'a> Unpin for CreateRole<'a>
impl<'a> UnsafeUnpin for CreateRole<'a>where
&'a str: UnsafeUnpin,
InternalBitFlags: UnsafeUnpin,
PhantomData<fn(GuildMarker) -> GuildMarker>: UnsafeUnpin,
NonZeroU64Inner: UnsafeUnpin,
&'a Client: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
NonZeroI32Inner: UnsafeUnpin,
&'static str: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more