Skip to main content

channel_link

Function channel_link 

Source
pub const fn channel_link(channel: ChannelId) -> ChannelLink
Expand description

Links to the channel channel, a DM unless the guild is set (D-213).

Unlike a channel_mention, a link works outside Discord too.

discord.js counterpart: channelLink.

ยงExamples

use djs_formatters::channel_link;
use djs_model::id::{ChannelId, GuildId};

let channel = ChannelId::new(222_197_033_908_436_994);
assert_eq!(channel_link(channel).to_string(), "https://discord.com/channels/@me/222197033908436994");
assert_eq!(
    channel_link(channel).guild(GuildId::new(81_384_788_765_712_384)).to_string(),
    "https://discord.com/channels/81384788765712384/222197033908436994"
);