npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@slay-epic/roblx.js

v1.1.0

Published

Uses the Roblox OpenCloud API for third-parties applications to interact with roblox's servers

Downloads

5

Readme

@slay-epic/roblx.js

About

@slay-epic/roblx.js is an npm package that allows the ease of interacting with Roblox's OpenCloud Api.

Documentation

To start using @slay-epic/roblx.js simply require the package first.

const RobloxJs = require("@slay-epic/roblx.js")

Classes

RobloxApiClient

The main class that interacts with the api.

Constructor

new RobloxApiClient({
    api_key: "abc123",
    global_universeId: ""
})

Parameters

  • api_key REQUIRED - This is your api key from the Creator Dashboard.
  • global_universeId - This parameter is optional but you would need to manually pass down the universe id when interacting with the api.

Methods

registerDataStore()

RobloxApiClient.registerDataStore(DataStoreName,universe_id)

Parameters

  • DataStoreName REQUIRED - The name of the data store you want to manage.
  • universe_id - This parameter is optional. The universe id of the game you are managing the data store on. If there is no universe_id passed then it uses the RobloxApiClient.data.global_universeId

Returns a DataStore class that is linked with the game via universe id (Note: Universe Id is NOT the same as Place Id)

DataStore

This class handles datastore management such as updating a key, removing it etc.

Constructor

new DataStore(RobloxApiClient,DataStoreName)

Parameters

  • RobloxApiClient REQUIRED - The RobloxApiClient class.
  • DataStoreName REQUIRED - The name of the data store you are trying to manage.

Methods

async getEntry()

Returns the value and metadata associated with an entry.

DataStore.getEntry(options,universe_id)

Options

{
    key: "123",
    scope: ""
}

Parameters

  • options
    • key REQUIRED - The key identifing the entry.
    • scope - See more information about Scopes.
  • universe_id - This parameter is optional. The universe id of the game you are managing the data store on. If there is no universe_id passed then it uses the RobloxApiClient.data.global_universeId

async setEntry()

Sets the value, metadata and user IDs associated with an entry.

DataStore.setEntry(options,universe_id)

Options

{
    key: "123",
    scope: "",
    matchVersion: "",
    exclusiveCreate: false
}

Parameters

  • options
    • key REQUIRED - The key identifing the entry.
    • scope - See more information about Scopes.
    • matchVersion - Provide to update only if the current version matches this.
    • exclusiveCreate - Create the entry only if it does not exist.
  • universe_id - This parameter is optional. The universe id of the game you are managing the data store on. If there is no universe_id passed then it uses the RobloxApiClient.data.global_universeId

async incrementEntry()

Increments the value for an entry by a given amount, or create a new entry with that amount.

DataStore.incrementEntry(options,universe_id)

Options

{
    key: "123",
    scope: "",
    increment: 0
}

Parameters

  • options
    • key REQUIRED - The key identifing the entry.
    • scope - See more information about Scopes.
    • increment - The amount by which the entry should be incremented, or the starting value if it doesn't exist.
  • universe_id - This parameter is optional. The universe id of the game you are managing the data store on. If there is no universe_id passed then it uses the RobloxApiClient.data.global_universeId

MessagingService

This class manages the messaging-service api such as publishing information to the servers that runs on the specified experience.

Constructor

new MessagingService(RobloxAPIClient,Topic)

Parameters

  • RobloxApiClient REQUIRED - The RobloxApiClient class.
  • Topic - This parameter is optional but you would need to manually pass down the topic when interacting with the api.

Methods

async publish()

Communicate with the servers that runs the experience

MessagingService.publish(message,topic,universe_id)

Parameters

  • message REQUIRED - The message you want to send to the servers
  • topic - This parameter is optional. The topic is the specific keyword the server uses to filter the incoming messages it recieves. If there is no topic passed then it uses the MessagingService.topic
  • universe_id - This parameter is optional. The universe id of the game you are managing the messaging service on. If there is no universe_id passed then it uses the RobloxApiClient.data.global_universeId

Additional Information

To have a communication with a third-party application and roblox's server using Messaging Service, you can do it like this

NodeJs App:

const RobloxJs = require("@slay-epic/roblx.js")
const {RobloxApiClient,MessagingService} = RobloxJS

const Client = new RobloxApiClient({
    api_key: "your_api_key",
    global_universeId: "your_universe_id"
})

const MessageManager = new MessagingService(Client,"topic")

async function publish(message){
    await MessageManager.publish(message)
}

publish("It works!")

Roblox SeverScript

local MessagingService = game:GetService("MessagingService")
local HTTPService = game:GetService("HttpService")

MessagingService:SubscribeAsync("topic",function(msg)
	local data = HTTPService:JSONDecode(msg.Data) -- Needs to be decoded since it recieves a json encoded data
    print(data) -- "It Works"
end)

Side Note: When testing this you must be in a LIVE server, which means you cannot test it with Roblox Studio

Support

Need help with this package? Come on down to our discord server and go to the #roblox・js under support channel to get some help. Provide information as much as possible so it is easier for us to diagnose your issue

Additional Resources

Roblox DataStore Api Documentation

Roblox Messaging Service Api Documentation

Life Digger's DataStore Api Tutorial (Node.js)

Life Digger's Messaging Service Api Tutorial