Module utils

Source
Expand description

A set of utilities to help with common use cases that are not required to fully use the library.

Modules§

token
Utilities to parse and validate Discord tokens.

Structs§

Content
Describes formatting on string content
ContentSafeOptions
Struct that allows to alter content_safe’s behaviour.
CreateQuickModal
Convenience builder to create a modal, wait for the user to submit and parse the response.
CustomMessage
A builder for constructing a personal Message instance.
FormattedTimestamp
Represents a combination of a timestamp and a style for formatting time in messages.
FormattedTimestampParseError
An error that can occur when parsing a FormattedTimestamp from a string.
MessageBuilder
The Message Builder is an ergonomic utility to easily build a message, by adding text and mentioning mentionable structs.
QuickModalResponse

Enums§

ChannelParseError
Error that can be returned from Channel::convert.
ContentModifier
Formatting modifiers for MessageBuilder content pushes
EmojiParseError
Error that can be returned from Emoji::convert.
FormattedTimestampStyle
Enum representing various styles for formatting time in messages.
GuildChannelParseError
Error that can be returned from GuildChannel::convert.
GuildParseError
Error that can be returned from Guild::convert.
MemberParseError
Error that can be returned from Member::convert.
MessageParseError
Error that can be returned from Message::convert.
RoleParseError
Error that can be returned from Role::convert.
UserParseError
Error that can be returned from User::convert.

Traits§

ArgumentConvert
Parse a value from a string in context of a received message.
EmbedMessageBuilding
A trait with additional functionality over the MessageBuilder for creating content with additional functionality available only in embeds.

Functions§

content_safe
Transforms role, channel, user, @everyone and @here mentions into raw text by using the Cache and the users passed in with users.
parse_channelDeprecated
parse_channel_mention
Retrieves an Id from a channel mention.
parse_emoji
Retrieves the animated state, name and Id from an emoji mention, in the form of an EmojiIdentifier.
parse_invite
Retrieves the “code” part of an invite out of a URL.
parse_message_id_pair
Retrieves IDs from “{channel ID}-{message ID}” (retrieved by shift-clicking on “Copy ID”).
parse_message_url
Retrieves guild, channel, and message ID from a message URL.
parse_quotes
Turns a string into a vector of string arguments, splitting by spaces, but parsing content within quotes as one individual argument.
parse_roleDeprecated
parse_role_mention
Retrieves an Id from a role mention.
parse_user_mention
Retrieves an Id from a user mention.
parse_user_tag
Retrieves the username and discriminator out of a user tag (name#discrim). In order to accomodate next gen Discord usernames, this will also accept name style tags.
parse_usernameDeprecated
parse_webhook
Parses the id and token from a webhook url. Expects a url::Url rather than a &str.
shard_id
Calculates the Id of the shard responsible for a guild, given its Id and total number of shards used.
validate_token
Validates that a token is likely in a valid format.