diff options
Diffstat (limited to 'commands')
| -rw-r--r-- | commands/fetchDiscord.js | 26 | ||||
| -rw-r--r-- | commands/findColeweight.js | 22 |
2 files changed, 48 insertions, 0 deletions
diff --git a/commands/fetchDiscord.js b/commands/fetchDiscord.js new file mode 100644 index 0000000..f44c385 --- /dev/null +++ b/commands/fetchDiscord.js @@ -0,0 +1,26 @@ +import axios from "../../axios" +import constants from "../util/constants" +const PREFIX = constants.PREFIX + +export function fetchDiscord(arg) +{ + if(arg == undefined) { ChatLib.chat(`${PREFIX}&eRequires a username!`); return } + + axios.get(`https://api.ashcon.app/mojang/v2/user/${arg}`) + .then(res => { + let uuid = res.data.uuid + axios.get(`https://api.hypixel.net/player?key=${constants.data.api_key}&uuid=${uuid}`) + .then(res2 => { + let discordMessage = new TextComponent(`${PREFIX}&a${res.data.username}'s Discord: `) + ChatLib.chat(discordMessage); + ChatLib.chat(`&b${res2.data.player.socialMedia.links.DISCORD}`) + }) + .catch(err => { + ChatLib.chat(`${PREFIX}&eNo discord linked :( (or no key linked)`) + }) + }) + .catch(err => { + ChatLib.chat(`${PREFIX}&eInvalid name! `) + }) +} + 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 |
