TextChatCommand

显示已弃用

*此内容使用人工智能(Beta)翻译,可能包含错误。若要查看英文页面,请点按 此处

代表文本聊天命令。可以用于创建自定义文本聊天命令,当父辈到 TextChatService 时。

自定义命令最多可以有两个别名,触发事件会在用户输入“/PrimaryAlias”或“/SecondaryAlias”到聊天时发生。有关自定义命令的示例,请参阅自定义文本聊天命令

要了解有关使用 TextChatService 的更多信息,请参阅 体验内文字聊天

概要

属性

活动

属性

AutocompleteVisible

读取并联

Enabled

读取并联

决定是否启用 TextChatCommand

禁用时,匹配“/PrimaryAlias”或“/SecondaryAlias”的消息不会被击沉,而是发送给其他用户。

使用此来禁用在案件基础上的默认命令。

PrimaryAlias

读取并联

一个主要别名用于触发 TextChatCommand

如果用户发送了带有 TextChannel:SendAsync() 匹配 "/`Class.TextChatCommand.PrimaryAlias`" 的消息,那么该消息不会发送,而是 TextChatCommand.Triggered 被触发。

SecondaryAlias

读取并联

用于触发 TextChatCommand 的次要别名。

方法

活动

Triggered

开发人员可以绑定执行命令的事件。

当用户通过 TextChannel:SendAsync() 向服务器发送消息时,消息被 TextChatCommand 截获,如果消息内容匹配 "/`Class.TextChatCommand.PrimaryAlias``" 或 "/`Class.TextChatCommand.SecondaryAlias`",则不会复制到其他用户。

例如,对于 TextChatCommandTextChatCommand.PrimaryAlias 为“静音”的情况,如果用户发送 "/mute SomeUserName",那么相关的 TextChatCommand 静音将发射其 TextChatCommand.Triggered .消息“/mute SomeUserName”不会复制给其他用户。

参数

originTextSource: TextSource

对引用到 TextSource 触发命令的负责人的参考,通过 TextChannel:SendAsync()

unfilteredText: string

完整、未过滤的文本,用于触发可以用于分解命令消信息中参数的命令。