@quenty/chatproviderservice 4.2.1 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/package.json +24 -23
- package/src/Client/Binders/ChatTagClient.lua +1 -1
- package/src/Client/ChatProviderServiceClient.lua +1 -0
- package/src/Client/Commands/ChatProviderCommandServiceClient.lua +56 -0
- package/src/Server/Binders/ChatTag.lua +32 -0
- package/src/Server/Binders/HasChatTags.lua +14 -0
- package/src/Server/ChatProviderService.lua +3 -0
- package/src/Server/Commands/ChatProviderCommandService.lua +91 -1
- package/src/Shared/Binders/ChatTagBase.lua +4 -0
- package/src/Shared/Binders/HasChatTagsBase.lua +8 -2
- package/src/Shared/ChatTagConstants.lua +2 -0
- package/src/Shared/Commands/ChatTagCmdrUtils.lua +29 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/chatproviderservice@4.2.1...@quenty/chatproviderservice@4.3.0) (2023-12-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* ChatProviderService can disable chat ([99d06db](https://github.com/Quenty/NevermoreEngine/commit/99d06db7c7f1a2b16d2cb5ae9c0a26c842f1270b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [4.2.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/chatproviderservice@4.2.0...@quenty/chatproviderservice@4.2.1) (2023-10-28)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/chatproviderservice
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/chatproviderservice",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Provide wrapper around chat system to allow tags to be set",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,33 +25,34 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/attributeutils": "^9.
|
|
29
|
-
"@quenty/baseobject": "^7.
|
|
30
|
-
"@quenty/binder": "^9.
|
|
31
|
-
"@quenty/brio": "^9.
|
|
32
|
-
"@quenty/clienttranslator": "^9.
|
|
33
|
-
"@quenty/cmdrservice": "^8.
|
|
34
|
-
"@quenty/color3utils": "^6.
|
|
35
|
-
"@quenty/
|
|
36
|
-
"@quenty/
|
|
37
|
-
"@quenty/
|
|
28
|
+
"@quenty/attributeutils": "^9.2.0",
|
|
29
|
+
"@quenty/baseobject": "^7.1.0",
|
|
30
|
+
"@quenty/binder": "^9.2.0",
|
|
31
|
+
"@quenty/brio": "^9.2.0",
|
|
32
|
+
"@quenty/clienttranslator": "^9.2.0",
|
|
33
|
+
"@quenty/cmdrservice": "^8.3.0",
|
|
34
|
+
"@quenty/color3utils": "^6.2.0",
|
|
35
|
+
"@quenty/datastore": "^8.2.0",
|
|
36
|
+
"@quenty/instanceutils": "^8.2.0",
|
|
37
|
+
"@quenty/loader": "^7.1.0",
|
|
38
|
+
"@quenty/localizedtextutils": "^7.2.0",
|
|
38
39
|
"@quenty/maid": "^2.6.0",
|
|
39
|
-
"@quenty/permissionprovider": "^9.
|
|
40
|
-
"@quenty/playerbinder": "^9.
|
|
41
|
-
"@quenty/playerutils": "^3.
|
|
42
|
-
"@quenty/preferredparentutils": "^4.
|
|
43
|
-
"@quenty/promise": "^7.
|
|
40
|
+
"@quenty/permissionprovider": "^9.3.0",
|
|
41
|
+
"@quenty/playerbinder": "^9.2.0",
|
|
42
|
+
"@quenty/playerutils": "^3.3.0",
|
|
43
|
+
"@quenty/preferredparentutils": "^4.1.0",
|
|
44
|
+
"@quenty/promise": "^7.1.0",
|
|
44
45
|
"@quenty/richtext": "^1.2.0",
|
|
45
|
-
"@quenty/rx": "^8.
|
|
46
|
-
"@quenty/rxbinderutils": "^9.
|
|
47
|
-
"@quenty/servicebag": "^7.
|
|
48
|
-
"@quenty/signal": "^3.
|
|
46
|
+
"@quenty/rx": "^8.2.0",
|
|
47
|
+
"@quenty/rxbinderutils": "^9.2.0",
|
|
48
|
+
"@quenty/servicebag": "^7.1.0",
|
|
49
|
+
"@quenty/signal": "^3.1.0",
|
|
49
50
|
"@quenty/string": "^3.1.0",
|
|
50
|
-
"@quenty/table": "^3.
|
|
51
|
-
"@quenty/valueobject": "^8.
|
|
51
|
+
"@quenty/table": "^3.4.0",
|
|
52
|
+
"@quenty/valueobject": "^8.2.0"
|
|
52
53
|
},
|
|
53
54
|
"publishConfig": {
|
|
54
55
|
"access": "public"
|
|
55
56
|
},
|
|
56
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "2c2dbbc0cb2fbb46b4f3270c559c63890fe18b26"
|
|
57
58
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
local require = require(script.Parent.loader).load(script)
|
|
6
6
|
|
|
7
|
-
local ChatTagBase = require("ChatTagBase")
|
|
8
7
|
local Binder = require("Binder")
|
|
8
|
+
local ChatTagBase = require("ChatTagBase")
|
|
9
9
|
|
|
10
10
|
local ChatTagClient = setmetatable({}, ChatTagBase)
|
|
11
11
|
ChatTagClient.ClassName = "ChatTagClient"
|
|
@@ -28,6 +28,7 @@ function ChatProviderServiceClient:Init(serviceBag)
|
|
|
28
28
|
-- Binders
|
|
29
29
|
self._serviceBag:GetService(require("ChatTagClient"))
|
|
30
30
|
self._serviceBag:GetService(require("ChatProviderTranslator"))
|
|
31
|
+
self._serviceBag:GetService(require("ChatProviderCommandServiceClient"))
|
|
31
32
|
self._hasChatTagsBinder = self._serviceBag:GetService(require("HasChatTagsClient"))
|
|
32
33
|
end
|
|
33
34
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
@class ChatProviderCommandServiceClient
|
|
3
|
+
]=]
|
|
4
|
+
|
|
5
|
+
local require = require(script.Parent.loader).load(script)
|
|
6
|
+
|
|
7
|
+
local Players = game:GetService("Players")
|
|
8
|
+
|
|
9
|
+
local ChatTagCmdrUtils = require("ChatTagCmdrUtils")
|
|
10
|
+
local Set = require("Set")
|
|
11
|
+
local Maid = require("Maid")
|
|
12
|
+
local String = require("String")
|
|
13
|
+
|
|
14
|
+
local ChatProviderCommandServiceClient = {}
|
|
15
|
+
ChatProviderCommandServiceClient.ServiceName = "ChatProviderCommandServiceClient"
|
|
16
|
+
|
|
17
|
+
function ChatProviderCommandServiceClient:Init(serviceBag)
|
|
18
|
+
assert(not self._serviceBag, "Already initialized")
|
|
19
|
+
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
20
|
+
self._maid = Maid.new()
|
|
21
|
+
|
|
22
|
+
self._cmdrService = self._serviceBag:GetService(require("CmdrServiceClient"))
|
|
23
|
+
self._chatProviderServiceClient = self._serviceBag:GetService(require("ChatProviderServiceClient"))
|
|
24
|
+
self._chatTagBinder = self._serviceBag:GetService(require("ChatTagClient"))
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
function ChatProviderCommandServiceClient:Start()
|
|
28
|
+
self._cmdrService:PromiseCmdr():Then(function(cmdr)
|
|
29
|
+
ChatTagCmdrUtils.registerChatTagKeys(cmdr, self)
|
|
30
|
+
|
|
31
|
+
self:_registerChatCommand(cmdr)
|
|
32
|
+
end)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
function ChatProviderCommandServiceClient:_registerChatCommand(cmdr)
|
|
36
|
+
self._maid:GiveTask(self._chatProviderServiceClient.MessageIncoming:Connect(function(textChatMessage)
|
|
37
|
+
if not (textChatMessage.TextSource and textChatMessage.TextSource.UserId == Players.LocalPlayer.UserId) then
|
|
38
|
+
return
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
if String.startsWith(textChatMessage.Text, "/cmdr") then
|
|
42
|
+
cmdr:Show()
|
|
43
|
+
end
|
|
44
|
+
end))
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
function ChatProviderCommandServiceClient:GetChatTagKeyList()
|
|
48
|
+
local tagSet = {}
|
|
49
|
+
for chatTag, _ in pairs(self._chatTagBinder:GetAllSet()) do
|
|
50
|
+
local tagKey = chatTag.ChatTagKey.Value
|
|
51
|
+
tagSet[tagKey] = true
|
|
52
|
+
end
|
|
53
|
+
return Set.toList(tagSet)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
return ChatProviderCommandServiceClient
|
|
@@ -15,8 +15,40 @@ function ChatTag.new(folder, serviceBag)
|
|
|
15
15
|
local self = setmetatable(ChatTagBase.new(folder), ChatTag)
|
|
16
16
|
|
|
17
17
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
18
|
+
self._playerDataStoreService = self._serviceBag:GetService(require("PlayerDataStoreService"))
|
|
19
|
+
|
|
20
|
+
self:_loadData()
|
|
18
21
|
|
|
19
22
|
return self
|
|
20
23
|
end
|
|
21
24
|
|
|
25
|
+
function ChatTag:_getPlayer()
|
|
26
|
+
return self._obj:FindFirstAncestorWhichIsA("Player")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
function ChatTag:_loadData()
|
|
30
|
+
local player = self:_getPlayer()
|
|
31
|
+
if not player then
|
|
32
|
+
return
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
local tagKey = self.ChatTagKey.Value
|
|
36
|
+
if not tagKey then
|
|
37
|
+
return
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
self._maid:GivePromise(self._playerDataStoreService:PromiseDataStore(player))
|
|
41
|
+
:Then(function(dataStore)
|
|
42
|
+
return dataStore:GetSubStore("chatTags"):GetSubStore(tagKey)
|
|
43
|
+
end)
|
|
44
|
+
:Then(function(dataStore)
|
|
45
|
+
return dataStore:Load("UserDisabled", false)
|
|
46
|
+
:Then(function(userDisabled)
|
|
47
|
+
self.UserDisabled.Value = userDisabled
|
|
48
|
+
|
|
49
|
+
self._maid:GiveTask(dataStore:StoreOnValueChange("UserDisabled", self.UserDisabled))
|
|
50
|
+
end)
|
|
51
|
+
end)
|
|
52
|
+
end
|
|
53
|
+
|
|
22
54
|
return Binder.new("ChatTag", ChatTag)
|
|
@@ -13,6 +13,7 @@ local HasChatTagsConstants = require("HasChatTagsConstants")
|
|
|
13
13
|
local LocalizedTextUtils = require("LocalizedTextUtils")
|
|
14
14
|
local PlayerBinder = require("PlayerBinder")
|
|
15
15
|
local String = require("String")
|
|
16
|
+
local BinderUtils = require("BinderUtils")
|
|
16
17
|
|
|
17
18
|
local HasChatTags = setmetatable({}, HasChatTagsBase)
|
|
18
19
|
HasChatTags.ClassName = "HasChatTags"
|
|
@@ -53,6 +54,7 @@ function HasChatTags:AddChatTag(chatTagData)
|
|
|
53
54
|
|
|
54
55
|
local tag = self._chatTagBinder:Create("Folder")
|
|
55
56
|
tag.Name = string.format("ChatTag_%s", String.toCamelCase(chatTagData.TagText))
|
|
57
|
+
tag:SetAttribute(ChatTagConstants.TAG_KEY_ATTRIBUTE, String.toCamelCase(chatTagData.TagText))
|
|
56
58
|
tag:SetAttribute(ChatTagConstants.TAG_TEXT_ATTRIBUTE, chatTagData.TagText)
|
|
57
59
|
tag:SetAttribute(ChatTagConstants.TAG_COLOR_ATTRIBUTE, chatTagData.TagColor)
|
|
58
60
|
tag:SetAttribute(ChatTagConstants.TAG_PRIORITY_ATTRIBUTE, chatTagData.TagPriority)
|
|
@@ -66,6 +68,18 @@ function HasChatTags:AddChatTag(chatTagData)
|
|
|
66
68
|
return tag
|
|
67
69
|
end
|
|
68
70
|
|
|
71
|
+
function HasChatTags:GetChatTagByKey(chatTagKey)
|
|
72
|
+
assert(type(chatTagKey) == "string", "Bad chatTagKey")
|
|
73
|
+
|
|
74
|
+
for _, item in pairs(BinderUtils.getChildren(self._chatTagBinder, self._chatTagsContainer)) do
|
|
75
|
+
if item.ChatTagKey.Value == chatTagKey then
|
|
76
|
+
return item
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
return nil
|
|
81
|
+
end
|
|
82
|
+
|
|
69
83
|
--[=[
|
|
70
84
|
Removes all chat tags from the player
|
|
71
85
|
]=]
|
|
@@ -31,6 +31,7 @@ function ChatProviderService:Init(serviceBag)
|
|
|
31
31
|
-- External
|
|
32
32
|
self._serviceBag:GetService(require("CmdrService"))
|
|
33
33
|
self._serviceBag:GetService(require("PermissionService"))
|
|
34
|
+
self._serviceBag:GetService(require("PlayerDataStoreService"))
|
|
34
35
|
|
|
35
36
|
-- Internal
|
|
36
37
|
self._serviceBag:GetService(require("ChatProviderCommandService"))
|
|
@@ -40,6 +41,8 @@ function ChatProviderService:Init(serviceBag)
|
|
|
40
41
|
self._serviceBag:GetService(require("ChatTag"))
|
|
41
42
|
self._hasChatTagsBinder = self._serviceBag:GetService(require("HasChatTags"))
|
|
42
43
|
|
|
44
|
+
-- note: normally we don't expose default APi surfaces like this with defaults, however, because this only affects developers and this
|
|
45
|
+
-- tends to significantly improve feedback we're leaving this default configuration in place.
|
|
43
46
|
self:SetDeveloperTag(ChatTagDataUtils.createChatTagData({
|
|
44
47
|
TagText = "(dev)";
|
|
45
48
|
LocalizedText = LocalizedTextUtils.create("chatTags.dev");
|
|
@@ -4,8 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
local require = require(script.Parent.loader).load(script)
|
|
6
6
|
|
|
7
|
-
local
|
|
7
|
+
local Players = game:GetService("Players")
|
|
8
|
+
|
|
9
|
+
local ChatTagCmdrUtils = require("ChatTagCmdrUtils")
|
|
8
10
|
local ChatTagDataUtils = require("ChatTagDataUtils")
|
|
11
|
+
local PlayerUtils = require("PlayerUtils")
|
|
12
|
+
local Set = require("Set")
|
|
13
|
+
local Maid = require("Maid")
|
|
9
14
|
|
|
10
15
|
local ChatProviderCommandService = {}
|
|
11
16
|
ChatProviderCommandService.ServiceName = "ChatProviderCommandService"
|
|
@@ -13,19 +18,60 @@ ChatProviderCommandService.ServiceName = "ChatProviderCommandService"
|
|
|
13
18
|
function ChatProviderCommandService:Init(serviceBag)
|
|
14
19
|
assert(not self._serviceBag, "Already initialized")
|
|
15
20
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
21
|
+
self._maid = Maid.new()
|
|
16
22
|
|
|
17
23
|
-- External
|
|
18
24
|
self._cmdrService = self._serviceBag:GetService(require("CmdrService"))
|
|
19
25
|
|
|
20
26
|
-- Internal
|
|
21
27
|
self._chatProviderService = self._serviceBag:GetService(require("ChatProviderService"))
|
|
28
|
+
self._chatTagBinder = self._serviceBag:GetService(require("ChatTag"))
|
|
29
|
+
self._hasChatTagsBinder = self._serviceBag:GetService(require("HasChatTags"))
|
|
22
30
|
end
|
|
23
31
|
|
|
24
32
|
function ChatProviderCommandService:Start()
|
|
25
33
|
self:_registerCommands()
|
|
34
|
+
self:_createActivateChatCommand()
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
function ChatProviderCommandService:_createActivateChatCommand()
|
|
38
|
+
local command = Instance.new("TextChatCommand")
|
|
39
|
+
command.Name = "OpenCmdrCommand"
|
|
40
|
+
command.PrimaryAlias = "/cmdr"
|
|
41
|
+
|
|
42
|
+
self._maid:GiveTask(command)
|
|
43
|
+
self._maid:GiveTask(command.Triggered:Connect(function(originTextSource, _unfilteredText)
|
|
44
|
+
local player = Players:GetPlayerByUserId(originTextSource.UserId)
|
|
45
|
+
if not player then
|
|
46
|
+
return
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
self._permissionService:PromiseIsAdmin(player):Then(function(isAdmin)
|
|
50
|
+
if isAdmin then
|
|
51
|
+
self._remoting.OpenCmdr:FireClient(player)
|
|
52
|
+
end
|
|
53
|
+
end)
|
|
54
|
+
end))
|
|
55
|
+
|
|
56
|
+
self._chatProviderService:AddChatCommand(command)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
function ChatProviderCommandService:GetChatTagKeyList()
|
|
61
|
+
local tagSet = {}
|
|
62
|
+
for chatTag, _ in pairs(self._chatTagBinder:GetAllSet()) do
|
|
63
|
+
local tagKey = chatTag.ChatTagKey.Value
|
|
64
|
+
tagSet[tagKey] = true
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
return Set.toList(tagSet)
|
|
26
68
|
end
|
|
27
69
|
|
|
28
70
|
function ChatProviderCommandService:_registerCommands()
|
|
71
|
+
self._cmdrService:PromiseCmdr():Then(function(cmdr)
|
|
72
|
+
ChatTagCmdrUtils.registerChatTagKeys(cmdr, self)
|
|
73
|
+
end)
|
|
74
|
+
|
|
29
75
|
self._cmdrService:RegisterCommand({
|
|
30
76
|
Name = "add-chat-tag";
|
|
31
77
|
Aliases = { };
|
|
@@ -84,6 +130,50 @@ function ChatProviderCommandService:_registerCommands()
|
|
|
84
130
|
|
|
85
131
|
return string.format("Cleared chat tags on a player %q", PlayerUtils.formatName(player))
|
|
86
132
|
end)
|
|
133
|
+
|
|
134
|
+
self._cmdrService:RegisterCommand({
|
|
135
|
+
Name = "set-chat-tag-disabled";
|
|
136
|
+
Aliases = { };
|
|
137
|
+
Description = "Sets if a chat tag is disabled for a player. This will save.";
|
|
138
|
+
Group = "ChatTags";
|
|
139
|
+
Args = {
|
|
140
|
+
{
|
|
141
|
+
Name = "Target";
|
|
142
|
+
Type = "player";
|
|
143
|
+
Description = "Player to disable or enable the tag for";
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
Name = "TagKey";
|
|
147
|
+
Type = "chatTagKey";
|
|
148
|
+
Description = "Chat tag to disable";
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
Name = "ChatTagDisabled";
|
|
152
|
+
Type = "boolean";
|
|
153
|
+
Description = "Whether or not the tag is disabled";
|
|
154
|
+
Default = true;
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
}, function(_context, player, chatTagKey, chatTagDisabled)
|
|
158
|
+
local hasChatTags = self._hasChatTagsBinder:Get(player)
|
|
159
|
+
|
|
160
|
+
if not hasChatTags then
|
|
161
|
+
return string.format("%s does not have chat tags", PlayerUtils.formatName(player))
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
local chatTag = hasChatTags:GetChatTagByKey(chatTagKey)
|
|
165
|
+
if not chatTag then
|
|
166
|
+
return string.format("%s does not have a chat tag with that key", PlayerUtils.formatName(player))
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
chatTag.UserDisabled.Value = chatTagDisabled
|
|
170
|
+
|
|
171
|
+
return string.format("Chat tag %q on player %q `UserDisabled` set to %s", chatTagKey, PlayerUtils.formatName(player), tostring(chatTagDisabled))
|
|
172
|
+
end)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
function ChatProviderCommandService:Destroy()
|
|
176
|
+
self._maid:DoCleaning()
|
|
87
177
|
end
|
|
88
178
|
|
|
89
179
|
return ChatProviderCommandService
|
|
@@ -22,11 +22,15 @@ function ChatTagBase.new(obj)
|
|
|
22
22
|
self._chatTagColor = AttributeValue.new(self._obj, ChatTagConstants.TAG_COLOR_ATTRIBUTE, Color3.new(1, 1, 1))
|
|
23
23
|
self._chatTagPriority = AttributeValue.new(self._obj, ChatTagConstants.TAG_PRIORITY_ATTRIBUTE, 0)
|
|
24
24
|
|
|
25
|
+
self.UserDisabled = AttributeValue.new(self._obj, ChatTagConstants.USER_DISABLED_ATTRIBUTE, false)
|
|
26
|
+
self.ChatTagKey = AttributeValue.new(self._obj, ChatTagConstants.TAG_KEY_ATTRIBUTE, false)
|
|
27
|
+
|
|
25
28
|
return self
|
|
26
29
|
end
|
|
27
30
|
|
|
28
31
|
function ChatTagBase:ObserveChatTagData()
|
|
29
32
|
return Rx.combineLatest({
|
|
33
|
+
UserDisabled = self.UserDisabled:Observe();
|
|
30
34
|
TagText = self._chatTagText:Observe();
|
|
31
35
|
TagLocalizedText = self._chatTagLocalizedTextData:Observe():Pipe({
|
|
32
36
|
Rx.map(function(text)
|
|
@@ -68,8 +68,14 @@ function HasChatTagsBase:_observeTagDataListBrio()
|
|
|
68
68
|
RxBrioUtils.switchMapBrio(function(child)
|
|
69
69
|
return RxBinderUtils.observeChildrenBrio(chatTagBinder, child);
|
|
70
70
|
end);
|
|
71
|
-
RxBrioUtils.
|
|
72
|
-
return chatTag:ObserveChatTagData()
|
|
71
|
+
RxBrioUtils.flatMapBrio(function(chatTag)
|
|
72
|
+
return chatTag:ObserveChatTagData():Pipe({
|
|
73
|
+
RxBrioUtils.toBrio();
|
|
74
|
+
RxBrioUtils.onlyLastBrioSurvives();
|
|
75
|
+
})
|
|
76
|
+
end);
|
|
77
|
+
RxBrioUtils.where(function(chatTagData)
|
|
78
|
+
return not chatTagData.UserDisabled
|
|
73
79
|
end);
|
|
74
80
|
RxBrioUtils.reduceToAliveList()
|
|
75
81
|
})
|
|
@@ -9,6 +9,8 @@ local Table = require("Table")
|
|
|
9
9
|
return Table.readonly({
|
|
10
10
|
TAG_TEXT_ATTRIBUTE = "TagText";
|
|
11
11
|
TAG_COLOR_ATTRIBUTE = "TagColor";
|
|
12
|
+
TAG_KEY_ATTRIBUTE = "ChatTagKey";
|
|
12
13
|
TAG_LOCALIZED_TEXT_ATTRIBUTE = "TagLocalizedText";
|
|
13
14
|
TAG_PRIORITY_ATTRIBUTE = "TagPriority";
|
|
15
|
+
USER_DISABLED_ATTRIBUTE = "UserDisabled";
|
|
14
16
|
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
@class ChatTagCmdrUtils
|
|
3
|
+
]=]
|
|
4
|
+
|
|
5
|
+
local ChatTagCmdrUtils = {}
|
|
6
|
+
|
|
7
|
+
function ChatTagCmdrUtils.registerChatTagKeys(cmdr, chatProviderService)
|
|
8
|
+
local chatTagKey = {
|
|
9
|
+
Transform = function(text)
|
|
10
|
+
local chatTagKeyList = chatProviderService:GetChatTagKeyList()
|
|
11
|
+
local find = cmdr.Util.MakeFuzzyFinder(chatTagKeyList)
|
|
12
|
+
return find(text)
|
|
13
|
+
end;
|
|
14
|
+
Validate = function(keys)
|
|
15
|
+
return #keys > 0, "No chat tag with that key could be found."
|
|
16
|
+
end,
|
|
17
|
+
Autocomplete = function(keys)
|
|
18
|
+
return keys
|
|
19
|
+
end,
|
|
20
|
+
Parse = function(keys)
|
|
21
|
+
return keys[1]
|
|
22
|
+
end;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
cmdr.Registry:RegisterType("chatTagKey", chatTagKey)
|
|
26
|
+
cmdr.Registry:RegisterType("chatTagKeys", cmdr.Util.MakeListableType(chatTagKey))
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
return ChatTagCmdrUtils
|