Show / Hide Table of Contents

Class MentionUtils

Provides a series of helper methods for parsing mentions.

Inheritance
System.Object
MentionUtils
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Discord
Assembly: Discord.Net.Core.dll
Syntax
public static class MentionUtils

Methods

| Improve this Doc View Source

MentionChannel(UInt64)

Returns a mention string based on the channel ID.

Declaration
public static string MentionChannel(ulong id)
Parameters
Type Name Description
System.UInt64 id
Returns
Type Description
System.String

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

| Improve this Doc View Source

MentionRole(UInt64)

Returns a mention string based on the role ID.

Declaration
public static string MentionRole(ulong id)
Parameters
Type Name Description
System.UInt64 id
Returns
Type Description
System.String

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

| Improve this Doc View Source

MentionUser(UInt64)

Returns a mention string based on the user ID.

Declaration
public static string MentionUser(ulong id)
Parameters
Type Name Description
System.UInt64 id
Returns
Type Description
System.String

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

| Improve this Doc View Source

ParseChannel(String)

Parses a provided channel mention string.

Declaration
public static ulong ParseChannel(string text)
Parameters
Type Name Description
System.String text
Returns
Type Description
System.UInt64
Exceptions
Type Condition
System.ArgumentException

Invalid mention format.

| Improve this Doc View Source

ParseRole(String)

Parses a provided role mention string.

Declaration
public static ulong ParseRole(string text)
Parameters
Type Name Description
System.String text
Returns
Type Description
System.UInt64
Exceptions
Type Condition
System.ArgumentException

Invalid mention format.

| Improve this Doc View Source

ParseUser(String)

Parses a provided user mention string.

Declaration
public static ulong ParseUser(string text)
Parameters
Type Name Description
System.String text
Returns
Type Description
System.UInt64
Exceptions
Type Condition
System.ArgumentException

Invalid mention format.

| Improve this Doc View Source

TryParseChannel(String, out UInt64)

Tries to parse a provided channel mention string.

Declaration
public static bool TryParseChannel(string text, out ulong channelId)
Parameters
Type Name Description
System.String text
System.UInt64 channelId
Returns
Type Description
System.Boolean
| Improve this Doc View Source

TryParseRole(String, out UInt64)

Tries to parse a provided role mention string.

Declaration
public static bool TryParseRole(string text, out ulong roleId)
Parameters
Type Name Description
System.String text
System.UInt64 roleId
Returns
Type Description
System.Boolean
| Improve this Doc View Source

TryParseUser(String, out UInt64)

Tries to parse a provided user mention string.

Declaration
public static bool TryParseUser(string text, out ulong userId)
Parameters
Type Name Description
System.String text
System.UInt64 userId
Returns
Type Description
System.Boolean
  • Improve this Doc
  • View Source
Back to top Generated by DocFX