Redeemer

mail@pastecode.io avatar
unknown
javascript
2 years ago
5.3 kB
32
Indexable
Never
 //MLBB Send VC
          if (input.toLowerCase().startsWith("!sendvc")) {
            let playerid = input.toLowerCase().replace("!sendvc ", "");
            if (playerid.length < 0) {}
            axios.get("https://api.mobilelegends.com/mlweb/sendMail?roleId=" + playerid + "&language=en").then(response => {
              let sendvcAPI = response.data.code;
              if (sendvcAPI == "0") {
                api.sendMessage("✅ Verification Code Successfully Sent to " + playerid + "\n\nNote: The verification code is valid for only 30 Minutes", event.threadID, event.messageID);
                api.setMessageReaction("✅", event.messageID, (err) => {}, true);
              } else {
                if (sendvcAPI == "-20028") {
                  api.sendMessage("❎ Please Check Your MailBox, Verification Code Already Sent!", event.threadID, event.messageID);
                  api.setMessageReaction("❎", event.messageID, (err) => {}, true);
                } else {
                  if (sendvcAPI == "-20023") {
                    api.sendMessage("❎ Invalid Game ID!", event.threadID, event.messageID);
                    api.setMessageReaction("❎", event.messageID, (err) => {}, true);
                  } else {
                    api.sendMessage("Code: " + response.data.code + "\nMessage: " + response.data.message, event.threadID, event.messageID);
                  }
                }
              }
            }).catch(error => {
              api.sendMessage(error, event.threadID, event.messageID);
              console.log(error);
            });
          }
          
          
if (input.startsWith("!redeem")) {
            let playerInfo = input.split(" ");
            axios.post('https://api.mobilelegends.com/mlweb/sendCdk', {
              redeemCode: playerInfo[3],
              roleId: playerInfo[1],
              vCode: playerInfo[2],
              language: "en"
            }).then((response) => {
              let redeemAPI = response.data.code;
              if (redeemAPI == "0") {
                api.sendMessage("✅ " + playerInfo[3] + " has been successfully redeemed by " + playerInfo[1], event.threadID, event.messageID);
                api.setMessageReaction("✅", event.messageID, (err) => {}, true);
              } else {
                if (redeemAPI == "-20010") {
                  api.sendMessage("❎ " + playerInfo[2] + " is invalid verification code!", event.threadID, event.messageID);
                  api.setMessageReaction("❎", event.messageID, (err) => {}, true);
                } else {
                  if (redeemAPI == "1412") {
                    api.sendMessage("❎ Limit reached for number of people exchanging!", event.threadID, event.messageID);
                    api.setMessageReaction("❎", event.messageID, (err) => {}, true);
                  } else {
                    if (redeemAPI == "-20009") {
                      api.sendMessage("❎ Please Update Verifcation Code!", event.threadID, event.messageID);
                      api.setMessageReaction("❎", event.messageID, (err) => {}, true);
                    } else {
                      if (redeemAPI == "1410") {
                        api.sendMessage("❎ " + playerInfo[3] + " is being redeemed by many players", event.threadID, event.messageID);
                        api.setMessageReaction("❎", event.messageID, (err) => {}, true);
                      } else {
                        if (redeemAPI == "1402") {
                          api.sendMessage("❎ " + playerInfo[3] + " Doesn't Exist!", event.threadID, event.messageID);
                          api.setMessageReaction("❎", event.messageID, (err) => {}, true);
                        } else {
                          if (redeemAPI == "1404") {
                            api.sendMessage("❎ Incorrect format of CDKey!", event.threadID, event.messageID);
                            api.setMessageReaction("❎", event.messageID, (err) => {}, true);
                          } else {
                            if (redeemAPI == "1407") {
                              api.sendMessage("❎ Exceed Exchange Limit!", event.threadID, event.messageID);
                              api.setMessageReaction("❎", event.messageID, (err) => {}, true);
                            } else {
                              if (redeemAPI == "1405") {
                                api.sendMessage("❎ " + playerInfo[3] + " has been already redeemed!", event.threadID, event.messageID);
                                api.setMessageReaction("❎", event.messageID, (err) => {}, true);
                              } else {
                                api.sendMessage("Code: " + response.data.code + "\nMessage: " + response.data.message, event.threadID, event.messageID);
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
              console.log(response);
            }, (error) => {
              api.sendMessage(error, event.threadID, event.messageID);
              console.log(error);
            });
          }