This repository was archived by the owner on May 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathminified.js
1 lines (1 loc) · 4.77 KB
/
minified.js
1
(()=>{async function a(a){var b=[],c="";fetch("https://fb.blooket.com/c/firebase/join",{body:`{\"id\":\"${a}\",\"name\":\"answerdotjs\"}`,method:"PUT",mode:"cors"}).then(async d=>{var e=await d.json();console.info(`Set id is ${e.host.set}`),console.info(`Game pin is ${a}`),console.info(`Game mode is ${e.host.s.t}`),c=e.host.s.t,console.log("Getting game answers...");var f=await fetch(`https://api.blooket.com/api/games?gameId=${e.host.set}`),g=await f.json(),h=g.questions;h.forEach(a=>{a.question=a.question.replace(/ +(?= )/g,"").trim(),console.log(a.question+":"+a.correctAnswers),a.correctAnswers[0]=a.correctAnswers[0].trim().replace(/ +(?= )/g,"");var c=!1;"object"==typeof a.image&&(c=!0),b.push({num:a.number,text:a.question,possibleAnswers:a.answers,correctAnswers:a.correctAnswers,hasImage:c,image:a.image})})});var d={},e={},f=setInterval(()=>{var a=Math.floor;switch(c){case"Gold":var g=document.querySelectorAll("[class^=\"styles__choice\"");3==g.length&&g[a(3*Math.random())].click();var h=document.querySelector("[class^='styles__headerInside___']");h&&h.innerText&&document.querySelector("[class^='arts__regularBody___']").click();var i=document.querySelector("[class^='styles__noPlayers___'] > div");i&&i.click();var j=document.querySelector("[class^='styles__playerContainer___']");j&&j.click();break;case"Hack":var k=document.querySelectorAll("[class^='styles__button___']"),l=document.querySelector("[class^='styles__introHeader___']");k.length&&l.innerText&&!l.innerText.includes("HACKING")&&k[a(Math.random()*k.length)].click();var m=document.querySelector("[class^='styles__nextText___']");m&&m.parentElement.click();var n=document.querySelectorAll("[class^=\"styles__choice__\"]");3==n.length&&n[a(Math.random()*n.length)].click();var o=document.querySelector("[class^='styles__choiceContainer___']");if(o&&o.click(),k.length&&l&&l.innerText.includes("HACKING")){var p,q=document.querySelector("[class^='styles__introHeader___'] > span").innerText,r=document.querySelectorAll("[class^='styles__buttonDeactivated___']");if(r.forEach(a=>{a.classList.contains("[class^='styles__buttonNotChosen___']")||(p=a.innerText)}),!d[q]&&!e[q])k[a(Math.random()*k.length)].click();else if(!d[q]&&e[q])e[q].forEach(a=>{k.forEach(b=>{b.innerText==a&&b.click()})});else{var s;k.forEach(a=>{a.innerText==d[q]&&(s=a)}),s&&s.click()}var t="",u=document.querySelectorAll("[class^='styles__introHeader___']").forEach(a=>{"CORRECT"==a.innerText?t="CORRECT":"INCORRECT"==a.innerText&&(t="INCORRECT")});if("CORRECT"==t)d[q]=p;else if("INCORRECT"==t&&!r[q]){var v=[];k.forEach(a=>{v.push(a.innerText)}),e[q]=v}}break;case"Royale":clearInterval(f),setInterval(()=>{var a=document.querySelector("[class^='styles__questionText___']"),c=document.querySelector("[class^='styles__feedbackContainer___'] > div"),d=document.querySelector("[class^='styles__image___']"),e=null!==d,f=e?d.src.split("/")[d.src.split("/").length-1].split(".")[0]:void 0;if(c&&Math.random.toString().includes("[native code]")&&c.click(),a&&a.innerText);else return;var g=b.filter(b=>e?!0==b.hasImage&&b.image.id==f&&b.text==a.innerText:b.text==a.innerText),h=document.querySelectorAll("[class^='styles__answerContainer___']");g.forEach(a=>{for(var b,c=!1,d=0;d<h.length&&!1==c;d++)b=h[d],b.innerText&&a.correctAnswers.includes(b.innerText)&&(b.click(),c=!0)})},50);break;case"Fish":var w=document.querySelector("[class^='styles__pageButton___']");w&&w.click();var x=document.querySelector("[class^='arts__modal___']");x&&x.click();}var y=document.querySelector("[class^='styles__questionText___']"),z=document.querySelector("[class^='styles__feedbackContainer___'] > div"),A=document.querySelector("[class^='styles__image___']"),B=null!==A,C=B?A.src.split("/")[A.src.split("/").length-1].split(".")[0]:void 0;if(z&&Math.random.toString().includes("[native code]")&&z.click(),y&&y.innerText);else return;var D=b.filter(a=>B?!0==a.hasImage&&a.image.id==C&&a.text==y.innerText:a.text==y.innerText),E=document.querySelectorAll("[class^='styles__answerContainer___']");D.forEach(a=>{for(var b,c=!1,d=0;d<E.length&&!1==c;d++)b=E[d],b.innerText&&a.correctAnswers.includes(b.innerText)&&(b.click(),c=!0)})},250)}var b=document.querySelector("[class^='styles__idInput___']");if(!b){var c=document.body.appendChild(document.createElement("iframe")),d=c.contentWindow;return d.alert("Please only run this script on the start screen (where you input id)"),void document.body.removeChild(c)}var e=document.querySelector("[class^='styles__mainBox___']");e.onsubmit=function(...c){var d=document.body.appendChild(document.createElement("iframe")),e=d.contentWindow;e.alert(`Starting bot with game code ${b.value}. If you incorrectly entered the game code, please refresh the page.`),document.body.removeChild(d),a(b.value)};var f=document.querySelector("[class^='styles__joinButton___']");f.onclick=function(...a){e.onsubmit()}})();