light_mode dark_mode routine

Class CommandAttribute code

命名空间
Another_Mirai_Native.Abstractions.Attributes
程序集
Another-Mirai-Native.Abstractions.dll

将一个方法标记为指令处理器。框架将根据 MatchModeTemplate 自动将匹配的消息路由到该方法。

[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public class CommandAttribute : Attribute
继承
CommandAttribute
继承成员

构造函数

CommandAttribute(MatchMode, string, MessageScope) code

将一个方法标记为指令处理器。框架将根据 MatchModeTemplate 自动将匹配的消息路由到该方法。

public CommandAttribute(MatchMode matchMode, string template, MessageScope scope = MessageScope.All)

参数

matchMode MatchMode

指令的匹配模式。

template string

用于匹配消息内容的模板字符串。

scope MessageScope

此指令响应的消息来源范围。默认为 All

属性

MatchMode code

指令的匹配模式。

public MatchMode MatchMode { get; }

属性值

MatchMode

Scope code

此指令响应的消息来源范围。默认为 All

public MessageScope Scope { get; set; }

属性值

MessageScope

Template code

用于匹配消息内容的模板字符串。 当 MatchModeRegex 时,此值为正则表达式。

public string Template { get; }

属性值

string