Install tetrio.js with npm:
npm install tetrio.js
As TETR.IO is in alpha, the API may change without notice and this module may as well change or be nonfunctional.
Not-so-good-looking documentation can be found here.
I recommend using Visual Studio Code to develop with tetrio.js. Built-in intellisense will give you useful informations and will prevent wrong uses.
You can also check the official documentation, but this module is not modeled on it.
const tetrio = require('tetrio.js');
const client = new tetrio.Client();
client.getUser('hicka').then(user => {
console.log(user);
});
/* Data:
id: '5e8cc73320d4e90291432ba8',
name: 'hicka',
supporter: false,
verified: false,
role: 'user',
bot: false,
country: 'FR',
flag: '🇫🇷' ,
league: {
apm: 35.5,
decaying: false,
gamesPlayed: 532,
gamesWon: 267,
glicko: 1882,
percentile: 0.13706227222310252,
percentileRank: 's+',
rank: 's+',
rating: 20283.25003409502,
rd: 61,
standing: 1731,
localStanding: 32,
pps: 1.84,
vs: 74.09,
winRate: 0.5018796992481203
},
avatarUrl: 'https://tetr.io/user-content/avatars/5e8cc73320d4e90291432ba8.jpg?rv=1601327878791',
badges: Map {},
badStanding: false,
gamesPlayed: 606,
gameTime: 199243.65106111096,
gamesWon: 304,
winRate: 0.5016501650165016,
xp: 794948
*/
tetrio.js, by Hicka