@quenty/chatproviderservice 9.18.1-canary.520.20071a8.0 → 9.18.1-canary.520.f23602e.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,14 +3,12 @@
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)
6
+ ## [9.18.1-canary.520.f23602e.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/chatproviderservice@9.18.0...@quenty/chatproviderservice@9.18.1-canary.520.f23602e.0) (2024-11-14)
7
7
 
8
8
 
9
9
  ### Bug Fixes
10
10
 
11
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
12
 
15
13
 
16
14
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/chatproviderservice",
3
- "version": "9.18.1-canary.520.20071a8.0",
3
+ "version": "9.18.1-canary.520.f23602e.0",
4
4
  "description": "Provide wrapper around chat system to allow tags to be set",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -55,5 +55,5 @@
55
55
  "publishConfig": {
56
56
  "access": "public"
57
57
  },
58
- "gitHead": "20071a874fd7dbe733fdc116789fa8993ef0a405"
58
+ "gitHead": "f23602e73a41ce4135ca18bc4ab7f01e935b2cab"
59
59
  }
@@ -4,9 +4,8 @@
4
4
 
5
5
  local require = require(script.Parent.loader).load(script)
6
6
 
7
- local HttpService = game:GetService("HttpService")
8
- local Players = game:GetService("Players")
9
7
  local TextChatService = game:GetService("TextChatService")
8
+ local Players = game:GetService("Players")
10
9
 
11
10
  local Maid = require("Maid")
12
11
  local Signal = require("Signal")
@@ -39,22 +38,12 @@ function ChatProviderServiceClient:Start()
39
38
 
40
39
  local metadata = textChatMessage.Metadata
41
40
  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
41
+ local isValidColor = Color3.fromHex(metadata)
42
+ if isValidColor then
43
+ local overrideProperties = Instance.new("TextChatMessageProperties")
44
+ overrideProperties.Text = `<font color="#{metadata}">{textChatMessage.Text}</font>`
45
+
46
+ return overrideProperties
58
47
  end
59
48
  end
60
49
 
@@ -75,32 +64,12 @@ function ChatProviderServiceClient:Start()
75
64
  end
76
65
  end
77
66
 
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?)
67
+ function ChatProviderServiceClient:SendSystemMessage(channel: TextChannel, message: string, color: Color3?)
68
+ assert(typeof(channel) == "Instance" and channel.ClassName == "TextChannel", "[ChatProviderServiceClient.SendSystemMessage] - Bad channel")
84
69
  assert(typeof(message) == "string", "[ChatProviderServiceClient.SendSystemMessage] - Bad message")
70
+ assert(typeof(color) == "Color3" or color == nil, "[ChatProviderServiceClient.SendSystemMessage] - Bad color")
85
71
 
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)
72
+ channel:DisplaySystemMessage(message, color and color:ToHex())
104
73
  end
105
74
 
106
75
  function ChatProviderServiceClient:_renderTags(textSource)