Skip to main content

slash_command_mention

Function slash_command_mention 

Source
pub const fn slash_command_mention(
    name: &str,
    id: CommandId,
) -> SlashCommandMention<'_>
Expand description

Mentions the slash command name with the ID id: </airhorn:816437322781949972>.

A subcommand is added with subcommand, a subcommand in a group with group (D-213).

discord.js counterpart: chatInputApplicationCommandMention.

ยงExamples

use djs_formatters::slash_command_mention;
use djs_model::id::CommandId;

let id = CommandId::new(123_456_789_012_345_678);
assert_eq!(slash_command_mention("ping", id).to_string(), "</ping:123456789012345678>");
assert_eq!(
    slash_command_mention("tag", id).subcommand("show").to_string(),
    "</tag show:123456789012345678>"
);
assert_eq!(
    slash_command_mention("admin", id).group("users", "ban").to_string(),
    "</admin users ban:123456789012345678>"
);