Comparing version 4.13.1 to 4.14.0
@@ -12,3 +12,3 @@ // Includes | ||
* 🔐 Removes an asset from the authenticated user's inventory; throws an error if the item is not owned. | ||
* @category Assets | ||
* @category Asset | ||
* @alias deleteFromInventory | ||
@@ -15,0 +15,0 @@ * @param {number} assetId - The id of the asset. |
@@ -11,3 +11,3 @@ // Includes | ||
* ✅ Get the info of an asset. | ||
* @category Assets | ||
* @category Asset | ||
* @param {number} assetId - The id of the asset. | ||
@@ -23,3 +23,3 @@ * @returns {Promise<ProductInfo>} | ||
const httpOpt = { | ||
url: '//api.roblox.com/marketplace/productinfo?assetId=' + asset, | ||
url: `//economy.roblox.com/v2/assets/${asset}/details`, | ||
options: { | ||
@@ -26,0 +26,0 @@ resolveWithFullResponse: true, |
// Includes | ||
const http = require('../util/http.js').func | ||
const getGeneralToken = require('../util/getGeneralToken').func | ||
const configureItem = require('./configureItem.js').func | ||
const configureItem = require('../develop/configureItem.js').func | ||
@@ -13,3 +13,3 @@ // Args | ||
* 🔐 Upload an animation, either as a new asset or by overwriting an existing animation. | ||
* @category Assets | ||
* @category Asset | ||
* @alias uploadAnimation | ||
@@ -16,0 +16,0 @@ * @param {string | Stream} data - The rbxm file containing the KeyframeSequence. |
@@ -12,3 +12,3 @@ // Includes | ||
* 🔐 Upload an item. | ||
* @category Assets | ||
* @category Asset | ||
* @alias uploadItem | ||
@@ -23,3 +23,3 @@ * @param {string} name - The name of the asset. | ||
* // Login using your cookie | ||
* noblox.uploadItem("A cool decal.", 13, fs.createReadStream("./Image.png")) | ||
* await noblox.uploadItem("A cool decal.", 13, fs.createReadStream("./Image.png")) | ||
**/ | ||
@@ -26,0 +26,0 @@ |
@@ -12,3 +12,3 @@ // Includes | ||
* 🔐 Upload a model. | ||
* @category Assets | ||
* @category Asset | ||
* @alias uploadModel | ||
@@ -15,0 +15,0 @@ * @param {string | Stream} data - The model data. |
@@ -8,3 +8,3 @@ const http = require('../util/http.js').func | ||
/** | ||
* 🔐 Add users to a conversation. | ||
* 🔐 Get conversation details for the conversationIds specified in the parameters | ||
* @category Chat | ||
@@ -34,5 +34,12 @@ * @alias getConversations | ||
} else { | ||
return JSON.parse(res.body) | ||
let response = JSON.parse(res.body) | ||
response = response.map((entry) => { | ||
entry.lastUpdated = new Date(entry.lastUpdated) | ||
return entry | ||
}) | ||
return response | ||
} | ||
}) | ||
} |
const events = require('events') | ||
const onNotification = require('../user/onNotification.js').func | ||
const onNotification = require('../client/onNotification.js').func | ||
@@ -15,5 +15,10 @@ exports.optional = ['jar'] | ||
* // Login using your cookie | ||
* noblox.onNewConversation().on("data", function(data) { | ||
* console.log("New conversation!", data) | ||
* const conversationEvent = noblox.onNewConversation() | ||
* conversationEvent.on("data", function(data) { | ||
* console.log("New conversation! ", data) | ||
* }) | ||
* conversationEvent.on("error", function(err) { | ||
* console.error("Something went wrong: ", err) | ||
* // Handle error as needed | ||
* }) | ||
**/ | ||
@@ -20,0 +25,0 @@ |
const events = require('events') | ||
const onNotification = require('../user/onNotification.js').func | ||
const onNotification = require('../client/onNotification.js').func | ||
@@ -9,3 +9,6 @@ exports.optional = ['jar'] | ||
/** | ||
* 🔐 An event for when someone messages you. | ||
* 🔐 An event for when someone messages you via. chat. This event will only emit for messages sent via. chat windows on | ||
* the website - those in the pop-up/overlay window. To handle messages sent via. the older email-like | ||
* message function, see onMessage. | ||
* @see [onMessage()](global.html#onMessage) | ||
* @category Chat | ||
@@ -16,5 +19,10 @@ * @alias onNewMessage | ||
* // Login using your cookie | ||
* noblox.onNewMessage().on("data", function(data) { | ||
* console.log("New message!", data) | ||
* const messageEvent = noblox.onNewMessage() | ||
* messageEvent.on("data", function(data) { | ||
* console.log("New chat message! ", data) | ||
* }) | ||
* messageEvent.on("error", function(err) { | ||
* console.error("Something went wrong: ", err) | ||
* // Handle error as needed | ||
* }) | ||
**/ | ||
@@ -21,0 +29,0 @@ |
const events = require('events') | ||
const onNotification = require('../user/onNotification.js').func | ||
const onNotification = require('../client/onNotification.js').func | ||
@@ -15,5 +15,10 @@ exports.optional = ['jar'] | ||
* // Login using your cookie | ||
* noblox.onNewMessageBySelf().on("data", function(data) { | ||
* console.log("Sent message!", data) | ||
* const messageSent = noblox.onNewMessageBySelf() | ||
* messageSent.on("data", function(data) { | ||
* console.log("Sent chat message! ", data) | ||
* }) | ||
* messageSent.on("error", function(err) { | ||
* console.error("Something went wrong: ", err) | ||
* // Handle error as needed | ||
* }) | ||
**/ | ||
@@ -20,0 +25,0 @@ |
const events = require('events') | ||
const onNotification = require('../user/onNotification.js').func | ||
const onNotification = require('../client/onNotification.js').func | ||
@@ -15,5 +15,10 @@ exports.optional = ['jar'] | ||
* // Login using your cookie | ||
* noblox.onUserOnline().on("data", function(data) { | ||
* console.log("User online!", data) | ||
* const userOnlineEvent = noblox.onUserOnline() | ||
* userOnlineEvent.on("data", function(data) { | ||
* console.log("User online! ", data) | ||
* }) | ||
* userOnlineEvent.on("error", function(err) { | ||
* console.error("Something went wrong: ", err) | ||
* // Handle error as needed | ||
* }) | ||
**/ | ||
@@ -20,0 +25,0 @@ |
const events = require('events') | ||
const onNotification = require('../user/onNotification.js').func | ||
const onNotification = require('../client/onNotification.js').func | ||
@@ -15,5 +15,10 @@ exports.optional = ['jar'] | ||
* // Login using your cookie | ||
* noblox.onUserTyping().on("data", function(data) { | ||
* console.log("User typing!", data) | ||
* const userTyping = noblox.onUserTyping() | ||
* userTyping.on("data", function(data) { | ||
* console.log("User typing! ", data) | ||
* }) | ||
* userTyping.on("error", function(err) { | ||
* console.error("Something went wrong: ", err) | ||
* // Handle error as needed | ||
* }) | ||
**/ | ||
@@ -20,0 +25,0 @@ |
const events = require('events') | ||
const onNotification = require('../user/onNotification.js').func | ||
const onNotification = require('../client/onNotification.js').func | ||
@@ -15,5 +15,10 @@ exports.optional = ['jar'] | ||
* // Login using your cookie | ||
* noblox.onPartyDeleted().on("data", function(data) { | ||
* console.log("Party deleted!", data) | ||
* const partyDeleted = noblox.onPartyDeleted() | ||
* partyDeleted.on("data", function(data) { | ||
* console.log("Party deleted! ", data) | ||
* }) | ||
* partyDeleted.on("error", function(err) { | ||
* console.error("Something went wrong: ", err) | ||
* // Handle error as needed | ||
* }) | ||
**/ | ||
@@ -20,0 +25,0 @@ |
const events = require('events') | ||
const onNotification = require('../user/onNotification.js').func | ||
const onNotification = require('../client/onNotification.js').func | ||
@@ -15,5 +15,10 @@ exports.optional = ['jar'] | ||
* // Login using your cookie | ||
* noblox.onPartyInvite().on("data", function(data) { | ||
* console.log("Invited to party!", data) | ||
* const partyInvite = noblox.onPartyInvite() | ||
* partyInvite.on("data", function(data) { | ||
* console.log("Invited to party! ", data) | ||
* }) | ||
* partyInvite.on("error", function(err) { | ||
* console.error("Something went wrong: ", err) | ||
* // Handle error as needed | ||
* }) | ||
**/ | ||
@@ -20,0 +25,0 @@ |
const events = require('events') | ||
const onNotification = require('../user/onNotification.js').func | ||
const onNotification = require('../client/onNotification.js').func | ||
@@ -15,5 +15,10 @@ exports.optional = ['jar'] | ||
* // Login using your cookie | ||
* noblox.onPartyJoinedGame().on("data", function(data) { | ||
* console.log("Party joined game!", data) | ||
* const partyJoinedGame = noblox.onPartyJoinedGame() | ||
* partyJoinedGame.on("data", function(data) { | ||
* console.log("Party joined game! ", data) | ||
* }) | ||
* partyJoinedGame.on("error", function(err) { | ||
* console.error("Something went wrong: ", err) | ||
* // Handle error as needed | ||
* }) | ||
**/ | ||
@@ -20,0 +25,0 @@ |
const events = require('events') | ||
const onNotification = require('../user/onNotification.js').func | ||
const onNotification = require('../client/onNotification.js').func | ||
@@ -15,5 +15,10 @@ exports.optional = ['jar'] | ||
* // Login using your cookie | ||
* noblox.onPartyLeftGame().on("data", function(data) { | ||
* console.log("Party left game!", data) | ||
* const partyLeftGame = noblox.onPartyLeftGame() | ||
* partyLeftGame.on("data", function(data) { | ||
* console.log("Party left game! ", data) | ||
* }) | ||
* partyLeftGame.on("error", function(err) { | ||
* console.error("Something went wrong: ", err) | ||
* // Handle error as needed | ||
* }) | ||
**/ | ||
@@ -20,0 +25,0 @@ |
const events = require('events') | ||
const onNotification = require('../user/onNotification.js').func | ||
const onNotification = require('../client/onNotification.js').func | ||
@@ -15,5 +15,10 @@ exports.optional = ['jar'] | ||
* // Login using your cookie | ||
* noblox.onPartySelfJoined().on("data", function(data) { | ||
* console.log("You joined a party!", data) | ||
* const joinedParty = noblox.onPartySelfJoined() | ||
* joinedParty.on("data", function(data) { | ||
* console.log("You joined a party! ", data) | ||
* }) | ||
* joinedParty.on("error", function(err) { | ||
* console.error("Something went wrong: ", err) | ||
* // Handle error as needed | ||
* }) | ||
**/ | ||
@@ -20,0 +25,0 @@ |
const events = require('events') | ||
const onNotification = require('../user/onNotification.js').func | ||
const onNotification = require('../client/onNotification.js').func | ||
@@ -15,5 +15,10 @@ exports.optional = ['jar'] | ||
* // Login using your cookie | ||
* noblox.onPartySelfLeft().on("data", function(data) { | ||
* console.log("You left a party!", data) | ||
* const leftParty = noblox.onPartySelfLeft() | ||
* leftParty.on("data", function(data) { | ||
* console.log("You left a party! ", data) | ||
* }) | ||
* leftParty.on("error", function(err) { | ||
* console.error("Something went wrong: ", err) | ||
* // Handle error as needed | ||
* }) | ||
**/ | ||
@@ -20,0 +25,0 @@ |
const events = require('events') | ||
const onNotification = require('../user/onNotification.js').func | ||
const onNotification = require('../client/onNotification.js').func | ||
@@ -15,5 +15,10 @@ exports.optional = ['jar'] | ||
* // Login using your cookie | ||
* noblox.onPartyUserJoined().on("data", function(data) { | ||
* console.log("Someone joined a party!", data) | ||
* const partyJoined = noblox.onPartyUserJoined() | ||
* partyJoined.on("data", function(data) { | ||
* console.log("Someone joined a party! ", data) | ||
* }) | ||
* partyJoined.on("error", function(err) { | ||
* console.error("Something went wrong: ", err) | ||
* // Handle error as needed | ||
* }) | ||
**/ | ||
@@ -20,0 +25,0 @@ |
const events = require('events') | ||
const onNotification = require('../user/onNotification.js').func | ||
const onNotification = require('../client/onNotification.js').func | ||
@@ -15,5 +15,10 @@ exports.optional = ['jar'] | ||
* // Login using your cookie | ||
* noblox.onPartyUserLeft().on("data", function(data) { | ||
* console.log("User left party!", data) | ||
* const partyLeft = noblox.onPartyUserLeft() | ||
* partyLeft.on("data", function(data) { | ||
* console.log("Someone left party! ", data) | ||
* }) | ||
* partyLeft.on("error", function(err) { | ||
* console.error("Something went wrong: ", err) | ||
* // Handle error as needed | ||
* }) | ||
**/ | ||
@@ -20,0 +25,0 @@ |
@@ -20,3 +20,3 @@ // Includes | ||
// Define | ||
exports.func = function (args) { | ||
exports.func = async function (args) { | ||
const jar = args.jar | ||
@@ -33,17 +33,14 @@ const option = args.option | ||
} | ||
return http(httpOpt) | ||
.then(function (res) { | ||
if (res.statusCode !== 200) { | ||
throw new Error('You are not logged in.') | ||
} else { | ||
const json = JSON.parse(res.body) | ||
if (option) { | ||
const searchKey = Object.keys(json).filter((key) => { | ||
return option.toLowerCase() === key.toLowerCase() | ||
})[0] | ||
return json[searchKey] | ||
} | ||
return json | ||
} | ||
}) | ||
const res = await http(httpOpt) | ||
if (res.statusCode !== 200) { | ||
throw new Error('You are not logged in.') | ||
} | ||
const json = JSON.parse(res.body) | ||
if (!option) { | ||
return json | ||
} | ||
const searchKey = Object.keys(json).filter((key) => { | ||
return option.toLowerCase() === key.toLowerCase() | ||
})[0] | ||
return json[searchKey] | ||
} |
@@ -47,2 +47,3 @@ // Dependencies | ||
opt.headers.cookie = '.ROBLOSECURITY=' + opt.jar.session + ';' | ||
opt.headers['x-api-key'] = opt.jar.apiKey | ||
opt.jar = null | ||
@@ -49,0 +50,0 @@ } |
{ | ||
"name": "noblox.js", | ||
"version": "4.13.1", | ||
"description": "A Node.js wrapper for Roblox. (original from sentanos)", | ||
"version": "4.14.0", | ||
"description": "A Node.js API wrapper for Roblox.", | ||
"main": "lib/index.js", | ||
@@ -25,3 +25,3 @@ "types": "typings/index.d.ts", | ||
"cheerio": "^1.0.0-rc.10", | ||
"entities": "^3.0.1", | ||
"entities": "^4.3.0", | ||
"figlet": "^1.4.0", | ||
@@ -39,3 +39,4 @@ "request": "^2.81.0", | ||
"Joshua Lanese <froastj@gmail.com>", | ||
"Neztore <hi@nezto.re>" | ||
"Neztore <hi@nezto.re>", | ||
"Alan Bixby <alan@bxb.gg> (https://alanbix.by)" | ||
], | ||
@@ -48,13 +49,14 @@ "homepage": "https://github.com/noblox/noblox.js", | ||
"better-docs": "2.7.2", | ||
"dotenv": "16.0.0", | ||
"dotenv": "16.0.3", | ||
"eslint": "^7.28.0", | ||
"eslint-config-standard": "^16.0.3", | ||
"eslint-plugin-import": "^2.25.3", | ||
"eslint-plugin-jest": "26.1.1", | ||
"eslint-plugin-jest": "27.2.1", | ||
"eslint-plugin-node": "^11.0.0", | ||
"eslint-plugin-promise": "^5.1.0", | ||
"jest": "^27.3.1", | ||
"jest": "^29.5.0", | ||
"jest-extended": "^3.2.4", | ||
"jsdoc": "3.6.10", | ||
"progress": "^2.0.0", | ||
"standard": "^16.0.4" | ||
"standard": "^17.0.0" | ||
}, | ||
@@ -65,2 +67,5 @@ "jest": { | ||
], | ||
"setupFilesAfterEnv": [ | ||
"jest-extended/all" | ||
], | ||
"coveragePathIgnorePatterns": [ | ||
@@ -67,0 +72,0 @@ "lib/party", |
@@ -19,3 +19,3 @@ const chalk = require('chalk') | ||
${chalk.green('We have created a request for Roblox to implement a change log to help keep the project\'s endpoints updated which you can find here: https://devforum.roblox.com/t/introduce-change-logs-to-roblox-api-endpoints/524783.')} | ||
${chalk.bgGreen('We also have our very own discord.js for support and informational purposes. To stay updated on new updates and bugs, you can join our Discord server with the following link: https://discord.gg/R5GVSyTVGv')} | ||
${chalk.bgGreen('We also have our very own Discord for support and informational purposes. To stay updated on new updates and bugs, you can join our Discord server with the following link: https://discord.gg/R5GVSyTVGv')} | ||
`) |
@@ -1,2 +0,2 @@ | ||
const { buy, configureItem, deleteFromInventory, getProductInfo, getResaleData, getResellers, uploadItem, uploadAnimation, setCookie } = require('../lib') | ||
const { buy, deleteFromInventory, getProductInfo, uploadAnimation, uploadItem, uploadModel, setCookie, getOwnership, getCurrentUser } = require('../lib') | ||
const fs = require('fs') | ||
@@ -12,95 +12,23 @@ | ||
expect.extend({ | ||
nullOrAny (received, expected) { | ||
if (received === null) { | ||
return { | ||
pass: true, | ||
message: () => `expected null or instance of ${this.utils.printExpected(expected)}, but received ${this.utils.printReceived(received)}` | ||
} | ||
} | ||
if (expected === String) { | ||
return { | ||
pass: typeof received === 'string' || received instanceof String, | ||
message: () => `expected null or instance of ${this.utils.printExpected(expected)}, but received ${this.utils.printReceived(received)}` | ||
} | ||
} | ||
if (expected === Number) { | ||
return { | ||
pass: typeof received === 'number' || received instanceof Number, | ||
message: () => `expected null or instance of ${this.utils.printExpected(expected)}, but received ${this.utils.printReceived(received)}` | ||
} | ||
} | ||
if (expected === Function) { | ||
return { | ||
pass: typeof received === 'function' || received instanceof Function, | ||
message: () => `expected null or instance of ${this.utils.printExpected(expected)}, but received ${this.utils.printReceived(received)}` | ||
} | ||
} | ||
if (expected === Object) { | ||
return { | ||
pass: received !== null && typeof received === 'object', | ||
message: () => `expected null or instance of ${this.utils.printExpected(expected)}, but received ${this.utils.printReceived(received)}` | ||
} | ||
} | ||
if (expected === Boolean) { | ||
return { | ||
pass: typeof received === 'boolean', | ||
message: () => `expected null or instance of ${this.utils.printExpected(expected)}, but received ${this.utils.printReceived(received)}` | ||
} | ||
} | ||
/* jshint -W122 */ | ||
/* global Symbol */ | ||
if (typeof Symbol !== 'undefined' && this.expectedObject === Symbol) { | ||
return { | ||
pass: typeof received === 'symbol', | ||
message: () => `expected null or instance of ${this.utils.printExpected(expected)}, but received ${this.utils.printReceived(received)}` | ||
} | ||
} | ||
/* jshint +W122 */ | ||
return { | ||
pass: received instanceof expected, | ||
message: () => `expected null or instance of ${this.utils.printExpected(expected)}, but received ${this.utils.printReceived(received)}` | ||
} | ||
} | ||
}) | ||
describe('Asset Methods', () => { | ||
it('buy() successfully purchases an item', () => { | ||
return buy(1778181).then(res => { | ||
return expect(res).toEqual({ | ||
productId: expect.any(Number), | ||
price: expect.any(Number) | ||
}) | ||
it('deleteFromInventory() successfully deletes an item from user\'s inventory', async () => { | ||
await getOwnership(await getCurrentUser('UserId'), 1778181).then((res) => { | ||
if (!res) return buy(1778181) | ||
}) | ||
return await expect(deleteFromInventory(1778181)).resolves.not.toThrow() | ||
}) | ||
it('deleteFromInventory() successfully deletes an item from user\'s inventory', () => { | ||
return deleteFromInventory(1778181) | ||
it('deleteFromInventory() errors when it tries to delete an item from user\'s inventory that isn\'t there', async () => { | ||
return await expect(deleteFromInventory(1778181)).rejects.toThrow() | ||
}) | ||
it('configureItem() successfully configures an item user owns', () => { | ||
return configureItem(1989194006, 'Main t-shirt', 'Uploaded by me').then(() => { | ||
return getProductInfo(1989194006).then((res) => { | ||
return expect(res).toMatchObject({ | ||
Name: 'Main t-shirt', | ||
Description: 'Uploaded by me' | ||
}) | ||
}) | ||
}) | ||
}) | ||
it('getProductInfo() successfully returns a product\'s information', () => { | ||
return getProductInfo(1989194006).then((res) => { | ||
return expect(res).toMatchObject({ | ||
AssetId: expect.any(Number), | ||
ProductId: expect.any(Number), | ||
Name: expect.any(String), | ||
Description: expect.any(String), | ||
Creator: expect.any(Object), | ||
PriceInRobux: expect.nullOrAny(Number) | ||
PriceInRobux: expect.toBeOneOf([expect.any(Number), null]) | ||
}) | ||
@@ -110,48 +38,31 @@ }) | ||
it('getResaleData() successfully returns a collectible\'s resale history', () => { | ||
return getResaleData(20573078).then((res) => { // Shaggy | ||
return expect(res).toMatchObject({ | ||
assetStock: expect.nullOrAny(Number), | ||
sales: expect.any(Number), | ||
numberRemaining: expect.nullOrAny(Number), | ||
recentAveragePrice: expect.any(Number), | ||
originalPrice: expect.nullOrAny(Number), | ||
priceDataPoints: expect.arrayContaining([ | ||
expect.objectContaining({ | ||
value: expect.nullOrAny(Number), | ||
date: expect.nullOrAny(Date) | ||
}) | ||
]) | ||
}) | ||
}) | ||
it('getProductInfo() errors when returning a product\'s information that does not exist', async () => { | ||
return await expect(getProductInfo(3)).rejects.toThrow() | ||
}) | ||
it('getResellers() successfully returns a collectible\'s resellable copies', () => { | ||
return getResellers(20573078).then((res) => { // Shaggy | ||
return expect(res).toEqual( | ||
expect.arrayContaining([ | ||
expect.objectContaining({ | ||
userAssetId: expect.any(Number), | ||
price: expect.any(Number), | ||
serialNumber: expect.nullOrAny(Number), | ||
seller: expect.objectContaining({ | ||
id: expect.any(Number), | ||
type: expect.any(String), | ||
name: expect.any(String) | ||
}) | ||
}) | ||
]) | ||
) | ||
it('uploadAnimation() uploads an animation', () => { | ||
return uploadAnimation(fs.createReadStream('./test/assets/KeyframeSequence.rbxm'), { name: 'noblox', description: 'A noblox test!', copyLocked: true, allowComments: false }).then((res) => { | ||
return expect(res).toEqual(expect.any(Number)) | ||
}) | ||
}) | ||
it('uploadItem() uploads an image', () => { | ||
return uploadItem('noblox', 13, fs.createReadStream('./img/noblox-js.png')) | ||
it('uploadAnimation() errors when no options are provided', async () => { | ||
await expect(uploadAnimation(fs.createReadStream('./test/assets/KeyframeSequence.rbxm'))).rejects.toThrow() | ||
}) | ||
it('uploadAnimation() uploads an animation', () => { | ||
return uploadAnimation(fs.createReadStream('./test/assets/KeyframeSequence.rbxm'), { name: 'noblox', description: 'A noblox test!', copyLocked: true, allowComments: false }).then((res) => { | ||
return expect(res).toEqual(expect.any(Number)) | ||
}) | ||
it('uploadItem() uploads an image', async () => { | ||
await expect(uploadItem('noblox', 13, fs.createReadStream('./img/noblox-js.png'))).resolves.not.toThrow() | ||
}) | ||
it('uploadModel() uploads a model', async () => { | ||
await expect(uploadModel(fs.createReadStream('./test/assets/Great-White-Shark-Fin.rbxm'), { | ||
name: 'Shark Fin', | ||
description: 'Uploaded via noblox', | ||
copyLocked: true | ||
})).resolves.not.toThrow() | ||
}) | ||
it('uploadModel() errors when no options are provided', async () => { | ||
await expect(uploadModel(fs.createReadStream('./test/assets/Great-White-Shark-Fin.rbxm'))).rejects.toThrow() | ||
}) | ||
}) |
@@ -100,8 +100,9 @@ const { avatarRules, currentlyWearing, getAvatar, getCurrentAvatar, getRecentItems, outfitDetails, outfits, redrawAvatar, removeAssetId, setAvatarBodyColors, setAvatarScales, setPlayerAvatarType, setWearingAssets, wearAssetId, setCookie } = require('../lib') | ||
return redrawAvatar().catch((err) => { | ||
expect(() => { throw new Error(err) }).toThrowError('Redraw avatar floodchecked') | ||
// eslint-disable-next-line jest/no-conditional-expect | ||
expect(() => { throw new Error(err) }).toThrow('Redraw avatar floodchecked') | ||
}) | ||
}) | ||
it('removeAssetId() takes off a worn asset on logged in user\'s avatar', () => { | ||
return removeAssetId(1989194006) | ||
it('removeAssetId() takes off a worn asset on logged in user\'s avatar', async () => { | ||
await expect(removeAssetId(1989194006)).resolves.not.toThrow() | ||
}) | ||
@@ -147,4 +148,4 @@ | ||
it('setWearingAssets() sets the player worn asset ID list to whatever is provided', () => { | ||
return setWearingAssets([63690008, | ||
it('setWearingAssets() sets the player worn asset ID list to whatever is provided', async () => { | ||
await expect(setWearingAssets([63690008, | ||
86498048, | ||
@@ -159,8 +160,8 @@ 86500008, | ||
144076760 | ||
]) | ||
])).resolves.not.toThrow() | ||
}) | ||
it('wearAssetId() wears the asset ID provided on the currently logged in user\'s avatar', () => { | ||
return wearAssetId(1989194006) | ||
it('wearAssetId() wears the asset ID provided on the currently logged in user\'s avatar', async () => { | ||
await expect(wearAssetId(1989194006)).resolves.not.toThrow() | ||
}) | ||
}) |
@@ -1,2 +0,2 @@ | ||
const { getAwardedTimestamps, getBadgeInfo, setCookie } = require('../lib') | ||
const { getAwardedTimestamps, getBadgeInfo, getGameBadges, getPlayerBadges, setCookie } = require('../lib') | ||
@@ -35,2 +35,63 @@ beforeAll(() => { | ||
}) | ||
it('getGameBadges() returns information on the badges in a game', () => { | ||
return getGameBadges(66654135).then((res) => { | ||
return expect(res).toEqual( | ||
expect.arrayContaining([ | ||
expect.objectContaining({ | ||
id: expect.any(Number), | ||
name: expect.any(String), | ||
description: expect.any(String), | ||
displayName: expect.any(String), | ||
displayDescription: expect.any(String), | ||
enabled: expect.any(Boolean), | ||
iconImageId: expect.any(Number), | ||
displayIconImageId: expect.any(Number), | ||
created: expect.any(Date), | ||
updated: expect.any(Date), | ||
statistics: expect.objectContaining({ | ||
pastDayAwardedCount: expect.any(Number), | ||
awardedCount: expect.any(Number), | ||
winRatePercentage: expect.any(Number) | ||
}), | ||
awardingUniverse: expect.objectContaining({ | ||
id: expect.any(Number), | ||
name: expect.any(String), | ||
rootPlaceId: expect.any(Number) | ||
}) | ||
}) | ||
]) | ||
) | ||
}) | ||
}) | ||
it('getPlayerBadges() returns information on badges a player has earned', () => { | ||
return getPlayerBadges(55549140, 10).then((res) => { | ||
return expect(res).toEqual( | ||
expect.arrayContaining([ | ||
expect.objectContaining({ | ||
id: expect.any(Number), | ||
name: expect.any(String), | ||
description: expect.any(String), | ||
displayName: expect.any(String), | ||
displayDescription: expect.any(String), | ||
enabled: expect.any(Boolean), | ||
iconImageId: expect.any(Number), | ||
displayIconImageId: expect.any(Number), | ||
awarder: expect.objectContaining({ | ||
id: expect.any(Number), | ||
type: expect.any(String) | ||
}), | ||
statistics: expect.objectContaining({ | ||
pastDayAwardedCount: expect.any(Number), | ||
awardedCount: expect.any(Number), | ||
winRatePercentage: expect.any(Number) | ||
}), | ||
created: expect.any(Date), | ||
updated: expect.any(Date) | ||
}) | ||
]) | ||
) | ||
}) | ||
}) | ||
}) |
@@ -15,3 +15,3 @@ const { addUsersToConversation, chatSettings, getChatMessages, getConversations, getRolloutSettings, getUnreadConversationCount, getUnreadMessages, getUserConversations, markChatAsRead, markChatAsSeen, multiGetLatestMessages, removeFromGroupConversation, renameGroupConversation, sendChatMessage, setChatUserTyping, start121Conversation, startGroupConversation, setCookie } = require('../lib') | ||
it('addUsersToConversation() adds additional user(s) to form a group chat', () => { | ||
return addUsersToConversation(8212952828, [66592931]).then((res) => { | ||
return addUsersToConversation(8212952828, [3187412077]).then((res) => { | ||
if (res && res.conversationId) newConversationId = res.conversationId | ||
@@ -36,12 +36,12 @@ | ||
it('getChatMessages() returns chat messages', () => { | ||
return getChatMessages(8212952828) | ||
it('getChatMessages() returns chat messages', async () => { | ||
await expect(getChatMessages(8212952828)).resolves.not.toThrow() | ||
}) | ||
it('getConversations() returns chat conversations that fit the provided IDs', () => { | ||
return getConversations([8212952828]) | ||
it('getConversations() returns chat conversations that fit the provided IDs', async () => { | ||
await expect(getConversations([8212952828])).resolves.not.toThrow() | ||
}) | ||
it('getRolloutSettings() returns rollout settings for chat features', () => { | ||
return getRolloutSettings(['LuaChat', 'Party']) | ||
it('getRolloutSettings() returns rollout settings for chat features', async () => { | ||
await expect(getRolloutSettings(['LuaChat', 'Party'])).resolves.not.toThrow() | ||
}) | ||
@@ -57,32 +57,32 @@ | ||
it('getUnreadMessages() returns unread messages in a given conversation', () => { | ||
return getUnreadMessages([8212952828]) | ||
it('getUnreadMessages() returns unread messages in a given conversation', async () => { | ||
await expect(getUnreadMessages([8212952828])).resolves.not.toThrow() | ||
}) | ||
it('getUserConversations() returns all conversations the logged in user is in', () => { | ||
return getUserConversations() | ||
it('getUserConversations() returns all conversations the logged in user is in', async () => { | ||
await expect(getUserConversations()).resolves.not.toThrow() | ||
}) | ||
it('markChatAsRead() marks a conversation\'s messages as read to the specified message', () => { | ||
return markChatAsRead(8212952828, 'e775e103-876f-4332-84ab-1ea14f326d39') | ||
it('markChatAsRead() marks a conversation\'s messages as read to the specified message', async () => { | ||
await expect(markChatAsRead(8212952828, 'e775e103-876f-4332-84ab-1ea14f326d39')).resolves.not.toThrow() | ||
}) | ||
it('markChatAsSeen() marks the conversations provided as seen', () => { | ||
return markChatAsSeen([8212952828]) | ||
it('markChatAsSeen() marks the conversations provided as seen', async () => { | ||
await expect(markChatAsSeen([8212952828])).resolves.not.toThrow() | ||
}) | ||
it('multiGetLatestMessages() returns the latest messages corresponding to the given list of conversation IDs', () => { | ||
return multiGetLatestMessages([8212952828]) | ||
it('multiGetLatestMessages() returns the latest messages corresponding to the given list of conversation IDs', async () => { | ||
await expect(multiGetLatestMessages([8212952828])).resolves.not.toThrow() | ||
}) | ||
it('removeFromGroupConversation() removes a user from a given conversation', () => { | ||
return removeFromGroupConversation(newConversationId, 66592931) | ||
it('removeFromGroupConversation() removes a user from a given conversation', async () => { | ||
await expect(removeFromGroupConversation(newConversationId, 3187412077)).resolves.not.toThrow() | ||
}) | ||
it('renameGroupConversation() renames a group conversation', () => { | ||
return renameGroupConversation(newConversationId, 'noblox testing') | ||
it('renameGroupConversation() renames a group conversation', async () => { | ||
await expect(renameGroupConversation(newConversationId, 'noblox testing')).resolves.not.toThrow() | ||
}) | ||
it('sendChatMessage() sends a chat message with provided content', () => { | ||
return sendChatMessage(newConversationId, 'This is a test.') | ||
it('sendChatMessage() sends a chat message with provided content', async () => { | ||
await expect(sendChatMessage(newConversationId, 'This is a test.')).resolves.not.toThrow() | ||
}) | ||
@@ -96,4 +96,4 @@ | ||
it('start121Conversation() starts a conversation with another user', () => { | ||
return start121Conversation(55549140) | ||
it('start121Conversation() starts a conversation with another user', async () => { | ||
await expect(start121Conversation(3187412077)).resolves.not.toThrow() | ||
}) | ||
@@ -104,3 +104,3 @@ | ||
it('startGroupConversation() opens a conversation with multiple people in it', () => { | ||
return startGroupConversation([55549140, 66592931], 'noblox test 2').then((res) => { | ||
return startGroupConversation([55549140, 3187412077], 'noblox test 2').then((res) => { | ||
expect(res).toMatchObject({ resultType: 'Success' }) | ||
@@ -107,0 +107,0 @@ }) |
@@ -10,2 +10,4 @@ ### What is Authentication on Roblox? | ||
> [Are you hosting your bot remotely? Due to recent security improvements, cookies are now locked by IP region. Learn connect to your VPS and generate the cookie remotely here.](https://noblox.js.org/tutorial-VPS%20Authentication.html) | ||
#### **Chrome** | ||
@@ -12,0 +14,0 @@ 1. Click the arrow icon on the right-hand side of the toolbar. |
@@ -158,2 +158,3 @@ // types/Types | ||
Name: string; | ||
HasVerifiedBadge: boolean; | ||
} | ||
@@ -165,2 +166,4 @@ | ||
type ProductInfo = { | ||
TargetId: number; | ||
ProductType?: string; | ||
AssetId: number; | ||
@@ -186,2 +189,5 @@ ProductId: number; | ||
ContentRatingTypeId: number; | ||
SaleAvailabilityLocations?: string[]; | ||
SaleLocation?: string; | ||
CollectibleItemId?: number; | ||
} | ||
@@ -258,2 +264,28 @@ | ||
*/ | ||
type ThumbnailRequest = { | ||
requestId?: string; | ||
targetId?: number; | ||
token?: string; | ||
alias?: string; | ||
type: 'Avatar' | 'AvatarHeadShot' | 'GameIcon' | 'BadgeIcon' | 'GameThumbnail' | 'GamePass' | 'Asset' | 'BundleThumbnail' | 'Outfit' | 'GroupIcon' | 'DeveloperProduct' | 'AutoGeneratedAsset' | 'AvatarBust' | 'PlaceIcon' | 'AutoGeneratedGameIcon' | 'ForceAutoGeneratedGameIcon'; | ||
size: string; | ||
format?: 'png' | 'jpeg'; | ||
isCircular?: boolean; | ||
} | ||
/** | ||
* @typedef | ||
*/ | ||
type ThumbnailData = { | ||
requestId?: string; | ||
errorCode: number; | ||
errorMessage: string; | ||
targetId: number; | ||
state: "Completed" | "Pending" | "Blocked"; | ||
imageUrl?: string; | ||
} | ||
/** | ||
* @typedef | ||
*/ | ||
type UploadItemResponse = { | ||
@@ -621,3 +653,3 @@ id: number; | ||
conversationTitle: ChatConversationTitle; | ||
lastUpdated: string; | ||
lastUpdated: Date; | ||
conversationUniverse: ChatConversationUniverse; | ||
@@ -697,39 +729,12 @@ } | ||
/// Game | ||
/** | ||
* @typedef | ||
*/ | ||
type GameInstancePlayerThumbnail = { | ||
AssetId: number; | ||
AssetTypeId: number; | ||
Url: string; | ||
IsFinal: boolean; | ||
} | ||
/** | ||
* @typedef | ||
*/ | ||
type GameInstancePlayer = { | ||
Id: number; | ||
Username: string; | ||
Thumbnail: GameInstancePlayerThumbnail; | ||
} | ||
/** | ||
* @typedef | ||
*/ | ||
type GameInstance = { | ||
Capacity: number; | ||
Ping: number; | ||
Fps: number; | ||
ShowSlowGameMessage: boolean; | ||
Guid: string; | ||
PlaceId: number; | ||
CurrentPlayers: Array<GameInstancePlayer>; | ||
UserCanJoin: boolean; | ||
ShowShutdownButton: boolean; | ||
JoinScript: string; | ||
FriendsDescription: string; | ||
FriendsMouseover: string; | ||
PlayersCapacity: string; | ||
id: string; | ||
maxPlayers: number; | ||
playing: number; | ||
playerTokens: Array<string>; | ||
fps: number; | ||
ping: number; | ||
} | ||
@@ -739,12 +744,2 @@ | ||
* @typedef | ||
*/ | ||
type GameInstances = { | ||
PlaceId: number; | ||
ShowShutdownAllButton: boolean; | ||
Collection: Array<GameInstance>; | ||
TotalCollectionSize: number; | ||
} | ||
/** | ||
* @typedef | ||
*/ | ||
@@ -846,13 +841,2 @@ type GamePassResponse = { | ||
*/ | ||
type DeveloperProductUpdateResult = { | ||
universeId: number, | ||
name: string, | ||
priceInRobux: number, | ||
description?: string, | ||
productId: number | ||
} | ||
/** | ||
* @typedef | ||
*/ | ||
type CheckDeveloperProductNameResult = { | ||
@@ -1168,3 +1152,3 @@ Success: boolean; | ||
displayName: string; | ||
buildersClubMembershipType: "None" | "BC" | "TBC" | "OBC" | "RobloxPremium"; | ||
hasVerifiedBadge?: boolean; | ||
} | ||
@@ -1178,4 +1162,4 @@ | ||
poster: GroupUser; | ||
created: string; | ||
updated: string; | ||
created: Date; | ||
updated: Date; | ||
} | ||
@@ -1212,3 +1196,3 @@ | ||
description: object; | ||
created: string; | ||
created: Date; | ||
} | ||
@@ -1301,2 +1285,5 @@ | ||
individualToGroupRobux?: number; | ||
premiumPayouts?: number; | ||
groupPremiumPayouts?: number; | ||
adjustmentRobux?: number; | ||
} | ||
@@ -1311,4 +1298,4 @@ | ||
body: string; | ||
created: string; | ||
updated: string; | ||
created: Date; | ||
updated: Date; | ||
} | ||
@@ -1393,3 +1380,3 @@ | ||
description: string; | ||
created: string; | ||
created: Date; | ||
isBanned: boolean; | ||
@@ -1414,10 +1401,14 @@ id: number; | ||
type FriendEntry = { | ||
created: Date; | ||
id: number; | ||
isBanned: boolean; | ||
isDeleted: boolean; | ||
isOnline?: boolean; | ||
presenceType: UserPresenceType; | ||
isDeleted: boolean; | ||
id: number; | ||
name: string; | ||
description: string; | ||
created: string; | ||
description?: string; | ||
displayName: string; | ||
externalAppDisplayName?: string; | ||
friendFrequentRank: number; | ||
friendFrequentScore: number; | ||
presenceType?: UserPresenceType; | ||
} | ||
@@ -1440,3 +1431,3 @@ | ||
description: string; | ||
created: string; | ||
created: Date; | ||
displayName: string; | ||
@@ -1517,5 +1508,3 @@ } | ||
*/ | ||
type FriendRequest = { | ||
userId: number; | ||
} | ||
type FriendRequest = number; | ||
@@ -1576,2 +1565,3 @@ /** | ||
twitch?: string; | ||
guilded?: string; | ||
} | ||
@@ -1838,1 +1828,75 @@ | ||
} | ||
/// Datastores | ||
/** | ||
* @typedef | ||
*/ | ||
type Datastore = { | ||
name: string; | ||
createdTime: Date; | ||
} | ||
/** | ||
* @typedef | ||
*/ | ||
type DatastoresResult = { | ||
datastores: Datastore[]; | ||
nextPageCursor?: string; | ||
} | ||
/** | ||
* @typedef | ||
*/ | ||
type EntryKey = { | ||
scope: string; | ||
key: string; | ||
} | ||
/** | ||
* @typedef | ||
*/ | ||
type DatastoreKeysResult = { | ||
keys: EntryKey[]; | ||
nextPageCursor?: string; | ||
} | ||
/** | ||
* @typedef | ||
*/ | ||
type DatastoreEntry = { | ||
data: any; | ||
metadata: { | ||
/** (ISO datetime, UTC): the time at which the entry was created */ | ||
robloxEntryCreatedTime: Date; | ||
/** (ISO datetime, UTC): the time at which the entry was updated */ | ||
lastModified: Date; | ||
/** version of the entry being read */ | ||
robloxEntryVersion: string; | ||
robloxEntryAttributes?: string; | ||
robloxEntryUserIDs?: string; | ||
/** the base-64 encoded MD5 checksum of the content */ | ||
contentMD5: string; | ||
/** the content length in bytes */ | ||
contentLength: number; | ||
} | ||
} | ||
/** | ||
* @typedef | ||
*/ | ||
type EntryVersion = { | ||
version: string; | ||
deleted: boolean; | ||
contentLength: number; | ||
createdTime: Date; | ||
objectCreatedTime: Date; | ||
} | ||
/** | ||
* @typedef | ||
*/ | ||
type EntryVersionsResult = { | ||
versions: EntryVersion[]; | ||
nextPageCursor: string; | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
680836
258
15564
16
34
- Removedentities@3.0.1(transitive)
Updatedentities@^4.3.0