Module serenity::utils

source ·
Available on crate feature utils only.
Expand description

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

Modules§

  • Utilities to parse and validate Discord tokens.

Structs§

Enums§

Traits§

Functions§

  • Transforms role, channel, user, @everyone and @here mentions into raw text by using the Cache and the users passed in with users.
  • parse_channelDeprecated
  • 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.
  • 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.
  • parse_roleDeprecated
  • Retrieves an Id from a role mention.
  • Retrieves an Id from a user mention.
  • 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
  • Parses the id and token from a webhook url. Expects a url::Url rather than a &str.
  • Calculates the Id of the shard responsible for a guild, given its Id and total number of shards used.
  • Validates that a token is likely in a valid format.