Skip to main content

Class MessageExtensions

Provides extension methods for Discord.IUserMessage that relates to commands.

Assembly: Discord.Net.Commands.dll​
View Source​
Declaration
public static class MessageExtensions

Methods​

HasCharPrefix(IUserMessage, Char, ref Int32)​

Gets whether the message starts with the provided character.

View Source​
Declaration
public static bool HasCharPrefix(this IUserMessage msg, char c, ref int argPos)
Returns​

System.Boolean: true if the message begins with the char <code data-dev-comment-type="paramref" class="paramref">c</code>; otherwise false.

Parameters​
TypeNameDescription
Discord.IUserMessagemsgThe message to check against.
System.CharcThe char prefix.
System.Int32argPosReferences where the command starts.

HasStringPrefix(IUserMessage, String, ref Int32, StringComparison)​

Gets whether the message starts with the provided string.

View Source​
Declaration
public static bool HasStringPrefix(this IUserMessage msg, string str, ref int argPos, StringComparison comparisonType = StringComparison.Ordinal)
Returns​

System.Boolean

Parameters​
TypeName
Discord.IUserMessagemsg
System.Stringstr
System.Int32argPos
System.StringComparisoncomparisonType

HasMentionPrefix(IUserMessage, IUser, ref Int32)​

Gets whether the message starts with the user's mention string.

View Source​
Declaration
public static bool HasMentionPrefix(this IUserMessage msg, IUser user, ref int argPos)
Returns​

System.Boolean

Parameters​
TypeName
Discord.IUserMessagemsg
Discord.IUseruser
System.Int32argPos