代表文本聊天命令。可以用于创建自定义文本聊天命令,当父辈到 TextChatService 时。
自定义命令最多可以有两个别名,触发事件会在用户输入“/PrimaryAlias”或“/SecondaryAlias”到聊天时发生。有关自定义命令的示例,请参阅自定义文本聊天命令。
要了解有关使用 TextChatService 的更多信息,请参阅 体验内文字聊天 。
概要
属性
决定是否启用 TextChatCommand。
一个主要别名用于触发 TextChatCommand 。
用于触发 TextChatCommand 的次要别名。
活动
开发人员可以绑定执行命令的事件。
属性
AutocompleteVisible
Enabled
决定是否启用 TextChatCommand。
禁用时,匹配“/PrimaryAlias”或“/SecondaryAlias”的消息不会被击沉,而是发送给其他用户。
使用此来禁用在案件基础上的默认命令。
PrimaryAlias
一个主要别名用于触发 TextChatCommand 。
如果用户发送了带有 TextChannel:SendAsync() 匹配 "/`Class.TextChatCommand.PrimaryAlias`" 的消息,那么该消息不会发送,而是 TextChatCommand.Triggered 被触发。
方法
活动
Triggered
开发人员可以绑定执行命令的事件。
当用户通过 TextChannel:SendAsync() 向服务器发送消息时,消息被 TextChatCommand 截获,如果消息内容匹配 "/`Class.TextChatCommand.PrimaryAlias``" 或 "/`Class.TextChatCommand.SecondaryAlias`",则不会复制到其他用户。
例如,对于 TextChatCommand 与 TextChatCommand.PrimaryAlias 为“静音”的情况,如果用户发送 "/mute SomeUserName",那么相关的 TextChatCommand 静音将发射其 TextChatCommand.Triggered .消息“/mute SomeUserName”不会复制给其他用户。
参数
对引用到 TextSource 触发命令的负责人的参考,通过 TextChannel:SendAsync() 。
完整、未过滤的文本,用于触发可以用于分解命令消信息中参数的命令。