#[non_exhaustive]pub struct CreateGuildEmoji {
pub name: CompactString,
pub image: ImageData,
pub roles: Vec<RoleId>,
}Expand description
The body of Create Guild Emoji.
The image (PNG, JPEG, GIF for animated emojis, or WebP) may be at most 256 KiB; Discord shows it at 128×128.
discord.js counterpart: GuildEmojiCreateOptions.
§Examples
use djs_model::{id::RoleId, rest::CreateGuildEmoji, util::ImageData};
let png = b"\x89PNG\r\n\x1a\n...".to_vec();
let mut body = CreateGuildEmoji::new("ferris", ImageData::new(png)?);
body.roles.push(RoleId::new(1_100_000_000_000_000_001));
let json = serde_json::to_string(&body)?;
assert!(json.starts_with(r#"{"name":"ferris","image":"data:image/png;base64,"#));
assert!(json.ends_with(r#","roles":["1100000000000000001"]}"#));Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: CompactStringThe name (2–32 characters: letters, digits and underscores).
image: ImageDataThe image.
roles: Vec<RoleId>The roles allowed to use the emoji; empty (the default) means everyone.
Implementations§
Source§impl CreateGuildEmoji
impl CreateGuildEmoji
Sourcepub fn new(name: impl Into<CompactString>, image: ImageData) -> Self
pub fn new(name: impl Into<CompactString>, image: ImageData) -> Self
An emoji named name showing image, usable by everyone.
discord.js counterpart: GuildEmojiCreateOptions.
Trait Implementations§
Source§impl Clone for CreateGuildEmoji
impl Clone for CreateGuildEmoji
Source§impl Debug for CreateGuildEmoji
impl Debug for CreateGuildEmoji
impl Eq for CreateGuildEmoji
Source§impl Hash for CreateGuildEmoji
impl Hash for CreateGuildEmoji
Source§impl PartialEq for CreateGuildEmoji
impl PartialEq for CreateGuildEmoji
Source§impl Serialize for CreateGuildEmoji
impl Serialize for CreateGuildEmoji
impl StructuralPartialEq for CreateGuildEmoji
Auto Trait Implementations§
impl !Freeze for CreateGuildEmoji
impl Forget for CreateGuildEmoji
impl Move for CreateGuildEmoji
impl RefUnwindSafe for CreateGuildEmoji
impl Send for CreateGuildEmoji
impl Sync for CreateGuildEmoji
impl Unpin for CreateGuildEmoji
impl UnsafeUnpin for CreateGuildEmoji
impl UnwindSafe for CreateGuildEmoji
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