Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

blooket.js

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blooket.js

This is a terminal client for the quiz service known as Blooket

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Blooket.JS

V 0.1 Beta

In version 0.1, the JS is only for pre release. The only game mode supported is Gold Quest, and all of the features do not work fully.

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
  • When a player tries to steal or swap from the client, the players get the points from the action, but you don't lose any.

Bugs

  • Client swapping does not work
  • Client can't join mid-game

Documentation

Better documentation coming soon to blooket.js.org.

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()

Then, to join a game, use

game.join(pin,name,animal)

Since blooket.js emits events, you can use game.on to catch them. Some examples are below

game.on("SocketConnect", function(s) {
  console.log("Connected to socket " + s.url)
})
game.on("DataReceived", function(s) {
  console.log("Connected to a " + s[1] + " game. The ID is " + s[0])
})
game.on("joined", function(player) {
  console.log(`joined as ${player.name}`)
})
game.on("GameStart", function() {
  console.log("The game is starting!")
})
game.on("QuestionStart", function(q) {
  game.answer(3) // The game.answer function answers the question, in this case, it will answer the third possible response.
})
game.on("Correct", function() {
  console.log("Yay! You answered correctly")
})
game.on("NextQuestion", function() {
  console.log("Question Completed!")
  game.startquestion() // this functions begins the next question
})
// The following are specific to Gold Quest
game.on("GetGold", function() {
  console.log("Collect your gold")
  game.getgold(1) // This function says to collect the gold (or prize). Out of the 3 randomly chosen prizes (see the "goldchance.js" file), this will pick the 1st one.
})
game.on("Steal", function(data) {
  console.log("Stealing from the first player...")
  game.rob(Object.keys(data)[0]) // This function says to steal from the first player. You can use the players name, or Object.keys(data)[0], replacing zero with the player number.
})
game.on("Swap", function(data) {
  console.log("swapping with the first player...")
  game.swap(Object.keys(data)[0]) // This function says to swap with the first player. You can use the players name, or Object.keys(data)[0], replacing zero with the player number. The swap function does not do anything to you, but it does swap the other players score.
})

Keywords

FAQs

Package last updated on 17 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc