Module serenity::utils [−][src]
Expand description
A set of utilities to help with common use cases that are not required to fully use the library.
Modules
Colour constants used by Discord for their branding, role colour palette, etc.
Structs
A utility struct to help with working with the basic representation of a
colour. This is particularly useful when working with a Role
’s colour,
as the API works with an integer value instead of an RGB value.
Describes formatting on string content
Struct that allows to alter content_safe
’s behaviour.
The Message Builder is an ergonomic utility to easily build a message, by adding text and mentioning mentionable structs.
Enums
Error that can be returned from ChannelCategory::convert
.
Formatting modifiers for MessageBuilder content pushes
Error that can be returned from Emoji::convert
.
Error that can be returned from GuildChannel::convert
.
Error that can be returned from Guild::convert
.
Error that can be returned from Member::convert
.
Error that can be returned from Message::convert
.
Traits
Parse a value from a string in context of a received message.
A trait with additional functionality over the MessageBuilder
for
creating content with additional functionality available only in embeds.
Functions
Transforms role, channel, user, @everyone
and @here
mentions
into raw text by using the Cache
only.
Converts a HashMap into a final serde_json::Map
representation.
Retrieves an Id from a channel mention.
Retrieves the animated state, name and Id from an emoji mention, in the form of an
EmojiIdentifier
.
Retrieves the “code” part of an invite out of a URL.
Retrieve the ID number out of a channel, role, or user mention.
Retrieves IDs from “{channel ID}-{message ID}” (retrieved by shift-clicking on “Copy ID”).
Retrieves guild, channel, and message ID from a message URL.
Turns a string into a vector of string arguments, splitting by spaces, but parsing content within quotes as one individual argument.
Retrieves an Id from a role mention.
Retrieves the username and discriminator out of a user tag (name#discrim
).
Retrieves an Id from a user mention.
Parses the id and token from a webhook url. Expects a reqwest::Url
object rather than a &str
.
Reads an image from a path and encodes it into base64.
Calculates the Id of the shard responsible for a guild, given its Id and total number of shards used.