Welcome to the git repo of the Blazing Sails Handler. This package simply servers the purpose for acting as a simple wrapper around the steamAPI for Blazing Sails.
npm i blazingsailshandler
To use the package the following template is required:
const blazingSailsHandler = require("blazingsailshandler");
blazingSailsHandler.init("Your Steam API key here");
const data = await blazingSailsHandler.query(Type_ID, 'steamID64');
- discord.js v12
const Discord = rqeuire("discord.js");
const client = new Discord.Client();
const bsHandler = require("blazingsailshandler");
const config = require("./config.json");
client.on('ready', () => {
bsHandler.init(config.steamAPIKey);
});
client.on('message', async message => {
// Split into arguments and command
let data = message.split(' ');
const command = data[0].toLowerCase();
data.shift();
/* Example output:
command => "blazingsails"
data => [ "0" , "User's steamID64" ]
*/
if (command === "blazingsails"){
const playerData = await bsHandler.query(
parseInt(data[0]), // Convert type to int
data[1], // Valid steamID
);
// Format and display code goes here //
}
});
(Currently the only data that can be queried is steam achievements)
Format is Type_ID : Response Data
- 0 : Achievements
The return data is formatted to hose a single structure that tells you if it suceeded or failed. The data relating to the success/failure is then available within the content field.
Examples:
// Success
{
isValid : true,
type : type,
content : {
// Resulting content
}
}
// Fail
{
isValid : false,
type : type,
content : "Error Message"
}
Example valid response where the user has unlocked 3 achievements.
{
isValid : true,
type : 0,
content : {
count : 3,
listRaw : [
"ACH_FIRST_STARTUP",
"ACH_DISCOVER_TRIDENTCLUSTER",
"ACH_DISCOVER_TROPICALCLUSTER"
],
listFormatted : [
"Landlubber No More",
"Wrath Of Poseidon",
"Tropical Refuge"
]
}
}