m4a1.js
This a wrapper of the TRNetwork Public API for CSGO stats.
Instalattion
You gotta request a Free API key on Tracker.gg
Dependencies
axios
To install use:
npm i m4a1.js
You must call CSAPI.fetchUser before using any other method.
Methods | Description |
---|
info | user info |
stats | lifeline stats |
weapons | weapons stats |
maps | maps stats |
There are constants to format the string of maps and weapons (feel free to pr if something is missing)
const { MAPS, WEAPONS } = require('m4a1.js')
MAPS['de_cbble']
MAPS['de_train']
MAPS['de_shorttrain']
WEAPONS['ak47']
WEAPONS['deagle']
WEAPONS['hkp2000']
This module supports either
You can see the diference between them in this page
Example code: (Feel free to use my steamid for testing)
const { CSAPI } = require('m4a1.js')
try {
const user = await CSAPI.fetchUser('iFraan_', 'YourApiKey')
console.log('User:', user.info())
console.log('Stats:', user.stats())
console.log('Weapons:', user.weapons())
console.log('Maps:', user.maps())
} catch (e) {
console.log(e)
}
Disclaimer
This project is fully for educational purposes.