@quenty/chatproviderservice 9.18.0 → 9.18.1-canary.520.20071a8.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,24 @@
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.18.1-canary.520.20071a8.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/chatproviderservice@9.18.0...@quenty/chatproviderservice@9.18.1-canary.520.20071a8.0) (2024-11-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Create properties from metadata instead of caching ([f23602e](https://github.com/Quenty/NevermoreEngine/commit/f23602e73a41ce4135ca18bc4ab7f01e935b2cab))
12
+ * pcall metadata in case it isn't a hex color ([0c6df93](https://github.com/Quenty/NevermoreEngine/commit/0c6df93f4e611dcdcf8c1fde454ee4bf7fa43ef0))
13
+ * Take encoded message data as parameter + make channel optional ([20071a8](https://github.com/Quenty/NevermoreEngine/commit/20071a874fd7dbe733fdc116789fa8993ef0a405))
14
+
15
+
16
+ ### Features
17
+
18
+ * Add way to send system messages ([4db9577](https://github.com/Quenty/NevermoreEngine/commit/4db95775860f06b6e4cd9793c6a0e6457a27a0e1))
19
+
20
+
21
+
22
+
23
+
6
24
  # [9.18.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/chatproviderservice@9.17.0...@quenty/chatproviderservice@9.18.0) (2024-11-13)
7
25
 
8
26
  **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": "9.18.0",
3
+ "version": "9.18.1-canary.520.20071a8.0",
4
4
  "description": "Provide wrapper around chat system to allow tags to be set",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,34 +25,35 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/attributeutils": "^14.13.0",
29
- "@quenty/baseobject": "^10.7.1",
30
- "@quenty/binder": "^14.15.0",
31
- "@quenty/brio": "^14.13.0",
32
- "@quenty/clienttranslator": "^14.14.0",
33
- "@quenty/cmdrservice": "^13.16.0",
34
- "@quenty/color3utils": "^11.13.0",
35
- "@quenty/datastore": "^13.16.0",
36
- "@quenty/instanceutils": "^13.13.0",
37
- "@quenty/loader": "^10.7.1",
38
- "@quenty/localizedtextutils": "^12.13.0",
39
- "@quenty/maid": "^3.4.0",
40
- "@quenty/permissionprovider": "^14.15.0",
41
- "@quenty/playerbinder": "^14.15.0",
42
- "@quenty/playerutils": "^8.13.0",
43
- "@quenty/preferredparentutils": "^4.3.0",
44
- "@quenty/promise": "^10.8.0",
45
- "@quenty/richtext": "^1.3.0",
46
- "@quenty/rx": "^13.13.0",
47
- "@quenty/rxbinderutils": "^14.15.0",
48
- "@quenty/servicebag": "^11.10.0",
49
- "@quenty/signal": "^7.9.0",
50
- "@quenty/string": "^3.3.0",
51
- "@quenty/table": "^3.7.0",
52
- "@quenty/valueobject": "^13.13.0"
28
+ "@quenty/attributeutils": "14.13.0",
29
+ "@quenty/baseobject": "10.7.1",
30
+ "@quenty/binder": "14.15.0",
31
+ "@quenty/brio": "14.13.0",
32
+ "@quenty/clienttranslator": "14.14.0",
33
+ "@quenty/cmdrservice": "13.16.0",
34
+ "@quenty/color3utils": "11.13.0",
35
+ "@quenty/datastore": "13.16.0",
36
+ "@quenty/instanceutils": "13.13.0",
37
+ "@quenty/loader": "10.7.1",
38
+ "@quenty/localizedtextutils": "12.13.0",
39
+ "@quenty/maid": "3.4.0",
40
+ "@quenty/permissionprovider": "14.15.0",
41
+ "@quenty/playerbinder": "14.15.0",
42
+ "@quenty/playerutils": "8.13.0",
43
+ "@quenty/preferredparentutils": "4.3.0",
44
+ "@quenty/promise": "10.8.0",
45
+ "@quenty/remoting": "12.14.0",
46
+ "@quenty/richtext": "1.3.0",
47
+ "@quenty/rx": "13.13.0",
48
+ "@quenty/rxbinderutils": "14.15.0",
49
+ "@quenty/servicebag": "11.10.0",
50
+ "@quenty/signal": "7.9.0",
51
+ "@quenty/string": "3.3.0",
52
+ "@quenty/table": "3.7.0",
53
+ "@quenty/valueobject": "13.13.0"
53
54
  },
54
55
  "publishConfig": {
55
56
  "access": "public"
56
57
  },
57
- "gitHead": "451334becfa36a10b55fa53cbdd88091cdf9ddbf"
58
+ "gitHead": "20071a874fd7dbe733fdc116789fa8993ef0a405"
58
59
  }
@@ -4,8 +4,9 @@
4
4
 
5
5
  local require = require(script.Parent.loader).load(script)
6
6
 
7
- local TextChatService = game:GetService("TextChatService")
7
+ local HttpService = game:GetService("HttpService")
8
8
  local Players = game:GetService("Players")
9
+ local TextChatService = game:GetService("TextChatService")
9
10
 
10
11
  local Maid = require("Maid")
11
12
  local Signal = require("Signal")
@@ -36,6 +37,27 @@ function ChatProviderServiceClient:Start()
36
37
  TextChatService.OnIncomingMessage = function(textChatMessage)
37
38
  self.MessageIncoming:Fire(textChatMessage)
38
39
 
40
+ local metadata = textChatMessage.Metadata
41
+ if metadata then
42
+ local success, decodedMessageData = pcall(function()
43
+ return HttpService:JSONDecode(metadata)
44
+ end)
45
+
46
+ if success and decodedMessageData then
47
+ local color = decodedMessageData.Color or "#ffffff"
48
+ local isValidHex = pcall(function()
49
+ return Color3.fromHex(color)
50
+ end)
51
+
52
+ if isValidHex then
53
+ local overrideProperties = Instance.new("TextChatMessageProperties")
54
+ overrideProperties.Text = `<font color="#{color}">{textChatMessage.Text}</font>`
55
+
56
+ return overrideProperties
57
+ end
58
+ end
59
+ end
60
+
39
61
  local textSource = textChatMessage.TextSource
40
62
  if not textSource then
41
63
  return
@@ -53,6 +75,34 @@ function ChatProviderServiceClient:Start()
53
75
  end
54
76
  end
55
77
 
78
+ --[=[
79
+ Sends a system message to the provided TextChannel.
80
+ @param encodedMessageData string
81
+ @param channel TextChannel?
82
+ ]=]
83
+ function ChatProviderServiceClient:SendSystemMessage(message: string, encodedMessageData: string?, channel: TextChannel?)
84
+ assert(typeof(message) == "string", "[ChatProviderServiceClient.SendSystemMessage] - Bad message")
85
+
86
+ if not channel then
87
+ local channels = TextChatService:FindFirstChild("TextChannels")
88
+ if not channels then
89
+ return
90
+ end
91
+
92
+ local general = channels:FindFirstChild("RBXGeneral")
93
+ if general then
94
+ channel = general
95
+ end
96
+ end
97
+
98
+ if not channel then
99
+ warn("[ChatProviderServiceClient.SendSystemMessage] - Failed to get default channel")
100
+ return
101
+ end
102
+
103
+ channel:DisplaySystemMessage(message, encodedMessageData)
104
+ end
105
+
56
106
  function ChatProviderServiceClient:_renderTags(textSource)
57
107
  local player = Players:GetPlayerByUserId(textSource.UserId)
58
108
  if not player then