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
@@ -0,0 +1,110 @@
|
|
1
|
+
/**
|
2
|
+
* About:
|
3
|
+
* Deletes group wall posts with optional filtering.
|
4
|
+
*
|
5
|
+
* NOTE: By default, this will delete all wall posts. Change the body of shouldDelete 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
|
+
sortOrder: 'Asc' // Sort order: "Asc" or "Desc"
|
13
|
+
}
|
14
|
+
|
15
|
+
function shouldDelete (wallPost) {
|
16
|
+
/*
|
17
|
+
if (wallPost.poster === null) {
|
18
|
+
return true // Deleted posts from deleted users
|
19
|
+
} else if (wallPost.poster.username === "Bob") {
|
20
|
+
return true // Delete posts from Bob
|
21
|
+
} else if (wallPost.body.toLowerCase().includes("noob")) {
|
22
|
+
return true // Delete post containing "noob", case insensitive
|
23
|
+
}
|
24
|
+
|
25
|
+
return false
|
26
|
+
*/
|
27
|
+
|
28
|
+
return true // Delete all posts
|
29
|
+
}
|
30
|
+
|
31
|
+
// Dependencies
|
32
|
+
const noblox = require('noblox.js')
|
33
|
+
const logUpdate = require('log-update')
|
34
|
+
|
35
|
+
// Main
|
36
|
+
let scanning = true
|
37
|
+
const posts = {
|
38
|
+
scanned: 0,
|
39
|
+
filtered: 0,
|
40
|
+
deleted: 0,
|
41
|
+
failed: 0
|
42
|
+
}
|
43
|
+
|
44
|
+
async function getWallPage (getWallOptions, cursor) {
|
45
|
+
getWallOptions.limit = 100
|
46
|
+
getWallOptions.cursor = cursor || ''
|
47
|
+
|
48
|
+
const wallPage = await noblox.getWall(getWallOptions)
|
49
|
+
|
50
|
+
return wallPage
|
51
|
+
}
|
52
|
+
|
53
|
+
function filterWallPosts (wallPosts) {
|
54
|
+
const filteredPostIDs = []
|
55
|
+
|
56
|
+
for (const wallPost of wallPosts) {
|
57
|
+
if (shouldDelete(wallPost)) {
|
58
|
+
posts.filtered++
|
59
|
+
filteredPostIDs.push(wallPost.id)
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
return filteredPostIDs
|
64
|
+
}
|
65
|
+
|
66
|
+
function deleteWallPosts (wallPostIDs) {
|
67
|
+
wallPostIDs.forEach((wallPostID) => {
|
68
|
+
const deleteWallPostOptions = {
|
69
|
+
group: options.group,
|
70
|
+
id: wallPostID
|
71
|
+
}
|
72
|
+
|
73
|
+
noblox.deleteWallPost(deleteWallPostOptions)
|
74
|
+
.then(() => {
|
75
|
+
posts.deleted++
|
76
|
+
})
|
77
|
+
.catch((e) => {
|
78
|
+
posts.failed++
|
79
|
+
})
|
80
|
+
})
|
81
|
+
}
|
82
|
+
|
83
|
+
noblox.setCookie(cookie)
|
84
|
+
.then(async () => {
|
85
|
+
console.time('Time taken')
|
86
|
+
|
87
|
+
const logUpdater = setInterval(() => {
|
88
|
+
logUpdate(`Scanned: ${posts.scanned}\nFiltered: ${posts.filtered}\nDeleted: ${posts.deleted}\nFailed: ${posts.failed}`)
|
89
|
+
|
90
|
+
if (!scanning && posts.deleted + posts.failed === posts.filtered) {
|
91
|
+
clearInterval(logUpdater)
|
92
|
+
|
93
|
+
console.timeEnd('Time taken')
|
94
|
+
}
|
95
|
+
}, 100)
|
96
|
+
|
97
|
+
let wallPage = await getWallPage(options)
|
98
|
+
posts.scanned += wallPage.data.length
|
99
|
+
|
100
|
+
deleteWallPosts(filterWallPosts(wallPage.data))
|
101
|
+
|
102
|
+
while (wallPage.nextPageCursor !== null) {
|
103
|
+
wallPage = await getWallPage(options, wallPage.nextPageCursor)
|
104
|
+
posts.scanned += wallPage.data.length
|
105
|
+
|
106
|
+
deleteWallPosts(filterWallPosts(wallPage.data))
|
107
|
+
}
|
108
|
+
|
109
|
+
scanning = false
|
110
|
+
})
|
@@ -0,0 +1,100 @@
|
|
1
|
+
/**
|
2
|
+
* About:
|
3
|
+
* Reverts all rank change actions of a group after a specified date, with the option to filter by user.
|
4
|
+
*/
|
5
|
+
|
6
|
+
// Settings
|
7
|
+
const cookie = process.env.COOKIE || '' // Roblox account .ROBLOSECURITY cookie
|
8
|
+
const options = {
|
9
|
+
group: 0, // Group ID
|
10
|
+
userId: -1, // Revert rank changes made by this specified user - NOTE: When <= 0 any rank changes will be reverted
|
11
|
+
afterDate: new Date('2021-01-01 00:00 CDT') // Date after which any rank changes will be reverted
|
12
|
+
}
|
13
|
+
|
14
|
+
// Dependencies
|
15
|
+
const noblox = require('noblox.js')
|
16
|
+
const logUpdate = require('log-update')
|
17
|
+
|
18
|
+
// Main
|
19
|
+
let scanning = true
|
20
|
+
const logItems = {
|
21
|
+
scanned: 0,
|
22
|
+
filtered: 0,
|
23
|
+
reverted: 0,
|
24
|
+
failed: 0
|
25
|
+
}
|
26
|
+
|
27
|
+
async function getAuditLogPage (getAuditLogOptions, cursor) {
|
28
|
+
getAuditLogOptions.cursor = cursor || ''
|
29
|
+
|
30
|
+
const auditLogPage = await noblox.getAuditLog(getAuditLogOptions)
|
31
|
+
|
32
|
+
return auditLogPage
|
33
|
+
}
|
34
|
+
|
35
|
+
function filterAuditLogItems (auditLogItems) {
|
36
|
+
const filteredAuditLogItems = []
|
37
|
+
|
38
|
+
for (const auditLogItem of auditLogItems) {
|
39
|
+
if (Date.parse(auditLogItem.created) > options.afterDate) {
|
40
|
+
logItems.filtered++
|
41
|
+
filteredAuditLogItems.push(auditLogItem.description)
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
return filteredAuditLogItems
|
46
|
+
}
|
47
|
+
|
48
|
+
async function revertAuditLogItems (auditLogItems) {
|
49
|
+
for (const auditLogItem of auditLogItems) {
|
50
|
+
const setRankOptions = {
|
51
|
+
group: options.group,
|
52
|
+
target: auditLogItem.TargetId,
|
53
|
+
rank: auditLogItem.OldRoleSetId
|
54
|
+
}
|
55
|
+
|
56
|
+
await noblox.setRank(setRankOptions)
|
57
|
+
.then(() => {
|
58
|
+
logItems.reverted++
|
59
|
+
})
|
60
|
+
.catch((e) => {
|
61
|
+
logItems.failed++
|
62
|
+
})
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
noblox.setCookie(cookie)
|
67
|
+
.then(async () => {
|
68
|
+
console.time('Time taken')
|
69
|
+
|
70
|
+
const logUpdater = setInterval(() => {
|
71
|
+
logUpdate(`Scanned: ${logItems.scanned}\nFiltered: ${logItems.filtered}\nReverted: ${logItems.reverted}\nFailed: ${logItems.failed}`)
|
72
|
+
|
73
|
+
if (!scanning && logItems.reverted + logItems.failed === logItems.filtered) {
|
74
|
+
clearInterval(logUpdater)
|
75
|
+
|
76
|
+
console.timeEnd('Time taken')
|
77
|
+
}
|
78
|
+
}, 100)
|
79
|
+
|
80
|
+
const getAuditLogOptions = {
|
81
|
+
group: options.group,
|
82
|
+
actionType: 'changeRank',
|
83
|
+
userId: options.userId > 0 ? options.userId : null,
|
84
|
+
limit: 100
|
85
|
+
}
|
86
|
+
|
87
|
+
let auditLogPage = await getAuditLogPage(getAuditLogOptions)
|
88
|
+
logItems.scanned += auditLogPage.data.length
|
89
|
+
|
90
|
+
await revertAuditLogItems(filterAuditLogItems(auditLogPage.data))
|
91
|
+
|
92
|
+
while (auditLogPage.nextPageCursor !== null && Date.parse(auditLogPage.data[auditLogPage.data.length - 1].created) > options.afterDate) {
|
93
|
+
auditLogPage = await getAuditLogPage(getAuditLogOptions, auditLogPage.nextPageCursor)
|
94
|
+
logItems.scanned += auditLogPage.data.length
|
95
|
+
|
96
|
+
await revertAuditLogItems(filterAuditLogItems(auditLogPage.data))
|
97
|
+
}
|
98
|
+
|
99
|
+
scanning = false
|
100
|
+
})
|
@@ -0,0 +1,119 @@
|
|
1
|
+
/**
|
2
|
+
* About:
|
3
|
+
* Saves group players to a JSON file with optional filtering.
|
4
|
+
*
|
5
|
+
* NOTE: By default, this will save all players found. Change the body of shouldSave to alter this behaviour.
|
6
|
+
*/
|
7
|
+
|
8
|
+
// Settings
|
9
|
+
const cookie = process.env.COOKIE || '' // Roblox account .ROBLOSECURITY cookie
|
10
|
+
const outputFile = 'players.json' // Output file name
|
11
|
+
const options = {
|
12
|
+
group: 0, // Group ID
|
13
|
+
all: true, // Get all members of group - NOTE: Overrides roleset option
|
14
|
+
roleset: [1, 2, 3], // Array of roleset IDs - NOTE: This is not the same as role number
|
15
|
+
limit: -1, // Save limit - NOTE: When <= 0 there is no limit
|
16
|
+
sortOrder: 'Asc' // Sort order: "Asc" or "Desc"
|
17
|
+
}
|
18
|
+
|
19
|
+
function shouldSave (player) {
|
20
|
+
/*
|
21
|
+
if (player.username === "Bob") {
|
22
|
+
return true // Save Bob
|
23
|
+
} else if (player.username.toLowerCase().includes("bot")) {
|
24
|
+
return true // Save users with username containing "bot"
|
25
|
+
} else if (player.userId > 1000000000) {
|
26
|
+
return true // Save users with userId over 1 billion
|
27
|
+
}
|
28
|
+
|
29
|
+
return false
|
30
|
+
*/
|
31
|
+
|
32
|
+
return true // Save all players found
|
33
|
+
}
|
34
|
+
|
35
|
+
// Dependencies
|
36
|
+
const noblox = require('noblox.js')
|
37
|
+
const js = require('JSONStream')
|
38
|
+
const fs = require('fs')
|
39
|
+
|
40
|
+
// Main
|
41
|
+
const stream = js.stringify('[\n ', ',\n ', '\n]\n')
|
42
|
+
const output = fs.createWriteStream(`./${outputFile}`)
|
43
|
+
stream.pipe(output)
|
44
|
+
|
45
|
+
noblox.setCookie(cookie)
|
46
|
+
.then(async () => {
|
47
|
+
console.time('Time taken')
|
48
|
+
|
49
|
+
const getRolesOptions = {
|
50
|
+
group: options.group
|
51
|
+
}
|
52
|
+
|
53
|
+
const groupRoles = await noblox.getRoles(getRolesOptions)
|
54
|
+
let targetRoles = []
|
55
|
+
|
56
|
+
if (options.all) {
|
57
|
+
targetRoles = groupRoles
|
58
|
+
} else {
|
59
|
+
for (const role of groupRoles) {
|
60
|
+
if (options.roleset.includes(role.id)) {
|
61
|
+
targetRoles.push(role)
|
62
|
+
}
|
63
|
+
|
64
|
+
if (targetRoles.length === options.roleset.length) {
|
65
|
+
break
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
if (targetRoles.length === 0) {
|
71
|
+
console.error('No roles matching the roleset IDs were found.')
|
72
|
+
|
73
|
+
return
|
74
|
+
}
|
75
|
+
|
76
|
+
options.roleset = targetRoles.map((role) => {
|
77
|
+
return role.id
|
78
|
+
})
|
79
|
+
|
80
|
+
let totalPlayers = 0
|
81
|
+
|
82
|
+
for (const role of targetRoles) {
|
83
|
+
totalPlayers += role.memberCount
|
84
|
+
}
|
85
|
+
|
86
|
+
if (options.limit > 0) {
|
87
|
+
totalPlayers = Math.min(options.limit, totalPlayers)
|
88
|
+
}
|
89
|
+
|
90
|
+
if (totalPlayers >= 10000) {
|
91
|
+
console.log(`Fetching ${totalPlayers} players, this will take a while...`)
|
92
|
+
} else if (totalPlayers >= 2000) {
|
93
|
+
console.log(`Fetching ${totalPlayers} players, this may take a while...`)
|
94
|
+
} else {
|
95
|
+
console.log(`Fetching ${totalPlayers} players...`)
|
96
|
+
}
|
97
|
+
|
98
|
+
const getPlayersOptions = {
|
99
|
+
group: options.group,
|
100
|
+
limit: 100,
|
101
|
+
sortOrder: options.sortOrder,
|
102
|
+
rolesetId: options.roleset
|
103
|
+
}
|
104
|
+
|
105
|
+
const groupPlayers = await noblox.getPlayers(getPlayersOptions)
|
106
|
+
|
107
|
+
console.log(`Writing ${totalPlayers} players to file...`)
|
108
|
+
|
109
|
+
for (const player of groupPlayers) {
|
110
|
+
if (shouldSave(player)) {
|
111
|
+
stream.write(player)
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
stream.end()
|
116
|
+
|
117
|
+
console.log(`Done, check ${outputFile} file.`)
|
118
|
+
console.timeEnd('Time taken')
|
119
|
+
})
|
@@ -0,0 +1,96 @@
|
|
1
|
+
/**
|
2
|
+
* About:
|
3
|
+
* Saves wall posts to a JSON file with optional filtering.
|
4
|
+
*
|
5
|
+
* NOTE: By default, this will save all wall posts. Change the body of shouldSave to alter this behaviour.
|
6
|
+
*/
|
7
|
+
|
8
|
+
// Settings
|
9
|
+
const cookie = process.env.COOKIE || '' // Roblox account .ROBLOSECURITY cookie
|
10
|
+
const outputFile = 'wall.json' // Output file name
|
11
|
+
const options = {
|
12
|
+
group: 0, // Group Id
|
13
|
+
sortOrder: 'Asc' // Sort order: "Asc" or "Desc"
|
14
|
+
}
|
15
|
+
|
16
|
+
function shouldSave (wallPost) {
|
17
|
+
/*
|
18
|
+
if (wallPost.poster === null) {
|
19
|
+
return true // Save posts from deleted users
|
20
|
+
} else if (wallPost.poster.username === "Bob") {
|
21
|
+
return true // Save posts from Bob
|
22
|
+
} else if (wallPost.body.toLowerCase().includes("noob")) {
|
23
|
+
return true // Save post containing "noob", case insensitive
|
24
|
+
}
|
25
|
+
|
26
|
+
return false
|
27
|
+
*/
|
28
|
+
|
29
|
+
return true // Save all posts
|
30
|
+
}
|
31
|
+
|
32
|
+
// Dependencies
|
33
|
+
const noblox = require('noblox.js')
|
34
|
+
const logUpdate = require('log-update')
|
35
|
+
const js = require('JSONStream')
|
36
|
+
const fs = require('fs')
|
37
|
+
|
38
|
+
// Main
|
39
|
+
const stream = js.stringify('[\n ', ',\n ', '\n]\n')
|
40
|
+
const output = fs.createWriteStream(`./${outputFile}`)
|
41
|
+
stream.pipe(output)
|
42
|
+
|
43
|
+
const wallPosts = {
|
44
|
+
found: 0,
|
45
|
+
written: 0,
|
46
|
+
skipped: 0
|
47
|
+
}
|
48
|
+
|
49
|
+
async function getWallPage (getWallOptions, cursor) {
|
50
|
+
getWallOptions.limit = 100
|
51
|
+
getWallOptions.cursor = cursor || ''
|
52
|
+
|
53
|
+
const wallPage = await noblox.getWall(getWallOptions)
|
54
|
+
|
55
|
+
return wallPage
|
56
|
+
}
|
57
|
+
|
58
|
+
function streamWallPageData (wallPageData) {
|
59
|
+
for (const wallPost of wallPageData) {
|
60
|
+
if (shouldSave(wallPost)) {
|
61
|
+
stream.write(wallPost)
|
62
|
+
wallPosts.written += 1
|
63
|
+
} else {
|
64
|
+
wallPosts.skipped += 1
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
noblox.setCookie(cookie)
|
70
|
+
.then(async () => {
|
71
|
+
console.time('Time taken')
|
72
|
+
|
73
|
+
const logUpdater = setInterval(() => {
|
74
|
+
logUpdate(`Found: ${wallPosts.found}\nWritten: ${wallPosts.written}\nSkipped: ${wallPosts.skipped}`)
|
75
|
+
}, 100)
|
76
|
+
|
77
|
+
let wallPage = await getWallPage(options)
|
78
|
+
wallPosts.found += wallPage.data.length
|
79
|
+
|
80
|
+
streamWallPageData(wallPage.data)
|
81
|
+
|
82
|
+
while (wallPage.nextPageCursor !== null) {
|
83
|
+
wallPage = await getWallPage(options, wallPage.nextPageCursor)
|
84
|
+
wallPosts.found += wallPage.data.length
|
85
|
+
|
86
|
+
streamWallPageData(wallPage.data)
|
87
|
+
}
|
88
|
+
|
89
|
+
stream.end()
|
90
|
+
|
91
|
+
clearInterval(logUpdater)
|
92
|
+
logUpdate(`Found: ${wallPosts.found}\nWritten: ${wallPosts.written}\nSkipped: ${wallPosts.skipped}`)
|
93
|
+
|
94
|
+
console.log(`Done, check ${outputFile} file.`)
|
95
|
+
console.timeEnd('Time taken')
|
96
|
+
})
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,55 @@
|
|
1
|
+
{
|
2
|
+
"recurseDepth": 2,
|
3
|
+
|
4
|
+
"source": {
|
5
|
+
"include": ["./typings", "./lib"],
|
6
|
+
"includePattern": "\\.(jsx|js|ts|tsx)$"
|
7
|
+
},
|
8
|
+
|
9
|
+
"opts" : {
|
10
|
+
"encoding": "utf8",
|
11
|
+
"destination": "./docs/",
|
12
|
+
"readme": "./README.md",
|
13
|
+
"recurse": true,
|
14
|
+
"verbose": true,
|
15
|
+
"tutorials": "./tutorials",
|
16
|
+
"template": "better-docs"
|
17
|
+
},
|
18
|
+
|
19
|
+
"plugins": [
|
20
|
+
"node_modules/better-docs/category",
|
21
|
+
"node_modules/better-docs/typescript",
|
22
|
+
"plugins/markdown"
|
23
|
+
],
|
24
|
+
|
25
|
+
"tags": {
|
26
|
+
"allowUnknownTags": ["optional", "category"]
|
27
|
+
},
|
28
|
+
|
29
|
+
"templates": {
|
30
|
+
"better-docs": {
|
31
|
+
"logo": "./noblox-js-small.png",
|
32
|
+
"title": "noblox.js",
|
33
|
+
"hideGenerator": true,
|
34
|
+
"navLinks": [
|
35
|
+
{
|
36
|
+
"label": "GitHub",
|
37
|
+
"href": "https://github.com/noblox/noblox.js"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"label": "noblox.js Discord",
|
41
|
+
"href": "https://discord.gg/R5GVSyTVGv"
|
42
|
+
}
|
43
|
+
],
|
44
|
+
"trackingCode": "<!-- Global site tag (gtag.js) - Google Analytics -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=UA-121100860-3\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'UA-121100860-3');\n</script>\n"
|
45
|
+
},
|
46
|
+
"search": true,
|
47
|
+
"default": {
|
48
|
+
"staticFiles": {
|
49
|
+
"include": [
|
50
|
+
"./img"
|
51
|
+
]
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
// Includes
|
2
|
+
const http = require('../util/http.js').func
|
3
|
+
|
4
|
+
// Args
|
5
|
+
exports.required = ['userId']
|
6
|
+
exports.optional = ['jar']
|
7
|
+
|
8
|
+
// Docs
|
9
|
+
/**
|
10
|
+
* 🔐 Get the social link data (promotion channels) associated with a user.
|
11
|
+
* @category AccountInformation
|
12
|
+
* @alias getUserSocialLinks
|
13
|
+
* @param {number} userId - The id of the user.
|
14
|
+
* @returns {Promise<PromotionChannelsResponse>}
|
15
|
+
* @example const noblox = require("noblox.js")
|
16
|
+
* const userSocialLinks = await noblox.getUserSocialLinks(2416399685)
|
17
|
+
**/
|
18
|
+
|
19
|
+
// Define
|
20
|
+
function getUserSocialLinks (userId, jar) {
|
21
|
+
return http({
|
22
|
+
url: `//accountinformation.roblox.com/v1/users/${userId}/promotion-channels`,
|
23
|
+
options: {
|
24
|
+
jar: jar,
|
25
|
+
resolveWithFullResponse: true
|
26
|
+
}
|
27
|
+
})
|
28
|
+
.then(({ statusCode, body }) => {
|
29
|
+
const { errors } = JSON.parse(body)
|
30
|
+
if (statusCode === 200) {
|
31
|
+
return JSON.parse(body)
|
32
|
+
} else if (statusCode === 400) {
|
33
|
+
throw new Error(`${errors[0].message} | userId: ${userId}`)
|
34
|
+
} else {
|
35
|
+
throw new Error(`An unknown error occurred with getUserSocialLinks() | [${statusCode}] userId: ${userId}`)
|
36
|
+
}
|
37
|
+
})
|
38
|
+
}
|
39
|
+
|
40
|
+
exports.func = function ({ userId, jar }) {
|
41
|
+
return getUserSocialLinks(userId, jar)
|
42
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
// Includes
|
2
|
+
const http = require('../util/http.js').func
|
3
|
+
const getGeneralToken = require('../util/getGeneralToken.js').func
|
4
|
+
|
5
|
+
// Args
|
6
|
+
exports.required = ['userId']
|
7
|
+
exports.optional = ['jar']
|
8
|
+
|
9
|
+
// Docs
|
10
|
+
/**
|
11
|
+
* 🔐 Block a user.
|
12
|
+
* @category AccountSettings
|
13
|
+
* @alias block
|
14
|
+
* @param {number} userId - The id of the user that is being blocked.
|
15
|
+
* @returns {Promise<void>}
|
16
|
+
* @example const noblox = require("noblox.js")
|
17
|
+
* // Login using your cookie
|
18
|
+
* noblox.block(123456)
|
19
|
+
**/
|
20
|
+
|
21
|
+
// Define
|
22
|
+
function block (jar, token, userId) {
|
23
|
+
return new Promise((resolve, reject) => {
|
24
|
+
const httpOpt = {
|
25
|
+
url: `//accountsettings.roblox.com/v1/users/${userId}/block`,
|
26
|
+
options: {
|
27
|
+
method: 'POST',
|
28
|
+
jar: jar,
|
29
|
+
headers: {
|
30
|
+
'X-CSRF-TOKEN': token
|
31
|
+
},
|
32
|
+
resolveWithFullResponse: true
|
33
|
+
}
|
34
|
+
}
|
35
|
+
return http(httpOpt)
|
36
|
+
.then(function (res) {
|
37
|
+
if (res.statusCode === 200) {
|
38
|
+
resolve()
|
39
|
+
} else {
|
40
|
+
const body = JSON.parse(res.body) || {}
|
41
|
+
if (body.errors && body.errors.length > 0) {
|
42
|
+
const errors = body.errors.map((e) => {
|
43
|
+
return e.message
|
44
|
+
})
|
45
|
+
reject(new Error(`${res.statusCode} ${errors.join(', ')}`))
|
46
|
+
}
|
47
|
+
}
|
48
|
+
})
|
49
|
+
})
|
50
|
+
}
|
51
|
+
|
52
|
+
exports.func = function (args) {
|
53
|
+
const jar = args.jar
|
54
|
+
return getGeneralToken({ jar: jar })
|
55
|
+
.then(function (xcsrf) {
|
56
|
+
return block(jar, xcsrf, args.userId)
|
57
|
+
})
|
58
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
// Includes
|
2
|
+
const http = require('../util/http.js').func
|
3
|
+
const getGeneralToken = require('../util/getGeneralToken.js').func
|
4
|
+
|
5
|
+
// Args
|
6
|
+
exports.required = ['userId']
|
7
|
+
exports.optional = ['jar']
|
8
|
+
|
9
|
+
// Docs
|
10
|
+
/**
|
11
|
+
* 🔐 Unblock a user.
|
12
|
+
* @category AccountSettings
|
13
|
+
* @alias unblock
|
14
|
+
* @param {number} userId - The id of the user.
|
15
|
+
* @returns {Promise<void>}
|
16
|
+
* @example const noblox = require("noblox.js")
|
17
|
+
* // Login using your cookie
|
18
|
+
* noblox.unblock(123456)
|
19
|
+
**/
|
20
|
+
|
21
|
+
// Define
|
22
|
+
function unblock (jar, token, userId) {
|
23
|
+
return new Promise((resolve, reject) => {
|
24
|
+
const httpOpt = {
|
25
|
+
url: `//accountsettings.roblox.com/v1/users/${userId}/unblock`,
|
26
|
+
options: {
|
27
|
+
method: 'POST',
|
28
|
+
jar: jar,
|
29
|
+
headers: {
|
30
|
+
'X-CSRF-TOKEN': token
|
31
|
+
},
|
32
|
+
resolveWithFullResponse: true
|
33
|
+
}
|
34
|
+
}
|
35
|
+
return http(httpOpt)
|
36
|
+
.then(function (res) {
|
37
|
+
if (res.statusCode === 200) {
|
38
|
+
resolve()
|
39
|
+
} else {
|
40
|
+
const body = JSON.parse(res.body) || {}
|
41
|
+
if (body.errors && body.errors.length > 0) {
|
42
|
+
const errors = body.errors.map((e) => {
|
43
|
+
return e.message
|
44
|
+
})
|
45
|
+
reject(new Error(`${res.statusCode} ${errors.join(', ')}`))
|
46
|
+
}
|
47
|
+
}
|
48
|
+
})
|
49
|
+
})
|
50
|
+
}
|
51
|
+
|
52
|
+
exports.func = function (args) {
|
53
|
+
const jar = args.jar
|
54
|
+
return getGeneralToken({ jar: jar })
|
55
|
+
.then(function (xcsrf) {
|
56
|
+
return unblock(jar, xcsrf, args.userId)
|
57
|
+
})
|
58
|
+
}
|