The rblx library is meant for easy interactions with the Roblox Open Cloud & Web APIs. Currently, this includes all of the Open Cloud Datastore API functions, Open Cloud OrderedDatastore API functions, Open Cloud Place Management API functions, Open Cloud MessagingService API functions, and almost all Web API functions.
- Install via npm:
npm install rblx
(includes type declarations)
Create a new file* in the root of your project called .env
with the following content:
RBXTKN=
+ your Open Cloud API key
RBXROBLOXSECURITY=
+ your bot account's (do NOT use your own) .ROBLOXSECURITY
token (cookie value)
*Don't forget to add this .env file to your .gitignore!
OpenCloudAssetManager {Class}
Creates a new OpenCloudUniverse object
Pass the API key through this function, or use the npm dotenv package and process.env.RBXTKN
from above
OpenCloudAssetManager.createAsset(assetType: Util.AssetType, filePath: string, name: string, desc: string)
Create a new asset
Get operation data related to an asset uplooad
Update an asset (currently locked to only Models on Roblox's end)
OpenCloudUniverse {Class}
Creates a new OpenCloudUniverse object
Pass the API key through this function, or use the npm dotenv package and process.env.RBXTKN
from above
Return an object containing the previous page cursor, next page cursor, and datastore objects.
Return an OrderedDataStore.
Save the rblx
file located at pathToFile
to Roblox, therefore not publishing.
Publish the rblx
file located at pathToFile
to Roblox, therefore also saving to Roblox.
Publish some data to a MessagingService topic (this only works in Live Servers as of 7/8/22)
OpenCloudDataStore {Class}
Creates a new OpenCloudDataStore class - THIS IS NOT MEANT TO BE CALLED MANUALLY
Authenticate the OpenCloudDataStore with your API key
OpenCloudDataStore.listKeys(limit?: number | LimitOptions, allScopes?: boolean, prefix?: string, cursor?: string)
IF LIMIT IS NUMBER: Return an object containing the previous page cursor, next page cursor, and keys on the current page
IF LIMIT IS LIMITOPTIONS: Return an object with the number of keys specified
LimitOptions
is used if you want to receive the number of keys you made as the limit. The intended functionality of Roblox's limit parameter does not guarantee you will receive as many keys as you have requested, but using LimitOptions instead of a number value will do so.
LimitOptions
follows this schema:
{
limit: number,
useV2Limit: boolean // true to get all keys specified
}
Get the value of a key
OpenCloudDataStore.set(key: string, value: any = null, exclusiveCreate?: boolean, matchVersion?: string)
Set/update the value of a key
NOTE: You cannot use exclusiveCreate
and matchVersion
in the same request!
Increment a value by incrementBy
units
Delete a key from the OpenCloudDataStore
OpenCloudDataStore.listVersions(key: string, limit: number = 1, sortOrder: 'Ascending'|'Descending' = 'Ascending', cursor?: string, startTime?: string, endTime?: string)
List all versions of a key (with versionIds for get
ting)
Note: startTime
and endTime
must be ISO dates in UTC time!
Get the value of key
at version versionId
OpenCloudOrderedDataStore {Class}
Creates a new OpenCloudOrderedDataStore class - THIS IS NOT MEANT TO BE CALLED MANUALLY
Authenticate the OpenCloudOrderedDataStore with your API key
OpenCloudOrderedDataStore.listEntries(maxPageSize: number, cursor: string, order: OrderType, filter: string)
List all entries in an OpenCloudOrderedDataStore
Create a new entry in an OpenCloudOrderedDataStore
Get an entry from an OpenCloudOrderedDataStore
Delete a new entry from an OpenCloudOrderedDataStore
Update an entry in an OpenCloudOrderedDataStore
Increment an entry in an OpenCloudOrderedDataStore by a certain amount
Client {Class}
Creates a new Client class
Authenticate the Client with your .ROBLOSECURITY token (recommended: store in .env file)
Accept a friend request from userId
Accept a trade of id tradeId
Send a friend request to userId
Block ❌ userId
See if you can trade with userId
Claim ownership of group groupId
Counter a trade of id tradeId
with your offers
Decline all friend requests
Decline a friend request from a single user of id userId
Decline trade of id tradeId
Get your account's birthdate
Get your account's (xbox) consecutive login days
Get your account's description
Get your account's display name
Get your account's friend count
Get your account's friend requests
Get your account's number of friend requests
Get your account's gender
Get your account's locale (language)
Get your account's phone number (if applicable)
Get your account's social links (if applicable)
Get your account's status
Get a trade with id tradeId
Get your account's trades
Get your account's trades count
Get your account's user id
Get your account's username
Check if you are following userId
Remove friend with id userId
Remove your primary group
Send trades (specify who in the form of an id in the offers
parameter's options)
Set your account's birthdate
Set your account's description
Set your account's display name
Set your account's gender
Set your account's primary group to the group of id groupId
Set your account's social links
Set your account's status
Unblock the user of id userId
// Open Cloud
const { OpenCloudUniverse } = require('rblx');
let uni = new OpenCloudUniverse(0000);
uni.authenticate(process.env.RBXTKN);
let dstore = (await uni.getDatastores(1)).datastores[0];
let newKey = await dstore.set('newkey', 100);
await dstore.increment('newkey', 50);
let newValue = await dstore.get('newkey');
console.log(newValue); // 150
// Web API
const { Client } = require('rblx')
let bot = new Client();
bot.login(process.env.RBXROBLOXSECURITY)
.then(async () => {
let status = await bot.getStatus();
let newStatus = status.replace('day 1', 'day 2');
await bot.setStatus(newStatus);
});
- GitHub Repository: https://github.com/RyloRiz/rblx
- NPM: https://www.npmjs.com/package/rblx
Thanks for reading! If you have any suggestions or bug reports, please file an issue and I'll get back to you ASAP!