blob: 2b2699f8c33eef1a396a698d1e2b2ec6ba223e9d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import axios from "../../axios"
import constants from "../util/constants"
const PREFIX = constants.PREFIX
export function leaderboard(arg2, arg3)
{
if(arg2 != undefined && parseInt(arg2) == arg2 && !isNaN(parseInt(arg2, 10)))
{
if(arg3 == undefined && parseInt(arg2) == arg2 && !isNaN(parseInt(arg2, 10)))
{
axios.get(`https://ninjune.dev/api/coleweight-leaderboard`)
.then(res => {
for(let i = 0; i < arg2; i++)
{
ChatLib.chat(`&a${res.data[i].rank}. &b${res.data[i].name}: &f${res.data[i].coleweight}`)
}
})
.catch(err => {
ChatLib.chat(`${PREFIX}&4Error! &eApi might be down.`)
})
}
else if(parseInt(arg3) == arg3 && !isNaN(parseInt(arg3, 10)))
{
axios.get(`https://ninjune.dev/api/coleweight-leaderboard`)
.then(res => {
for(let i = arg2 - 1; i < arg3; i++)
{
ChatLib.chat(`&a${res.data[i].rank}. &b${res.data[i].name}: &f${res.data[i].coleweight}`)
}
})
.catch(err => {
ChatLib.chat(`${PREFIX}&4Error! &eApi might be down.`)
})
}
else
{
ChatLib.chat(`${PREFIX}&ePlease enter an integer! (how many positions) (or a range ie. '20 40')`)
}
}
else
{
ChatLib.chat(`${PREFIX}&ePlease enter an integer! (how many positions) (or a range ie. '20 40')`)
}
}
|