aboutsummaryrefslogtreecommitdiff
path: root/commands/findColeweight.js
diff options
context:
space:
mode:
authorNinjune x <enderknight537@gmail.com>2022-11-17 16:56:06 -0600
committerNinjune x <enderknight537@gmail.com>2022-11-17 16:56:06 -0600
commitfb63481d2c5b7b468df6c5ebdee30178bc9155f5 (patch)
tree3ec467f8acb9594c7b5547426a3b640856dc7e37 /commands/findColeweight.js
parent9085ac77ce364572b14f132b64ead5cde2194607 (diff)
downloadcoleweight-fb63481d2c5b7b468df6c5ebdee30178bc9155f5.tar.gz
coleweight-fb63481d2c5b7b468df6c5ebdee30178bc9155f5.tar.bz2
coleweight-fb63481d2c5b7b468df6c5ebdee30178bc9155f5.zip
1.6.0 Changelog in releasesv1.6.1
Diffstat (limited to 'commands/findColeweight.js')
-rw-r--r--commands/findColeweight.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/commands/findColeweight.js b/commands/findColeweight.js
new file mode 100644
index 0000000..d3fa38a
--- /dev/null
+++ b/commands/findColeweight.js
@@ -0,0 +1,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)`)
+ })
+} \ No newline at end of file