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​
Type | Name |
---|---|
System.UInt64 | id |
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​
Type | Name |
---|---|
System.UInt64 | id |
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​
Type | Name |
---|---|
System.UInt64 | id |
ParseUser(String)​
Parses a provided user mention string.
View Source​
Declaration
public static ulong ParseUser(string text)
Returns​
System.UInt64
Parameters​
Type | Name | Description |
---|---|---|
System.String | text | The 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​
Type | Name | Description |
---|---|---|
System.String | text | The user mention. |
System.UInt64 | userId | The 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​
Type | Name |
---|---|
System.String | text |
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​
Type | Name |
---|---|
System.String | text |
System.UInt64 | channelId |
ParseRole(String)​
Parses a provided role mention string.
View Source​
Declaration
public static ulong ParseRole(string text)
Returns​
System.UInt64
Parameters​
Type | Name |
---|---|
System.String | text |
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​
Type | Name |
---|---|
System.String | text |
System.UInt64 | roleId |