aboutsummaryrefslogtreecommitdiff
path: root/commands/findColeweight.js
blob: d3fa38a75b33acc2e3f1b4e5161c69a14a292453 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import axios from "../../axios"
import constants from "../util/constants"
const PREFIX = constants.PREFIX

export function findColeweight(arg)
{
    ChatLib.chat(`${PREFIX}Finding Coleweight!`)
    let username = ""
    if(arg == undefined) 
        username = Player.getUUID()
    else 
        username = arg 
    axios.get(`https://ninjune.dev/api/coleweight?username=${username}`)
        .then(res => {
            let coleweightMessage = new TextComponent(`${PREFIX}&b${res.data.rank}. ${res.data.name}&b's Coleweight: ${res.data.coleweight} (Top &l${res.data.percentile}&b%)`)
                .setHoverValue(`&fExperience&f: &a${res.data.exp}\n&fPowder&f: &a${res.data.pow}\n&fCollection&f: &a${res.data.col}\n&fMiscellaneous&f: &a${res.data.bes + res.data.nuc}`)
            ChatLib.chat(coleweightMessage)
        })
        .catch(err => {
            ChatLib.chat(`${PREFIX}&eError. (api may be down)`)
        })
}