Function serenity::utils::parse_message_url[][src]

pub fn parse_message_url(s: &str) -> Option<(GuildId, ChannelId, MessageId)>
Expand description

Retrieves guild, channel, and message ID from a message URL.

If the URL is malformed, None is returned.

Examples

use serenity::model::prelude::*;
use serenity::utils::parse_message_url;

assert_eq!(
    parse_message_url(
        "https://discord.com/channels/381880193251409931/381880193700069377/806164913558781963"
    ),
    Some((
        GuildId(381880193251409931),
        ChannelId(381880193700069377),
        MessageId(806164913558781963),
    )),
);
assert_eq!(parse_message_url("https://google.com"), None);