Table of Contents

Class MentionUtils

Namespace
HeyBox
Assembly
HeyBox.Net.Core.dll

提供一组用于生成与解析提及标签的辅助方法。

public static class MentionUtils
Inheritance
MentionUtils
Inherited Members

Properties

MentionEveryone

返回全体成员提及字符串。

public static string MentionEveryone { get; }

Property Value

string

MentionHere

返回在线成员提及字符串。

public static string MentionHere { get; }

Property Value

string

Methods

MentionChannel(ulong)

返回基于频道 ID 的格式化频道提及字符串。

public static string MentionChannel(ulong id)

Parameters

id ulong

Returns

string

频道提及字符串。

MentionRole(ulong)

返回基于角色 ID 的格式化频道提及字符串。

public static string MentionRole(ulong id)

Parameters

id ulong

Returns

string

角色提及字符串。

MentionUser(uint)

返回基于用户 ID 的格式化频道提及字符串。

public static string MentionUser(uint id)

Parameters

id uint

Returns

string

用户提及字符串。

ParseChannel(string)

解析指定的频道提及字符串。

public static ulong ParseChannel(string text)

Parameters

text string

要解析的频道提及字符串。

Returns

ulong

解析的频道 ID。

Exceptions

ArgumentException

无效的频道提及字符串格式。

ParseRole(string)

解析指定的角色提及字符串。

public static ulong ParseRole(string text)

Parameters

text string

要解析的角色提及字符串。

Returns

ulong

解析的角色 ID。

Exceptions

ArgumentException

无效的角色提及字符串格式。

ParseUser(string)

将指定的用户提及字符串解析为用户 ID。

public static uint ParseUser(string text)

Parameters

text string

要解析的用户提及字符串。

Returns

uint

解析的用户 ID。

Exceptions

ArgumentException

无效的用户提及字符串格式。

TryParseChannel(string, out ulong)

尝试解析指定的频道提及字符串。

public static bool TryParseChannel(string text, out ulong channelId)

Parameters

text string

要解析的频道提及字符串。

channelId ulong

如果解析成功,则为频道 ID;否则为 0

Returns

bool

如果解析成功,则为 true;否则为 false

TryParseRole(string, out ulong)

尝试解析指定的角色提及字符串。

public static bool TryParseRole(string text, out ulong roleId)

Parameters

text string

T 要解析的角色提及字符串。

roleId ulong

如果解析成功,则为角色 ID;否则为 0

Returns

bool

如果解析成功,则为 true;否则为 false

TryParseUser(string, out uint)

尝试解析指定的用户提及字符串。

public static bool TryParseUser(string text, out uint userId)

Parameters

text string

要解析的用户提及字符串。

userId uint

如果解析成功,则为用户 ID;否则为 0

Returns

bool

如果解析成功,则为 true;否则为 false