#twilight #discord #channel #user-id #role #emoji #mentions

twilight-mention

Utilities for working with mentions in the Twilight ecosystem

28 releases (16 breaking)

0.16.0-rc.1 Feb 21, 2024
0.15.3 Sep 10, 2023
0.15.1 Feb 26, 2023
0.14.0 Nov 14, 2022
0.2.0 Oct 30, 2020

#372 in Text processing

Download history 19/week @ 2024-01-22 10/week @ 2024-01-29 67/week @ 2024-02-05 44/week @ 2024-02-12 157/week @ 2024-02-19 101/week @ 2024-02-26 45/week @ 2024-03-04 34/week @ 2024-03-11 33/week @ 2024-03-18 16/week @ 2024-03-25 102/week @ 2024-04-01 46/week @ 2024-04-08 290/week @ 2024-04-15 68/week @ 2024-04-22 28/week @ 2024-04-29 25/week @ 2024-05-06

413 downloads per month
Used in twilight

ISC license

1.5MB
31K SLoC

twilight-mention

codecov badge discord badge github badge license badge rust badge

twilight-mention is a utility crate for the Discord twilight-rs ecosystem to mention its model types and parse those mentions.

With this library, you can create mentions for various types, such as users, emojis, roles, members, or channels.

Examples

Create a mention formatter for a user ID, and then format it in a message:

use twilight_mention::Mention;
use twilight_model::id::{marker::UserMarker, Id};

let user_id = Id::<UserMarker>::new(123);
let message = format!("Hey there, {}!", user_id.mention());

Dependencies

~1.4–2.1MB
~45K SLoC