Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.3 kB
7
Indexable
Never
if (input.startsWith("*save")){
    let data = input.split(" ");
    if (data.length < 3){
        api.sendMessage("⚠️Invalid Use Of Command!\n💡Usage: *save <ml_id> <server>", event.threadID);
        } else {
        let id = data[1];
        let zone = data[2];
        let senderID = event.senderID;
        const https = require('https');
        const infs = require('got');
        infs.get("https://zhenteam.000webhostapp.com/mlbbinfo.php?role="+id+"&key=ZhenTeam&zone="+zone)
        .then(res=>{
        var infoss = res.body;
        var infoss = infoss.replace(/ /g,'');
          var respons = JSON.parse(infoss);
        response = respons.Information.Response,
        ign = respons.Information.InGameName,
        aydi = respons.Information.Role,
        serv = respons.Information.Server;
          if (response === "Success"){
const https = require('https');
const got = require('got');
got.get("https://jsonblob.com/api/964489343905579008")
.then(res=>{
    var infojson = res.body;
    var inf = JSON.parse(infojson);
    var infs = JSON.stringify(inf);
    var info = infs;
    var infos = info.substring(0, info.length-1)
            if (infos.includes(event.senderID)){
                api.sendMessage("❎You have already saved account", event.threadID, event.messageID);
            } else {
            let senderID = event.senderID;
            var toAdd = `${infos},"${senderID}":{"ign":"${ign}","id":"${aydi}","server":"${serv}"}}`;
            const axios = require('axios');
            const data = toAdd;
            axios.put('https://jsonblob.com/api/964489343905579008', data)
                .then(res=>{
                    api.sendMessage("✅Account saved successfully\nIgn: "+ign+"\nId: "+aydi+"\nServer: "+serv, event.threadID, event.messageID);
                })
                .catch(err=>{
                    console.error(err);
                });
            }
                })
                .catch(err=>{
                    console.log(err.message)
                });
            } else {
                api.sendMessage("❎Invalid id or server", event.threadID, event.messageID);
            }
})
.catch(err=>{
    console.log(err.message)
});
        }
    }