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

export function setkey(arg2)
{
    if(arg2 == undefined) { ChatLib.chat(`${PREFIX}&eRequires an argument!`); return; }
    else key = arg2

    constants.data.api_key = key
    constants.data.save()
    axios.get(`https://api.hypixel.net/key?key=${constants.data.api_key}`)
    .then(res => {
        if(res.data.success == true)
            ChatLib.chat(`${PREFIX}&aSuccsessfully set api key!`)
        else
            ChatLib.chat(`${PREFIX}&eKey is not valid!`)
    })
    .catch(err => {
        ChatLib.chat(`${PREFIX}&eKey is not valid!`)
    })
}