@quenty/grouputils 3.2.0 → 3.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 +8 -0
- package/package.json +2 -2
- package/src/Shared/GroupUtils.lua +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
# [3.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/grouputils@3.2.0...@quenty/grouputils@3.3.0) (2021-11-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/grouputils
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [3.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/grouputils@3.1.2...@quenty/grouputils@3.2.0) (2021-11-20)
|
|
7
15
|
|
|
8
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/grouputils",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Group utility functions for Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "4b7d1e041ef0aa63af33ca36459ea016d6c2b139"
|
|
36
36
|
}
|
|
@@ -32,6 +32,28 @@ function GroupUtils.promiseRankInGroup(player, groupId)
|
|
|
32
32
|
end)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
function GroupUtils.promiseRoleInGroup(player, groupId)
|
|
36
|
+
assert(typeof(player) == "Instance" and player:IsA("Player"), "Bad player")
|
|
37
|
+
assert(type(groupId) == "number", "Bad groupId")
|
|
38
|
+
|
|
39
|
+
return Promise.spawn(function(resolve, reject)
|
|
40
|
+
local role = nil
|
|
41
|
+
local ok, err = pcall(function()
|
|
42
|
+
role = player:GetRoleInGroup(groupId)
|
|
43
|
+
end)
|
|
44
|
+
|
|
45
|
+
if not ok then
|
|
46
|
+
return reject(err)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
if type(role) ~= "string" then
|
|
50
|
+
return reject("Role is not a string")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
return resolve(role)
|
|
54
|
+
end)
|
|
55
|
+
end
|
|
56
|
+
|
|
35
57
|
function GroupUtils.promiseGroupInfo(groupId)
|
|
36
58
|
assert(groupId, "Bad groupId")
|
|
37
59
|
|