0.0.27 • Published 3 years ago

trackmania-api-node v0.0.27

Weekly downloads
20
License
MIT
Repository
github
Last release
3 years ago

Trackmania 2020 api node

codecov

Converting this repo to a npm module

"This API is not intended to be used outside of the game

Be aware that Nadeo can change the API without even warning us, since the API is intended only to be used in game, so don't except any support for them, and don't try to make anything serious out of this

Also, don't abuse of this API, has they have the right to lock your account since, for them, it's someone that is trying to hack or just trying to give bad performance to the servers"

Usage

Docs

Nodejs

npm i trackmania-api-node

const { loginUbi, loginTrackmaniaUbi, getTrophyCount } = require('trackmania-api-node')

const login = async credentials => {
    try {
        const { ticket } = await loginUbi(credentials) // login to ubi, level 0
        return await loginTrackmaniaUbi(ticket) // login to trackmania, level 1
    } catch (e) {
        // axios error
        console.log(e.toJSON())
    }
}

const getTrophies = async loggedIn => {
    const { accessToken, accountId, username } = loggedIn
    try {
        const trophyCount = await getTrophyCount(accessToken, accountId)
        console.log(username + ' trophies:')
        console.log(trophyCount)
    } catch (e) {
        // axios error
        console.log(e.toJSON())
    }
}

;(async () => {
    const credentials = Buffer.from('email' + ':' + 'password').toString('base64')
    const loggedIn = await login(credentials)
    if (loggedIn) await getTrophies(loggedIn)
})()
user trophies:
{
  accountId: 'censored',
  points: 12345,
  t1Count: 70,
  t2Count: 200,
  t3Count: 80,
  t4Count: 2,
  t5Count: 5,
  t6Count: 1,
  t7Count: 0,
  t8Count: 0,
  t9Count: 0,
  timestamp: '2020-07-25T15:50:50+00:00'
}

Contributing

Guide

0.0.27

3 years ago

0.0.26

4 years ago

0.0.23

4 years ago

0.0.24

4 years ago

0.0.25

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.14

4 years ago

0.0.15

4 years ago

0.0.16

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago