Add documentation for the discord module
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
//! Utilities for handling Discord's image hashes.
|
||||
|
||||
use twilight_model::util::ImageHash;
|
||||
|
||||
/// Returns the URL of a user's avatar.
|
||||
///
|
||||
/// Arguments:
|
||||
/// * `hash` - The user's avatar hash (if available).
|
||||
/// * `user_id` - The user's ID.
|
||||
/// * `discriminator` - The user's discriminator.
|
||||
///
|
||||
/// Returns:
|
||||
/// [`String`] - The URL of the user's avatar.
|
||||
pub fn get_avatar_url(hash: Option<ImageHash>, user_id: u64, discriminator: u64) -> String {
|
||||
if let Some(hash) = hash {
|
||||
format!("https://cdn.discordapp.com/avatars/{user_id}/{hash}.webp?size=256")
|
||||
|
||||
@@ -1,2 +1,7 @@
|
||||
//! A set of utilities to interact with Discord not included in the main framework.
|
||||
//!
|
||||
//! It currently includes a markdown escaper and a utility to get image URLs from Discord's image
|
||||
//! hashes.
|
||||
|
||||
pub mod images;
|
||||
pub mod sanitizing;
|
||||
|
||||
Reference in New Issue
Block a user