Basic request manager flow - TheBlackParrot/DumbRequestManager GitHub Wiki
I've gotten a couple questions since release asking how to interface with the mod, which I can't really answer for every specific streaming/content bot. So this will act as a generalized write-up explaining what to do.
By default, the HTTP/web API resides at http://localhost:13337
. If you need to change this, modify the mod's configuration file (found at UserData/DumbRequestManager.json
)
[!NOTE]
- Map
25f
is used as an example, replace this with the map key included with the command input.- User
TheBlackParrot
is used as an example, replace this with an identifiable, unique name -- usually the username or displayed name
Step 1
Upon receiving a map request command/input for 25f
, send a HTTP request (using the GET method, if asked) to http://localhost:13337/query/25f
.
- You will get a JSON-formatted response back if the mod is able to find data on the map you requested. Most bots are able to parse this response into something you can interact with.
Store this response in a variable that you can use later in the command's effect/code/return/etc.
[!NOTE] This will attempt to grab data using the following sources in this order:
- Data from an already downloaded map (supplemented with some data from SongDetailsCache)
- SongDetailsCache only
- BeatSaver's API
Step 2
At this point, if you want to filter maps out, this is where those should happen.
For example, if you want to automatically deny a map over 5 minutes in length, use a conditional that checks if Duration
in the parsed response variable is over/greater than 300
.
- This value is in seconds, there's 60 seconds in 1 minute, so we multiply 60 and 5 to get 300.
If it's true
, we respond to the command input with a denial message explaining that the map is too long and stop the command response flow here. If it's false
, we continue on.
[!NOTE] For more values you can use with filters, see the Map data object structure
Step 3
Once the map passes any filter checks, we can tell the mod to add it to the queue by sending another HTTP request (using the GET method, if asked) to http://localhost:13337/addKey/25f?user=TheBlackParrot
.
- Like the
query
command in step 1, you will get a JSON-formatted response back if the mod is able to find data on the map you requested (which it should, otherwise step 1 would have failed).
And that's all it takes for a basic request system! There are additional API methods that enable better command feedback, and feedback from in-game button presses as well.