diff options
author | Ninjune x <enderknight537@gmail.com> | 2023-01-08 02:12:14 -0600 |
---|---|---|
committer | Ninjune x <enderknight537@gmail.com> | 2023-01-08 02:12:14 -0600 |
commit | 688e13930681bca7881d19468745f7067e9bc5c2 (patch) | |
tree | 9e95e59359dd2ae6e2e7761666b99a191bb62a1f /commands/findColeweight.js | |
parent | 1891ada92ab1911cfaaa7ad0e72c85573f4fcbb6 (diff) | |
download | coleweight-future.tar.gz coleweight-future.tar.bz2 coleweight-future.zip |
v1.8.6future
Diffstat (limited to 'commands/findColeweight.js')
-rw-r--r-- | commands/findColeweight.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/commands/findColeweight.js b/commands/findColeweight.js index d3fa38a..a2c5156 100644 --- a/commands/findColeweight.js +++ b/commands/findColeweight.js @@ -1,4 +1,6 @@ import axios from "../../axios" +import { findGriefer } from "../chat/grieferTrack" +import settings from "../settings" import constants from "../util/constants" const PREFIX = constants.PREFIX @@ -12,11 +14,17 @@ export function findColeweight(arg) 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}`) + let griefer = findGriefer(username), coleweightMessage + console.log(griefer.offenses) + if(griefer.found) + coleweightMessage = new TextComponent(`${PREFIX}&b${res.data.rank}. ${res.data.name}&b's Coleweight: ${res.data.coleweight} (Top &l${res.data.percentile}&b%) &c&lGriefed ${griefer.offences} time(s) &c(last grief: &a${griefer.dateObj.toString().slice(4, 15)}&c)`) + else + coleweightMessage = new TextComponent(`${PREFIX}&b${res.data.rank}. ${res.data.name}&b's Coleweight: ${res.data.coleweight} (Top &l${res.data.percentile}&b%)`) + coleweightMessage.setHoverValue(`&fExperience&f: &a${Math.round(res.data.experience.total*100) / 100}\n&fPowder&f: &a${Math.round(res.data.powder.total*100) / 100}\n&fCollection&f: &a${Math.round(res.data.collection.total*100) / 100}\n&fMiscellaneous&f: &a${Math.round(res.data.miscellaneous.total*100) / 100}`) ChatLib.chat(coleweightMessage) - }) + }) .catch(err => { - ChatLib.chat(`${PREFIX}&eError. (api may be down)`) + if(settings.debug) ChatLib.chat(`${PREFIX}&eError. (api may be down) ${err}`) + else ChatLib.chat(`${PREFIX}&eError. (api may be down)`) }) }
\ No newline at end of file |