#discord-api #twilight #parser #discord-bot #channel #user-id #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

#947 in Parser implementations

Download history 22/week @ 2024-06-17 32/week @ 2024-06-24 6/week @ 2024-07-08 5/week @ 2024-07-15 62/week @ 2024-07-22 118/week @ 2024-07-29 66/week @ 2024-08-05 80/week @ 2024-08-12 46/week @ 2024-08-19 33/week @ 2024-08-26 5/week @ 2024-09-02 27/week @ 2024-09-09 17/week @ 2024-09-16 88/week @ 2024-09-23 75/week @ 2024-09-30

209 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.3–2MB
~44K SLoC