@quenty/playerthumbnailutils 3.2.0 → 3.3.1-canary.7d62582.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 +19 -0
- package/LICENSE.md +1 -1
- package/package.json +4 -4
- package/src/Shared/PlayerThumbnailUtils.lua +30 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.1-canary.7d62582.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerthumbnailutils@3.3.0...@quenty/playerthumbnailutils@3.3.1-canary.7d62582.0) (2021-12-18)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/playerthumbnailutils
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerthumbnailutils@3.2.0...@quenty/playerthumbnailutils@3.3.0) (2021-12-14)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* Add PlayerThumbnailUtils.promiseUserName(userId) ([42a2ed7](https://github.com/Quenty/NevermoreEngine/commit/42a2ed77649d397f37e8d7eb6f20e9e3f77ec5f8))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [3.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerthumbnailutils@3.1.2...@quenty/playerthumbnailutils@3.2.0) (2021-11-20)
|
|
7
26
|
|
|
8
27
|
|
package/LICENSE.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/playerthumbnailutils",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1-canary.7d62582.0",
|
|
4
4
|
"description": "Reimplementation of Player:GetUserThumbnailAsync but as a promise with retry logic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/loader": "
|
|
29
|
-
"@quenty/promise": "
|
|
28
|
+
"@quenty/loader": "3.1.1",
|
|
29
|
+
"@quenty/promise": "3.2.1-canary.7d62582.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "7d625829eb771b307f589dacdc9060ad3ba1d531"
|
|
35
35
|
}
|
|
@@ -44,4 +44,34 @@ function PlayerThumbnailUtils.promiseUserThumbnail(userId, thumbnailType, thumbn
|
|
|
44
44
|
return promise
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
function PlayerThumbnailUtils.promiseUserName(userId)
|
|
48
|
+
assert(type(userId) == "number", "Bad userId")
|
|
49
|
+
|
|
50
|
+
local promise
|
|
51
|
+
promise = Promise.spawn(function(resolve, reject)
|
|
52
|
+
local tries = 0
|
|
53
|
+
repeat
|
|
54
|
+
tries = tries + 1
|
|
55
|
+
local name
|
|
56
|
+
local ok, err = pcall(function()
|
|
57
|
+
name = Players:GetNameFromUserIdAsync(userId)
|
|
58
|
+
end)
|
|
59
|
+
|
|
60
|
+
-- Don't retry if we immediately error (timeout exceptions!)
|
|
61
|
+
if not ok then
|
|
62
|
+
return reject(err)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
if type(name) == "string" then
|
|
66
|
+
return resolve(name)
|
|
67
|
+
else
|
|
68
|
+
task.wait(0.05)
|
|
69
|
+
end
|
|
70
|
+
until tries >= MAX_TRIES or (not promise:IsPending())
|
|
71
|
+
reject()
|
|
72
|
+
end)
|
|
73
|
+
|
|
74
|
+
return promise
|
|
75
|
+
end
|
|
76
|
+
|
|
47
77
|
return PlayerThumbnailUtils
|