Git Product home page Git Product logo

bloxy's People

Contributors

affenity avatar dependabot-preview[bot] avatar fantasycoder123 avatar guidojw avatar returnedtrue avatar syrilai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bloxy's Issues

Cannot Purchase Item

When running:
roblox.buyAsset(2480046724, 7, 4125826);

I am unable to purchase a asset.

Todo list

  • Being able to sign in using 2FA
  • Be able to edit group settings aka. Description, emblem, group roles and ranks, remove /add group roles
  • being able to get players/users in the group (page etc)
  • get a user’s games (not places)
  • implement this stuff https://auth.roblox.com/docs

Throttle verify.eryn.io calls

Hi there, I see that your library is making use of my public verify.eryn.io API. That's super cool!

The verify.eryn.io API has an enforced rate limit of 60 requests per 60 seconds. The docs ask the developer to enforce that limit locally, instead of sending out an unmetered number of requests as your library currently does here.

It would be great if you could throttle requests if the user exceeds this limit. You can use a library like p-throttle to throttle this method without much effort; in this case you'd pass the function, followed by 60, 60000 to indicate a maximum of 60 calls in 60 seconds.

Also, if you want to future-proof your library, make sure that it follows redirects, as the API endpoint will be changing in a few months.

Thanks!

X-CSRF Token trouble

I'm experiencing token validation errors with the current way how tokens are handled. (on v5.0.2)

There are two different bugs:

  1. The very first token fetched once a method is called that requires a token causes an error:
    For example when I try to update my group's status on app startup, it gives me a token validation error. Whenever I retry after 5 minutes (the current set interval in the RESTController), it works.
  2. The 5 minute interval is too long:
    If I try to change the shout again somewhere during the end of the 5 minute interval after previous successful call, it also causes a token validation error. Due to this, I concluded that the 5 minute interval is too long.

To fix the second bug, I think the interval can be made shorter to something like 3 minutes.
However, I haven't found a good way to fix the first bug (have tested some solutions like immediately refetching the token after the firsts fetch). The only solution that fixed this is what I PR'd in the dev version as well: always refresh the token instead of based on an interval (what noblox.js also still does).

You will probably see a similar PR by me soon.

Export types in index.ts

I'm working on rewriting my API in TypeScript and noticed that all bloxy now exports is the Client.
It would be nice if all types are exported too, so I don't have to import them from their respective modules directly.

RBL-14

Group#properties issue

Hello.
Recently, I noticed that the Group#properties have an issue with the .shout & .memberCount properties.

This is the code I have:

const Discord = require('discord.js');
const bloxy = require('bloxy');
const bloxyClient = new bloxy();
const groupId = '4366007';

module.exports.run = async (bot, message, args) => { 
    bloxyClient.getGroup(groupId).then(group => {
        let embed = new Discord.RichEmbed()
        .setColor('BLUE')
        .setAuthor('Group Information', bot.user.displayAvatarURL)
        .addField('Group Name', group.name)
        .addField('Group ID', group.groupId)
        .addField('Membercount', group.memberCount)
        .addField('Owner', group.owner.username)
        .addField('Description', group.description)
        .addField('Current Shout', group.shout.body);
        message.channel.send(embed);
    });
}

On the Membercount & Current Shout fields, it shows:
Membercount; the membercount of approximately 1 week ago.
Current Shout: the group shout which was made 1 week ago.

In my side of view, this is an issue which should be fixed as many people may be using those properties on their bot and the bloxy source is giving incorrect information on those two properties.

Remove API endpoints that no longer exist

User-reported:

should remove /v1/contacts/match and /v1/contacts/update from the friends and contacts objects, since the endpoints no longer exist since a few weeks ago

Verify and submit PR

Not all APIs have allowedStatusCodes set

Example: the Catalog API has them set but the Groups API hasn't.

This way the validStatusCode response handler can't do its job correctly.
Now for example if you try a method that your user isn't permitted to do (like GroupsAPI.payoutMembers on a user that's not the regarding group's owner), the Roblox API will throw a 403 and since the method in the Groups API doesn't have the allowedStatusCodes set, bloxy will think the request was successful.

Conflict in userPresenceType

There seems to be a conflict in the UserPresenceType stored in the User class
In the User class, the userPresenceType value in the presence field is of type string, however this can be populated in three ways:

  1. Through the Presence API
    The Presence API returns a string, as shown here:
    https://github.com/Visualizememe/bloxy/blob/25f3940d49edf3acb63d740c41e4f2e336b6ec49/src/client/apis/PresenceAPI.ts#L16

  2. Through the Friends API
    The UserPresenceType can be returned in the Friends API. This is stored as a string, as shown here:
    https://github.com/Visualizememe/bloxy/blob/25f3940d49edf3acb63d740c41e4f2e336b6ec49/src/client/apis/FriendsAPI.ts#L126

  3. Through the Profile Header
    In the profile header, the UserPresenceType returned is a number, as seen here:
    https://github.com/Visualizememe/bloxy/blob/25f3940d49edf3acb63d740c41e4f2e336b6ec49/src/client/apis/OtherAPI.ts#L14
    which is then used to create the User object:
    https://github.com/Visualizememe/bloxy/blob/25f3940d49edf3acb63d740c41e4f2e336b6ec49/src/client/Client.ts#L103

Here is the mapping between numbers and string:
0 - "Offline"
1 - "Online"
2 - "In Game"
3 - "In Studio"

The UserPresenceType stored here is conflicted with the type for the User object. There needs to be a decision made to ensure this is kept uniform in all locations

Error: Failed to retrieve module "got" and no custom requester provided!

When i try to run my bloxy code it outputs this error:

Error: Failed to retrieve module "got" and no custom requester provided!
    at getRequester (C:\Users\kvand\OneDrive\Bureaublad\JS Devproduct\node_modules\bloxy\dist\controllers\rest\lib\getRequester.js:10:19)
    at new RESTController (C:\Users\kvand\OneDrive\Bureaublad\JS Devproduct\node_modules\bloxy\dist\controllers\rest\RESTController.js:38:53)
    at new Client (C:\Users\kvand\OneDrive\Bureaublad\JS Devproduct\node_modules\bloxy\dist\client\Client.js:17:21)
    at Object.<anonymous> (C:\Users\kvand\OneDrive\Bureaublad\JS Devproduct\index.js:2:16)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49

No matter what i do nothing seems to help.

Publish Asset Issue

await client.apis.publishAPI.uploadAssets({ files: 'test.rbxm', }).then(data => { console.log(data.AssetDetails); }).catch(err => { console.log(err); });

When I try the above, it returns an empty array as the promise. Any reasons why this may happen?!

[BLOXY-15] Bloxy X - Major rewrite and upcoming release of bloxy

A major rewrite of bloxy has been in the works for some time now. For the sake of transparency, I want to include updates and what's remaining before launching a new version in a beta phase.

Recap of new features

TL;DR: Easier to use, tons of new features (oauth, realtime, open cloud, typed endpoints, retries, type-safety and much more). Around the time of launch you'll be able to read more about the features on the brand new docs site. Supports ESM and CJS. Coming soon™️

What's in the works?

High-level view of the new features that are coming:

  • OAuth - Seamless usage of Roblox's new OAuth system.
  • Realtime - New version with better typing and updated dependencies
  • Cloud - Wrapper for the Roblox Open Cloud
  • Endpoints - Automated endpoint schema generation
  • Docs - Brand new documentation
  • Endpoint - Create custom Roblox endpoints with type-safety
  • Rest - More stable rest wrapper, being able to bring your own option seamlessly, more robust handling, retries
  • Tests - Better testing, unit tests, E2E tests
  • Client - Abstraction layer for interacting with the API through classes.

Expected release and changes

Release:
This is in active development and is expected to launch mid-february 2024. Although many features are complete, I need to set up testing and reliability tests.

What's changing (breaking):
The new bloxy version will have several notable changes. Most notably, the new version (X) has 100% breaking changes. Although a considerable amount of syntax and naming is familiar, they have all changed due to the nature of the new version. If you wish to upgrade to the new version, you must adapt to the new structure.

From SyncLinear.com | BLOXY-15

Issue with createDeveloperProduct.

Upon using createDeveloperProduct, I get this error shown:

BloxyHttpError [BloxyHttpInvalidStatusCodeError]:

Invalid status code in response. Body: {"errors":[{"code":0,"message":"No HTTP resource was found that matches the request URI 'http://develop.roblox.com/v1/universes/2095224927/developerproducts'."}]} | Status code: 404, status: undefined. Possible reasons:
- Invalid request method (i.e. POST instead of GET)
- Resource removed / updated to another route
- You're not logged in (use .login on the client to log in)


    at validStatusCode (C:\Users\Spiral\Desktop\bot\node_modules\bloxy\dist\controllers\rest\response\handlers\validStatusCode.js:30:29)
    at C:\Users\Spiral\Desktop\bot\node_modules\bloxy\dist\controllers\rest\response\RESTResponse.js:12:78
    at Array.map (<anonymous>)
    at RESTResponse.process (C:\Users\Spiral\Desktop\bot\node_modules\bloxy\dist\controllers\rest\response\RESTResponse.js:12:63)
    at RESTRequest.<anonymous> (C:\Users\Spiral\Desktop\bot\node_modules\bloxy\dist\controllers\rest\request\RESTRequest.js:26:29)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\Spiral\Desktop\bot\node_modules\tslib\tslib.js:111:62)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  statusCode: 404,
  status: undefined
}

I believe that this is the doing of Bloxy itself and not my code. I will not post my code publicly so if you feel you need to review my code for further investigation, contact me at SpiralRBX#5787

Suggestion: Custom event emitter

My suggestion was originally made in the Roblox API discord.
This is a suggestion to remove the need for Client.initWS(). This can be pretty confusing, this solution could fix this.

My suggestion is that for classes which extend event emitters, (I.e. Group/GroupFunctions) A listener is added for the newListener event.

Within this listener, it would check if the websocket has been initialised. If it hasn't, it would initialise it. It would then emit an error if this fails.

This means that:

  • Users do not have to run this function somewhere in their code
  • It's simpler: People only need to run a single function

Disadvantages:

  • People may not expect adding an event listener to do other things 'under the hood' - I wouldn't say this is much of an issue as people generally just expect things to work. This could be remedied by making it clear in documentation that this is an extended EventEmiter.

Example implementation (Pseudo code):

const WS = // Get websocket object somehow

Class Example extends EventEmitter {
constructor () {
this.on('newListener', function (eventName, listener) {
    if (!WS.active) {
        WS.init()
}
})
}
}

[BLOXY-14] Group.getJoinRequests has incorrect typings

Group.getJoinRequests has a return type of GroupJoinRequest (only declared and used in that file) with incorrect fields.
The method is basically a proxy to GroupsAPI.getJoinRequests which has a return type of GetJoinRequests.

The difference (and thus the bug) here is that GroupJoinRequest has fields like user, group, ... (which the Roblox API doesn't return) and GetJoinRequest has the correct fields: requester & created.

The implementation of these methods is correct, this is a typing bug only.

BLOXY-14

[BLOXY-12] You have to reinstall bloxy when you install a new package.

Whenever I try to use bloxy but need to install a new package it just stops working. Error:
Error: Failed to retrieve module "got" and no custom requester provided! at Object.getRequester [as default] (C:\Users\Owner\Downloads\RankBloxCode\node_modules\bloxy\dist\controllers\rest\lib\getRequester.js:10:19) at new RESTController (C:\Users\Owner\Downloads\RankBloxCode\node_modules\bloxy\dist\controllers\rest\RESTController.js:38:48) at new Client (C:\Users\Owner\Downloads\RankBloxCode\node_modules\bloxy\dist\client\Client.js:17:21) at fetchRobloxRank (C:\Users\Owner\Downloads\RankBloxCode\suspensions.js:87:24) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Client.<anonymous> (C:\Users\Owner\Downloads\RankBloxCode\suspensions.js:53:26)

When I reinstall it using: npm i bloxy --force it works again.

BLOXY-12

Getting "404, not found", when doing group.payout()

Error thrown:

Error while withdrawing: Error: Failed to payout. Status code: 404, status message: Not Found
    at RobloxGroup.exports.run (path\to\node_modules\bloxy\src\group\methods\payout.js:32:41)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Method used:

const memberObj = {
    userId: 123456
    amount: 123
}

await group.payout({
    members: [memberObj],
    recurring: false,
    usePercentage: false
});

Bloxy just not working

I reinstalled it about 25 times and it still gives me the same error, tried installing got and same error.
image

RequestError: fn is not a function when using the REST api

I'm getting this error when using the REST api:

RequestError: fn is not a function
    at Request._makeRequest (C:\Users\terri\Projects\Misc\nypd-shutdown\node_modules\got\dist\source\core\index.js:1177:19)
    at C:\Users\terri\Projects\Misc\nypd-shutdown\node_modules\got\dist\source\core\index.js:328:28
    at Request._makeRequest (C:\Users\terri\Projects\Misc\nypd-shutdown\node_modules\got\dist\source\core\index.js:1124:43)
    at C:\Users\terri\Projects\Misc\nypd-shutdown\node_modules\got\dist\source\core\index.js:328:28
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  code: undefined,
  timings: undefined
}

This is my code:

const Response = await RobloxClient.rest.request({
    method: "POST",
    request: {
        method: "POST",
        body: JSON.stringify(ShutdownForm),
    },
    path: "games/shutdown-all-instances",
    url: "https://www.roblox.com",
    requiresAuth: true,
    json: true
}).catch(console.error)

TokenController never refreshes token

This happens on the dev branch:

For the first request that requires a token, a token is fetched from the auth login API, then it's never refreshed again. This starts causing token validation errors when Roblox refreshes the token.

There are three ways I can think of that can fix this:

  • Fetch a new token for every request that needs one (I think noblox does this).
  • Fetch a new token when a requests fails with HTTP 403, then do the request again with the new token.
  • Do something with the refreshInterval property you added to the TokenController, probably refresh the token when the last request that required a token was longer than refreshInterval ms ago?

Where do I enter the 2captcha code?

Hey there! I've been looking on the code, and saw in the authentication module that there's an option to specify a 2captcha key? Thanks in advance! :-) ~Jonas

Remove lodash from existence

Yeah, it's basically being used for one thing: merging objects. It adds a looot of extra size, and should be removed from the face of the earth.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.