Skip to main content

Class MentionUtils

Provides a series of helper methods for parsing mentions.

Assembly: Discord.Net.Core.dll​
View Source​
Declaration
public static class MentionUtils

Methods​

MentionUser(UInt64)​

Returns a mention string based on the user ID.

View Source​
Declaration
public static string MentionUser(ulong id)
Returns​

System.String: A user mention string (e.g. <@80351110224678912>).

Parameters​
TypeName
System.UInt64id

MentionChannel(UInt64)​

Returns a mention string based on the channel ID.

View Source​
Declaration
public static string MentionChannel(ulong id)
Returns​

System.String: A channel mention string (e.g. <#103735883630395392>).

Parameters​
TypeName
System.UInt64id

MentionRole(UInt64)​

Returns a mention string based on the role ID.

View Source​
Declaration
public static string MentionRole(ulong id)
Returns​

System.String: A role mention string (e.g. <@&165511591545143296>).

Parameters​
TypeName
System.UInt64id

ParseUser(String)​

Parses a provided user mention string.

View Source​
Declaration
public static ulong ParseUser(string text)
Returns​

System.UInt64

Parameters​
TypeNameDescription
System.StringtextThe user mention.

TryParseUser(String, out UInt64)​

Tries to parse a provided user mention string.

View Source​
Declaration
public static bool TryParseUser(string text, out ulong userId)
Returns​

System.Boolean

Parameters​
TypeNameDescription
System.StringtextThe user mention.
System.UInt64userIdThe UserId of the user.

ParseChannel(String)​

Parses a provided channel mention string.

View Source​
Declaration
public static ulong ParseChannel(string text)
Returns​

System.UInt64

Parameters​
TypeName
System.Stringtext

TryParseChannel(String, out UInt64)​

Tries to parse a provided channel mention string.

View Source​
Declaration
public static bool TryParseChannel(string text, out ulong channelId)
Returns​

System.Boolean

Parameters​
TypeName
System.Stringtext
System.UInt64channelId

ParseRole(String)​

Parses a provided role mention string.

View Source​
Declaration
public static ulong ParseRole(string text)
Returns​

System.UInt64

Parameters​
TypeName
System.Stringtext

TryParseRole(String, out UInt64)​

Tries to parse a provided role mention string.

View Source​
Declaration
public static bool TryParseRole(string text, out ulong roleId)
Returns​

System.Boolean

Parameters​
TypeName
System.Stringtext
System.UInt64roleId