Class MentionUtils
- Namespace
- Discord
- Assembly
- Discord.Net.Core.dll
Provides a series of helper methods for parsing mentions.
public static class MentionUtils
- Inheritance
-
MentionUtils
- Inherited Members
Methods
MentionChannel(ulong)
Returns a mention string based on the channel ID.
public static string MentionChannel(ulong id)
Parameters
id
ulong
Returns
- string
A channel mention string (e.g. <#103735883630395392>).
MentionRole(ulong)
Returns a mention string based on the role ID.
public static string MentionRole(ulong id)
Parameters
id
ulong
Returns
- string
A role mention string (e.g. <@&165511591545143296>).
MentionUser(ulong)
Returns a mention string based on the user ID.
public static string MentionUser(ulong id)
Parameters
id
ulong
Returns
- string
A user mention string (e.g. <@80351110224678912>).
ParseChannel(string)
Parses a provided channel mention string.
public static ulong ParseChannel(string text)
Parameters
text
string
Returns
Exceptions
- ArgumentException
Invalid mention format.
ParseRole(string)
Parses a provided role mention string.
public static ulong ParseRole(string text)
Parameters
text
string
Returns
Exceptions
- ArgumentException
Invalid mention format.
ParseUser(string)
Parses a provided user mention string.
public static ulong ParseUser(string text)
Parameters
text
stringThe user mention.
Returns
Exceptions
- ArgumentException
Invalid mention format.
TryParseChannel(string, out ulong)
Tries to parse a provided channel mention string.
public static bool TryParseChannel(string text, out ulong channelId)
Parameters
Returns
TryParseRole(string, out ulong)
Tries to parse a provided role mention string.
public static bool TryParseRole(string text, out ulong roleId)
Parameters
Returns
TryParseUser(string, out ulong)
Tries to parse a provided user mention string.
public static bool TryParseUser(string text, out ulong userId)