Add documentation for the discord module

This commit is contained in:
2025-08-13 00:27:45 -03:00
parent 6ba65eef71
commit fb660c162b
2 changed files with 16 additions and 0 deletions
+11
View File
@@ -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")
+5
View File
@@ -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;