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
package/.eslintrc.js ADDED
@@ -0,0 +1,21 @@
1
+ module.exports = {
2
+ env: {
3
+ commonjs: true,
4
+ es6: true,
5
+ node: true
6
+ },
7
+ extends: [
8
+ 'standard',
9
+ 'plugin:jest/recommended'
10
+ ],
11
+ globals: {
12
+ Atomics: 'readonly',
13
+ SharedArrayBuffer: 'readonly'
14
+ },
15
+ parserOptions: {
16
+ ecmaVersion: 2018
17
+ },
18
+ rules: {
19
+ },
20
+ plugins: ['jest']
21
+ }
@@ -0,0 +1,3 @@
1
+ # These are supported funding model platforms
2
+ open_collective: noblox
3
+ github: noblox
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: "[BUG]"
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ ## Before posting a bug, be sure that someone else has not posted it already and it is an actual bug with noblox.js and not other frameworks like discord.js
11
+
12
+ **Describe the bug**
13
+ A clear and concise description of what the bug is.
14
+
15
+ **To Reproduce**
16
+ Steps to reproduce the behavior:
17
+ 1. Go to '...'
18
+ 2. Click on '....'
19
+ 3. Scroll down to '....'
20
+ 4. See error
21
+
22
+ **Expected behavior**
23
+ A clear and concise description of what you expected to happen.
24
+
25
+ **Screenshots**
26
+ If applicable, add screenshots to help explain your problem.
27
+
28
+ **Additional context**
29
+ Add any other context about the problem here.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ ## Before posting a feature request, make sure that it hasn't been suggested before, is a feasible idea, and can benefit everyone.
11
+
12
+ **Is your feature request related to a problem? Please describe.**
13
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
14
+
15
+ **Describe the solution you'd like**
16
+ A clear and concise description of what you want to happen.
17
+
18
+ **Describe alternatives you've considered**
19
+ A clear and concise description of any alternative solutions or features you've considered.
20
+
21
+ **Additional context**
22
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,33 @@
1
+ name: Publish docs
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+
8
+ jobs:
9
+ deploy:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout code
13
+ uses: actions/checkout@v2
14
+
15
+ - name: Set up node
16
+ uses: actions/setup-node@v1
17
+ with:
18
+ node-version: 14
19
+
20
+ - name: Install yarn
21
+ run: npm install -g yarn
22
+
23
+ - name: Build docs
24
+ run: |
25
+ yarn install
26
+ yarn docs
27
+
28
+ - name: Deploy
29
+ uses: peaceiris/actions-gh-pages@v3
30
+ with:
31
+ deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
32
+ publish_dir: ./docs
33
+ cname: noblox.js.org
@@ -0,0 +1,70 @@
1
+ name: Test & Publish
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout code
13
+ uses: actions/checkout@v2
14
+
15
+ - name: Set up node
16
+ uses: actions/setup-node@v1
17
+ with:
18
+ node-version: 14
19
+
20
+ - name: Install yarn
21
+ run: npm install -g yarn
22
+
23
+ - name: Install dependencies
24
+ run: yarn install
25
+
26
+ - name: Lint lib/
27
+ run: yarn lint
28
+
29
+ publish-npm:
30
+ needs: test
31
+ runs-on: ubuntu-latest
32
+ steps:
33
+ - name: Checkout code with ADMIN_TOKEN
34
+ if: github.event.pull_request.head.repo.full_name == github.repository
35
+ uses: actions/checkout@v2
36
+ with:
37
+ token: ${{ secrets.ADMIN_TOKEN }}
38
+
39
+ - name: Checkout code
40
+ if: github.event.pull_request.head.repo.full_name != github.repository
41
+ uses: actions/checkout@v2
42
+
43
+ - name: Prepare repository
44
+ run: git fetch --unshallow --tags
45
+
46
+ - name: Set up node
47
+ uses: actions/setup-node@v1
48
+ with:
49
+ node-version: 14
50
+
51
+ - name: Install yarn
52
+ run: npm install -g yarn
53
+
54
+ - name: Install dependencies
55
+ run: yarn install --frozen-lockfile
56
+
57
+ - name: Cache node modules
58
+ uses: actions/cache@v1
59
+ with:
60
+ path: node_modules
61
+ key: yarn-deps-${{ hashFiles('yarn.lock') }}
62
+ restore-keys: |
63
+ yarn-deps-${{ hashFiles('yarn.lock') }}
64
+
65
+ - name: Create Release
66
+ env:
67
+ GH_TOKEN: ${{ secrets.GH_TOKEN }}
68
+ NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
69
+ run: |
70
+ npx auto shipit
package/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: node_js
2
+ node_js:
3
+ - 14
4
+
5
+ before_install:
6
+ - yarn install
7
+
8
+ script:
9
+ - yarn lint
10
+
11
+ branches:
12
+ except:
13
+ - jest-tests
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at noblox@mit.edu. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Joshua Lanese <froastj@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,168 @@
1
+ <h1 align="center">
2
+ <img src="https://raw.githubusercontent.com/noblox/noblox.js/master/img/noblox-js.png" alt="noblox.js" width="400"/>
3
+ <br>
4
+ </h1>
5
+
6
+ <h4 align="center">A Node.js wrapper for interacting with the Roblox API; forked from <a href="https://github.com/sentanos/roblox-js">roblox-js</a>.</h4>
7
+
8
+ <p align="center">
9
+ <a href="https://standardjs.com"><img src="https://img.shields.io/badge/code_style-standard-blue.svg?style=flat-square" alt="JavaScript Style Guide"/></a>
10
+ <a href="https://discord.gg/R5GVSyTVGv"><img src="https://img.shields.io/badge/discord-noblox.js-blue.svg?style=flat-square" alt="noblox.js Discord"/></a>
11
+ <a href="https://npmjs.org/noblox.js"><img src="https://img.shields.io/npm/v/noblox.js.svg?style=flat-square" alt="NPM package"/>
12
+ <a href="https://travis-ci.org/noblox/noblox.js"><img src="https://img.shields.io/travis/noblox/noblox.js/master.svg?style=flat-square" alt="Travis Build Status"/></a></a>
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="#about">About</a> •
17
+ <a href="#prerequisites">Prerequisites</a> •
18
+ <a href="#installation">Installation</a> •
19
+ <a href="#quickstart">Quickstart</a> •
20
+ <a href="#documentation">Documentation</a> •
21
+ <a href="#common-issues">Common Issues</a> •
22
+ <a href="https://www.youtube.com/playlist?list=PLEW4K4VqMUb_VMA3Yp9LI4gReRyVWGTnU">YouTube Series</a> •
23
+ <a href="#credits">Credits</a> •
24
+ <a href="#license">License</a>
25
+ </p>
26
+
27
+ ---
28
+
29
+ ## About
30
+
31
+ `noblox.js` is an open-source Roblox API wrapper written in JavaScript (with TypeScript compatibility) as a fork from sentanos's <a href="https://github.com/sentanos/roblox-js"> roblox-js module</a>.
32
+
33
+ This NPM package enables operations froms the [Roblox website](https://www.roblox.com) to be executed via NodeJS; many individuals leverage `noblox.js` along side [Roblox's HTTPService](http://wiki.roblox.com/index.php?title=API:Class/HttpService) to create in-game scripts that interact with the website, i.e. promote users, shout events, and so on, or to create Discord utiltiies to manage their community.
34
+
35
+ If you are looking for more information on how to create something like this, check out [our sister library, `noblox.js-server`](https://github.com/noblox/noblox.js-server) or [our YouTube series](https://www.youtube.com/playlist?list=PLEW4K4VqMUb_VMA3Yp9LI4gReRyVWGTnU). Keep in mind that these resources may not always be up to date, so it is **highly** encouraged that you learn to use the `noblox.js` library directly.
36
+
37
+ ---
38
+
39
+ ## Prerequisites
40
+
41
+ - [**Node.js®**](https://nodejs.org/en/download/current/)
42
+
43
+ ---
44
+
45
+ ## Installation
46
+
47
+ With node.js installed simply run:
48
+ ```bash
49
+ # Run this to install noblox.js locally to your repository.
50
+ $ npm install noblox.js
51
+
52
+ # Alternatively, if you are using yarn:
53
+ $ yarn add noblox.js
54
+
55
+ # To use noblox.js anywhere, run this code to install the package globally:
56
+ $ npm install noblox.js -g
57
+ ```
58
+ That's it!
59
+
60
+ ---
61
+
62
+ ## Documentation
63
+
64
+ You can locate the [`noblox.js` documentation here](https://noblox.js.org/); keep in mind some internal or legacy methods may not be documented.
65
+
66
+ ### Legend
67
+ You may notice our documentation utilizes emojis in every function description; they have meanings!
68
+
69
+ | Icon | Description |
70
+ | ---- | ----------- |
71
+ | 🔐 | Authentication through `setCookie()` is required to use this method.<sup id="a1">[1](#f1)</sup>
72
+ | 🔓 | Authentication through `setCookie()` is required in **some** use-cases; dependent on the target's privacy settings.
73
+ | ✅ | No authentication is required to use this method.
74
+
75
+ <b id="f1">[1](#a1)</b> : Extended permissions may be required such as edit permissions or account ownership.
76
+
77
+ ---
78
+
79
+ ## Quickstart
80
+
81
+ 1) [Install `noblox.js`.](#installation)
82
+
83
+ 2) Retrieve your `.ROBLOSECURITY` cookie. Instructions on how to do that can be found [here](https://noblox.js.org/tutorial-Authentication.html).
84
+
85
+ 3) Write your code.
86
+
87
+ _Using `async/await` syntax:_
88
+ ```js
89
+ const noblox = require('noblox.js')
90
+ async function startApp () {
91
+ // You MUST call setCookie() before using any authenticated methods [marked by 🔐]
92
+ // Replace the parameter in setCookie() with your .ROBLOSECURITY cookie.
93
+ const currentUser = await noblox.setCookie('_|WARNING:-DO-NOT-SHARE-THIS.--Sharing-this-will-allow-someone-to-log-in-as-you-and-to-steal-your-ROBUX-and-items.|_6E6F626C6F782E6A73')
94
+ console.log(`Logged in as ${currentUser.UserName} [${currentUser.UserID}]`)
95
+
96
+ // Do everything else, calling functions and the like.
97
+ const groupInfo = await noblox.getGroup(9997719)
98
+ console.log(groupInfo)
99
+ }
100
+ startApp()
101
+ ```
102
+
103
+ You are now using noblox.js!
104
+
105
+ ### [More examples can be found here.](https://github.com/noblox/noblox.js/tree/master/examples)
106
+
107
+ **Promises are fundamental to this library**; if you are unfamiliar with JavaScript promises, we recommend you check out [our tutorial here](https://noblox.js.org/tutorial-Promises.html), and [Daniel Shiffman's JavaScript series](https://www.youtube.com/watch?v=QO4NXhWo_NM&list=PLRqwX-V7Uu6YgpA3Oht-7B4NBQwFVe3pr&index=12).
108
+
109
+ ---
110
+
111
+ ## Hiding Your Cookie
112
+
113
+ It is bad practice to store your `.ROBLOSECURITY` cookie inside your codebase; it is too easy to accidentally screenshot or push this private key to GitHub. We recommend using a [package such as `dotenv`](https://www.npmjs.com/package/dotenv) to store your private information in environmental variables.
114
+
115
+ We recommend using a secondary account for botting purposes.
116
+
117
+ Consult their documentation or [follow this video](https://www.youtube.com/watch?v=17UVejOw3zA).
118
+
119
+ ---
120
+
121
+ ### Invalidating A Cookie
122
+
123
+ In the event of accidentally exposing your `.ROBLOSECURITY` cookie, do not panic. Go to [`Account Settings` > `Security`](https://www.roblox.com/my/account#!/security), select `Sign out of all other sessions`, then log out of your account. This should invalidate your `.ROBLOSECURITY` cookie.
124
+
125
+
126
+ ---
127
+
128
+ ## Common Issues
129
+
130
+ > **Error: You are not logged in.**
131
+
132
+ You may be calling a function before `setCookie()` is completed; make sure that you are awaiting `setCookie()` before initializing any event listeners or function calls.
133
+
134
+ `noblox.js` is a promise based library, this enables you to run operations concurrently; however if you are not awaiting your promises, this means while `setCookie()` is validating your cookie, _your other functions will continue to run_- ~30ms is a **long time** at the computer scale.
135
+
136
+ **Promises are fundamental to this library**; if you are unfamiliar with JavaScript promises, we recommend you check out [our tutorial here](https://noblox.js.org/tutorial-Promises.html), and [Daniel Shiffman's JavaScript series](https://www.youtube.com/watch?v=QO4NXhWo_NM&list=PLRqwX-V7Uu6YgpA3Oht-7B4NBQwFVe3pr&index=12).
137
+
138
+ > **Error: 400 The roleset is invalid or does not exist.**
139
+
140
+ You likely are using a `rankId` (0 - 255) instead of a `rolesetId` (>255); a `rolesetId` is a unique identifier for a role which you can find by calling [`getRoles(groupId)`](https://noblox.js.org/global.html#getRoles).
141
+
142
+ Roblox's naming scheme is a fickle beast; similarly, a `developerProductId` is _different_ than a `productId` (which appears on the public facing dashboard); use [`getDeveloperProducts(placeId)`](https://noblox.js.org/global.html#getDeveloperProducts) to see the `developerProductId`.
143
+
144
+
145
+
146
+ > **Error: Initialization failed: 401 Authorization has been denied for this request.**
147
+
148
+ First, see the steps for `Error: You are not logged in`.
149
+
150
+ If this is unresolved, are you sure the bot has permissions to access this resource? Can you do this operation manually on the website through the bot account?
151
+
152
+ At the end of the day, a 'bot' is a user account, it cannot magically bypass privacy restrictions or group permissions.
153
+
154
+ ---
155
+
156
+ ## Credits
157
+ * [suufi](https://github.com/suufi) - Lead maintainer
158
+ * [sentanos](https://github.com/sentanos) - We wouldn't exist without him. 😀
159
+ * [Neztore](https://github.com/Neztore) - Library maintenance and review
160
+ * [alanbixby](https://github.com/alanbixby) - Library maintenance
161
+ * [popeeyy](https://github.com/popeeyy) - Creation of the documentation.
162
+ * [edward](https://github.com/edwrddd) - Helping with the creation of the documentation.
163
+
164
+ ---
165
+
166
+ ## License
167
+
168
+ [MIT](https://github.com/noblox/noblox.js/blob/master/LICENSE)
@@ -0,0 +1,130 @@
1
+ /**
2
+ * About:
3
+ * Exiles group members with optional filtering.
4
+ *
5
+ * NOTE: By default, this will exile all players in the rolesets provided. Change the body of shouldExile to alter this behaviour.
6
+ */
7
+
8
+ // Settings
9
+ const cookie = process.env.COOKIE || '' // Roblox account .ROBLOSECURITY cookie
10
+ const options = {
11
+ group: 0, // Group ID
12
+ roleset: [1, 2, 3], // Array of roleset IDs - NOTE: This is not the same as role number
13
+ limit: -1, // Search limit - NOTE: When <= 0 there is no limit
14
+ exileLimit: -1, // Exile limit - NOTE: When <= 0 there is no limit
15
+ sortOrder: 'Asc' // Sort order: "Asc" or "Desc"
16
+ }
17
+
18
+ function shouldExile (player) {
19
+ /*
20
+ if (player.username === "Bob") {
21
+ return true // Exile Bob
22
+ } else if (player.username.toLowerCase().includes("bot")) {
23
+ return true // Exile users with username containing "bot"
24
+ } else if (player.userId > 1000000000) {
25
+ return true // Exile users with userId over 1 billion
26
+ }
27
+
28
+ return false
29
+ */
30
+
31
+ return true // Exile all players found
32
+ }
33
+
34
+ // Dependencies
35
+ const noblox = require('noblox.js')
36
+ const logUpdate = require('log-update')
37
+
38
+ const players = {
39
+ passed: 0,
40
+ exiled: 0,
41
+ failed: 0
42
+ }
43
+
44
+ noblox.setCookie(cookie)
45
+ .then(async () => {
46
+ console.time('Time taken')
47
+
48
+ const getRolesOptions = {
49
+ group: options.group
50
+ }
51
+
52
+ const groupRoles = await noblox.getRoles(getRolesOptions)
53
+ const targetRoles = []
54
+
55
+ for (const role of groupRoles) {
56
+ if (options.roleset.includes(role.id)) {
57
+ targetRoles.push(role)
58
+ }
59
+
60
+ if (targetRoles.length === options.roleset.length) {
61
+ break
62
+ }
63
+ }
64
+
65
+ if (targetRoles.length === 0) {
66
+ console.error('No roles matching the roleset IDs were found.')
67
+
68
+ return
69
+ }
70
+
71
+ options.roleset = targetRoles.map((role) => {
72
+ return role.id
73
+ })
74
+
75
+ let totalPlayers = 0
76
+
77
+ for (const role of targetRoles) {
78
+ totalPlayers += role.memberCount
79
+ }
80
+
81
+ if (options.limit > 0) {
82
+ totalPlayers = Math.min(options.limit, totalPlayers)
83
+ }
84
+
85
+ if (totalPlayers >= 10000) {
86
+ console.log(`Fetching ${totalPlayers} players, this will take a while...`)
87
+ } else if (totalPlayers >= 2000) {
88
+ console.log(`Fetching ${totalPlayers} players, this may take a while...`)
89
+ } else {
90
+ console.log(`Fetching ${totalPlayers} players...`)
91
+ }
92
+
93
+ const getPlayersOptions = {
94
+ group: options.group,
95
+ limit: 100,
96
+ sortOrder: options.sortOrder,
97
+ rolesetId: options.roleset
98
+ }
99
+
100
+ const groupPlayers = await noblox.getPlayers(getPlayersOptions)
101
+
102
+ const logUpdater = setInterval(() => {
103
+ logUpdate(`Got ${groupPlayers.length} players, exiling...\nPassed: ${players.passed}\nExiled: ${players.exiled}\nFailed: ${players.failed}`)
104
+
105
+ if (players.passed + players.exiled + players.failed === groupPlayers.length) {
106
+ clearInterval(logUpdater)
107
+
108
+ console.timeEnd('Time taken')
109
+ }
110
+ }, 100)
111
+
112
+ groupPlayers.forEach((player) => {
113
+ if (shouldExile(player)) {
114
+ const exileOptions = {
115
+ group: options.group,
116
+ target: player.userId
117
+ }
118
+
119
+ noblox.exile(exileOptions)
120
+ .then(() => {
121
+ players.exiled++
122
+ })
123
+ .catch(() => {
124
+ players.failed++
125
+ })
126
+ } else {
127
+ players.passed++
128
+ }
129
+ })
130
+ })