HQ Trivia API
This is a Node.JS wrapper for HQ Trivia
Installation
npm i hqtrivia-api
API Methods
hq.getUserData()
- Get the authenticated user datahq.getShows()
- Get the game schedulehq.getLeaderboard()
- Get the game leaderboardhq.getUserById()
- Get user by IDhq.searchUsers()
- Search usershq.getFriends()
- Get all friendshq.acceptFriendRequest(userId)
- Accept friend requesthq.addFriend(userId)
- Add friendhq.getIncomingFriendRequests()
- Get incoming friend requestshq.connectToGame()
- Connect to the gamehq.disconnectFromGame()
- Disconnect from the gamehq.getUpcomingSchedule()
- Get upcoming games schedulehq.setToken(token)
- Sets token for requestshq.changeUsername(username)
- Change usernamehq.checkUsername(username)
- Check usernamehq.makePayout(email)
- Make payout
Registration methods
hq.sendCode(phone, [method])
- Sends the code to the specified phonehq.confirmCode(code, [verificationId])
- Confirm codehq.register(username, [referral], [verificationId])
- Register an account if it is not registered
Trivia Game Methods
hq.sendAnswer(answerID, questionId)
- Send answer to HQhq.sendSurveyAnswer(answerID, questionId)
- Send survey answer to HQhq.useExtralive(questionId)
- Use extra livehq.sendEraser(questionId)
- Use eraserhq.getErasers(friendIds)
- Get erasers
Words Game Methods
hq.sendLetter(roundId, showId, letter)
- Send letter to HQhq.sendWord(roundId, showId, word)
- Send word to HQ
Events
connected
- Called when successfully connected to the game (Words, Trivia)disconnected
- Called when disconnected from the game (Words, Trivia)question
- Called when a question is received from the server (Trivia)questionClosed
- Called when a question is closed (Trivia)questionSummary
- Called when the summary of a question is received from the server (Trivia)questionFinished
- Called when question is finished (Trivia)gameStatus
- Called when the game status is received from the server (Words, Trivia)startRound
- Called when the round starts (Words)letterReveal
- Called when letter reveal (Words)endRound
- Called when round ends (Words)showWheel
- Called when wheel shows (Words)hideWheel
- Called when wheel hideens (Words)guessResponse
- Called after sending a letter or word (Words)
Trivia Example 1
const HQTrivia = const hq = '[token]' hq hq hq hq
Words Example 1
const HQTrivia = const hq = '[token]' hq hq hq hq
Register example
const HQTrivia = const hq = await hqconst response = await hqif responseaccountRegistred console hq else const token = await hq console hq