open-cloud.js
is a wrapper around Roblox's Open Cloud API.
import { Client } from "open-cloud.js";
const client = new Client({
apiKey: "",
universeId: ""
});
(async () => {
const dataStoreInstance = client.DataStore.createInstance("Cash");
// Give "Roblox" 750 cash
console.log(
await dataStoreInstance.setEntry({
entryKey: "1",
content: "750"
})
);
/*
Respond:
{
version: '', // The entry version
deleted: false, // Is it deleted?
contentLength: 3, // The number is 3 letter long!
createdTime: '', // The time when you set the cash amount
objectCreatedTime: '' // The time when the key was created
}
*/
console.log(
await dataStoreInstance.getEntry({
entryKey: "1"
})
);
// 750
// Oh hey! Roblox still have 750 cash!
console.log(await dataStoreInstance.listEntries());
/*
{
// Oh hey! only roblox have the cash!
keys: [ { key: '1' } ],
nextPageCursor: ''
}
*/
})();