@quenty/badgeutils 7.0.0 → 7.1.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 +4 -4
- package/src/Shared/BadgeUtils.lua +28 -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
|
+
# [7.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/badgeutils@7.0.0...@quenty/badgeutils@7.1.0) (2023-12-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add BadgeUtils.promiseUserHasBadge(userId, badgeId) ([bd46efc](https://github.com/Quenty/NevermoreEngine/commit/bd46efc830942ec91a24a45b4244f3ee94d0934a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [7.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/badgeutils@6.8.0...@quenty/badgeutils@7.0.0) (2023-10-11)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/badgeutils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/badgeutils",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Utility functions involving badges on Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/loader": "^7.
|
|
29
|
-
"@quenty/promise": "^7.
|
|
28
|
+
"@quenty/loader": "^7.1.0",
|
|
29
|
+
"@quenty/promise": "^7.1.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "2c2dbbc0cb2fbb46b4f3270c559c63890fe18b26"
|
|
35
35
|
}
|
|
@@ -71,4 +71,32 @@ function BadgeUtils.promiseBadgeInfo(badgeId)
|
|
|
71
71
|
end)
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
+
--[=[
|
|
75
|
+
Returns true if the uesr has the badge
|
|
76
|
+
|
|
77
|
+
@param userId number
|
|
78
|
+
@param badgeId number
|
|
79
|
+
@return Promise<BadgeInfoDictionary>
|
|
80
|
+
]=]
|
|
81
|
+
function BadgeUtils.promiseUserHasBadge(userId, badgeId)
|
|
82
|
+
assert(type(userId) == "number", "Bad userId")
|
|
83
|
+
assert(type(badgeId) == "number", "Bad badgeId")
|
|
84
|
+
|
|
85
|
+
return Promise.spawn(function(resolve, reject)
|
|
86
|
+
local result
|
|
87
|
+
local ok, err = pcall(function()
|
|
88
|
+
result = BadgeService:UserHasBadgeAsync(userId, badgeId)
|
|
89
|
+
end)
|
|
90
|
+
|
|
91
|
+
if not ok then
|
|
92
|
+
return reject(err)
|
|
93
|
+
end
|
|
94
|
+
if type(result) ~= "boolean" then
|
|
95
|
+
return reject("Failed to get a boolean from UserHasBadgeAsync")
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
return resolve(result)
|
|
99
|
+
end)
|
|
100
|
+
end
|
|
101
|
+
|
|
74
102
|
return BadgeUtils
|