@quenty/chatproviderservice 9.25.0 → 9.25.2-canary.547.11ae689.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 CHANGED
@@ -3,6 +3,29 @@
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
+ ## [9.25.2-canary.547.11ae689.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/chatproviderservice@9.25.0...@quenty/chatproviderservice@9.25.2-canary.547.11ae689.0) (2025-04-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
12
+ * Bump package versions for republishing ([ba47c62](https://github.com/Quenty/NevermoreEngine/commit/ba47c62e32170bf74377b0c658c60b84306dc294))
13
+
14
+
15
+
16
+
17
+
18
+ ## [9.25.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/chatproviderservice@9.25.0...@quenty/chatproviderservice@9.25.1) (2025-04-07)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
24
+
25
+
26
+
27
+
28
+
6
29
  # [9.25.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/chatproviderservice@9.24.5...@quenty/chatproviderservice@9.25.0) (2025-04-02)
7
30
 
8
31
  **Note:** Version bump only for package @quenty/chatproviderservice
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2014-2024 James Onnen (Quenty)
3
+ Copyright (c) 2014-2025 James Onnen (Quenty)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/chatproviderservice",
3
- "version": "9.25.0",
3
+ "version": "9.25.2-canary.547.11ae689.0",
4
4
  "description": "Provide wrapper around chat system to allow tags to be set",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,35 +25,35 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/attributeutils": "^14.17.0",
29
- "@quenty/baseobject": "^10.8.0",
30
- "@quenty/binder": "^14.19.0",
31
- "@quenty/brio": "^14.17.0",
32
- "@quenty/clienttranslator": "^14.19.0",
33
- "@quenty/cmdrservice": "^13.22.0",
34
- "@quenty/color3utils": "^11.18.0",
35
- "@quenty/datastore": "^13.20.0",
36
- "@quenty/instanceutils": "^13.17.0",
37
- "@quenty/loader": "^10.8.0",
38
- "@quenty/localizedtextutils": "^12.17.0",
39
- "@quenty/maid": "^3.4.0",
40
- "@quenty/permissionprovider": "^14.19.0",
41
- "@quenty/playerbinder": "^14.19.0",
42
- "@quenty/playerutils": "^8.17.0",
43
- "@quenty/preferredparentutils": "^4.3.0",
44
- "@quenty/promise": "^10.10.1",
45
- "@quenty/remoting": "^12.18.0",
46
- "@quenty/richtext": "^1.3.0",
47
- "@quenty/rx": "^13.17.0",
48
- "@quenty/rxbinderutils": "^14.19.0",
49
- "@quenty/servicebag": "^11.11.1",
50
- "@quenty/signal": "^7.10.0",
51
- "@quenty/string": "^3.3.1",
52
- "@quenty/table": "^3.7.1",
53
- "@quenty/valueobject": "^13.17.0"
28
+ "@quenty/attributeutils": "14.17.2-canary.547.11ae689.0",
29
+ "@quenty/baseobject": "10.8.2-canary.547.11ae689.0",
30
+ "@quenty/binder": "14.19.2-canary.547.11ae689.0",
31
+ "@quenty/brio": "14.17.2-canary.547.11ae689.0",
32
+ "@quenty/clienttranslator": "14.19.2-canary.547.11ae689.0",
33
+ "@quenty/cmdrservice": "13.22.2-canary.547.11ae689.0",
34
+ "@quenty/color3utils": "11.18.2-canary.547.11ae689.0",
35
+ "@quenty/datastore": "13.20.2-canary.547.11ae689.0",
36
+ "@quenty/instanceutils": "13.17.2-canary.547.11ae689.0",
37
+ "@quenty/loader": "10.8.2-canary.547.11ae689.0",
38
+ "@quenty/localizedtextutils": "12.17.2-canary.547.11ae689.0",
39
+ "@quenty/maid": "3.4.2-canary.547.11ae689.0",
40
+ "@quenty/permissionprovider": "14.19.2-canary.547.11ae689.0",
41
+ "@quenty/playerbinder": "14.19.2-canary.547.11ae689.0",
42
+ "@quenty/playerutils": "8.17.2-canary.547.11ae689.0",
43
+ "@quenty/preferredparentutils": "4.3.2-canary.547.11ae689.0",
44
+ "@quenty/promise": "10.10.3-canary.547.11ae689.0",
45
+ "@quenty/remoting": "12.18.2-canary.547.11ae689.0",
46
+ "@quenty/richtext": "1.3.2-canary.547.11ae689.0",
47
+ "@quenty/rx": "13.17.2-canary.547.11ae689.0",
48
+ "@quenty/rxbinderutils": "14.19.2-canary.547.11ae689.0",
49
+ "@quenty/servicebag": "11.11.3-canary.547.11ae689.0",
50
+ "@quenty/signal": "7.10.2-canary.547.11ae689.0",
51
+ "@quenty/string": "3.3.3-canary.547.11ae689.0",
52
+ "@quenty/table": "3.7.3-canary.547.11ae689.0",
53
+ "@quenty/valueobject": "13.17.2-canary.547.11ae689.0"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"
57
57
  },
58
- "gitHead": "e8ea56930e65322fcffc05a1556d5df988068f0b"
58
+ "gitHead": "11ae6894c9c40c596e521dc1d2a71977af63752f"
59
59
  }
@@ -11,7 +11,7 @@ local ChatTagClient = setmetatable({}, ChatTagBase)
11
11
  ChatTagClient.ClassName = "ChatTagClient"
12
12
  ChatTagClient.__index = ChatTagClient
13
13
 
14
- function ChatTagClient.new(folder, serviceBag)
14
+ function ChatTagClient.new(folder: Folder, serviceBag)
15
15
  local self = setmetatable(ChatTagBase.new(folder), ChatTagClient)
16
16
 
17
17
  self._serviceBag = assert(serviceBag, "No serviceBag")
@@ -16,7 +16,7 @@ local HasChatTagsClient = setmetatable({}, HasChatTagsBase)
16
16
  HasChatTagsClient.ClassName = "HasChatTagsClient"
17
17
  HasChatTagsClient.__index = HasChatTagsClient
18
18
 
19
- function HasChatTagsClient.new(player, serviceBag)
19
+ function HasChatTagsClient.new(player: Player, serviceBag)
20
20
  local self = setmetatable(HasChatTagsBase.new(player), HasChatTagsClient)
21
21
 
22
22
  self._serviceBag = assert(serviceBag, "No serviceBag")
@@ -30,14 +30,14 @@ function HasChatTagsClient:GetChatTagBinder()
30
30
  return self._chatTagBinder
31
31
  end
32
32
 
33
- function HasChatTagsClient:GetAsRichText()
33
+ function HasChatTagsClient:GetAsRichText(): string?
34
34
  local lastChatTags = self._lastChatTags.Value
35
35
  if not (lastChatTags and #lastChatTags > 0) then
36
36
  return nil
37
37
  end
38
38
 
39
- local output = "<b>"
40
- for index, tagData in pairs(lastChatTags) do
39
+ local output: string = "<b>"
40
+ for index, tagData in lastChatTags do
41
41
  output = output .. string.format("<font color='%s'>", Color3Utils.toWebHexString(tagData.TagColor))
42
42
 
43
43
  local translatedText
@@ -12,11 +12,12 @@ local Maid = require("Maid")
12
12
  local Signal = require("Signal")
13
13
  local String = require("String")
14
14
  local TextChannelUtils = require("TextChannelUtils")
15
+ local _ServiceBag = require("ServiceBag")
15
16
 
16
17
  local ChatProviderServiceClient = {}
17
18
  ChatProviderServiceClient.ServiceName = "ChatProviderServiceClient"
18
19
 
19
- function ChatProviderServiceClient:Init(serviceBag)
20
+ function ChatProviderServiceClient:Init(serviceBag: _ServiceBag.ServiceBag)
20
21
  assert(not self._serviceBag, "Already initialized")
21
22
  self._serviceBag = assert(serviceBag, "No serviceBag")
22
23
  self._maid = Maid.new()
@@ -73,6 +74,8 @@ function ChatProviderServiceClient:Start()
73
74
 
74
75
  return properties
75
76
  end
77
+
78
+ return
76
79
  end
77
80
  end
78
81
 
@@ -10,17 +10,18 @@ local ChatTagCmdrUtils = require("ChatTagCmdrUtils")
10
10
  local Set = require("Set")
11
11
  local Maid = require("Maid")
12
12
  local String = require("String")
13
+ local _ServiceBag = require("ServiceBag")
13
14
 
14
15
  local ChatProviderCommandServiceClient = {}
15
16
  ChatProviderCommandServiceClient.ServiceName = "ChatProviderCommandServiceClient"
16
17
 
17
- function ChatProviderCommandServiceClient:Init(serviceBag)
18
+ function ChatProviderCommandServiceClient:Init(serviceBag: _ServiceBag.ServiceBag)
18
19
  assert(not self._serviceBag, "Already initialized")
19
20
  self._serviceBag = assert(serviceBag, "No serviceBag")
20
21
  self._maid = Maid.new()
21
22
 
22
23
  self._cmdrService = self._serviceBag:GetService(require("CmdrServiceClient"))
23
- self._chatProviderServiceClient = self._serviceBag:GetService(require("ChatProviderServiceClient"))
24
+ self._chatProviderServiceClient = self._serviceBag:GetService((require :: any)("ChatProviderServiceClient"))
24
25
  self._chatTagBinder = self._serviceBag:GetService(require("ChatTagClient"))
25
26
  end
26
27
 
@@ -11,7 +11,7 @@ local ChatTag = setmetatable({}, ChatTagBase)
11
11
  ChatTag.ClassName = "ChatTag"
12
12
  ChatTag.__index = ChatTag
13
13
 
14
- function ChatTag.new(folder, serviceBag)
14
+ function ChatTag.new(folder: Folder, serviceBag)
15
15
  local self = setmetatable(ChatTagBase.new(folder), ChatTag)
16
16
 
17
17
  self._serviceBag = assert(serviceBag, "No serviceBag")
@@ -22,7 +22,7 @@ function ChatTag.new(folder, serviceBag)
22
22
  return self
23
23
  end
24
24
 
25
- function ChatTag:_getPlayer()
25
+ function ChatTag:_getPlayer(): Player
26
26
  return self._obj:FindFirstAncestorWhichIsA("Player")
27
27
  end
28
28
 
@@ -4,8 +4,6 @@
4
4
 
5
5
  local require = require(script.Parent.loader).load(script)
6
6
 
7
- local ChatProviderService = require("ChatProviderService")
8
- local ChatTag = require("ChatTag")
9
7
  local ChatTagConstants = require("ChatTagConstants")
10
8
  local ChatTagDataUtils = require("ChatTagDataUtils")
11
9
  local HasChatTagsBase = require("HasChatTagsBase")
@@ -19,12 +17,12 @@ local HasChatTags = setmetatable({}, HasChatTagsBase)
19
17
  HasChatTags.ClassName = "HasChatTags"
20
18
  HasChatTags.__index = HasChatTags
21
19
 
22
- function HasChatTags.new(player, serviceBag)
20
+ function HasChatTags.new(player: Player, serviceBag)
23
21
  local self = setmetatable(HasChatTagsBase.new(player), HasChatTags)
24
22
 
25
23
  self._serviceBag = assert(serviceBag, "No serviceBag")
26
- self._chatProviderService = self._serviceBag:GetService(ChatProviderService)
27
- self._chatTagBinder = self._serviceBag:GetService(ChatTag)
24
+ self._chatProviderService = self._serviceBag:GetService((require :: any)("ChatProviderService"))
25
+ self._chatTagBinder = self._serviceBag:GetService(require("ChatTag"))
28
26
 
29
27
  self._chatTagsContainer = Instance.new("Folder")
30
28
  self._chatTagsContainer.Name = HasChatTagsConstants.TAG_CONTAINER_NAME
@@ -49,7 +47,7 @@ end
49
47
 
50
48
  @param chatTagData ChatTagData
51
49
  ]=]
52
- function HasChatTags:AddChatTag(chatTagData)
50
+ function HasChatTags:AddChatTag(chatTagData: ChatTagDataUtils.ChatTagData)
53
51
  assert(ChatTagDataUtils.isChatTagData(chatTagData), "Bad chatTagData")
54
52
 
55
53
  local tag = self._chatTagBinder:Create("Folder")
@@ -60,7 +58,10 @@ function HasChatTags:AddChatTag(chatTagData)
60
58
  tag:SetAttribute(ChatTagConstants.TAG_PRIORITY_ATTRIBUTE, chatTagData.TagPriority)
61
59
 
62
60
  if chatTagData.TagLocalizedText then
63
- tag:SetAttribute(ChatTagConstants.TAG_LOCALIZED_TEXT_ATTRIBUTE, LocalizedTextUtils.toJSON(chatTagData.TagLocalizedText))
61
+ tag:SetAttribute(
62
+ ChatTagConstants.TAG_LOCALIZED_TEXT_ATTRIBUTE,
63
+ LocalizedTextUtils.toJSON(chatTagData.TagLocalizedText)
64
+ )
64
65
  end
65
66
 
66
67
  tag.Parent = self._chatTagsContainer
@@ -68,10 +69,10 @@ function HasChatTags:AddChatTag(chatTagData)
68
69
  return tag
69
70
  end
70
71
 
71
- function HasChatTags:GetChatTagByKey(chatTagKey)
72
+ function HasChatTags:GetChatTagByKey(chatTagKey: string): ChatTagDataUtils.ChatTagData?
72
73
  assert(type(chatTagKey) == "string", "Bad chatTagKey")
73
74
 
74
- for _, item in pairs(BinderUtils.getChildren(self._chatTagBinder, self._chatTagsContainer)) do
75
+ for _, item in BinderUtils.getChildren(self._chatTagBinder, self._chatTagsContainer) do
75
76
  if item.ChatTagKey.Value == chatTagKey then
76
77
  return item
77
78
  end
@@ -84,7 +85,7 @@ end
84
85
  Removes all chat tags from the player
85
86
  ]=]
86
87
  function HasChatTags:ClearTags()
87
- for _, item in pairs(self._chatTagsContainer:GetChildren()) do
88
+ for _, item in self._chatTagsContainer:GetChildren() do
88
89
  if self._chatTagBinder:Get(item) then
89
90
  item:Destroy()
90
91
  end
@@ -17,11 +17,14 @@ local Promise = require("Promise")
17
17
  local Rx = require("Rx")
18
18
  local RxBrioUtils = require("RxBrioUtils")
19
19
  local Signal = require("Signal")
20
+ local _Observable = require("Observable")
21
+ local _Brio = require("Brio")
22
+ local _ServiceBag = require("ServiceBag")
20
23
 
21
24
  local ChatProviderService = {}
22
25
  ChatProviderService.ServiceName = "ChatProviderService"
23
26
 
24
- function ChatProviderService:Init(serviceBag)
27
+ function ChatProviderService:Init(serviceBag: _ServiceBag.ServiceBag)
25
28
  self._serviceBag = assert(serviceBag, "No serviceBag")
26
29
  self._maid = Maid.new()
27
30
 
@@ -34,7 +37,7 @@ function ChatProviderService:Init(serviceBag)
34
37
  self._serviceBag:GetService(require("PlayerDataStoreService"))
35
38
 
36
39
  -- Internal
37
- self._serviceBag:GetService(require("ChatProviderCommandService"))
40
+ self._serviceBag:GetService((require :: any)("ChatProviderCommandService"))
38
41
  self._serviceBag:GetService(require("ChatProviderTranslator"))
39
42
 
40
43
  -- Binders
@@ -57,7 +60,7 @@ function ChatProviderService:Init(serviceBag)
57
60
  }))
58
61
  end
59
62
 
60
- function ChatProviderService:AddChatCommand(textChatCommand)
63
+ function ChatProviderService:AddChatCommand(textChatCommand: TextChatCommand)
61
64
  assert(typeof(textChatCommand) == "Instance", "Bad textChatCommand")
62
65
 
63
66
  textChatCommand.Parent = PreferredParentUtils.getPreferredParent(TextChatService, "ChatProviderCommands")
@@ -66,10 +69,10 @@ end
66
69
  --[=[
67
70
  Sets the developer chat tag
68
71
 
69
- @param chatTagData ChatTagData | nil
72
+ @param chatTagData ChatTagData?
70
73
  @return Maid
71
74
  ]=]
72
- function ChatProviderService:SetDeveloperTag(chatTagData)
75
+ function ChatProviderService:SetDeveloperTag(chatTagData: ChatTagDataUtils.ChatTagData)
73
76
  assert(ChatTagDataUtils.isChatTagData(chatTagData) or chatTagData == nil, "Bad chatTagData")
74
77
 
75
78
  if chatTagData then
@@ -85,16 +88,16 @@ end
85
88
  --[=[
86
89
  Sets the admin tag to the game
87
90
 
88
- @param chatTagData ChatTagData | nil
91
+ @param chatTagData ChatTagData?
89
92
  @return Maid
90
93
  ]=]
91
- function ChatProviderService:SetAdminTag(chatTagData)
94
+ function ChatProviderService:SetAdminTag(chatTagData: ChatTagDataUtils.ChatTagData?)
92
95
  assert(ChatTagDataUtils.isChatTagData(chatTagData) or chatTagData == nil, "Bad chatTagData")
93
96
 
94
97
  if chatTagData then
95
98
  local permissionService = self._serviceBag:GetService(require("PermissionService"))
96
99
  local observeBrio = permissionService:ObservePermissionedPlayersBrio(PermissionLevel.ADMIN):Pipe({
97
- RxBrioUtils.flatMapBrio(function(player)
100
+ RxBrioUtils.flatMapBrio(function(player: Player)
98
101
  return Rx.fromPromise(permissionService:PromiseIsPermissionLevel(player, PermissionLevel.CREATOR))
99
102
  :Pipe({
100
103
  Rx.switchMap(function(isAlsoCreator)
@@ -114,7 +117,10 @@ function ChatProviderService:SetAdminTag(chatTagData)
114
117
  end
115
118
  end
116
119
 
117
- function ChatProviderService:_addObservablePlayerTag(observePlayersBrio, chatTagData)
120
+ function ChatProviderService:_addObservablePlayerTag(
121
+ observePlayersBrio: _Observable.Observable<_Brio.Brio<Player>>,
122
+ chatTagData: ChatTagDataUtils.ChatTagData
123
+ )
118
124
  assert(ChatTagDataUtils.isChatTagData(chatTagData), "Bad chatTagData")
119
125
 
120
126
  local topMaid = Maid.new()
@@ -146,7 +152,10 @@ end
146
152
  @param chatTagData ChatTagData
147
153
  @return Promise<Instance>
148
154
  ]=]
149
- function ChatProviderService:PromiseAddChatTag(player, chatTagData)
155
+ function ChatProviderService:PromiseAddChatTag(
156
+ player: Player,
157
+ chatTagData: ChatTagDataUtils.ChatTagData
158
+ ): Promise.Promise<Instance>
150
159
  assert(typeof(player) == "Instance" and player:IsA("Player"), "Bad player")
151
160
  assert(ChatTagDataUtils.isChatTagData(chatTagData), "Bad chatTagData")
152
161
 
@@ -178,14 +187,18 @@ end
178
187
 
179
188
  @param speakerName string
180
189
  @param chatTagDataList { ChatTagData }
190
+ @return Promise
181
191
  ]=]
182
- function ChatProviderService:PromiseSetSpeakerTags(speakerName, chatTagDataList)
192
+ function ChatProviderService:PromiseSetSpeakerTags(
193
+ speakerName: string,
194
+ chatTagDataList: { ChatTagDataUtils.ChatTagData }
195
+ ): Promise.Promise<()>
183
196
  assert(type(speakerName) == "string", "Bad speakerName")
184
197
  assert(ChatTagDataUtils.isChatTagDataList(chatTagDataList))
185
198
 
186
199
  return self:_promiseSpeaker(speakerName):Then(function(speaker)
187
200
  if not speaker then
188
- return nil
201
+ return
189
202
  end
190
203
 
191
204
  speaker:SetExtraData("Tags", chatTagDataList)
@@ -211,7 +224,7 @@ function ChatProviderService:_getChatServiceAsync()
211
224
  return self._chatService
212
225
  end
213
226
 
214
- function ChatProviderService:_promiseChatService()
227
+ function ChatProviderService:_promiseChatService(): Promise.Promise<any>
215
228
  if self._chatService then
216
229
  return Promise.resolved(self._chatService)
217
230
  end
@@ -227,7 +240,7 @@ function ChatProviderService:_promiseChatService()
227
240
  return Promise.resolved(self._chatServicePromise)
228
241
  end
229
242
 
230
- function ChatProviderService:_promiseSpeaker(speakerName)
243
+ function ChatProviderService:_promiseSpeaker(speakerName: string)
231
244
  assert(type(speakerName) == "string", "Bad speakerName")
232
245
 
233
246
  return self:_promiseChatService():Then(function(chatService)
@@ -11,11 +11,12 @@ local ChatTagDataUtils = require("ChatTagDataUtils")
11
11
  local PlayerUtils = require("PlayerUtils")
12
12
  local Set = require("Set")
13
13
  local Maid = require("Maid")
14
+ local _ServiceBag = require("ServiceBag")
14
15
 
15
16
  local ChatProviderCommandService = {}
16
17
  ChatProviderCommandService.ServiceName = "ChatProviderCommandService"
17
18
 
18
- function ChatProviderCommandService:Init(serviceBag)
19
+ function ChatProviderCommandService:Init(serviceBag: _ServiceBag.ServiceBag)
19
20
  assert(not self._serviceBag, "Already initialized")
20
21
  self._serviceBag = assert(serviceBag, "No serviceBag")
21
22
  self._maid = Maid.new()
@@ -25,7 +26,7 @@ function ChatProviderCommandService:Init(serviceBag)
25
26
  self._permissionService = self._serviceBag:GetService(require("PermissionService"))
26
27
 
27
28
  -- Internal
28
- self._chatProviderService = self._serviceBag:GetService(require("ChatProviderService"))
29
+ self._chatProviderService = self._serviceBag:GetService((require :: any)("ChatProviderService"))
29
30
  self._chatTagBinder = self._serviceBag:GetService(require("ChatTag"))
30
31
  self._hasChatTagsBinder = self._serviceBag:GetService(require("HasChatTags"))
31
32
  end
@@ -14,7 +14,7 @@ local ChatTagBase = setmetatable({}, BaseObject)
14
14
  ChatTagBase.ClassName = "ChatTagBase"
15
15
  ChatTagBase.__index = ChatTagBase
16
16
 
17
- function ChatTagBase.new(obj)
17
+ function ChatTagBase.new(obj: Folder)
18
18
  local self = setmetatable(BaseObject.new(obj), ChatTagBase)
19
19
 
20
20
  self._chatTagText = AttributeValue.new(self._obj, ChatTagConstants.TAG_TEXT_ATTRIBUTE, "")
@@ -38,7 +38,7 @@ function ChatTagBase:ObserveChatTagData()
38
38
  return LocalizedTextUtils.fromJSON(text)
39
39
  else
40
40
  return nil
41
- end;
41
+ end
42
42
  end);
43
43
  });
44
44
  TagColor = self._chatTagColor:Observe();
@@ -15,7 +15,7 @@ local HasChatTagsBase = setmetatable({}, BaseObject)
15
15
  HasChatTagsBase.ClassName = "HasChatTagsBase"
16
16
  HasChatTagsBase.__index = HasChatTagsBase
17
17
 
18
- function HasChatTagsBase.new(player)
18
+ function HasChatTagsBase.new(player: Player)
19
19
  local self = setmetatable(BaseObject.new(player), HasChatTagsBase)
20
20
 
21
21
  self._lastChatTags = self._maid:Add(ValueObject.new(nil))
@@ -65,7 +65,7 @@ function HasChatTagsBase:_observeTagDataListBrio()
65
65
 
66
66
  return RxInstanceUtils.observeLastNamedChildBrio(self._obj, "Folder", HasChatTagsConstants.TAG_CONTAINER_NAME):Pipe({
67
67
  RxBrioUtils.switchMapBrio(function(child)
68
- return RxBinderUtils.observeChildrenBrio(chatTagBinder, child);
68
+ return RxBinderUtils.observeChildrenBrio(chatTagBinder, child)
69
69
  end);
70
70
  RxBrioUtils.flatMapBrio(function(chatTag)
71
71
  return chatTag:ObserveChatTagData():Pipe({
@@ -8,13 +8,20 @@ local LocalizedTextUtils = require("LocalizedTextUtils")
8
8
 
9
9
  local ChatTagDataUtils = {}
10
10
 
11
+ export type ChatTagData = {
12
+ TagText: string,
13
+ TagPriority: number,
14
+ TagLocalizedText: LocalizedTextUtils.LocalizedTextData?,
15
+ TagColor: Color3,
16
+ }
17
+
11
18
  --[=[
12
19
  Creates new chat tag data
13
20
 
14
21
  @param data ChatTagData
15
22
  @return ChatTagData
16
23
  ]=]
17
- function ChatTagDataUtils.createChatTagData(data)
24
+ function ChatTagDataUtils.createChatTagData(data: ChatTagData): ChatTagData
18
25
  assert(ChatTagDataUtils.isChatTagData(data), "Bad data")
19
26
 
20
27
  return data
@@ -27,18 +34,18 @@ end
27
34
  @return boolean
28
35
  @return string -- reason why
29
36
  ]=]
30
- function ChatTagDataUtils.isChatTagDataList(data)
37
+ function ChatTagDataUtils.isChatTagDataList(data: any): (boolean, string?)
31
38
  if type(data) ~= "table" then
32
39
  return false, "not a table"
33
40
  end
34
41
 
35
- for _, item in pairs(data) do
42
+ for _, item in data do
36
43
  if not ChatTagDataUtils.isChatTagData(item) then
37
44
  return false, "Bad tag data"
38
45
  end
39
46
  end
40
47
 
41
- return true
48
+ return true, nil
42
49
  end
43
50
 
44
51
  --[=[
@@ -47,7 +54,7 @@ end
47
54
  @param data any
48
55
  @return boolean
49
56
  ]=]
50
- function ChatTagDataUtils.isChatTagData(data)
57
+ function ChatTagDataUtils.isChatTagData(data: any): boolean
51
58
  return type(data) == "table"
52
59
  and type(data.TagText) == "string"
53
60
  and type(data.TagPriority) == "number"
@@ -1,28 +1,32 @@
1
+ --!strict
1
2
  --[=[
2
3
  Utility functions for querying text channels.
3
4
  @class TextChannelUtils
4
5
  ]=]
5
6
 
6
- local require = require(script.Parent.loader).load(script)
7
-
8
7
  local TextChatService = game:GetService("TextChatService")
9
8
 
10
9
  local TextChannelUtils = {}
11
10
 
12
- function TextChannelUtils.getDefaultTextChannel()
11
+ function TextChannelUtils.getDefaultTextChannel(): TextChannel?
13
12
  return TextChannelUtils.getTextChannel("RBXGeneral")
14
13
  end
15
14
 
16
- function TextChannelUtils.getTextChannel(channelName: string)
15
+ function TextChannelUtils.getTextChannel(channelName: string): TextChannel?
17
16
  local channels = TextChannelUtils.getTextChannels()
18
- if not channels then
19
- return
17
+ if channels == nil then
18
+ return nil
19
+ end
20
+
21
+ local found = channels:FindFirstChild(channelName)
22
+ if found == nil or not found:IsA("TextChannel") then
23
+ return nil
20
24
  end
21
25
 
22
- return channels:FindFirstChild(channelName)
26
+ return found
23
27
  end
24
28
 
25
- function TextChannelUtils.getTextChannels()
29
+ function TextChannelUtils.getTextChannels(): Instance?
26
30
  return TextChatService:FindFirstChild("TextChannels")
27
31
  end
28
32