noblox.js-middleware 0.0.1-security → 4.6.9
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of noblox.js-middleware might be problematic. Click here for more details.
- package/.eslintrc.js +21 -0
- package/.github/FUNDING.yml +3 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
- package/.github/workflows/doc-publish.yml +33 -0
- package/.github/workflows/npmpublish.yml +70 -0
- package/.travis.yml +13 -0
- package/CODE_OF_CONDUCT.md +76 -0
- package/LICENSE +21 -0
- package/README.md +166 -3
- package/examples/cleanPlayers.js +130 -0
- package/examples/cleanWall.js +110 -0
- package/examples/revertRanks.js +100 -0
- package/examples/savePlayers.js +119 -0
- package/examples/saveWall.js +96 -0
- package/img/moderatedThumbnails/moderatedThumbnail_100x100.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_110x110.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_140x140.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_150x150.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_150x200.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_180x180.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_250x250.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_30x30.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_352x352.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_420x420.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_48x48.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_50x50.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_60x60.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_720x720.png +0 -0
- package/img/moderatedThumbnails/moderatedThumbnail_75x75.png +0 -0
- package/img/noblox-js-small.png +0 -0
- package/img/noblox-js.png +0 -0
- package/img/thumbnailSizes.png +0 -0
- package/jsDocsConfig.json +55 -0
- package/lib/accountinformation/getUserSocialLinks.js +42 -0
- package/lib/accountsettings/block.js +58 -0
- package/lib/accountsettings/unblock.js +58 -0
- package/lib/asset/deleteFromInventory.js +69 -0
- package/lib/asset/getGamePassProductInfo.js +51 -0
- package/lib/asset/getProductInfo.js +56 -0
- package/lib/asset/uploadAnimation.js +103 -0
- package/lib/asset/uploadItem.js +83 -0
- package/lib/asset/uploadModel.js +90 -0
- package/lib/avatar/avatarRules.js +38 -0
- package/lib/avatar/currentlyWearing.js +32 -0
- package/lib/avatar/getAvatar.js +35 -0
- package/lib/avatar/getCurrentAvatar.js +37 -0
- package/lib/avatar/getRecentItems.js +37 -0
- package/lib/avatar/outfitDetails.js +32 -0
- package/lib/avatar/outfits.js +37 -0
- package/lib/avatar/redrawAvatar.js +48 -0
- package/lib/avatar/removeAssetId.js +55 -0
- package/lib/avatar/setAvatarBodyColors.js +60 -0
- package/lib/avatar/setAvatarScales.js +60 -0
- package/lib/avatar/setPlayerAvatarType.js +50 -0
- package/lib/avatar/setWearingAssets.js +50 -0
- package/lib/avatar/wearAssetId.js +55 -0
- package/lib/badges/getAwardedTimestamps.js +52 -0
- package/lib/badges/getBadgeInfo.js +43 -0
- package/lib/badges/getGameBadges.js +62 -0
- package/lib/badges/getPlayerBadges.js +28 -0
- package/lib/badges/updateBadgeInfo.js +80 -0
- package/lib/cache/add.js +14 -0
- package/lib/cache/addIf.js +26 -0
- package/lib/cache/clear.js +8 -0
- package/lib/cache/get.js +28 -0
- package/lib/cache/index.js +17 -0
- package/lib/cache/new.js +12 -0
- package/lib/cache/wrap.js +25 -0
- package/lib/chat/addUsersToConversation.js +61 -0
- package/lib/chat/chatSettings.js +33 -0
- package/lib/chat/getChatMessages.js +40 -0
- package/lib/chat/getConversations.js +43 -0
- package/lib/chat/getRolloutSettings.js +35 -0
- package/lib/chat/getUnreadConversationCount.js +33 -0
- package/lib/chat/getUnreadMessages.js +38 -0
- package/lib/chat/getUserConversations.js +37 -0
- package/lib/chat/markChatAsRead.js +52 -0
- package/lib/chat/markChatAsSeen.js +50 -0
- package/lib/chat/multiGetLatestMessages.js +37 -0
- package/lib/chat/onNewConversation.js +50 -0
- package/lib/chat/onNewMessage.js +53 -0
- package/lib/chat/onNewMessageBySelf.js +50 -0
- package/lib/chat/onUserOnline.js +50 -0
- package/lib/chat/onUserTyping.js +54 -0
- package/lib/chat/removeFromGroupConversation.js +62 -0
- package/lib/chat/renameGroupConversation.js +57 -0
- package/lib/chat/sendChatMessage.js +57 -0
- package/lib/chat/setChatUserTyping.js +61 -0
- package/lib/chat/start121Conversation.js +50 -0
- package/lib/chat/startCloudEditConversation.js +50 -0
- package/lib/chat/startGroupConversation.js +62 -0
- package/lib/client/onNotification.js +70 -0
- package/lib/client/setAPIKey.js +18 -0
- package/lib/client/setCookie.js +38 -0
- package/lib/datastores/deleteDatastoreEntry.js +66 -0
- package/lib/datastores/getDatastoreEntry.js +98 -0
- package/lib/datastores/getDatastoreEntryVersions.js +83 -0
- package/lib/datastores/getDatastoreKeys.js +73 -0
- package/lib/datastores/getDatastores.js +72 -0
- package/lib/datastores/incrementDatastoreEntry.js +93 -0
- package/lib/datastores/setDatastoreEntry.js +90 -0
- package/lib/develop/canManage.js +44 -0
- package/lib/develop/configureItem.js +142 -0
- package/lib/develop/updateUniverse.js +53 -0
- package/lib/develop/updateUniverseAccess.js +55 -0
- package/lib/economy/buy.js +99 -0
- package/lib/economy/getGroupFunds.js +43 -0
- package/lib/economy/getGroupRevenueSummary.js +48 -0
- package/lib/economy/getGroupTransactions.js +32 -0
- package/lib/economy/getResaleData.js +54 -0
- package/lib/economy/getResellers.js +35 -0
- package/lib/economy/getUserTransactions.js +34 -0
- package/lib/economy/onGroupTransaction.js +74 -0
- package/lib/friends/acceptFriendRequest.js +59 -0
- package/lib/friends/declineAllFriendRequests.js +57 -0
- package/lib/friends/declineFriendRequest.js +59 -0
- package/lib/friends/getFollowers.js +61 -0
- package/lib/friends/getFollowings.js +61 -0
- package/lib/friends/getFriendRequests.js +56 -0
- package/lib/friends/getFriends.js +53 -0
- package/lib/friends/onFriendRequest.js +58 -0
- package/lib/friends/removeFriend.js +58 -0
- package/lib/friends/sendFriendRequest.js +59 -0
- package/lib/friends/unfollow.js +58 -0
- package/lib/games/addDeveloperProduct.js +65 -0
- package/lib/games/checkDeveloperProductName.js +39 -0
- package/lib/games/configureGamePass.js +146 -0
- package/lib/games/getDeveloperProducts.js +51 -0
- package/lib/games/getGameInstances.js +31 -0
- package/lib/games/getGamePasses.js +39 -0
- package/lib/games/getGameRevenue.js +49 -0
- package/lib/games/getGameSocialLinks.js +45 -0
- package/lib/games/getGroupGames.js +30 -0
- package/lib/games/getPlaceInfo.js +48 -0
- package/lib/games/getUniverseInfo.js +51 -0
- package/lib/games/updateDeveloperProduct.js +69 -0
- package/lib/groups/changeRank.js +59 -0
- package/lib/groups/deleteWallPost.js +64 -0
- package/lib/groups/deleteWallPostsByUser.js +59 -0
- package/lib/groups/demote.js +25 -0
- package/lib/groups/exile.js +59 -0
- package/lib/groups/getAuditLog.js +67 -0
- package/lib/groups/getGroup.js +57 -0
- package/lib/groups/getGroupSocialLinks.js +44 -0
- package/lib/groups/getGroups.js +88 -0
- package/lib/groups/getJoinRequest.js +52 -0
- package/lib/groups/getJoinRequests.js +58 -0
- package/lib/groups/getPlayers.js +108 -0
- package/lib/groups/getRankInGroup.js +52 -0
- package/lib/groups/getRankNameInGroup.js +52 -0
- package/lib/groups/getRole.js +64 -0
- package/lib/groups/getRolePermissions.js +51 -0
- package/lib/groups/getRoles.js +56 -0
- package/lib/groups/getShout.js +49 -0
- package/lib/groups/getWall.js +59 -0
- package/lib/groups/groupPayout.js +103 -0
- package/lib/groups/handleJoinRequest.js +60 -0
- package/lib/groups/leaveGroup.js +60 -0
- package/lib/groups/onAuditLog.js +62 -0
- package/lib/groups/onJoinRequest.js +63 -0
- package/lib/groups/onJoinRequestHandle.js +105 -0
- package/lib/groups/onShout.js +57 -0
- package/lib/groups/onWallPost.js +58 -0
- package/lib/groups/promote.js +25 -0
- package/lib/groups/searchGroups.js +32 -0
- package/lib/groups/setGroupDescription.js +65 -0
- package/lib/groups/setGroupName.js +66 -0
- package/lib/groups/setRank.js +79 -0
- package/lib/groups/shout.js +65 -0
- package/lib/index.js +30 -0
- package/lib/internal/levelOneCopy.js +16 -0
- package/lib/internal/queue.js +61 -0
- package/lib/internal/timeout.js +30 -0
- package/lib/internal/wrap.js +78 -0
- package/lib/inventory/getCollectibles.js +31 -0
- package/lib/inventory/getInventory.js +32 -0
- package/lib/inventory/getInventoryById.js +31 -0
- package/lib/inventory/getOwnership.js +54 -0
- package/lib/inventory/getUAIDs.js +47 -0
- package/lib/itemconfiguration/getGroupAssets.js +32 -0
- package/lib/options.js +26 -0
- package/lib/party/onPartyDeleted.js +53 -0
- package/lib/party/onPartyInvite.js +53 -0
- package/lib/party/onPartyJoinedGame.js +53 -0
- package/lib/party/onPartyLeftGame.js +53 -0
- package/lib/party/onPartySelfJoined.js +53 -0
- package/lib/party/onPartySelfLeft.js +53 -0
- package/lib/party/onPartyUserJoined.js +53 -0
- package/lib/party/onPartyUserLeft.js +53 -0
- package/lib/premiumfeatures/getPremium.js +51 -0
- package/lib/presence/getPresences.js +63 -0
- package/lib/privatemessages/getMessages.js +60 -0
- package/lib/privatemessages/message.js +80 -0
- package/lib/privatemessages/onMessage.js +88 -0
- package/lib/thumbnails/getLogo.js +60 -0
- package/lib/thumbnails/getPlayerThumbnail.js +121 -0
- package/lib/thumbnails/getThumbnails.js +93 -0
- package/lib/trades/acceptTrade.js +58 -0
- package/lib/trades/canTradeWith.js +48 -0
- package/lib/trades/counterTrade.js +84 -0
- package/lib/trades/declineTrade.js +58 -0
- package/lib/trades/getTradeInfo.js +52 -0
- package/lib/trades/getTrades.js +37 -0
- package/lib/trades/sendTrade.js +82 -0
- package/lib/users/getBlurb.js +36 -0
- package/lib/users/getIdFromUsername.js +53 -0
- package/lib/users/getPlayerInfo.js +100 -0
- package/lib/users/getUsernameFromId.js +44 -0
- package/lib/users/onBlurbChange.js +46 -0
- package/lib/util/clearSession.js +32 -0
- package/lib/util/generalRequest.js +61 -0
- package/lib/util/getAction.js +45 -0
- package/lib/util/getCurrentUser.js +44 -0
- package/lib/util/getGeneralToken.js +52 -0
- package/lib/util/getHash.js +29 -0
- package/lib/util/getInputs.js +37 -0
- package/lib/util/getPageResults.js +89 -0
- package/lib/util/getSenderUserId.js +30 -0
- package/lib/util/getSession.js +38 -0
- package/lib/util/getVerification.js +60 -0
- package/lib/util/getVerificationInputs.js +31 -0
- package/lib/util/http.js +110 -0
- package/lib/util/jar.js +24 -0
- package/lib/util/refreshCookie.js +52 -0
- package/lib/util/relog.js +81 -0
- package/lib/util/setOptions.js +54 -0
- package/lib/util/shortPoll.js +102 -0
- package/lib/util/threaded.js +80 -0
- package/package.json +93 -3
- package/postinstall.js +1 -0
- package/settings.json +107 -0
- package/test/accountinformation.test.js +27 -0
- package/test/accountsettings.test.js +27 -0
- package/test/asset.test.js +81 -0
- package/test/assets/Great-White-Shark-Fin.rbxm +0 -0
- package/test/assets/KeyframeSequence.rbxm +0 -0
- package/test/avatar.test.js +164 -0
- package/test/badges.test.js +96 -0
- package/test/chat.test.js +104 -0
- package/test/datastore.test.js +105 -0
- package/test/develop.test.js +53 -0
- package/test/economy.test.js +137 -0
- package/test/friends.test.js +128 -0
- package/test/games.test.js +212 -0
- package/test/groups.test.js +311 -0
- package/test/inventory.test.js +98 -0
- package/test/itemconfiguration.test.js +24 -0
- package/test/premiumfeatures.test.js +17 -0
- package/test/presence.test.js +25 -0
- package/test/privatemessages.test.js +33 -0
- package/test/thumbnails.test.js +53 -0
- package/test/users.test.js +68 -0
- package/tutorials/Authentication.md +75 -0
- package/tutorials/Event Emitters.md +26 -0
- package/tutorials/Promises.md +86 -0
- package/tutorials/VPS Authentication.md +72 -0
- package/typings/index.d.ts +2525 -0
- package/typings/jsDocs.ts +1927 -0
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
|
+
})
|
Binary file
|
Binary file
|
@@ -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
|
+
})
|
@@ -0,0 +1,96 @@
|
|
1
|
+
const { getAwardedTimestamps, getBadgeInfo, getGameBadges, getPlayerBadges, 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('Badges Methods', () => {
|
12
|
+
it('getAwardedTimestamps() returns when badges were awarded to a player', () => {
|
13
|
+
return getAwardedTimestamps(64679301, [459405541]).then((res) => {
|
14
|
+
return expect(res).toMatchObject({
|
15
|
+
data: expect.any(Array)
|
16
|
+
})
|
17
|
+
})
|
18
|
+
})
|
19
|
+
|
20
|
+
it('getBadgeInfo() returns information on the provided badge ID', () => {
|
21
|
+
return getBadgeInfo(459405541).then((res) => {
|
22
|
+
return expect(res).toMatchObject({
|
23
|
+
id: expect.any(Number),
|
24
|
+
name: expect.any(String),
|
25
|
+
description: expect.any(String),
|
26
|
+
enabled: expect.any(Boolean),
|
27
|
+
iconImageId: expect.any(Number),
|
28
|
+
created: expect.any(Date),
|
29
|
+
updated: expect.any(Date),
|
30
|
+
statistics: expect.any(Object),
|
31
|
+
awardingUniverse: expect.any(Object)
|
32
|
+
})
|
33
|
+
})
|
34
|
+
})
|
35
|
+
|
36
|
+
it('getGameBadges() returns information on the badges in a game', () => {
|
37
|
+
return getGameBadges(66654135).then((res) => {
|
38
|
+
return expect(res).toEqual(
|
39
|
+
expect.arrayContaining([
|
40
|
+
expect.objectContaining({
|
41
|
+
id: expect.any(Number),
|
42
|
+
name: expect.any(String),
|
43
|
+
description: expect.any(String),
|
44
|
+
displayName: expect.any(String),
|
45
|
+
displayDescription: expect.any(String),
|
46
|
+
enabled: expect.any(Boolean),
|
47
|
+
iconImageId: expect.any(Number),
|
48
|
+
displayIconImageId: expect.any(Number),
|
49
|
+
created: expect.any(Date),
|
50
|
+
updated: expect.any(Date),
|
51
|
+
statistics: expect.objectContaining({
|
52
|
+
pastDayAwardedCount: expect.any(Number),
|
53
|
+
awardedCount: expect.any(Number),
|
54
|
+
winRatePercentage: expect.any(Number)
|
55
|
+
}),
|
56
|
+
awardingUniverse: expect.objectContaining({
|
57
|
+
id: expect.any(Number),
|
58
|
+
name: expect.any(String),
|
59
|
+
rootPlaceId: expect.any(Number)
|
60
|
+
})
|
61
|
+
})
|
62
|
+
])
|
63
|
+
)
|
64
|
+
})
|
65
|
+
})
|
66
|
+
|
67
|
+
it('getPlayerBadges() returns information on badges a player has earned', () => {
|
68
|
+
return getPlayerBadges(55549140, 10).then((res) => {
|
69
|
+
return expect(res).toEqual(
|
70
|
+
expect.arrayContaining([
|
71
|
+
expect.objectContaining({
|
72
|
+
id: expect.any(Number),
|
73
|
+
name: expect.any(String),
|
74
|
+
description: expect.any(String),
|
75
|
+
displayName: expect.any(String),
|
76
|
+
displayDescription: expect.any(String),
|
77
|
+
enabled: expect.any(Boolean),
|
78
|
+
iconImageId: expect.any(Number),
|
79
|
+
displayIconImageId: expect.any(Number),
|
80
|
+
awarder: expect.objectContaining({
|
81
|
+
id: expect.any(Number),
|
82
|
+
type: expect.any(String)
|
83
|
+
}),
|
84
|
+
statistics: expect.objectContaining({
|
85
|
+
pastDayAwardedCount: expect.any(Number),
|
86
|
+
awardedCount: expect.any(Number),
|
87
|
+
winRatePercentage: expect.any(Number)
|
88
|
+
}),
|
89
|
+
created: expect.any(Date),
|
90
|
+
updated: expect.any(Date)
|
91
|
+
})
|
92
|
+
])
|
93
|
+
)
|
94
|
+
})
|
95
|
+
})
|
96
|
+
})
|
@@ -0,0 +1,104 @@
|
|
1
|
+
const { addUsersToConversation, chatSettings, getChatMessages, getConversations, getRolloutSettings, getUnreadConversationCount, getUnreadMessages, getUserConversations, markChatAsRead, markChatAsSeen, multiGetLatestMessages, removeFromGroupConversation, renameGroupConversation, sendChatMessage, setChatUserTyping, start121Conversation, startGroupConversation, 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('Chat Methods', () => {
|
12
|
+
let newConversationId
|
13
|
+
|
14
|
+
it('addUsersToConversation() adds additional user(s) to form a group chat', () => {
|
15
|
+
return addUsersToConversation(8212952828, [3187412077]).then((res) => {
|
16
|
+
if (res && res.conversationId) newConversationId = res.conversationId
|
17
|
+
|
18
|
+
expect(res).toEqual(
|
19
|
+
expect.objectContaining({
|
20
|
+
conversationId: expect.any(Number)
|
21
|
+
})
|
22
|
+
)
|
23
|
+
})
|
24
|
+
})
|
25
|
+
|
26
|
+
it('chatSettings() returns chat settings', () => {
|
27
|
+
return chatSettings().then((res) => {
|
28
|
+
expect(res).toMatchObject({
|
29
|
+
chatEnabled: expect.any(Boolean),
|
30
|
+
isActiveChatUser: expect.any(Boolean)
|
31
|
+
})
|
32
|
+
})
|
33
|
+
})
|
34
|
+
|
35
|
+
it('getChatMessages() returns chat messages', async () => {
|
36
|
+
await expect(getChatMessages(8212952828)).resolves.not.toThrow()
|
37
|
+
})
|
38
|
+
|
39
|
+
it('getConversations() returns chat conversations that fit the provided IDs', async () => {
|
40
|
+
await expect(getConversations([8212952828])).resolves.not.toThrow()
|
41
|
+
})
|
42
|
+
|
43
|
+
it('getRolloutSettings() returns rollout settings for chat features', async () => {
|
44
|
+
await expect(getRolloutSettings(['LuaChat', 'Party'])).resolves.not.toThrow()
|
45
|
+
})
|
46
|
+
|
47
|
+
it('getUnreadConversationCount() returns number of unread conversations', () => {
|
48
|
+
return getUnreadConversationCount().then((res) => {
|
49
|
+
expect(res).toMatchObject({
|
50
|
+
count: expect.any(Number)
|
51
|
+
})
|
52
|
+
})
|
53
|
+
})
|
54
|
+
|
55
|
+
it('getUnreadMessages() returns unread messages in a given conversation', async () => {
|
56
|
+
await expect(getUnreadMessages([8212952828])).resolves.not.toThrow()
|
57
|
+
})
|
58
|
+
|
59
|
+
it('getUserConversations() returns all conversations the logged in user is in', async () => {
|
60
|
+
await expect(getUserConversations()).resolves.not.toThrow()
|
61
|
+
})
|
62
|
+
|
63
|
+
it('markChatAsRead() marks a conversation\'s messages as read to the specified message', async () => {
|
64
|
+
await expect(markChatAsRead(8212952828, 'e775e103-876f-4332-84ab-1ea14f326d39')).resolves.not.toThrow()
|
65
|
+
})
|
66
|
+
|
67
|
+
it('markChatAsSeen() marks the conversations provided as seen', async () => {
|
68
|
+
await expect(markChatAsSeen([8212952828])).resolves.not.toThrow()
|
69
|
+
})
|
70
|
+
|
71
|
+
it('multiGetLatestMessages() returns the latest messages corresponding to the given list of conversation IDs', async () => {
|
72
|
+
await expect(multiGetLatestMessages([8212952828])).resolves.not.toThrow()
|
73
|
+
})
|
74
|
+
|
75
|
+
it('removeFromGroupConversation() removes a user from a given conversation', async () => {
|
76
|
+
await expect(removeFromGroupConversation(newConversationId, 3187412077)).resolves.not.toThrow()
|
77
|
+
})
|
78
|
+
|
79
|
+
it('renameGroupConversation() renames a group conversation', async () => {
|
80
|
+
await expect(renameGroupConversation(newConversationId, 'noblox testing')).resolves.not.toThrow()
|
81
|
+
})
|
82
|
+
|
83
|
+
it('sendChatMessage() sends a chat message with provided content', async () => {
|
84
|
+
await expect(sendChatMessage(newConversationId, 'This is a test.')).resolves.not.toThrow()
|
85
|
+
})
|
86
|
+
|
87
|
+
it('setChatUserTyping() toggles typing status', async () => {
|
88
|
+
return setChatUserTyping(newConversationId, false).then((res) => {
|
89
|
+
expect(res).toMatchObject({ resultType: 'Success' })
|
90
|
+
})
|
91
|
+
})
|
92
|
+
|
93
|
+
it('start121Conversation() starts a conversation with another user', async () => {
|
94
|
+
await expect(start121Conversation(3187412077)).resolves.not.toThrow()
|
95
|
+
})
|
96
|
+
|
97
|
+
// TODO: startCloudEditConversation
|
98
|
+
|
99
|
+
it('startGroupConversation() opens a conversation with multiple people in it', () => {
|
100
|
+
return startGroupConversation([55549140, 3187412077], 'noblox test 2').then((res) => {
|
101
|
+
expect(res).toMatchObject({ resultType: 'Success' })
|
102
|
+
})
|
103
|
+
})
|
104
|
+
})
|