Releases: avivkeller/blooket.js
Blooket.JS Takedown
This project has been taken down per request of Blooket.
Minor Patch for Blooket.JS.
The README file will still 1.2.2 ,because this just for maintenance.
Version 1.2.2 Patch (Fixed Release)
V1.2.2 Patch
The version 1.2.2 Patch includes 1 new feature, glitches!
glitches are the powers given in factory mode. Currently, for every question the client gets correct, you have a 20% of getting a glitch, and a 80% chance of getting a blook.
Version 1.3 guaranteed features
Glitcheschance modifiable- (Some) Racing Mode powerups
Version 1.2.1 Patch
Just a small patch related to some issues.
Version 1.2
Version 1.2
New Features
- Tower Defense Support
Fixed Bugs
- Random Blook Function did not work if no players were in the game.
- WebSocket issue in the
socket.jsfile. - And more
Improved Features
- The time it takes to run Bot Spam lowered. (Only time it takes now to connect and find the websocket)
Version 1.1.0
New features:
- Bot Spam
- Random Blook Chooser (suggestion from #4 by @Justiniscoding)
- Auto Correct function (idea to change complicated command to function from #2 by @Justiniscoding)
Bugs Fixed:
- Blooket changed API url from www.blooket.com/api/ to api.blooket.com/api/ (Used by module
getdatain functiongetquestions) - Change WebSockets with Blooket's WebSocket changes
function getquestions(id) {
return new Promise(async(resolve, reject) => {
res = await got(`https://api.blooket.com/api/games?gameId=${id}\`)
questiondata = JSON.parse(res.body)
return resolve(questiondata)
});
}
Version 1.0.0
Blooket.JS
Version 1.0.0
Table Of Contents
Features
- Joining games
- Playing games
- Auto answer (can be set to do it correctly)
- Can use "Prizes", like the normal client
Semi-Bugs
(Bugs that are not bad)
- Answering takes 1 second exactly
- If a player swaps with the client, the client does not lose any gold
Bugs
- Client swapping does not work (Only for Gold Quest)
- Client can't join mid-game (Not Applicable for Battle Royale)
Documentation
Installing
Run npm install blooket.js to install Blooket.JS
Using
To import the package, use
const Blooket = require("blooket.js")
const game = new Blooket()The Blooket() class can have options with it. The options you can use are below
| Option | Description | Type | Values | Default Value |
|---|---|---|---|---|
| repeat | Once the client answers all questions, will it start over | Boolean | true/false | true |
| blookcash | (Factory Mode Only) How much cash each block should give. | Integer | Any number | 100 |
| blooktime | (Factory Mode Only) How long between the books generating cash | Integer (milliseconds) | Any Number | 1000 |
| answertime | (Battle Royale Mode Only) How long it took the client to answer | Integer (milliseconds 1 to 20000) | Any number 1 to 20000 | 1 |
| cafebonus | (Cafe Mode Only) The amount of cash to give the client after every answer. | Integer | Any number | 100 |
The options should be formatted as a JSON object like such
const game = new Blooket({
option: value
})Joining Games
To join a game, run the following command
game.join(pin,name,animal)Functions
-
join(pin, name, animal)
This join function is the main function run by the user,
It returns the events listed in the events section -
connect()
The connect function is run by join() function, as shown in the
blooket.jsfile. It connected the user to the socket and game. -
startquestion()
The startquestion function is used after
NextQuestionis emited (seeNextQuestioninEventsandNextQuestioninExamples), it is used to start the next question. -
answer(a)
The answer function is used to answer the question. the
avariable can be a number 1 through 4. The answer function is called by the user afterQuestionStartis emitted. (SeeQuestionStartinEventsandanswerinExamples). -
getgold(p)
(Only in Gold Quest) The getgold function is used to collect your prize. The
pvariable can by a number 1 through 3. The prizes you can get are randomly selected (seemodules/goldchance.js). This function is run when the user handles theGetGoldevent. (SeeGetGoldinEvents). -
swap(player)
(Only in Gold Quest) The swap function is used to swap with a player. The
playervariable should be a name of a player in the game, or aObject.keys()function likeObject.keys({variable})[0]replacing0with a number 0-through the amount of players subtracted by 1 (ex: 20 players means number 0 through 19). It is used while handling theSwapevent (seeSwapinEventsandSwap and StealinExamples). -
rob(player)
(Only in Gold Quest) The rob function is used to steal from a player. The
playervariable should be a name of a player in the game, or aObject.keys()function likeObject.keys({variable})[0]replacing0with a number 0-through the amount of players subtracted by 1 (ex: 20 players means number 0 through 19). It is used while handling theStealevent (seeStealinEventsandSwap and StealinExamples).
Events
The Blooket.JS class emits events at different times. Below is a brief explanation of the events
-
Joined
This is emitted when the client joins the game
-
GameStart
The GameStart event is emitted when the game begins, this event does not work in Battle Royale Mode.
-
QuestionStart
The QuestionStart event is emitted when a question begins. While handling this event, it is required to run the
game.answer()function. -
Correct
The Correct event is emitted when a question is answered correctly.
-
GetGold
The GetGold event is emitted when a player gets a question correct, and they are playing in gold quest mode. When handling this event, it is required to run the
game.getgold()function. -
Swap
The Swap event is emitted when the
game.getgold()function returnsswapas the prize. for more prize details, see themodules/goldchance.jsfile. When handling this event, it is required to run thegame.swap()function. Returns a list of players -
Steal
The Steal event is emitted similarly to the Swap event, except instead running
game.swap(), it is required to rungame.rob(). Returns a list of players -
NextQuestion
The NextQuestion event is emitted when the question has ended, and the prizes (gold, cash, blooks, etc.) have been processed, when handling this event, this is required to run the
game.startquestion()function. -
Debug Events
Examples
game.on("QuestionStart", function() {
game.answer(1) // can be 1,2,3,4
})game.on("GetGold", function() {
game.getgold(1) // can be 1,2,3
})game.on("Swap", function(p) {
game.swap(Object.keys(p)[0])
})
// Or
game.on("Steal", function(p) {
game.rob(Object.keys(p)[0])
})game.on("NextQuestion", function() {
game.startquestion()
})Upcoming Features
- Classic Game Mode
Powerups/Glitchsupport in Factory Mode- And more
My Other Projects
Some other projects I have created and worked on:
-
The First Transcontinental Railroad - Website, Repo
A website with information on the First Transcontinental Railroad, also good for a website example. (Uses examples from w3schools.)
-
Similar to this project, but online, it is still buggy.
-
EmbedCode in a website that allows to embed your source code into an iframe, with syntax highlighting and line numbering. Check the repo for more info.
v0.6-alpha
Same as Version 0.5, but fixed web sockets to work better
Version 0.5 Alpha
Almost time for the Beta!
New Features
- Racing Support
- Factory Support
- Cafe Support
- Battle Royale Support
0.2.2
0.2.2